N-nitroso compounds, consisting of nitrosamines and nitrosamides, are potentially important in the etiology of human cancer. An attempt to study the molecular structure-carcinogenicity relations of these compounds is reported. A pattern-recognition approach was used to develop predictive ability for carcinogenic potential. A set of 15 calculated molecular structure descriptors that supported a linear discriminant function able to successfully separate 116 carcinogens from 28 noncarcinogens was identified. Predictive ability of an overall of 91%--93% for carcinogens and 85% for noncarcinogens--was obtained in the randomized testing. This relatively high predictability demonstrates that pattern-recognition methods can be useful in analyzing these compounds for carcinogenic activity. The inclusion of two electronic descriptors implicitly supports the alpha-hydroxylation hypothesis. The relations of descriptors used and possible mechanism of action are discussed.