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
 Trevor-DHS Messages: 697Registered: 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]```

 Replicating table 8.4- Nepal DHS 2011 By: pramesh on Thu, 19 November 2015 21:05 Re: Replicating table 8.4- Nepal DHS 2011 By: Liz-DHS on Fri, 20 November 2015 16:11 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Fri, 20 November 2015 16:37 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Fri, 20 November 2015 16:51 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Fri, 20 November 2015 22:16 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Sat, 21 November 2015 13:56 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Sat, 21 November 2015 16:54 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Sun, 22 November 2015 17:43 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Sun, 22 November 2015 18:32 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Sun, 22 November 2015 20:08 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Sun, 22 November 2015 21:06 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Mon, 23 November 2015 04:38 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Mon, 23 November 2015 18:23 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Mon, 23 November 2015 18:45 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Mon, 23 November 2015 19:02 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Mon, 23 November 2015 19:10 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Mon, 23 November 2015 19:40 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Tue, 24 November 2015 03:58 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Tue, 24 November 2015 19:19 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Tue, 24 November 2015 19:38 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Tue, 24 November 2015 19:42 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Tue, 24 November 2015 19:44 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Tue, 24 November 2015 20:28 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Tue, 24 November 2015 23:49 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Wed, 25 November 2015 00:42 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Wed, 25 November 2015 00:58 Re: Replicating table 8.4- Nepal DHS 2011 By: Trevor-DHS on Wed, 25 November 2015 01:15 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Wed, 25 November 2015 01:38 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Tue, 01 December 2015 01:58 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Thu, 03 December 2015 15:55 Re: Replicating table 8.4- Nepal DHS 2011 By: Liz-DHS on Mon, 25 January 2016 15:12 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Tue, 26 January 2016 17:04 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Wed, 27 January 2016 05:42 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Tue, 05 April 2016 20:12 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Tue, 24 November 2015 19:43 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Wed, 25 November 2015 23:22 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Thu, 26 November 2015 05:02 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Thu, 26 November 2015 17:43 Re: Replicating table 8.4- Nepal DHS 2011 By: Liz-DHS on Wed, 02 December 2015 09:45 Re: Replicating table 8.4- Nepal DHS 2011 By: pramesh on Fri, 27 November 2015 18:26
 Previous Topic: Variable Construction Next Topic: Table 2.11 Clarification
Goto Forum:

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