The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Biomarkers » Merging 2003 Ghana DHS HW and KR files
Merging 2003 Ghana DHS HW and KR files [message #30401] Fri, 22 November 2024 00:05 Go to next message
Josie is currently offline  Josie
Messages: 4
Registered: October 2024
Member
Hi,

I am trying to merge the 2003 Ghana DHS HW and KR files to retrieve the new WHO anthropometric measures for analysis. How do I do this?

Does the HWHHID in the HW file correspond with the CASEID in the KR file?
What about the HHLINE variable in the HW file?

I have made initial attempts assuming that the HHLINE variable is the line number of the individual in the household. I decided to use B16 (child line number in the household) in the KR file to match for merging but it is not working. Is there something I need to take into consideration?

Kindly advise. I am using R for analysis.
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.
Previous Topic: Diabetes and Hypertension
Next Topic: Allegiant Air Rome Office
Goto Forum:
  


Current Time: Sat Nov 30 05:58:30 Coordinated Universal Time 2024