The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » DHS Burundi 1987
Re: DHS Burundi 1987 [message #29818 is a reply to message #29816] Thu, 08 August 2024 14:01 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 802
Registered: January 2013
Senior Member
Hi Jacob

A couple of problems with your code: 1) caseid in the women's data is 15 characters, whereas hwhhid is just 12 characters for the household ID. You need to drop the woman's line number part of caseid which is the last 3 characters. 2) midx is the variable that links from the KR file to the birth history, not to the household schedule. B16 is the variable that links to the household schedule.

I think the following code should do what you need:
* Sort the children's recode data and then merge
use "${kr2003}", clear
gen hwhhid = substr(caseid,1,12)
clonevar hwline = b16
sort hwhhid hwline
merge m:1 hwhhid hwline using "${hw2003}"
and then just use those cases with _merge==3 (it looks like there are 6 cases that do not match properly, with _merge==2)

Cheers. Trevor
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mozambique: Standard DHS, 2022-23, KR Dataset
Next Topic: Minimum acceptable diet
Goto Forum:
  


Current Time: Sun Sep 1 04:14:26 Coordinated Universal Time 2024