The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » How to link child health outcome with mothers' characteristics
Re: How to link child health outcome with mothers' characteristics [message #25320 is a reply to message #25315] Mon, 03 October 2022 09:53 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3199
Registered: February 2013
Senior Member
Following is a response from DHS staff member, Tom Pullum:

You just need to merge the mothers in the KR file with the women in the PR file. This could be a "m:1" merge or you can use an older version of the merge command, which I prefer. The following Stata code shows how to do it, and shows that the mother's PR data is repeated for each child.

cd e:\DHS\scratch

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\ETPR81FL.DTA", clear
keep if hv117==1
gen cluster=hv001
gen hh=hv002
gen mo_line=hvidx
sort cluster hh mo_line
save ETPR81temp.dta, replace

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\ETKR81FL.DTA", clear
gen cluster=v001
gen hh=v002
gen mo_line=v003
sort cluster hh mo_line
merge cluster hh mo_line using ETPR81temp.dta

tab _merge

keep if _merge==3
save ETKRPR81FL.dta, replace

gen children_per_mother=1
collapse(sum) children_per_mother, by(cluster hh mo_line)

tab children
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging and appending data files
Next Topic: Merge BDSQ7RDT and BDVA7RDT with the household data file
Goto Forum:
  


Current Time: Mon Nov 25 08:45:22 Coordinated Universal Time 2024