The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging IR and HR files for Bangladesh
Merging IR and HR files for Bangladesh [message #27301] Sat, 15 July 2023 10:53 Go to next message
Ghose is currently offline  Ghose
Messages: 17
Registered: May 2018
Member
Hi,

I am trying to merge the IR and HR files for Bangladesh, and getting a very small number of matched observations. In comparison, merging IR with PR retains all observations, which is confusing me.
So, could you check the codes and please let me know if this is the right way to do the matching?

1. IR & HR merge
. use "/Users/ghose/Downloads/BDHR7RDT/BDHR7RFL.DTA"

. rename (hv001 hv002 hvidx_01) (v001 v002 v003)
. sort v001 v002 v003

. merge m:1 v001 v002 v003 using "/Users/ghose/Downloads/BDIR7RDT/BDIR7RFL.DTA"

Result # of obs.
-----------------------------------------
not matched 35,510
from master 17,420 (_merge==1)
from using 18,090 (_merge==2)

matched 2,037 (_merge==3)
-----------------------------------------


2. IR & PR merge

. rename (hv001 hv002 hvidx) (v001 v002 v003)
. sort v001 v002 v003
. merge m:1 v001 v002 v003 using "/Users/ghose/Downloads/BDIR7RDT/BDIR7RFL.DTA"

Result # of obs.
-----------------------------------------
not matched 69,692
from master 69,692 (_merge==1)
from using 0 (_merge==2)

matched 20,127 (_merge==3)


Thanks in advance!


Re: Merging IR and HR files for Bangladesh [message #27317 is a reply to message #27301] Mon, 17 July 2023 12:40 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 staff member, Tom Pullum:

Your IR / HR merge does not work because a woman in the IR file is not necessarily the first person in the household in the HR file. Usually, she is NOT. Also, there can be more than one woman in the household. The IR / HR merge should only merge on hv001 hv02, matched with v001 v002. More important, it's not clear why you would want to merge the HR file with the IR file. Such a merge attaches, to each woman, all the information about the household AND about all the individuals in the household. The merged file would be difficult to use. Probably the IR / PR merge will meet your needs.

Re: Merging IR and HR files for Bangladesh [message #27327 is a reply to message #27317] Tue, 18 July 2023 08:21 Go to previous messageGo to next message
Ghose is currently offline  Ghose
Messages: 17
Registered: May 2018
Member
Hi Bridgette,

Thanks indeed for the quick response!

I have a follow-up question regarding merging IR and PR files for multiple countries, please.

Should I append the IR files for the target countries, and then append the respective PR files, and then merge the combined IR and PR files using the hv007 and v007 vars? Or should I merge the IR and PR files for each country first, and then append them country-wise?

Thank you.


Re: Merging IR and HR files for Bangladesh [message #27331 is a reply to message #27327] Wed, 19 July 2023 12:10 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3214
Registered: February 2013
Senior Member

Following is a response from Senior DHS staff member, Tom Pullum:

I recommend that you do the merging first, and then the appending. Note that some variables are survey-specific, for example region. When you append surveys, you will lose the labels, or the labels in the last survey in the append will over-write the earlier labels. You can keep survey-specific variables separate by giving them a new name that identifies the country and survey. In pooled files there can also be discrepancies, from one survey to another, in codes that you may think are standard, such as type or birth attendant or type of health facility. It's a good idea to do a lot of checking for comparability.
Previous Topic: Disability in HR with characteristics from IR and MR
Next Topic: Merging KR file with PR file India DHS 2019-21 (NFHS-5)
Goto Forum:
  


Current Time: Sat Dec 21 07:40:28 Coordinated Universal Time 2024