The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Child Health » DPT coverage in DHS Zambia 2007 using Births Recode
Re: DPT coverage in DHS Zambia 2007 using Births Recode [message #12479 is a reply to message #12437] Thu, 25 May 2017 06:01 Go to previous messageGo to previous message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hello ychin3y,

I sorted out the the code ... Now you should be getting the same results as in the report

See code below for Zambia DHS 2007 - ZMBR51FL




** ||| IMMUNIZATION OF CHILDREN AGED 12-23 MONTHS (ZAMBIA)

** 2007 DHS **

***************************************************************************
** WEIGHT VARIABLE
gen weight = v005/1000000

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

** SURVEY SET
gen psu =    v021
gen strata = v023
svyset psu [pw = weight], strata(strata)

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

// RENAME

rename v013 age
rename v106 education
rename v190 wealth
rename v025 residence
rename v024 region

///////////////////////////////////////////////////////////////////////////

** Child_age = 12-23 months old
gen months = v008 - b3
keep if b5 == 1 & months >= 12 & months <=23

gen child_age = months
replace child_age = 1 if b5 == 1 & months >= 12 & months <=13
replace child_age = 2 if b5 == 1 & months >= 14 & months <=15
replace child_age = 3 if b5 == 1 & months >= 16 & months <=17
replace child_age = 4 if b5 == 1 & months >= 18 & months <=19
replace child_age = 5 if b5 == 1 & months >= 20 & months <=21
replace child_age = 6 if b5 == 1 & months >= 22 & months <=23
label define child_age 1"12-13" 2"14-15" 3"16-17" 4"18-19" 5"20-21" 6"22-23"
label var child_age "Child age in months"
label val child_age child_age


** Recode of vaccination variables

gen	BCG	=	inrange(h2,1,3)

gen Polio0	=	inrange(h0,1,3)

gen DPT		=	(inrange(h3,1,3) | inrange(sdhh1,1,3))+(inrange(h5,1,3) | inrange(sdhh2,1,3))+(inrange(h7,1,3) | inrange(sdhh3,1,3))

gen Polio	=	inrange(h4,1,3)+inrange(h6,1,3)+inrange(h8,1,3)

**gen pv	=	inrange(pv1,1,3)+inrange(pv2,1,3)+inrange(pv3,1,3) /* Not available in Sierra Leone 2013 data */

gen ms		=	inrange(h9,1,3)

forvalues x = 1/3 {
gen Polio`x'	=	(Polio>=`x')
gen DPT`x'		=	(DPT>=`x')
/*gen Penta`c'	=	(pv>=`x')*/
}
**

** ========================================================================== **
** DEPENDENT VARIABLE
gen vaccination	=	(BCG==1 & Polio==3 & DPT==3 & ms==1)
label var vaccination "Received all vaccinations"
label define vaccination 0"No" 1"Yes"
label values vaccination vaccination

** All basic vaccinations
tab vaccination [iw = weight]	
tab vaccination					 
svy: tab vaccination, count percent format(%4.1f) col

** ========================================================================== **

** DROP IF NOT WITHIN SAMPLE
qui regr vaccination if v208 >0 & v208 !=. [pw=weight]		
drop if e(sample)!=1	

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

** BIRTH ORDER
gen birth_order1	= 	bord
replace birth_order1	=	bord-1 if b0 == 2
replace birth_order1	=	bord-2 if b0 == 3

recode birth_order1 (1=1 "1") (2/3=2 "2-3") (4/5=3 "4-5") ///
(6/20=4 "6+"), gen(birth_order)
label var birth_order "Birth order"
label values birth_order birth_order

** ========================================================================== **

****** ANALYSIS *****

* Table 10.2
label define DPT1 0"No" 1"Yes"
label define DPT2 0"No" 1"Yes"
label define DPT3 0"No" 1"Yes"

label val DPT1 DPT1
label val DPT2 DPT2
label val DPT3 DPT3

svy: tab DPT1, percent format(%4.1f) col
svy: tab DPT2, percent format(%4.1f) col
svy: tab DPT3, percent format(%4.1f) col

*****
* Selected characteristics on Table 10.3

* DPT1
svy: tab child_age DPT1, percent format(%4.1f) row
svy: tab b4 DPT1, percent format(%4.1f) row

* DPT2
svy: tab child_age DPT2, percent format(%4.1f) row
svy: tab b4 DPT2, percent format(%4.1f) row

* DPT3
svy: tab child_age DPT3, percent format(%4.1f) row
svy: tab b4 DPT3, percent format(%4.1f) row

* All vaccinations
svy: tab child_age vaccination, percent format(%4.1f) row
svy: tab b4 vaccination, percent format(%4.1f) row
svy: tab education vaccination, percent format(%4.1f) row
svy: tab wealth vaccination, percent format(%4.1f) row

exit

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Vaccinated by 12 months of age
Next Topic: SPSS syntax Infant and Child Mortality NDHS
Goto Forum:
  


Current Time: Fri Apr 26 21:42:59 Coordinated Universal Time 2024