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 messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 938
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.
Re: Merging 2003 Ghana DHS HW and KR files [message #31120 is a reply to message #30401] Fri, 04 July 2025 03:13 Go to previous message
JamesLily is currently offline  JamesLily
Messages: 7
Registered: July 2025
Member
Merging the 2003 Ghana DHS Household (HW) and Kids Recode that's not my neighbor files involves combining data at the appropriate unit level, usually linking household-level information (HW) with child-level records (KR). Since the KR file is child-based and the HW file is household-based, you typically merge them by household identifiers.
Previous Topic: BDHS2022_Sex and Age of respondents selected for biomarkers (blood pressure/blood glucose)
Next Topic: Zeddex Exchange & Zeddex Swap: Next-Generation Decentralized Trading Platform
Goto Forum:
  


Current Time: Sat Jul 19 05:54:59 Coordinated Universal Time 2025