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 next 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

Re: Merging Rwanda DHS 1992 without b16 [message #13905 is a reply to message #13894] Tue, 23 January 2018 07:15 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 1580
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

Note that hv111 and hv113 are included in this survey only for ages 0-14 (hv112 and hv114 are not included at all--you do not mention them but they can be very helpful). In later surveys the age interval is 0-17. These variables are collected in the household survey. The HW variables (hc70-hc73) for this survey were collected in the survey of women (see the variable "hwlevel") and apply to the surviving children of women in the household. Children in the household whose mother had died or for some other reason was not in the household do not have the HW variables.

I can't go into your do file in detail, but I have to say that we at DHS have not been able to find a certain way to link the children in the KR file to the children in the PR file in the early files that did not include b16. I have spent quite a bit of time working on this and so have others. Whoever can figure this out deserves a prize!

In the later surveys, not only is b16 included, but the age of the child in months (for children under 5), is included as hc1 and it can also be calculated as v008-b3. This gives an exact correspondence between the ages of children in the PR and KR files, in months, which would be a big help if you wanted to match specific children. But in the older surveys, not only is b16 omitted, but hc1 is also omitted, and the age of a child in years in the PR file, hv005, is fairly often inconsistent with the age in years in the KR file, b8. I recommend that you use the more recent surveys or re-define your research question in such a way that you can manage without trying to merge the PR and KR files.

Re: Merging Rwanda DHS 1992 without b16 [message #13923 is a reply to message #13905] Thu, 25 January 2018 09:38 Go to previous message
Sniz is currently offline  Sniz
Messages: 2
Registered: January 2018
Thanks for the time you took to respond to my question. So, does that mean that we cannot merge PR to IR and maybe work from there?
Previous Topic: Issue merging household and individual (women's) file
Next Topic: Merging Individual and HH Member Recode Files
Goto Forum:

Current Time: Mon Mar 18 10:24:36 Eastern Daylight Time 2019