NFHS 4 Data (Merging of PR and KR data file) [message #13952] |
Mon, 29 January 2018 08:29 |
Jayanta
Messages: 28 Registered: September 2017
|
Member |
|
|
Dear DHS team,
I was looking the previous comments on PR and KR file merging codes and applying it to NFHS4 data and found error message as given below.
"variables v001 v002 v003 b16 do not uniquely identify observations in the master data".
Your help will be appreciated in this regards.
Regards,
Jayanta
[Updated on: Mon, 29 January 2018 08:30] Report message to a moderator
|
|
|
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 |
Bridgette-DHS
Messages: 3203 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
|
|
|
|