The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » merging household and individual data
Re: merging household and individual data [message #9986 is a reply to message #9985] Tue, 14 June 2016 10:14 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3214
Registered: February 2013
Senior Member
Another response from Tom Pullum:

What I had in mind is given below. I said this would require the IR file. It COULD be done with the IR file, but it is easier with the BR file, and merging it with the PR file.

The file that is produced has a variable "line_number_of_mother". This is equivalent to hv112 if the child and mother are in the same household and the child's age is <18. However, it extends to ages 18 and above.

If the child is age 18+ and the child's mother is NOT in the same household as the child, then it is impossible to tell whether the mother is still alive. That information is provided with hv111 for children age <18. Let me know if you have questions. Cheers--Tom

* 2013 Nigeria DHS NG6A

* linking mothers and children in the same household

* The goal is to add a variable to each child in the PR file that will match
* hv112 for children age 0-17 but will continue for ages 18+

* Use BR file, merge with PR

* merge the mother's line number with the child

set more off
use e:\DHS\DHS_data\BR_files\NGBR6AFL.dta, clear

keep v001 v002 v003 b16
keep if b16>0 & b16<90

gen line_number_of_mother=v003

ren v001 hv001
ren v002 hv002
ren b16 hvidx
keep hv001 hv002 hvidx line_number_of_mother
sort hv001 hv002 hvidx
save e:\DHS\DHS_data\scratch\temp_child.dta, replace

* prepare the PR file, just keep the minimum variables needed for testing

use e:\DHS\DHS_data\PR_files\NGPR6AFL.dta, clear

keep hv001 hv002 hvidx hv104 hv105 hv111 hv112

sort hv001 hv002 hvidx

merge hv001 hv002 hvidx using e:\DHS\DHS_data\scratch\temp_child.dta
ren _merge merge_child

summarize hv105 if line_number_of_mother>0 & line_number_of_mother<.

* line number of mother should match hv112 for children under 18

correlate hv112 line_number_of_mother if hv105<18 & hv112>0 & hv112<90

tab line_number_of_mother if hv105>=18

tab hv105 if hv105>=18 & line_number_of_mother>0 & line_number_of_mother<.

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging Palestine
Next Topic: What is the underlying criteria for merging datasets from various waves?
Goto Forum:
  


Current Time: Sun Dec 22 03:47:50 Coordinated Universal Time 2024