The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Mortality » Calculating perinatal death
Calculating perinatal death [message #30363] Wed, 13 November 2024 02:45 Go to previous message
fahmidarima7 is currently offline  fahmidarima7
Messages: 3
Registered: August 2023
Member
**For ENMR, use BR file*****
* create a child Alive or Died variable using the b5 variable
gen alive=b5
lab def alive 0 "Died" 1 "Alive"
lab val alive alive
lab var alive "Alive or Died by the time of survey"

** Age at death using variables b6 and b5
gen age_death=.
replace age_death = 0 if b6<=106 & b5==0
replace age_death = 1 if b6>=107 & b6<=130 & b5==0
replace age_death = 2 if (b6> 130 & b6<=999) | b5==1
lab def age_death 0 "Early Neonatal Death" 1 "Late Neonatal Death" 2 "Survived Neonatal Period"
lab val age_death age_death
lab var age_death "Neonatal Mortality Status"
tab age_death

gen wt=v005/1000000
svyset v021 [pw=wt], strata(v023)

svy: tab age_death if v008-b3<60, per count form(%7.3g)
svy: tab age_death if v008-b3<60, per col form(%7.3g)
************************************************************ *******************************

************************************************************ ************************************
**For stillbirth, use IR file***
*Calculate still births in the last 5 years
gen stillbirths = 0
gen births = 0
gen nlbirths = 0

*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 appears to be), use the following:
*gen beg = 1
*gen end = 60
* Loop through calendar summing births, non-live pregnancies and stillbirths
forvalues i = 1/80 {
replace births = births+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',1) == "B"
replace nlbirths = nlbirths+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',1) == "T"
replace stillbirths = stillbirths+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',7) == "TPPPPPP"
}

* total pregnancies in last 5 years
gen totpreg5 = births+nlbirths
* total pregnancies of 7+ months in last 5 years (all live births, plus the stillbirths)
gen totpreg7m = births+stillbirths

* Create weight variable.
gen wgt = v005/1000000

* Set up svyset parameters for complex samples.
svyset v021 [pweight=wgt], strata(v023)

* Produce number of stillbirths
svy: tab stillbirths, cell count
************************************************************ ***************************************
******Merge BR and IR file*****************************
* preamble
numlabel,add
set more off
clear
////merge birth recode and individual recode/////
//merge with individual recode
use "/Users/Documents/BDIR81DT/BDIR81FL.DTA"

**BR file***
use "/Users/Documents/BDBR81DT/BDBR81FL.DTA", replace

keep b3 b5 b6 v005 v008 v021 v023

**merge**
merge 1:1 _n using "/Users/Documents/BDIR81DT/BDIR81FL.DTA"

keep if _merge==3
*******************************************************
I have prepared a syntax for calculating the perinatal mortality rate in Stata with guidance from this forum. However, my results do not match the numbers in the official report, and I am unsure where I might have gone wrong. Could you please review my syntax to help identify any errors? Additionally, I am finding the syntax on GitHub for calculating perinatal deaths quite complex. If possible, could you provide a simplified version of perinatal death equation in Stata?
 
Read Message
Read Message
Previous Topic: Pregnancy duration from vcal_1
Goto Forum:
  


Current Time: Sat Nov 23 17:53:47 Coordinated Universal Time 2024