We have investigated the structural and magnetic properties of the doped XM 12 and charged M 13 (X ϭ Na, Mg, Al, Si, P; M ϭ Sc, Y) clusters using the density-functional theory with spin-polarized generalized gradient approximation. It was found that doped atoms can induce significant change of the magnetic moments of Sc 13 and Y 13 clusters. The total magnetic moments of the NaM 12 , MgM 12 , AlM 12 , SiM 12 , and PM 12 clusters are regular 5, 6 (12), 7, 8, and 9 b , respectively (but 19 b for Sc 13 and Y 13 , 12 b for Y 13 ϩ , 18 b for Sc 13 ϩ , Sc 13 Ϫ , and Y 13 Ϫ ). The doped atom substituting the surface atom of the plausible icosahedral configuration is viewed as the ground-state structure of the XM 12 (X ϭ Na, P; M ϭ Sc, Y) and MgSc 12 clusters. While for XM 12 (X ϭ Al, Si; M ϭ Sc, Y) and MgY 12 clusters, the doped atom occupying the central position of the icosahedral configuration is viewed as the ground-state structure. The doping and the charging both enhance the stability of the Sc 13 and Y 13 clusters. These findings should have an important impact on the design of the adjustable magnetic moments systems.