Solution

To find the amount of time that has passed between any two dates you subtract them, but the years have to be converted to months by multiplying by twelve:

gen ageInMonths=(interviewYear-birthYear)*12 + (interviewMonth-birthMonth)

To find age in whole years you need to divide by 12 and drop the fractional part. Stata will drop the fractional part automatically if you declare your new variable to be an int:

gen int age=ageInMonths/12

Last Revised: 11/20/2009