The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Child Health » CR-KR Merger (Syntax)
Re: CR-KR Merger [message #30081 is a reply to message #30022] Fri, 20 September 2024 11:00 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 888
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:
The following two Stata commands are all that is necessary to merge the CR data onto the KR file, illustrated with the Kenya 2022 survey:
use "...KEKR8CFL.DTA", clear

merge m:1 v001 v002 v003 using "...KECR8CFL.DTA"

To run this, all you have to do is insert the paths to the KR and CR files. Note that many variables for the mother are in BOTH the CR and KR files. For those duplicates, the value in the CR file will overwrite the values in the KR file, but that should not be a problem. An alternative would be to drop the duplicates from one file or the other before the merge. I recommend that you check the correspondences between the files, because sometimes groups of variables appear as NA (a dot) in the merged file but they are not actually NA.

After these commands you can enter "tab _merge". The following appears:
. tab _merge

 

                 _merge |      Freq.     Percent        Cum.

------------------------+-----------------------------------

        master only (1) |     14,706       68.92       68.92

         using only (2) |      1,807        8.47       77.39

            matched (3) |      4,824       22.61      100.00

------------------------+-----------------------------------

                  Total |     21,337      100.00
_merge is 1 for children who do not match with any couples in the CR file: the child's mother is in the IR file but she does not have a partner

_merge is 2 for couples who do not match with any children: the woman in the couple does not have any children in the KR file

_merge is 3 for children who DO match with a couple in the CR file

You probably want to add these lines:
keep if _merge==3

drop _merge

There may not be as many matches (code 3) as you would expect, but remember that these are only births in the past 5 years. the percentages of births with code 3 would be higher for the BR file.

Note also that the mother's partner in the CR file is not necessarily the biological father of the child. The father may have died, may live elsewhere, the parents may be separated or divorced, etc. If the biological father is in the household, he is specified by line lv114 on the child's record in the PR file. Otherwise, the biological father is not in the data files.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: v717
Next Topic: Population for cause specific mortality rate from va dataset
Goto Forum:
  


Current Time: Sat Nov 23 05:54:47 Coordinated Universal Time 2024