The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Ethiopia » prevalence of anemia and associated factors (mismatch b/n DHS report and dataset)
Re: prevalence of anemia and associated factors [message #18376 is a reply to message #18374] Thu, 21 November 2019 05:28 Go to previous messageGo to previous message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hello zelalem,

Try this one (use the PR file [ETPR70FL]):

clear all
set matsize 800
set maxvar 10000
set mem 1g
cd "C:\UsersUser88\Desktop\ETHIOPIA DHS 2016\ETPR70DT"
use "ETPR70FL", clear
set more off

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **

** WEIGHT VARIABLE
gen weight = hv005/1000000
gen wt=weight

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **

** SURVEY SET
gen psu =    hv021
//gen strata = v022
gen strata = hv023
svyset psu [pw = weight], strata(strata)

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **

cap drop anaemiac
recode hc56 (0/69=3 "Severe anaemia") (70/99=2 "Moderate anaemia") ///
(100/109=1 "Mild anaemia") (110/250=0 "Not anaemiac") (999=.), g(anaemiac) 

cap drop any_anaemia
gen any_anaemia = inrange(anaemiac,1,3)
label define any_anaemia 0"Has no anaemia" 1"Has anaemia"
label var any_anaemia "Prevalence of anaemia in children"
label val any_anaemia any_anaemia

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **

keep if hc1 >= 6 & hc1 <= 59 & hv103==1

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
keep if anaemiac !=.

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **

** CHECK **
svy: tab any_anaemia, count format(%9.0f)
svy: tab anaemiac, count format(%9.0f)

svy: tab hv270 any_anaemia, percent format(%9.1f) row
svy: tab hv025 any_anaemia, percent format(%9.1f) row
svy: tab hv024 any_anaemia, percent format(%9.1f) row

svy: tab hv270 anaemiac, percent format(%9.1f) row
svy: tab hv025 anaemiac, percent format(%9.1f) row
svy: tab hv024 anaemiac, percent format(%9.1f) row

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **

/*
svy: tab hv270 anaemiac, count format(%9.0f)
svy: tab hv025 anaemiac, count format(%9.0f)
svy: tab hv024 anaemiac, count format(%9.0f)
*/

** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **

ssc install hplot, replace //needs internet connection
ssc install catplot, replace //needs internet connection

catplot anaemiac [aw=weight], by(hv270, compact note("") col(1)) ///
        bar(1, blcolor(gs8) bfcolor(brown*.4)) blabel(bar, format(%9.1f) ///
        pos(base)) percent(hv270) subtitle(, pos(9) ring(1) bcolor(none) nobexpand place(e)) ///
        ytitle(Prevalence of anaemia in children) var1opts(gap(*0.1) axis(noline)) ///
        var2opts(gap(*.2)) ysize(5) yla(none) ysc(noline) ///
        plotregion(lcolor(none))

*graph export "Prevalence of anaemia in children by HH wealth.emf", replace	
graph export "Prevalence of anaemia in children by HH wealth.pdf", replace	

*****************

catplot anaemiac hv270 [aw=weight], percent(hv270) stack asyvars ///
		bar(1, bcolor(ltblue)) bar(2, bcolor(pink*.2)) bar(3, bcolor(brown*.4)) ///
		bar(4, bcolor(bluishgray)) bar(5, bcolor(gs10)) bar(6, bcolor(red*.4)) ///
		bar(7, bcolor(sand)) blabel(bar, format(%9.1f) pos(center)) ///
		blabel(bar, format(%9.1f) pos(center) size(tiny)orientation(vertical) color(black)) ///
		ytitle(%) title(Prevalence of anaemia in children by HH wealth) subtitle(Ethiopia DHS 2016)

graph export "Prevalence of anaemia in children by HH wealth2.pdf", replace	

catplot any_anaemia hv270 [aw=weight], percent(hv270) stack asyvars ///
		bar(1, bcolor(gold)) bar(2, bcolor(ltblue)) bar(3, bcolor(gs0)) ///
		blabel(bar, format(%9.1f) pos(center)) bar(4, bcolor(g)) ytitle(%) ///
		title(Prevalence of any anaemia in children) subtitle(Ethiopia DHS 2016)

graph export "Prevalence of any anaemia in children by HH wealth.pdf", replace	

catplot any_anaemia hv024 [aw=weight], percent(hv024) stack asyvars ///
		bar(1, bcolor(gold)) bar(2, bcolor(ltblue)) bar(3, bcolor(gs0)) ///
		blabel(bar, format(%9.1f) pos(center)) bar(4, bcolor(g)) ytitle(%) ///
		title(Prevalence of any anaemia in children) subtitle(Ethiopia DHS 2016)

graph export "Prevalence of any anaemia in children by region.pdf", replace	

exit

 
Read Message
Read Message
Read Message
Previous Topic: Height and Weight Scores (WHO Child Growth Standards) data
Next Topic: Women's specific Data; TVET & employment variables
Goto Forum:
  


Current Time: Wed Sep 18 22:06:30 Coordinated Universal Time 2024