MERGING HW FILE AND KR FILE NFHS2 (DHS IV) [message #29297] |
Thu, 23 May 2024 21:51 ![Go to next message Go to next message](/theme/default/images/down.png) |
Noyel Sebastian
Messages: 11 Registered: March 2024
|
Member |
|
|
Hello,
Can I merge the Height-Weight File for NFHS2 to the KR file and use it for child nutrition outcomes? Can you help me with the Stata code for the same? I tried to calculate scores in the KR file, but it only generated missing values. The code used is:
gen DOB=mdy(b1, b3, b2)
format DOB %d
format %tdMon_DD,_CCYY DOB
la var DOB "Date of Birth of children"
*
gen SVDate=mdy(hw18, hw17, hw19)
format SVDate %d
format %tdMon_DD,_CCYY SVDate
la var SVDate "Survey date"
*
gen cage= (SVDate-DOB)/30.4167
format %5.0g cage
la var cage "Age of children in month"
*
gen ch=hw3/10 if hw3<9000
gen cw=hw2/10 if hw2<9000
*
*----------Z score calculation--------
*
zscore06, a(cage) s(b4) h(ch) w(cw) male(1) female(2)
*
replace haz06 =. if haz06 <-6
replace haz06 =. if haz06 >6
replace waz06 =. if waz06 <-6
replace waz06 =. if waz06 >5
replace whz06 =. if whz06 <-5
replace whz06 =. if whz06 >5
*
gen stunting= haz06<-2 if haz06<.
la de stunting 1 "Stunted" 0 "Non-stunted", replace
la val stunting stunting
*
gen underweight= waz06<-2 if waz06<.
la de underweight 1 "underweight" 0 "Non-underweight", replace
la val underweight underweight
*
gen wasting= whz06<-2 if whz06<.
la de wasting 1 "wasting" 0 "Non-wasting", replace
la val wasting wasting
Why is this code not working?
Thank You
[Updated on: Thu, 23 May 2024 21:55] Report message to a moderator
|
|
|
Re: MERGING HW FILE AND KR FILE NFHS2 (DHS IV) [message #29397 is a reply to message #29297] |
Tue, 11 June 2024 15:52 ![Go to previous message Go to previous message](/theme/default/images/up.png) |
Janet-DHS
Messages: 829 Registered: April 2022
|
Senior Member |
|
|
Following is a response from DHS staff member, Tom Pullum:
The following Stata lines will do this merge:
* Specify a workspace
cd e:\DHS\DHS_data\scratch
use "...IAHW22FL.DTA"
rename hwcaseid caseid
rename hwline bidx
save IAtemp.dta, replace
use "...IAKR23FL.DTA"
merge 1:1 caseid bidx using IAtemp.dta
|
|
|