The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Ethiopia » Calculating stillbirth using Ethiopia DHS 2000
Re: Calculating stillbirth using Ethiopia DHS 2000 [message #10623 is a reply to message #10620] Fri, 19 August 2016 17:33 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 788
Registered: January 2013
Senior Member
A few problems with the code you provided. You cannot mix the b* variables with the s2* variables and the m* variables. The b* and m* variables are for births and bidx_01 and midx_1 are the same birth, so you can use these together in a reshape command. However, the s2*, idx97* and ord97* variables are for pregnancies, not births and so idx97_01 and bidx_01 are not necessarily the same pregnancy/birth.

For the stillbirths, you don't need the b* and m* variables.

Here is a revised piece of code:
use "PKIR61FL.DTA", clear 

keep caseid v001 v002 v003 v005 v008 v011 v012 v013 v021 v022 v023 v024 v025 v201 v208 v211 v212 v218 v222 v224 v225 v228 v229 v230 v231 v232 v233 v234 v235 v239 v240 v241 v242 idx97_* ord97_* s2*_* 

rename *_0* *_*

local varlist idx97_ ord97_ s215_ s216_ s217_ s219_ s220m_ s220y_ s220c_ s220f_ s225c_ s225f_ s221_ s222_ s223_ s224_ s225u_ s225n_ s226m_ s226y_ s227_ s228_ s229_

* capture the variable labels
foreach v of local varlist { 
di "`v'"
	local l`v' : variable label `v'1
} 

reshape long `varlist', i(caseid) j(idx)

* copy the variable labels back to the variables
foreach v of local varlist {
  label variable `v' `"`l`v''"'
}

rename s*_ s*
rename idx97_ idx97
rename ord97_ ord97

drop if idx97==. 

keep if v008-s220c < 60

gen type = .
replace type = 1 if s216==1 | s217==1
replace type = 2 if type==. & s227 >= 7 & s227 < 98 
replace type = 3 if type==. & (s227 < 7 | s227 >= 98) & s228 == 1
replace type = 4 if type==. & (s227 < 7 | s227 >= 98)
lab def type 1 "Live birth" 2 "Stillbirth" 3 "Abortion" 4 "Miscarriage"
lab val type type
lab var type "Type of pregnancy"

tab type [iw=v005/1000000] 

I also added code above to carry the variable labels over from before the reshape to the new variables after the reshape.
This code produces slightly more stillbirths than in the DHS report as the DHS report calculates stillbirths from the calendar where a stillbirth at the time of live birth is not included, and where twin stillbirths are only counted once. Thus this code is producing about 12 extra stillbirths than the code based on the calendar, and similarly the total pregnancies of 7 months or more is high by the same number.
 
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: Analysis on Exclusive breastfeeding (EBF) in Ethiopian DHS 2016
Next Topic: Computing Newborn Mortality rates
Goto Forum:
  


Current Time: Thu Apr 18 11:59:49 Coordinated Universal Time 2024