The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » India » Birth order and pregnancy outcome
Re: Birth order and pregnancy outcome [message #15879 is a reply to message #15487] Wed, 03 October 2018 12:38 Go to previous messageGo to previous message
Courtney-DHS is currently offline  Courtney-DHS
Messages: 6
Registered: June 2018
Location: Rockville, Maryland
Member
Because table 6.15 specifically describes last births, you'll need to use the 'calendar data'. Please reference the DHS Contraceptive Calendar Tutorial (https://dhsprogram.com/data/Calendar-Tutorial/index.cfm) for a step-by-step guide in using these data.

The Stata code below should return the same results in Table 6.15. The code searches for the most recent occurrence of a live birth, abortion, miscarriage, or stillbirth. This code uses vcal_7 because this has the raw data from vcal_1 with codes that differentiate between abortion, miscarriage, stillbirths. If vcal_1 is used, all three (abortion, miscarriage, and stillbirth) will be recoded to the same code "T" for terminated birth.

There are likely many ways to do this, but this should show a step by step process for how to use the calendar string data.



*create weight
gen wt=v005/1000000


*limit the calendar to 60 months before the interview
gen cal = substr(vcal_7, v018, 60)

*check length - this shows calendar has been cut to 60 months (5 years)
gen length = strlen(cal)

*find the last occurrence of each code B=birth, A=abortion, M=miscarriage, S=stillbirth
gen last = . 
gen lastb = strpos(cal, "B")
gen lasta = strpos(cal, "A")
gen lastm = strpos(cal, "M")
gen lasts = strpos(cal, "S")

*replace the codes for whichever occurs first in the string (last = most recent in history)
replace last = lastb if (lastb > 0 & lastb < last)
replace last = lasta if (lasta > 0 & lasta < last)
replace last = lastm if (lastm > 0 & lastm < last)
replace last = lasts if (lasts > 0 & lasts < last)

*label the codes with numbers
gen lastcode = substr(cal, last, 1)
gen pregout = .
replace pregout = 1 if strmatch(lastcode,"B")
replace pregout = 2 if strmatch(lastcode,"A")
replace pregout = 3 if strmatch(lastcode,"M")
replace pregout = 4 if strmatch(lastcode,"S")

label var pregout "Last Pregnancy Outcome"
label define pregout 1 "live birth" 2 "abortion" 3 "miscarriage" 4 "stillbirth"
label values pregout pregout
tab pregout [iw=wt]
 
Read Message
Read Message
Read Message
Previous Topic: Sexual Abuse in Children
Next Topic: How to calculate pregnancies in the past 5 years in NFHS-4
Goto Forum:
  


Current Time: Mon Nov 25 11:36:46 Coordinated Universal Time 2024