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 #15690 is a reply to message #15682] Thu, 30 August 2018 11:43 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 789
Registered: January 2013
Senior Member
I have made a couple of change to the code above:
1) I realized that pidx97 and pord97 are also in reverse order, so I have added those to the fixes above.
2) I added v201 and tot_pregs into the keep command to use for calculating pregnancy interval, pregnancy order and birth order.

Below is additional code for calculating pregnancy interval, pregnancy order and birth order:
* create pregnancy interval variable
by caseid: gen     pregint = cmc_preg - cmc_preg[_n+1] 
by caseid: replace pregint = cmc_preg - cmc_preg[_n+2] if cmc_preg == cmc_preg[_n+1] // if a twin
by caseid: replace pregint = cmc_preg - cmc_preg[_n+3] if cmc_preg == cmc_preg[_n+2] // if the third of triplets
by caseid: replace pregint = cmc_preg - cmc_preg[_n+4] if cmc_preg == cmc_preg[_n+3] // if the fourth of quadruplets

* create pregnancy order variable
by caseid: gen     pregord = tot_pregs-pidx97+1
by caseid: replace pregord = pregord[_n+1] if cmc_preg == cmc_preg[_n+1] // if a twin
by caseid: replace pregord = pregord[_n+2] if cmc_preg == cmc_preg[_n+2] // if the third of triplets
by caseid: replace pregord = pregord[_n+3] if cmc_preg == cmc_preg[_n+3] // if the fourth of quadruplets

* create birth order variable
by caseid: gen     birthord = v201-bidx97+1 if bidx97 > 0 // a live birth
by caseid: replace birthord = birthord[_n+1] if bidx97 > 0 & bidx97[_n+1] > 0 & cmc_preg == cmc_preg[_n+1] // if a twin
by caseid: replace birthord = birthord[_n+2] if bidx97 > 0 & bidx97[_n+2] > 0 & cmc_preg == cmc_preg[_n+2] // if the third of triplets
by caseid: replace birthord = birthord[_n+3] if bidx97 > 0 & bidx97[_n+3] > 0 & cmc_preg == cmc_preg[_n+3] // if the fourth of quadruplets
This code calculates the pregnancy interval, pregnancy order and birth order, taking into account twins.
 
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: Fri Apr 26 05:10:33 Coordinated Universal Time 2024