The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Ethiopia » Replicating table 8.4: ETHIOPIA DHS 2000 (Calculating perinatal mortality using the ETHIOPIA DHS 2000 data)
Re: Replicating table 8.4: ETHIOPIA DHS 2000 [message #21873 is a reply to message #21857] Mon, 04 January 2021 12:57 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 788
Registered: January 2013
Senior Member
You nearly had it with your code! A couple of fixes for you:
1) You don't need the rename following the keep statement as there are less than 10 entries in the non-live pregnancy history, and thus no cases with a leading 0.
2) You had successfully isolated the stillbirths, but you also needed to drop the cases that were missing on s231c_

I added in code to extract just the births in the last 5 years from the birth history (at the beginning), and then added code to combine the files (at the end) using append (not merge as you are appending births and stillbirths, not merging them together).

* select cases and variables of interest from the birth history
use "ETBR41FL.DTA", clear
 
keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 b3 b6
* keep births in the last 5 years
keep if b3 > v008-60

save births, replace

* select cases and variables of interest from the non-live pregnancy history
use "ETIR41FL.DTA", clear

keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 s231ac_* s231c_*

* convert to long format to match birth history 
reshape long s231ac_ s231c_, i(caseid) j(i)

* keep only pregnancies in the last 5 years of 7 month duration or longer
drop if s231ac_==.
keep if s231ac_ > v008-60 & s231c_ >=7 & s231c_ != .

* rename cmc date of pregnancy to match birth history
rename s231ac_ b3

* combine births and non-live pregnancies of 7+ months
append using births

* set weight variable
gen wt = v005/1000000

* capture stillbirths - those with a duration of pregnancy in s231c_
gen stillbirth = (s231c_ != .)
tab stillbirth [iw=wt]

* capture early neonatal deaths (deaths in the first 7 days [0-6] = b6 < 107)
gen earlyneonatal = (b6 < 107)
tab earlyneonatal [iw=wt]

* perinatal mortality is stillbirths or early neonatal deaths
gen perinatal = (stillbirth | earlyneonatal)
tab perinatal [iw=wt]
This shows 234 stillbirths, 421 early neonatal deaths, and a perinatal mortality rate of 5.25 percent, equivalent to 52.5 per thousand (the last digit is slightly different and I don't have an explanation why).
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: childhood acute respiratoty tract infection and associated factors by usingEDHS2016
Next Topic: children mortality rate for Ethiopia's KR file
Goto Forum:
  


Current Time: Fri Apr 19 10:28:48 Coordinated Universal Time 2024