Home » Data » Merging data files » Merging children, mother, and father's characteristics (Merging children, mother, and father's characteristics keeping household level)
Re: Merging children, mother, and father's characteristics [message #27455 is a reply to message #27422] |
Tue, 15 August 2023 16:09 |
Bridgette-DHS
Messages: 3199 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Tom Pullum:
It sounds like your unit of analysis is children, not households. I recommend that you use the KR (child) file. Each child's record includes almost all of the variables for the mother: all of the "v" variables in the KR file pertain to the mother. For household-level variables that you also want to attach to the child's record, use the Stata lines that I will paste below. Attaching the father's data is more difficult. If the father is in the household, his line number is given by hv114 on the child's record in the PR file. It's a complex merge and you lose the children whose father is not in the household. The steps are described in other posts.
* Stata program to copy household-level variables into the KR file
* Specify workspace
cd e:\DHS\DHS_data\scratch
* Prepare household data
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\RWHR81FL.DTA" , clear
drop *_*
rename hv001 cluster
rename hv002 hh
sort cluster hh
save NGHR81_temp.dta, replace
* Prepare the KR file and merge
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\RWKR81FL.DTA" , clear
rename v001 cluster
rename v002 hh
sort cluster hh
merge m:1 cluster hh using NGHR81_temp.dta
keep if _merge==3
drop _merge
|
|
|
Goto Forum:
Current Time: Sun Dec 1 15:05:38 Coordinated Universal Time 2024
|