The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Other countries » Zambia: Mother and Father Education and source of water
Re: Zambia: Mother and Father Education and source of water [message #15780 is a reply to message #15568] Fri, 14 September 2018 16:32 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3199
Registered: February 2013
Senior Member
Following is a response from Senior DHS Specialist, Tom Pullum:

The following lines show how to merge the characteristics of the mother and father onto the record for the child using hv112 and hv114, the line numbers of the parents (if they are living and in the same household as the child). You need to save working files in some location. I use "scratch" folders and "temp" files. The file called "tempchild.dta" is the file you want. Source of drinking water is hv201. Every record in the PR file has hv201 on it, so it's in tempchild.dta.

set more off
cd e:\DHS\DHS_data\scratch

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\ZMPR61FL.DTA" , clear
save tempall.dta, replace

* construct a file of potential mothers
use tempall.dta, clear 
keep if hv104==2
keep hv001 hv002 hvidx hv106
rename hv106 mother_ed
rename hvidx mo_line
sort hv001 hv002 mo_line
save tempmo.dta, replace

* construct a file of potential fathers
use tempall.dta, clear 
keep if hv104==1
keep hv001 hv002 hvidx hv106
rename hv106 father_ed
rename hvidx fa_line
sort hv001 hv002 fa_line
save tempfa.dta, replace

* prepare children for merge with mothers

use tempall.dta, clear 
keep if hc1<.
rename hv112 mo_line
sort hv001 hv002 mo_line
merge hv001 hv002 mo_line using tempmo.dta
rename _merge mo_merge

rename hv114 fa_line
sort hv001 hv002 fa_line
merge hv001 hv002 fa_line using tempfa.dta
rename _merge fa_merge

drop if mo_line==. | fa_line==.
tab *_merge
drop *_merge
save tempchild.dta, replace

tab1 *_line
tab *_ed,m



 
Read Message
Read Message
Read Message
Previous Topic: Livestock Ownership
Next Topic: Pakistan DHS 2017
Goto Forum:
  


Current Time: Fri Nov 22 00:29:22 Coordinated Universal Time 2024