The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » Indonesia vcal calendar data
Re: Indonesia vcal calendar data [message #3648 is a reply to message #3557] Thu, 22 January 2015 11:20 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 702
Registered: January 2013
Senior Member
I haven't gone through your code, but here is code that will calculate the number of still births from the calendar. It also calculates live births and total pregnancies of 7 months or more, but these counts exclude twins (for which you need to use the birth history in addition).

* 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 {
*   Restrict to 60 months preceding survey
    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

 
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: B11 is actually missing or it represent first birth?
Next Topic: last birth
Goto Forum:
  


Current Time: Thu Jul 2 18:37:27 Eastern Daylight Time 2020