The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » Where can I find z-scores?
Re: Where can I find z-scores? [message #18139 is a reply to message #51] Wed, 25 September 2019 16:44 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 789
Registered: January 2013
Senior Member
The code described earlier is a little simplistic and doesn't handle all of the special cases that need to be taken into account. The code below addresses these. The code displays cases where the output of zscore06 and the DHS variables differs, but these should all be flagged cases where DHS has set the variables to a special value.

The following special situations are handled:
1) Setting the weight or height to missing if the child was not weighed or measured
2) Setting the age to missing if either the month or year of birth was not given, but assuming day 15 if only day of birth was not given. Some dates are imputed, but these are not used as they are not accurate measures of age in months (values of b10 > 1)
3) Setting whether the child was measured lying or standing.
4) DHS has used a special rule that if reported as "standing" but age is < 8 month (actually 240 days), this is ignored and the child is assumed to have been lying. Similarly if reported as "lying" but age 3 years or older (>1095 days) the child is assumed to have been standing. Note that this rule is likely to change in future surveys following WHO guidance to ignore "standing" if the child is less than 9 months of age, but permit "lying" for children older than 3 years.
5) zscore06 does not flag cases with implausible values. The code below flags H/A, W/A and W/H based on the zscore06 output variables. zscore06 leaves the implausible zscores in the data, while DHS replaces them with special values.
6) In earlier survey such as Guyana 2009, DHS variables hw70, hw71, or hw72 are all marked as flagged if any of the 3 indicators were flagged in 5) above. This has changed in more recent surveys so that only the individual indicator is marked as flagged.

gen hw2_2 = hw2/10
* set weight to missing if not weighed for any reason
replace hw2_2 = . if hw2 >= 990
gen hw3_2 = hw3/10
* set height to missing if not measured for any reason
replace hw3_2 = . if hw3 >= 9990

* calculate date of measurement and date of birth
gen mdate = mdy(hw18,hw17,hw19)
gen bdate = mdy(b1,hw16,b2) if hw16<=31
replace bdate = mdy(b1,15,b2) if hw16>31
* if month or year of birth not reported, we don't have accurate age
replace bdate = . if b10 > 1
gen age = (mdate-bdate)/30.4375

* lying or standing
gen measure = hw15
replace measure = . if measure == 9
* DHS ignores lying or standing if: "standing" but < 8 months (240 days); or "lying", but >= 36 months (>1095 days)
replace measure = . if measure==2 & age <   8 & age!=.
replace measure = . if measure==1 & age >= 36 & age!=.

* calculate z-scores
zscore06, a(age) s(b4) h(hw3_2) w(hw2_2) measure(measure)

* mark those with different results - these should all be flagged cases
gen dif_ha = (round(haz06*100,1) == hw70) if hw3_2 != .
gen dif_wa = (round(waz06*100,1) == hw71) if hw2_2 != .
gen dif_wh = (round(whz06*100,1) == hw72) if hw2_2 != . & hw3_2 != .

* generate flag variables from the zscore06 variables
gen flag_ha = (haz06 < -6 | haz06 > 6)
gen flag_wa = (waz06 < -6 | waz06 > 5)
gen flag_wh = (whz06 < -5 | whz06 > 5)

* just show the cases with some difference to check
browse b4 b10 hw2_2 hw3_2 hw15 age haz06 waz06 whz06 flag_ha flag_wa flag_wh hw70 hw71 hw72 dif_ha dif_wa dif_wh if dif_ha == 0 | dif_wa == 0 | dif_wh == 0

Note that the code above is for use with the HW series of variables in the KR file. In fact, for most analyses of anthropometric data, DHS uses the PR file and the equivalent HC variables. The difference is that the PR file includes all children in the KR file, plus children who were residents of the household, but whose mother did not live in the household or was not interviewed, whereas the KR file only includes children of interviewed women.
 
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 'Don't know' in exclusive breastfeeding
Next Topic: anemia prevalebce and associated factors in children aged 6-59 months
Goto Forum:
  


Current Time: Thu Apr 25 06:02:01 Coordinated Universal Time 2024