The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging BR file with PR file for NFHS-4 round(India) (Merging BR and PR)
Merging BR file with PR file for NFHS-4 round(India) [message #17833] Fri, 21 June 2019 02:29 Go to next message
preshit is currently offline  preshit
Messages: 13
Registered: March 2018
Location: Tucson, AZ, USA
Member
Hello DHS team,
I am trying to merge BR and PR file for NFHS-4 data. The BR file contains B16 variable hence merging should not be a problem. The objective is to get BPL card status variable (SH58) information on each child in BR file. I have read all the forum posting for similar merging. I tried codes posted in the forum links-

http://userforum.measuredhs.com/index.php?t=msg&th=7052& amp;start=0&

http://userforum.measuredhs.com/index.php?t=msg&th=6738& amp;start=0&

and

https://userforum.dhsprogram.com/index.php?t=msg&goto=16 733&S=Google

However, I am still getting error stating that "variables hhid hvidx do not uniquely identify observations in the master data". I have attempted 1:1 and m:1 merging as well as per the new merging code in STATA however could not pass this hurdle. Please let me know if there is any alternative for merging these files other than posted in above three links. Thank you so much for your time and help in advance. I really appreciate it.

Regards
Preshit
Re: Merging BR file with PR file for NFHS-4 round(India) [message #17839 is a reply to message #17833] Sun, 23 June 2019 19:43 Go to previous messageGo to next message
preshit is currently offline  preshit
Messages: 13
Registered: March 2018
Location: Tucson, AZ, USA
Member
On follow up to my query, I attempted the code provided by Bridgette-DHS in the link-https:// userforum.dhsprogram.com/index.php?t=msg&th=8202&got o=17795&#msg_17795.
I was able to merge PR and BR file; however, many cases were missing (please see the codes and out put below). Am I missing anything in my merging code? Also, I don't want to loose information on children who are not listed in household or missing in b16. Any help in merging NFHS-4 PR and BR file will be highly appreciated. Thank you.


*BR-file
use IABR74FL.DTA,clear

tab b16,m
tab b16,nolabel //"0"- not listed in household, missing values= 93,251


keep if b16>0 & b16<39 //missing values and children coded "0"- i.e. not listed in household were deleted

keep v001 v002 v003 v005 v024 b*

gen in_BR=1
rename v001 hv001
rename v002 hv002
rename b16 hvidx
rename v003 hv003
rename v024 hv024
sort hv001 hv002 hv003 hvidx hv024
describe, short //1,051,750 observations sort on hv001 hv002 hv003 hvidx hv024
save BR_reduced.dta, replace

clear all


*PR-file
use IAPR74FL.DTA,clear

keep hv001 hv002 hvidx hv0* hv1*

gen in_PR=1
sort hv001 hv002 hv003 hvidx hv024
describe,short //2,869,043 observations sort on hv001 hv002 hv003 hvidx hv024
save PR_reduced.dta, replace
clear all

*merge
use PR_reduced.dta, clear

merge 1:1 hv001 hv002 hv003 hvidx hv024 using BR_reduced.dta


/*

Result # of obs.
-----------------------------------------
not matched 3,008,433
from master 2,412,863 (_merge==1)
from using 595,570 (_merge==2)

matched 456,180 (_merge==3)
-----------------------------------------

*/

[Updated on: Sun, 23 June 2019 19:44]

Report message to a moderator

Re: Merging BR file with PR file for NFHS-4 round(India) [message #17856 is a reply to message #17839] Wed, 26 June 2019 20:25 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3214
Registered: February 2013
Senior Member

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

You are getting a large number of unmatched cases because you do not have any restrictions on age. The cases with _merge=1 are household members who do not appear in the birth histories--obviously the great majority of household members. The cases with _merge=2 are "children" in the birth histories who can be up to 30-34 years old, and not in the same household as their mother. If the child is missing on b16, it is because he/she has died. If b16 is =, then the child is living but not in the household.

It would be reasonable to impose an age limit such as 4 or 14 or 17 and to omit children who have died.

I don't see anything wrong with your Stata code.

Re: Merging BR file with PR file for NFHS-4 round(India) [message #17894 is a reply to message #17856] Sun, 07 July 2019 14:58 Go to previous message
preshit is currently offline  preshit
Messages: 13
Registered: March 2018
Location: Tucson, AZ, USA
Member
Thank you so much for your reply. I really appreciate it. I will restrict my population to certain age category then.

[Updated on: Sun, 07 July 2019 14:58]

Report message to a moderator

Previous Topic: Merging IR and BR
Next Topic: Merge WI to KR in Mali
Goto Forum:
  


Current Time: Fri Dec 20 12:32:01 Coordinated Universal Time 2024