The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Kenya » KDHS 2022 : Table 11.13.1 Nutritional status of women age 2049
KDHS 2022 : Table 11.13.1 Nutritional status of women age 2049 [message #28293] Sun, 10 December 2023 03:43 Go to next message
sokiya is currently offline  sokiya
Messages: 78
Registered: May 2017
Location: Nairobi
Senior Member
I am trying to replicate Table 11.13.1 Nutritional status of women age 2049 using the code below that I extracted from the DHS GitHub repo

use "KEIR8AFL.dta", clear

cap label define yesno 0"No" 1"Yes"
gen wt=v005/1000000

*** Anemia indicators ***

//Any anemia
gen nt_wm_any_anem=0 if v042==1 & v455==0
replace nt_wm_any_anem=1 if v457<4
label values nt_wm_any_anem yesno
label var nt_wm_any_anem "Any anemia - women"

//Mild anemia
gen nt_wm_mild_anem=0 if v042==1 & v455==0
replace nt_wm_mild_anem=1 if v457==3
label values nt_wm_mild_anem yesno
label var nt_wm_mild_anem "Mild anemia - women"

//Moderate anemia
gen nt_wm_mod_anem=0 if v042==1 & v455==0
replace nt_wm_mod_anem=1 if v457==2
label values nt_wm_mod_anem yesno
label var nt_wm_mod_anem "Moderate anemia - women"

//Severe anemia
gen nt_wm_sev_anem=0 if v042==1 & v455==0
replace nt_wm_sev_anem=1 if v457==1
label values nt_wm_sev_anem yesno
label var nt_wm_sev_anem "Severe anemia - women"

*** Anthropometry indicators ***

* age of most recent child
gen age = v008 - b3_01
	
	* to check if survey has b19, which should be used instead to compute age. 
	scalar b19_included=1
		capture confirm numeric variable b19_01, exact 
		if _rc>0 {
		* b19 is not present
		scalar b19_included=0
		}
		if _rc==0 {
		* b19 is present; check for values
		summarize b19_01
		  if r(sd)==0 | r(sd)==. {
		  scalar b19_included=0
		  }
		}

	if b19_included==1 {
	drop age
	gen age=b19_01
	}


//Height less than 145cm
gen nt_wm_ht= v438<1450 if inrange(v438,1300,2200)
label values nt_wm_ht yesno
label var nt_wm_ht "Height under 145cm - women"

//Mean BMI
gen bmi=v445/100
summarize bmi if inrange(bmi,12,60) & (v213!=1 & (v208==0 | age>=2)) [iw=wt]
gen nt_wm_bmi_mean=round(r(mean),0.1)
label var nt_wm_bmi_mean "Mean BMI  - women"

//Normal weight
gen nt_wm_norm= inrange(v445,1850,2499) if inrange(v445,1200,6000)
replace nt_wm_norm=. if (v213==1 | age<2)
label values nt_wm_norm yesno
label var nt_wm_norm "Normal BMI - women"

//Thin
gen nt_wm_thin= inrange(v445,1200,1849) if inrange(v445,1200,6000)
replace nt_wm_thin=. if (v213==1 | age<2)
label values nt_wm_thin yesno
label var nt_wm_thin "Thin BMI - women"

//Mildly thin
gen nt_wm_mthin= inrange(v445,1700,1849) if inrange(v445,1200,6000)
replace nt_wm_mthin=. if (v213==1 | age<2)
label values nt_wm_mthin yesno
label var nt_wm_mthin "Mildly thin BMI  - women"

//Moderately and severely thin
gen nt_wm_modsevthin= inrange(v445,1200,1699) if inrange(v445,1200,6000)
replace nt_wm_modsevthin=. if (v213==1 | age<2)
label values nt_wm_modsevthin yesno
label var nt_wm_modsevthin "Moderately and severely thin BMI - women"

//Overweight or obese
gen nt_wm_ovobese= inrange(v445,2500,6000) if inrange(v445,1200,6000)
replace nt_wm_ovobese=. if (v213==1 | age<2)
label values nt_wm_ovobese yesno
label var nt_wm_ovobese "Overweight or obese BMI  - women"

//Overweight
gen nt_wm_ovwt= inrange(v445,2500,2999) if inrange(v445,1200,6000)
replace nt_wm_ovwt=. if (v213==1 | age<2)
label values nt_wm_ovwt yesno
label var nt_wm_ovwt "Overweight BMI  - women"

//Obese
gen nt_wm_obese= inrange(v445,3000,6000) if inrange(v445,1200,6000)
replace nt_wm_obese=. if (v213==1 | age<2)
label values nt_wm_obese yesno
label var nt_wm_obese "Obese BMI  - women"

tabstat nt_wm_ht nt_wm_bmi_mean nt_wm_norm nt_wm_thin nt_wm_mthin nt_wm_modsevthin nt_wm_ovobese nt_wm_ovwt nt_wm_obese [fw=wt] if inrange(age, 20, 49) & sshort == 0, statistics(mean) save

but the results are not matching. Any help will be appreciated.

Re: KDHS 2022 : Table 11.13.1 Nutritional status of women age 2049 [message #28327 is a reply to message #28293] Thu, 14 December 2023 13:56 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3199
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Tom Pullum:

The following Stata lines will match table 11.13.1 exactly. I just include the results for the wealth quintiles and the total.

To get the match I had to express the ranges a little differently than in the table headings. Note that it is necessary to omit women who had a birth in the past two months or are pregnant from the BMI indicator.

For tabstat you need to use fweights. You can avoid the use of tabstat, but I think it's a nice command and it is under-used. It is used in the GitHub version.

Something I had never encountered before, and that I only figured out by trial and error, is that for "short", i.e. height less than 145 cm, to get a match you must drop the 5 shortest women in the sample. Apparently a lower plausible bound for height was enforced--but no upper bound. As I said, I have never seen this before and I don't know whether it is done for other tables on anthropometry in this survey or is done for other surveys.

use "...KEIR8BFL.DTA" , clear

gen ht=v438/10 if v438<9994
gen short=0 if ht<.
replace short=100 if ht<145

gen bmi=v445/100 if v445<9998
replace bmi=. if b19_01<2 | v213==1

foreach lv in normal totalthin mildlythin modsevthin overwtobese overwt obese {
gen bmi_`lv'=0 if bmi<.
}

replace bmi_normal     =100 if bmi>=18.5 & bmi<25
replace bmi_totalthin  =100 if bmi<18.5
replace bmi_mildlythin =100 if bmi>=17.0 & bmi<18.5 
replace bmi_modsevthin =100 if bmi<17.0
replace bmi_overwtobese=100 if bmi>=25.0 & bmi<.
replace bmi_overwt     =100 if bmi>=25.0 & bmi<30.0
replace bmi_obese      =100 if bmi>=30.0 & bmi<.

tabstat bmi* [fweight=v005] if v013>1, statistics(mean) by(v190)
tab v190 if v013>1 & bmi<.   [iweight=v005/1000000]

* to match the table for "short" we must drop the 6 shortest women!
sort ht

tabstat short [fweight=v005] if v013>1 & _n>6, statistics(mean) by(v190)
tab v190 if v013>1 & short<. & _n>6 [iweight=v005/1000000]
Re: KDHS 2022 : Table 11.13.1 Nutritional status of women age 2049 [message #28334 is a reply to message #28327] Fri, 15 December 2023 10:06 Go to previous message
sokiya is currently offline  sokiya
Messages: 78
Registered: May 2017
Location: Nairobi
Senior Member
Thanks so much for the guidance. I sincerely appreciate.
Previous Topic: Merging Aggregate Group Data with V613 Responses
Next Topic: KDHS 2022: Table 5.10 Age at first birth
Goto Forum:
  


Current Time: Fri Nov 22 23:55:44 Coordinated Universal Time 2024