We study magnetic properties of , where , C, N, O, and F, by using first-principles calculations based on density functional theory. Its parent compound has the structure, which has the symmetry of space group , No. 139. The magnetization increases by doping B, C, N, O, and F at the site of the structure. The amount of the increase is larger for , O, F than for , C. On the other hand, the crystal field parameter , which controls the axial magnetic anisotropy of the Nd magnetic moment, depends differently on the dopant. With increase of the atomic number from increases, takes a maximum value for , and then turns to decrease. This suggests that in , nitrogen is the most appropriate dopant among B, C, N, O, and F for permanent magnets in terms of magnetization and anisotropy. The above calculated properties are explained based on the detailed analysis of the electronic structures of .