Replicating table 8.4- Nepal DHS 2011 [message #8598] |
Thu, 19 November 2015 21:05 |
pramesh
Messages: 41 Registered: November 2015 Location: australia
|
Member |
|
|
Hi,
I was trying to replicate table 8.4 and tried both IR and BR data sets but still can not calculate total pregnancy 7 plus months (which is 5444). Can anyone help me sorting this out?
Thanks
Sam
|
|
|
Re: Replicating table 8.4- Nepal DHS 2011 [message #8605 is a reply to message #8598] |
Fri, 20 November 2015 16:11 |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
Dear User,
Here is a response from Senior data processing expert, Mr. Albert Themme:
Quote:Column 4 in table 8.4 (pregnancies of 7+ months) is based on all births in the birth history (all births are considered to have a duration of 7+ months) and all stillbirths following a pregnancy of 7 months or more based on the calendar. The relevant parts of the syntax are marked yellow and the code is CSPro.
|
|
|
|
|
|
|
|
|
|
|
Re: Replicating table 8.4- Nepal DHS 2011 [message #8625 is a reply to message #8624] |
Sun, 22 November 2015 21:06 |
Trevor-DHS
Messages: 802 Registered: January 2013
|
Senior Member |
|
|
I don't see where you get 4140 from, but I think you are miscalculating. If you use the code in message 3648 plus the code in message 3727, you should get the following result:
----------------------------------
totpreg7m | count proportion
----------+-----------------------
0 | 8507 .6712
1 | 3015 .2379 1 * 3015 = 3015
2 | 1036 .0818 2 * 1036 = 2072
3 | 111.6 .0088 3 * 111.6 = 334.8
4 | 1.093 8.6e-05 4 * 1.093 = 4.372
5 | 3.547 2.8e-04 5 * 3.547 = 17.375
|
Total | 1.3e+04 1 Sum = 5443.907
---------------------------------- totpreg7m contains the total number of pregnancies of 7 months or more (including twins), and when you multiply this out with the number of cases you get 5444 pregnancies of 7 months or more in total.
[Updated on: Sun, 22 November 2015 21:06] Report message to a moderator
|
|
|
|
|
Re: Replicating table 8.4- Nepal DHS 2011 [message #8639 is a reply to message #8598] |
Mon, 23 November 2015 18:45 |
Trevor-DHS
Messages: 802 Registered: January 2013
|
Senior Member |
|
|
It is not really a matter of limiting the observations. If you want 5444 cases, then these are 5444 pregnancies, and that is a different unit of analysis than women (which is what you have in the IR file). Each woman can have multiple pregnancies that are 7 months or more, so you need to convert your file to a file of pregnancies. I'm not sure what you want to do with that file, though. Are there characteristics of each pregnancy that you want to use? What do you ultimately want to do with this file?
[Updated on: Mon, 23 November 2015 18:46] Report message to a moderator
|
|
|
|
|
|
|
Re: Replicating table 8.4- Nepal DHS 2011 [message #8646 is a reply to message #8642] |
Tue, 24 November 2015 19:19 |
Trevor-DHS
Messages: 802 Registered: January 2013
|
Senior Member |
|
|
The following code reshapes the IR dataset into pregnancies and keeps pregnancies of 7 months duration.
* Using Nepal DHS 2011
use "C:\Data\DHS_Stata\NPIR60FL.DTA" , clear
gen pregs = 0
forvalues i = 1/80 {
gen cmc`i' = v017 + 80 - `i'
gen event`i' = substr(vcal_1, `i', 1)
gen type`i' = .
replace type`i' = 1 if substr(vcal_1,`i',1) == "B"
replace type`i' = 3 if substr(vcal_1,`i',1) == "T"
replace type`i' = 2 if substr(vcal_1,`i',7) == "TPPPPPP"
replace pregs = pregs+1 if (substr(vcal_1,`i',1) == "B" | substr(vcal_1,`i',1) == "T")
}
* Drop cases with no pregnancies
drop if pregs == 0
* Decide what variables you want to keep first before the reshape, modify this list as you need to add extra variables.
keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 cmc* event* type*
* The reshape is really really really slow if you don't select variables and cases first, and will most likely fail otherwise.
reshape long cmc event type, i(caseid) j(ix)
lab def type 1 "Birth" 2 "Stillbirth" 3 "Miscarriage/abortion"
lab val type type
lab var type "Type of pregnancy"
lab var cmc "Century month code of event"
lab var event "Calendar event code"
* Set length of calendar to use
gen callen = v018 + 59
* If calendar is aligned right (as in original dataset), use the following:
gen beg = v018
gen end = callen
* If calendar is aligned left (as it is in some datasets), use the following:
*gen beg = 1
*gen end = 60
* Include only the five year period
keep if ix >= beg & ix <= end
* check the pregnancy types
tab type [iw=v005/1000000]
* Note that this will not match the 5444 pregnancies of 7+ months as that includes twins.
* This file excludes twins, but i believe that is what you really need.
* keep only births and stillbirths
keep if type == 1 | type == 2
Note that this excludes twins so it does not match the 5444, but I think this is actually more useful for your needs.
|
|
|
|
|
|
|
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: 802 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|