The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Nepal » Replicating table 8.4- Nepal DHS 2011
Re: Replicating table 8.4- Nepal DHS 2011 [message #8657 is a reply to message #8656] Wed, 25 November 2015 01:15 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 697
Registered: January 2013
Senior Member
And here is the code to calculate the total births, stillbirths and pregnancies of 7 or more months directly from the IR file without reshaping:
* Open the Nepal 2001 dataset
use "C:\Data\DHS_Stata\NPIR41FL.DTA", clear

* rename to facilitate looping
ren b?_92_0* b?_92_* 
ren b??_9_0* b??_9_* 
ren s2*_0* s2*_*

* Calculate still births in the last 5 years
gen stillbirths = 0
gen births = 0

forvalues i = 1/20 {
* 	Data fixes
* 	This case looks to have died on the first day rather than being a still birth
	replace s216_`i'=1 if s227_`i'==. & s216_`i'==2
* 	This case looks to have been misrecorded as born died rather than lost before full term
	replace s216_`i'=3 if s227_`i'==3 & s216_`i'==2

*   Restrict to 60 months preceding survey
    replace births = births+1 if b3_92_`i' > v008-60 & s216_`i'==1
    replace stillbirths = stillbirths+1 if b3_92_`i' > v008-60 & s227_`i' != . & s227_`i' >= 7
}
gen totpreg7m = births+stillbirths

tab births [iw=v005/1000000]
tab stillbirths [iw=v005/1000000]
tab totpreg7m [iw=v005/1000000]
 
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: Variable Construction
Next Topic: Table 2.11 Clarification
Goto Forum:
  


Current Time: Fri Jun 5 04:34:20 Eastern Daylight Time 2020