I want to create an age variable from a head of household date of birth variable (HOH_DOB) and a YearMonth date variable (BeneMonth_date). I tried the following code, but it is giving me incorrect age values. Is this because my HOH_DOB is in a numeric daily date format and BeneMnth_date is in a numeric monthly date format? if so, how do i get them to be the same format?
gen HOH_age = ((BeneMonth_date) - HOH_DOB)/365.25
replace HOH_age = floor(age)
gen HOH_age = ((BeneMonth_date) - HOH_DOB)/365.25
replace HOH_age = floor(age)
Comment