The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Child Health » Child immunization (Child immunization for Nigeria)
Re: Child immunization [message #20336 is a reply to message #20325] Fri, 23 October 2020 22:25 Go to previous messageGo to previous message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hello Ugonna & Shireen,

Check this code out. It should work.

-------------------------

** ALL BASIC VACCINATIONS: NDHS 2008 **

** ========================================================================== **
********************************* M. Tsawe, PhD *********************************
************************ Last modified: 24 October 2020 ************************
** ========================================================================== **

clear all
set maxvar 20000
set mem 1g
cd "C:\Users\...\NGKR53DT"
use "NGKR53FL", clear
set more off

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

** WEIGHT VARIABLE
gen weight = v005/1000000

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

** SURVEY SET
gen psu = v021
gen strata = v023
svyset psu [pw = weight], strata(strata) vce(linearized) singleunit(scaled)
*svydes

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

// 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
svy:tab child_age, percent format (%4.1f) miss

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

** RECODE OF VACCINATION VARIABLES
gen BCG = inrange(h2,1,3)
gen Polio0 = inrange(h0,1,3)
gen Polio = inrange(h4,1,3)+inrange(h6,1,3)+inrange(h8,1,3)
gen DPT = inrange(h3,1,3)+inrange(h5,1,3)+inrange(h7,1,3)
gen measles = inrange(h9,1,3)

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

*** Loop ***
forvalues x = 1/3 {
	gen BCG`x' = (BCG>=`x')
	gen Polio`x' = (Polio>=`x')
	gen DPT`x' = (DPT>=`x')
	gen measles`x' = (measles>=`x')
}
**
recode h4 (1/3=1) (else=0), gen(Polios1)

** check if loop worked **
svy: tab wealth DPT3, percent format(%9.1f) miss row
svy: tab wealth DPT3, count format(%9.0f) miss

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

/* 
ALL BASIC VACCINATIONS:
----------------------
	BCG, measles and three doses each of DPT and 
	polio vaccine (excluding polio vaccine given at birth)
*/

cap drop vaccination
gen vaccination = (BCG==1 & DPT3==1 & Polio3==1 & measles1==1)
label var vaccination "Received all basic vaccinations"
label define vaccination 0"No" 1"Yes"
label values vaccination vaccination

*==============================================================================*
** DROP IF NOT WITHIN SAMPLE
keep if vaccination !=.

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

** CHECK
svy: tab vaccination, count format(%4.0f)
svy: tab vaccination, percent format(%4.1f)

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

exit
 
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: Child Discipline - Myanmar DHS 2015-2016
Next Topic: do files for cleaning the children's birth month and year
Goto Forum:
  


Current Time: Thu Apr 25 11:59:28 Coordinated Universal Time 2024