The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Ethiopia » Calculating Age structure explanatory variables on Household Wealth
Re: Calculating Age structure explanatory variables on Household Wealth [message #11186 is a reply to message #11184] Wed, 16 November 2016 10:31 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3230
Registered: February 2013
Senior Member
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 2016 dataset
Next Topic: Breastfeeding Initiation in Ethiopian population
Goto Forum:
  


Current Time: Wed Feb 5 23:53:30 Coordinated Universal Time 2025