The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Mortality » Survival status of preceding birth (Requesting stata code for survival status of preceding birth)
Survival status of preceding birth [message #25342] Sat, 08 October 2022 09:15 Go to next message
eibrahim is currently offline  eibrahim
Messages: 4
Registered: November 2020
Member
Greetings,
I would like to explain underfive mortality risk of index birth with the variable "survival status of preceding birth" using Bangladesh DHS birth recode. However, I do not have a clue on applicable Stata code to generate the variable. Specifically, I want the "survival status of the preceding birth" variable be explicitly classified as:

0 "Preceding birth survived"
1 "Preceding birth died before succeeding birth was conceived"
2 "Preceding birth died after succeeding birth was conceived/born"
3 "No preceding birth/Firstborn"


Any hint on achieving this task will be deeply appreciated.

Best,
Ibrahim

[Updated on: Tue, 11 October 2022 04:21]

Report message to a moderator

Re: Survival status of preceding birth [message #25364 is a reply to message #25342] Wed, 12 October 2022 12:17 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 891
Registered: April 2022
Senior Member
Following is a response from DHS staff member Tom Pullum:

Your question is outside the range of the DHS users forum but I already had a program to merge successive siblings and I just needed to adapt it for your purposes. I have modified your outcome variable, but just by omitting cases of type 3. Because most deaths occur at a very early age, there are many more cases of type 1 than of type 2.

* Program to construct pairs of children, a reference child plus next earlier sibling
* This example does not include the mother's variables

* b3 is cmc of birth

* b7 is (imputed) months of age at death.

* b11 is the interval between the two siblings, in months

* Specify a path to a workspace
cd e:\DHS\DHS_data\scratch

use v001 v002 v003 v008 b* using "...BDBR7RFL.DTA", clear

* To get b7r, add 6 months if b7 is >=24 and a multiple of 12.
* Do not change if the change would be later than the date of interview.
gen b7r=b7
replace b7r=b7+6 if b7>=24 & b7==12*int(b7/12) & b7+6<v008

egen sibsize=count(bidx),by(v001 v002 v003)

* construct two files, one for the younger child in a pair and one for the older child
sort v001 v002 v003 bidx
save temp_younger.dta, replace

rename b* b*_sib

* attach the child with bidx=2 to the child with bidx=1
* attach the child with bidx=3 to the child with bidx=2
* etc.

gen bidx=bidx_sib-1

sort v001 v002 v003 bidx
merge v001 v002 v003 bidx using temp_younger.dta
tab _merge

* the child with bidx=1 does not get attached to a younger sibling
* the child with bidx=sibsize does not get attached to an older sibling
* remove these two types of cases
drop if bidx==0 | bidx_sib==.

tab _merge
drop _merge

keep v001 v002 v003 bidx* b0* b3* b4* b5* b7* b11

gen sib_died=.
replace sib_died=0 if b5_sib==1
replace sib_died=1 if b5_sib==0 & b3_sib+b7r_sib<b3-9
replace sib_died=2 if b5_sib==0 & b3_sib+b7r_sib>=b3-9

label variable sib_died "Outcome for younger sib"
label define sib_died 0 "Alive" 1 "Died before" 2 "Died after"
label values sib_died sib_died

* "before" and "after" are relative to the month of conception of the reference child

order v001 v002 v003 bidx* b0* b3* b4* b5* b7_sib b7r_sib sib_died

list v001 v002 v003 bidx* b0* b3* b4* b7_sib b7r_sib b11 sib_died if _n<=50, table clean compress
tab sib_died

* save with some filename and then merge with the BR or KR file to get weights and other variables
Re: Survival status of preceding birth [message #25387 is a reply to message #25364] Thu, 13 October 2022 21:18 Go to previous message
eibrahim is currently offline  eibrahim
Messages: 4
Registered: November 2020
Member
I sincerely appreciate your time spent in putting this together in such detail and making it available for public use.
It's all the solution I seek.
Hopefully, others will find it useful.

Best regards,
Ibrahim
Previous Topic: Effect of Fertility decline on Maternal Mortality
Next Topic: How to convert Afghan Dates to Gregorian calendar -SAS
Goto Forum:
  


Current Time: Tue Nov 26 15:38:54 Coordinated Universal Time 2024