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 message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to previous message](/theme/default/images/down.png) |
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
|
|
|