Wednesday 24 November 2010

Computing Age from DOB in SPSS

There are million ways to do this. but here is what worked for me. You will need your date of birth variable to have month, day and year.

COMPUTE age_year = (DATE.MDY(11,01,2010) - BirthDate) / (60*60*24*365.25) .

COMPUTE age=RND(age_year).
FORMATS age (F3.0).
*fre age.

NOTE: This will create an AGE variable, as of now, not the age of respondent at the time of survey. To do that you would need survey date.

No comments: