Cognitive reserve is a determinant of social and occupational attainment in patients with pediatric and adult onset multiple sclerosis.