Home » Countries » Nepal » Replicating table 8.4- Nepal DHS 2011
Re: Replicating table 8.4- Nepal DHS 2011 [message #8653 is a reply to message #8651] |
Tue, 24 November 2015 20:28 |
Trevor-DHS
Messages: 787 Registered: January 2013
|
Senior Member |
|
|
I realized that I could get you on the right track fairly easily. Here is code to reshape Nepal 2001 pregnancy history data into a file of pregnancies
* Open the Nepal 2001 dataset
use "C:\Data\DHS_Stata\NPIR41FL.DTA", clear
* keep just a set of useful variables. If you keep too many this process gets really really slow and may fail due to memory
keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 ///
idx92_* bord9_* b0_92_* b1_92_* b2_92_* b3_92_* b4_92_* b5_92_* b6_92_* b7_92_* ///
b8_92_* b9_92_* b10_9_* b11_9_* b12_9_* b13_9_* b16_9_* s216_* s217_* s227_* s228_* s229_*
* rename variables for reshaping
rename *_0* *_*
* reshape the pregnancy history into a filee of pregnancies
reshape long idx92_ bord9_ b0_92_ b1_92_ b2_92_ b3_92_ b4_92_ b5_92_ b6_92_ b7_92_ ///
b8_92_ b9_92_ b10_9_ b11_9_ b12_9_ b13_9_ b16_9_ s216_ s217_ s227_ s228_ s229_, i(caseid) j(i)
* drop empty entries that contain no data
drop if idx92_==.
* rename variables to easier names
rename *_92_ *
rename *_9_ *
rename idx92_ idx
rename bord9_ bord
rename s*_ s*
* rename the b variables to p variables as these are for pregnancies and not for births,
* just to avoid confusion with the birth history variables.
rename b* p*
* Restrict to all pregnancies in the last 5 years
keep if p3 > v008-60
* Check the results of the pregnancies
tab s227 s216 [iw=v005/1000000],m
* There are a couple of cases that seem inconsistent here. Here is a suggestion for editing them:
* This case looks to have died on the first day rather than being a still birth
replace s216=1 if s227==. & s216==2
* This case looks to have been misrecorded as born died rather than lost before full term
replace s216=3 if s227==3 & s216==2
* To keep just the pregnancies of 7+ months duration, use the following:
keep if s227 == . | s227 >= 7
* I would then recode s216 into "born alive" and "stillbirth" (all of the others).
recode s216 (1=1 "Live birth")(2/3=2 "Stillbirth"), gen(type)
You can then rename and recode any variables you need to match the other files.
[Updated on: Wed, 25 November 2015 00:54] Report message to a moderator
|
|
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
Re: Replicating table 8.4- Nepal DHS 2011
|
|
|
Re: Replicating table 8.4- Nepal DHS 2011
|
|
|
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
|
|
|
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
|
|
|
Re: Replicating table 8.4- Nepal DHS 2011
|
|
|
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
|
Goto Forum:
Current Time: Thu Mar 28 18:52:20 Coordinated Universal Time 2024
|