Single-ion anisotropy of localized-electron compounds