To determine the prevalence of cognitive disability as a function of advanced age and gender in elderly nursing home and community-dwelling populations. Since cognitive dysfunction is associated with increased mortality, we hypothesized that selective survival results in a decreased prevalence of cognitive disability in the oldest old. Cohort study. An analysis of 6-month longitudinal data obtained from a national probability sample of older persons in 260 nursing homes (n = 1951) and 2-year-longitudinal data obtained from a sample of community-dwelling older persons (n = 2947). In the nursing home sample, the primary outcome measure was cognitive performance score. In the community sample, cognitive performance was determined using the results of three orientation questions and assessment of decision-making ability. Cognitive performance and subsequent survival, controlling for various disease states and demographic factors, were examined in three age cohorts of men and women (ages 65-79, 80-89, 90-99). In the nursing home sample, the cognitive performance of very old men (> or = 90 years) was better than that of younger men (aged 80-89 years, P < 0.05) and very old women (age > or = 90 years, P = 0.001). Among 80-89-year-olds with poor cognitive performance, the 6-month mortality rate was higher in men than in women (38% vs 19%, P = 0.001). However, the mortality rates of men and women with good cognitive performance were not statistically different in any age group. Proportional-hazards regression analysis demonstrated that poor cognitive performance remained a powerful predictor of death among men aged 80-89 years with a relative risk of 2.7 (95% Cl, 1.19-3.17; P = 0.0006) after controlling for covariates. Results from the community sample lent support to our findings: within each age group, mortality rates for men and women with intact cognitive performance were not statistically different. However, in the two older age groups, the mortality rates of subjects with impaired cognitive performance were significantly greater for men than for women (P < 0.01 for both age groups). Decreased cognitive performance is significantly associated with mortality among elderly men. Survival by men who have relatively intact cognitive function results in a population of oldest men, those aged 90-99 years, with cognitive performance scores better than younger men or similarly-aged women. The same selective survival phenomenon was not observed among women. Thus, there may be less cognitive disability among very old men than previously expected.