The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging Rwanda DHS 1992 without b16
Merging Rwanda DHS 1992 without b16 [message #13894] Fri, 19 January 2018 12:55 Go to previous message
Sniz is currently offline  Sniz
Messages: 2
Registered: January 2018
Dear Colleagues,
I hope somebody can help me with the following problem. I am using both 1992 and 2000 Rwanda DHS data sets. I am investigating the implication of orphan hood on early childhood malnutrition in pre and post genocide period. There is no problem with the 2000 dataset. I have run into a problem with respect to the 1992 data. I cannot merge the PR file to the KR file because there is no b16 variable -- the child line number. Without the b16, I cannot access the orphan hood variable. To overcome this problem, I thought I could merge the PR, IR, WI and HW then reshape the merged file to have the child as the unit of analysis. I did this and I am getting a reshape error saying that "3671 of 5510 observations have duplicate i values" using the following stata code:
 reshape long bidx_ bord_ b0_ b1_ b2_ b3_ b4_ b5_ b6_ b7_ b8_ b9_ b10_ b11_ b12_ b13_, i(caseid) j(bindex) 

Can anyone help me solve this problem?
Also, when I merged the PR and IR datasets I lost the HV113 (Father alive), which is the orphanhood variable critical to my study. I notice also in the 1992 PR data there is a variable sh11 (mother alive) and sh12 (Father alive) but they are different from the respective HV111 (mother alive) and HV113 (father alive). Why?

I will greatly appreciate your help.

Here is my merging code:
*****Merging Individual (IR) Record with Wealth Index****
use "RWIR21FL.DTA", clear
gen whhid=substr(caseid,1,12)
sort whhid
save "temp1"
merge whhid using "RWWI21FL.DTA"
keep if _merge==3
drop _merge
save " RWIR&WI.DTA", replace

********Merging PR, IR and WI********
*Preparing IR & WI
use "RWIR21FL.DTA", clear
sort v001 v002 v003
save "RWIR&WITEMP.DTA", replace

*Preparing PR file
use "RWPR21FL.DTA", clear

gen v001=hv001
gen v002=hv002
gen v003=hvidx
sort v001 v002 v003

merge v001 v002 v003 using "RWIR&WITEMP.DTA"
keep if _merge==3
drop _merge
save "RWPR&IR&WI.DTA", replace

****Merging PR, IR, WI and HW  Last part of the merging****
* rename variables and sort data for merging
use "RWHW21FL.DTA", clear  //Height and Weight Dataset
ren hwcaseid caseid
sort caseid
save "RWHWTEMP.DTA", replace

* Sort the PR, IR and WI data and then merge 
use "RWPR&IR&WI.DTA", clear //file containing PR, IR, and WI
sort caseid 
merge caseid using "RWHWTEMP.DTA"
keep if _merge==3
drop _merge
save "RWPR&IR&WI&HW.DTA", replace

Read Message
Read Message
Read Message
Previous Topic: Issue merging household and individual (women's) file
Next Topic: Merging Individual and HH Member Recode Files
Goto Forum:

Current Time: Fri Apr 3 20:43:12 Eastern Daylight Time 2020