The electronic structures of SmX ͑X = N, P, As, Sb, Bi, O, S, Se, Te, Po͒ compounds are calculated using the self-interaction corrected local-spin density approximation. The Sm ion is described with either five or six localized f electrons while the remaining electrons form bands, and the total energies of these scenarios are compared. With five localized f electrons a narrow f band is formed in the vicinity of the Fermi level leading to an effective intermediate valence. This scenario is the ground state of all the pnictides as well as SmO. With six localized f electrons, the chalcogenides are semiconductors, which is the ground state of SmS, SmSe, and SmTe. Under compression the Sm chalcogenides undergo first order transitions with destabilization of the f states into the intermediate valence state, the bonding properties of which are well reproduced by the present theory.