The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » NFHS 4 Data (Merging of PR and KR data file)
Re: NFHS 4 Data (Merging of PR and KR data file) [message #13958 is a reply to message #13952] Mon, 29 January 2018 20:13 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3151
Registered: February 2013
Senior Member

Following is a response from Senior DHS Stata Specialist, Tom Pullum:

The following lines will work. You do not need to include v003 at all. b16 is the line number of the child in the household file. You may have been confusing it with bidx, which is the number of the child in the birth history (with 1 for the most recent birth), or bord, which is birth order (with 1 for the first birth). That is, the values of bidx and bord are nested within v003, but b16 is comparable to v003 and to hvidx--as a line number nested within the household.

* Prepare KR file for merge
use e:\DHS\DHS_data\KR_files\IAKR71FL.dta, clear 
gen hv001=v001
gen hv002=v002
gen hvidx=b16
sort hv001 hv002 hvidx
save e:\DHS\DHS_data\scratch\IAKRtemp.dta, replace


* Prepare PR file for merge
use e:\DHS\DHS_data\PR_files\IAPR71FL.dta, clear
sort hv001 hv002 hvidx

* Merge KR with PR
merge hv001 hv002 hvidx using  e:\DHS\DHS_data\scratch\IAKRtemp.dta
tab _merge
 
Read Message
Read Message
Read Message
Previous Topic: Merging Individual and HH Member Recode Files
Next Topic: Merging children to their mothers
Goto Forum:
  


Current Time: Sat Aug 31 00:22:35 Coordinated Universal Time 2024