Following is a response from Senior DHS Stata Specialist, Tom Pullum:
Quote:I do not use SPSS. To do this in Stata you could just use the following lines. I am in effect omitting people whose age is not given.
set more off
use e:\DHS\DHS_data\PR_files\ETPR61FL.dta, clear
sort hhid
save e:\DHS\DHS_data\scratch\ETtemp.dta
gen age=.
replace age=3 if hv105<98
replace age=2 if hv105<65
replace age=1 if hv105<15
gen age1=0
gen age2=0
gen age3=0
replace age1=1 if age==1
replace age2=1 if age==2
replace age3=1 if age==3
tab1 age*
gen hhsize=1
replace hhsize=0 if hv105>=98
collapse (sum) hhsize age1 age2 age3, by(hhid)
gen prop_age1=age1/hhsize
gen prop_age2=age2/hhsize
gen prop_age3=age3/hhsize
gen youth_dep_ratio=age1/age2
gen oldage_dep_ratio=age3/age2
gen dep_ratio=(age1+age3)/age2
sort hhid
merge hhid using e:\DHS\DHS_data\scratch\ETtemp.dta
drop _merge
* then save; you could also merge with the HR file