The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Biomarkers » Merging 2003 Ghana DHS HW and KR files
Re: Merging 2003 Ghana DHS HW and KR files [message #30420 is a reply to message #30401] Tue, 26 November 2024 12:43 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 893
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:

The following lines will do this merge in Stata.  You will have to adapt to R.
use "...GHKR4BFL.DTA", clear
gen hwhhid=substr(caseid,1,12)
gen hwline=b16
drop if hwline==. | hwline==0

merge 1:1 hwhhid hwline using "...GHHW4AFL.DTA"
tab _merge
keep if _merge==3
drop _merge

hwhhid is a string that has all characters in caseid except the last three, which are the woman's line number. That's why I use the substring command to reduce to the first 12 characters. In the KR file the variable b16 is line number in the household listing but you have to remove the "." and "0" codes.
 
Read Message
Read Message
Previous Topic: Diabetes and Hypertension
Next Topic: Allegiant Air Rome Office
Goto Forum:
  


Current Time: Sat Nov 30 07:04:09 Coordinated Universal Time 2024