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.
I will try to collect all my SPSS/STATA and other stats notes here!!
Showing posts with label age. Show all posts
Showing posts with label age. Show all posts
Wednesday, 24 November 2010
Tuesday, 6 March 2007
Calculate age from survey data
The calculation of age from survey data may be as following:
AGE MONTHS=(Data of survey-Date of birth)/30.42)
where 30.42 is the average month length all over the year.
or
AGEYEARS=((Date of survey or interview-Date of birth)/365.25)
You should have the two dates (date of survey and date of birth) in NUMERIC format.
You also can use the option of integer in the beginning of the formula if you want the results to be in integer months or years (no fractions).
Subscribe to:
Posts (Atom)