Create an index with the PCA in Stata 11 from the Demographic and Health Survey

Dear all,

I am a new user. I am writing my Master's thesis and as a part of it I am analyzing the data from the Demographic and Health Surveys (DHS). I am investigating the individual- and community-level determinants of child mortality.

The wealth index in the DHS was generated for the fifth and the sixth DHS. For the previous DHS, I can find the Wealth Index.dta in the measure DHS website, but they are not complete. When I merge the WI.dta with the IndividualRecode.dta I have some missing values. Here attached you can find the do.file I used for merging the dta files by Tom Pullum from DHS. I would like to know if you, or you all, can guide me in creating the wealth index variable for the second, third, and fourth DHS.

It would be great for me if you could do it.

Thank you all.

* How to merge wealth data on ETWI41DT onto ETIR41DT
* Tom Pullum,, March 21, 2013

* First open the WI file and construct id codes for cluster and household
* that are compatible with those in the IR file, where they are integers.

use e:\DHS\DHS_data\WI_files\ETWI41FL.dta
list if _n<=20, table clean

* whhid has 12 characters but we need to figure out how to use them
* which part is cluster id and which part is household id?

gen str1 c1=substr(whhid,1,1)
gen str1 c2=substr(whhid,2,1)
gen str1 c3=substr(whhid,3,1)
gen str1 c4=substr(whhid,4,1)
gen str1 c5=substr(whhid,5,1)
gen str1 c6=substr(whhid,6,1)
gen str1 c7=substr(whhid,7,1)
gen str1 c8=substr(whhid,8,1)
gen str1 c9=substr(whhid,9,1)
gen str1 c10=substr(whhid,10,1)
gen str1 c11=substr(whhid,11,1)
gen str1 c12=substr(whhid,12,1)

list c1-c12 if _n==4, table clean

* It appears that cols 1-9 are cluster id and 10-12 are household id.
* Separate the one string into two strings.

drop c1-c12

gen str9 wv001=substr(whhid,1,9)
gen str9 wv002=substr(whhid,10,3)
list whhid wv001 wv002 if _n<=20, table clean

* Now convert those two strings into integers with the same names
* as in the IR file.
destring wv001, gen(v001)
destring wv002, gen(v002)
drop wwhid wv001 wv002

* This is the "using" file; sort it on the merge fields.
sort v001 v002
save e:\DHS\DHS_data\WI_files\ETWI41FL_temp.dta, replace

* Now open the IR file, sort, merge, confirm, and save.
use e:\DHS\DHS_data\IR_files\ETIR41FL.dta, clear
list v000 v001 v002 v003 if _n<=20, table clean
sort v001 v002
merge using e:\DHS\DHS_data\WI_files\ETWI41FL_temp.dta
tab _merge
drop _merge
list v000 v001 v002 v003 wlthind* if _n<=20, table clean
list v000 v001 v002 v003 wlthind* if _n<=20, table clean nolabel
save e:\DHS\DHS_data\IR_files\ETIR41FL_WI.dta, replace

Did you manage to create the wealth index with STATA? If so, do you have the do-file by any chance? I'm struggling to do mine with the GLSS6 data.

Thank you!