Re: Merging child and Household recode (2015-2016 India survey) [message #14086 is a reply to message #14069] |
Tue, 13 February 2018 09:20 |
Bridgette-DHS
Messages: 3199 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS Stata Specialist, Tom Pullum:
You should use the PR file rather than the HR file. Both of them are household data files but the PR file has one record per person, whereas the HR file has one record per household, and the individuals have "_1", "_2", etc. attached to their variable names. Moreover, and this is a very important exception to the usual id codes, the person id for this survey includes the state id, hv024 (or v024). The following lines will do this merge (of course you must change the paths to the data files). When you do this merge, you will find 3437 children who are in the KR file but not the PR file. Those are children who have died or for some other reason are not in the same household as the mother, and therefore b16 is "." or "0" .
use e:\DHS\DHS_data\KR_files\IAKR52FL.dta
keep v001 v002 v024 b16
rename v001 hv001
rename v002 hv002
rename v024 hv024
rename b16 hvidx
sort hv024 hv001 hv002 hvidx
save e:\DHS\DHS_data\scratch\IAKR_temp.dta, replace
use e:\DHS\DHS_data\PR_files\IAPR52FL.dta
keep hv001 hv002 hv024 hvidx
sort hv024 hv001 hv002 hvidx
merge hv024 hv001 hv002 hvidx using e:\DHS\DHS_data\scratch\IAKR_temp.dta
tab _merge
|
|
|