The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » merge CR file with IR
merge CR file with IR [message #23823] Wed, 08 December 2021 23:03 Go to next message
Tedy is currently offline  Tedy
Messages: 14
Registered: July 2020
Member
Hello dear DHS database experts, please I need the stata codes to merge the couple file (CR) with the woman file (IR).
Re: merge CR file with IR [message #23824 is a reply to message #23823] Thu, 09 December 2021 15:39 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3017
Registered: February 2013
Senior Member
We have had countless postings on the topic of merging DHS datasets. If you search with keywords "merge" or "merging", you should find answers to your questions.

For additional information on merging, please see the examples in the Guide to DHS Statistics - search for "Matching and Merging Datasets". Also, please see the following page for more information on merging: https://dhsprogram.com/data/Merging-Datasets.cfm
Re: merge CR file with IR [message #23826 is a reply to message #23824] Fri, 10 December 2021 06:59 Go to previous messageGo to next message
Tedy is currently offline  Tedy
Messages: 14
Registered: July 2020
Member
Thank you for your reply, I have read the guide to dhs statistics document and the concern I have is which of the files between CR and IR I will take as the base or primary file.
Re: merge CR file with IR [message #23827 is a reply to message #23826] Fri, 10 December 2021 07:51 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3017
Registered: February 2013
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

With this merge, it will make no difference whether you start with the IR file as the "master" file and the CR file as the "using" file, or the other way around. The only difference will be that if you do it one way, "_merge" will be coded 1 for the IR cases that are not in the CR file, and if you do it the other way, those cases will be coded 2. But that's automatic and Stata will tell you. (For this merge, there will be NO cases that are in the CR file and not in the IR file.)

I usually take the larger file as the "master" and the smaller file as the "using" but I'm not consistent about that because it really only makes a difference if your program does something next based on _merge being 1 or 2.

As a general rule, when you have to choose between doing A or B with Stata, I'd just try both, see if they "work", and then see if they give different results.

[Updated on: Fri, 10 December 2021 07:51]

Report message to a moderator

Re: merge CR file with IR [message #23828 is a reply to message #23827] Fri, 10 December 2021 09:08 Go to previous messageGo to next message
Tedy is currently offline  Tedy
Messages: 14
Registered: July 2020
Member
Thank you very much for your reply. But the concern I have is that in the couple file there is no weight-for-height, weight-for-age and height-for-age z-score data for the under five children and I need it for my analysis.
Re: merge CR file with IR [message #23829 is a reply to message #23828] Fri, 10 December 2021 10:36 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3017
Registered: February 2013
Senior Member

Following is another response from DHS Research & Data Analysis Director, Tom Pullum:

The IR file should include hw70_1 through hw70_6, which are the height-for-age z scores for the woman's children under 5. Similarly for 71 and 72, which are the weight-for-age and weight-for-height scores. You would keep them in the IR file for the merge, and then keep if _merge==3 to restrict to mothers who are in both the IR file and the CR file. If you want one line for each child under 5, you can then "reshape long". I don't understand why you would want to analyze the z scores for children using the CR file, but it can be done.

Re: merge CR file with IR [message #23834 is a reply to message #23828] Sat, 11 December 2021 14:38 Go to previous messageGo to next message
Tedy is currently offline  Tedy
Messages: 14
Registered: July 2020
Member
Thanks again for your response, I am doing this because I want to see the effects of both paternal and maternal characteristics on children's health as well.
Re: merge CR file with IR [message #23841 is a reply to message #23834] Mon, 13 December 2021 10:11 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3017
Registered: February 2013
Senior Member

Following is another response from DHS Research & Data Analysis Director, Tom Pullum:

In the PR file, the line numbers of the parents (if living with the child) are given by hv112 (for the mother) and hv114 (for the father). You do not know for sure that the male partner of the mother in the couples file is the father. Also the CR file will not contain all mothers and fathers who are living in the same household as the child.

Previous Topic: I share you summary of GPS & survey & year for bulk dowonloaders
Next Topic: merging data
Goto Forum:
  


Current Time: Thu Mar 28 16:34:24 Coordinated Universal Time 2024