I was trying to calculate total number of stillbirth five years preceding the survey using Ethiopia DHS 2000 individual recode data file. I could not find calander, pregnancy history and pregnancy outcome variables in this data file. Can anyone help me what variables I should be working with to calculate stillbirths for Ethiopia 2000 DHS?

Thank you heaps

Sammy ]]>

Thank you so much for your reply. However, Ethiopia DHS 2011 has no calendar information (Vcal_1), neither it has variable of pregnancy outcome (Live born/ Born dead/ lost before pregnancy). EDHS 2000 IR data file has no variable such as pregnancy history. I used the code you gave me but it did not work with EDHS 2000 IR data file. In this situation, how can i calculate stillbirth using EDHS 2011 IR data file.

Yours sincerely

Sammy]]>

i was using EDHS 2000 not 2011. I actually calculated the stillbirth for EDHS 2005 and 2011.

I just need the help to calculate stillbirth using EDHS 2000.

Thank you so much.

Yours sincerely

Sammy]]>

Instead, you may want to look at the example code in the linked message. This code refers to Nepal 2001 data, but the concept is very similar. The EDHS 2000 uses a pregnancy history, and the pregnancy history variables needed can be found in the variables S231AC*, and S231C*.]]>

Thank you so much for getting back to me.

I used the code you gave me which was used for Nepal DHS 2001 data file.

I have couple of issues here:

1. EDHS 2000 do not have variable such as s216 which was used to calculate stillbirth for 2001 Nepal DHS.

2. After reshaping, i used idx92_==. to drop empty entries that contain no data but it gives me total number of live births in five years preceding the survey rather than total number of pregnancies five years proceeding the survey.

I would like to share the code i used which was initially made by you for Nepal DHS 2001. Unfortunately it did not work.

Can you please advise what wrong did i do to calculate stillbirth using EDHS 2000 IR data file?

use "C:\Data\DHS_Stata\ETIR41FL.DTA" , clear

keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 s231c_* s231ac_* g231ac_* bidx_* bord_* idx92_* idx94_* v* b0_* b1_* b2_* b3_* b4_* b5_* b6_* b7_* b8_* b9_* b10_* b11_* b12_* b13_* b15_* b16_* scol24_* s230amg s230ayg s231ac_* g231am_* s231am_*

rename *_0* *_*

reshape long idx92_ idx94_ bord_ bidx_ b0_ b1_ b2_ b3_ b4_ b5_ b6_ b7_ b8_ b9_ b10_ b11_ b12_ b13_ b15_ b16_ s231ac_ s231c_ g231ac_ scol24_ g231am_ s231am_, i(caseid) j(i)

drop if idx92_==.

rename idx92_ idx

rename s*_ s*

rename b* p*

keep if p3 > v008-60|s231ac> v008-60

keep if s231c==.|s231c>=7

tab type [iw=v005/1000000]

Thank you so much.

Yours sincerely

Sammy

]]>

Below is code for extracting the still births from the non-live pregnancy history:

use "C:\Data\DHS_Stata\ETIR41FL.DTA" , clear keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 v* s231ac_* s231c_* rename *_0* *_* reshape long s231ac_ s231c_, i(caseid) j(i) drop if s231ac_==. keep if s231ac_ > v008-60 & s231c>=7

Thank you so much for the support.

Regards

Sammy]]>

I hope you are doing well.

I was trying to calculate stillbirth using Pakistan DHS 2012-13. This time i was trying not to use calendar. Instead of calendar, i intend to use pregnancy history information but my number does not match the number. Can you please advise me if i am using the right code. The code i used was:

use "PKIR61FL.DTA", clear

keep caseid v001 v002 v003 v005 v008 v011 v012 v013 v021 v022 v023 v024 v025 v201 v208 v211 v212 v218 v222 v224 v225 v228 v229 v230 v231 v232 v233 v234 v235 v239 v240 v241 v242 idx97_* ord97_* s2*_* midx_* m2n_* m13_* m14_* s* b*

rename *_0* *_*

reshape long bidx_ bord_ b0_ b1_ b2_ b3_ b4_ b5_ b6_ b7_ b8_ b9_ b10_ b11_ b12_ b13_ b15_ b16_ idx97_ ord97_ s215_ s216_ s217_ s219_ s220m_ s220y_ s220c_ s220f_ s225c_ s225f_ midx_ m2n_ m13_ m14_ s221_ s222_ s223_ s224_ s225u_ s225n_ s226m_ s226y_ s227_ s228_ s229_, i(caseid) j(idx)

count

drop if idx97_==.

count

rename s*_ s*

rename b* p*

keep if s220c > v008-60

tab s227 s216 [iw=v005/1000000],m

keep if s227 == . | s227 >= 7

recode s216 (1=1 "Live birth")(2/3=2 "Stillbirth"), gen(type)

tab type

tab type [iw=v005/1000000]

Thank you so much for your time.

Sammy

]]>

For the stillbirths, you don't need the b* and m* variables.

Here is a revised piece of code:

use "PKIR61FL.DTA", clear keep caseid v001 v002 v003 v005 v008 v011 v012 v013 v021 v022 v023 v024 v025 v201 v208 v211 v212 v218 v222 v224 v225 v228 v229 v230 v231 v232 v233 v234 v235 v239 v240 v241 v242 idx97_* ord97_* s2*_* rename *_0* *_* local varlist idx97_ ord97_ s215_ s216_ s217_ s219_ s220m_ s220y_ s220c_ s220f_ s225c_ s225f_ s221_ s222_ s223_ s224_ s225u_ s225n_ s226m_ s226y_ s227_ s228_ s229_ * capture the variable labels foreach v of local varlist { di "`v'" local l`v' : variable label `v'1 } reshape long `varlist', i(caseid) j(idx) * copy the variable labels back to the variables foreach v of local varlist { label variable `v' `"`l`v''"' } rename s*_ s* rename idx97_ idx97 rename ord97_ ord97 drop if idx97==. keep if v008-s220c < 60 gen type = . replace type = 1 if s216==1 | s217==1 replace type = 2 if type==. & s227 >= 7 & s227 < 98 replace type = 3 if type==. & (s227 < 7 | s227 >= 98) & s228 == 1 replace type = 4 if type==. & (s227 < 7 | s227 >= 98) lab def type 1 "Live birth" 2 "Stillbirth" 3 "Abortion" 4 "Miscarriage" lab val type type lab var type "Type of pregnancy" tab type [iw=v005/1000000]

I also added code above to carry the variable labels over from before the reshape to the new variables after the reshape.

This code produces slightly more stillbirths than in the DHS report as the DHS report calculates stillbirths from the calendar where a stillbirth at the time of live birth is not included, and where twin stillbirths are only counted once. Thus this code is producing about 12 extra stillbirths than the code based on the calendar, and similarly the total pregnancies of 7 months or more is high by the same number.]]>

Your help is so much appreciable.

Sammy ]]>

I am doing a similar analysis with Pakistan DHS data using pretty much the same code you posted and wondered about your statement on mixing the b* m* and s* variables. Is it ok to include some of the m* (with the idx and s variables) variables in the reshape in order to look at the maternity care variables for the live and non-live births?

Regards

]]>

I was trying to calculate total number of stillbirth using Nepal DHS dada 2011 (NPIR60FL.dta) using pregnancy history information. I used similar approach you previously used for Nepal DHS 2001. But my number does not match the number as appeared as 53 stillbirth and 5444 total pregnancy 7+ month' gestation. Here is the code I used to calculate stillbirth.

use "C:NPIR60FL.DTA"

keep caseid v214 v219 v220 v223 v225 v228 v229 v230 v231 v233 v001 v002 v003 v005 v008 v011 v013 ///

v017 v018 v019 v021 v022 v023 pidx97_* bord92_* pord97_* bidx97_* b0_* b1_* b2_* b3_* b4_* b5_* b6_* ///

b7_* b8_* b9_* b10_* b11_* b12_* b13_* b15_* b16_* s216_* s216b_* s217_* s228_* s220ab_* s220a_* ///

s220c_* sprego_* s226m_* s227_* s226c_* s229_* vcal_* m1_* m4_* m10_* m13_* m14_* m15_* m17_* m18_* ///

m46_* m45_* m34_* m3a_* m3b_* m3c_* m3d_* m3e_* m3f_* m3g_* m3h_* m3i_* m3j_* m3k_* m3l_* m3m_* m3n_* ///

v102 v168 v012 v502 v155 v463a v463b v463e v463f v463g v463x v024 sdevreg v212 v364 v206 v207 v717 v731 ///

v106 v705 v729 v130 v113 v116 v161 v158 v157 v159 v113 v116 v119 v120 v121 v123 v127 v153 v190 caseid v001 ///

v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 v024 v*

rename *_0* *_*

reshape long pidx97_ pord97_ bord92_ bidx97_ b0_ b1_ b2_ b3_ b4_ b5_ b6_ b7_ b8_ b9_ b10_ b11_ b12_ b13_ b15_ ///

b16_ s216_ s216b_ s217_ s226m_ s227_ s228_ sprego_ s220ab_ s220a_ s226c_ s220c_ s229_ vcal_ m1_ m4_ m10_ m13_ ///

m14_ m15_ m17_ m18_ m46_ m45_ m34_ m3a_ m3b_ m3c_ m3d_ m3e_ m3f_ m3g_ m3h_ m3i_ m3j_ m3k_ m3l_ m3m_ m3n_, i(caseid) j(p)

count

drop if pidx97_==.

count

rename pidx97_ pidx

rename bord92_ bord

rename bidx97_ bidx

rename s*_ s*

rename b*_ p*

rename vcal_ vcal

keep if (v008-p3)<=59| (v008-s226c)<=59

tab s220ab s216 [iw=v005/1000000],m

replace s216=1 if s220ab==. & s216==2

replace s216=3 if s220ab==3 & s216==2

keep if s220ab == . | s220ab >= 7

recode s216 (1=1 "Live birth")(2/3=2 "Stillbirth"), gen(type)

tab type

tab type [iw=v005/1000000]

Can you please advise me what wrong did I do in the above command? because I do not want to use calendar information to calculate stillbirth. (I would like to apply similar approach you used to calculate stillbirth for 2001 Nepal dhs data)

Thank you so much.

Warm regards

Sammy

]]>

I am following above my qyuarry as i posted this more than a year ago. I am still waiting any assistance through DHS fourum.

Thank you

Sammy]]>

For example, if a pregnancy history was like the following:

_1 Miscarriage 08/2015 _2 Live birth 06/2014 _3 Abortion 02/2012 _4 Live birth 06/2009

then the birth history would look like:

_1 Live birth 06/2014 _2 Live birth 06/2009

if you reshape the pregnancy history and birth history data together it would mix the records together as below and would not match them up properly:

_1 Miscarriage 08/2015 _1 Live birth 06/2014 _2 Live birth 06/2014 _2 Live birth 06/2009 _3 Abortion 02/2012 empty _4 Live birth 06/2009 empty

If you need to use both history variables and pregnancy history variables then you have to reshape the pregnancy history first and save the file, and then merge it to the birth history data in the BR file.

2) In reviewing this I discovered that there were errors in the construction of the pregnancy history variables in the Nepal 2011 survey and some variables (not all) were reversed (s220c s220f s225c s225f s226c s226f sprego). Essentially the data in these variables is in the reverse order from the order for other variables, so s2nn_x has the data for s2nn_y and vice versa. The below code fixes the problem and corrects the reversal for these variables.

use "NPIR60FL.DTA", clear rename *_0* *_* * fix for pidx97 pord97 s220c s220f s225c s225f s226c s226f and sprego replace s209 = 0 if s209 == . capture gen tot_pregs = v201 + s209 capture gen flipmax = int(tot_pregs/2) capture gen tempvar = . * reverse values of some variables to fix errors in the data file capture program drop flip_var program flip_var syntax anything if replace tempvar = `1'_`2' `if' replace `1'_`2' = `1'_`3' `if' replace `1'_`3' = tempvar `if' end local vlist pidx97 pord97 s220c s220f s225c s225f s226c s226f sprego * maximum of 15 entries used in pregnancy history, minimum of 2 as no need to flip when only 1 pregnancy forvalues p = 2/15 { forvalues i = 1/7 { local j = `p'-`i'+1 if `j' > `i' { foreach v of local vlist { flip_var `v' `i' `j' if tot_pregs == `p' di "flip_var `v' `i' `j' if tot_pregs == `p'" } } } } drop flipmax tempvar * end of fix for s220c s220f s225c s225f s226c s226f and sprego

3) Below is code for reshaping the pregnancy history, after applying the corrections above, and checking the number of stillbirths in the five years preceding the interview:

* keep just the variables needed keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 v024 v025 v201 tot_pregs b3_1 /// pidx97_* pord97_* bidx97_* s215_* s216_* s217_* s219_* s220m_* s220y_* s220c_* s220f_* s220a_* s221_* /// s226m_* s226y_* s226c_* s226f_* s227_* s228_* s229_* sprego_* * set up list for reshape local varlist pidx97_ pord97_ bidx97_ s215_ s216_ s217_ s219_ s220m_ s220y_ s220c_ s220f_ /// s220a_ s221_ s226m_ s226y_ s226c_ s226f_ s227_ s228_ s229_ sprego_ * capture the variable labels foreach v of local varlist { local l`v' : variable label `v'1 } * reshape into long format file of pregnancies reshape long `varlist', i(caseid) j(p) * copy the variable labels back to the variables foreach v of local varlist { label variable `v' `"`l`v''"' } * drop the empty pregnancy records drop if pidx97_==. * rename the variables rename pidx97_ pidx97 rename pord97_ pord97 rename s*_ s* * create cmc date of pregnancy for all pregnancies gen cmc_preg = s220c replace cmc_preg = s226c if cmc_preg == . * compute the weight gen wt=v005/1000000 * tabulate outcome for births and stillbirths tab sprego [iw=wt] if v008 - cmc_preg < 60 & sprego <= 2 * tabulate outcome dropping stillbirth twin of live birth to match calendar approach tab sprego [iw=wt] if v008 - cmc_preg < 60 & s226c != b3_1 & sprego <= 2

4) You have also included some m*_ variables in your list of variables, but these also cannot be reshape with the pregnancy history as this series is only for live births and you would be mixing births and pregnancies as in 1) above. It is also of no use to link the m* series of variables as there is no data for non-live births. This also answers the question from chr8850 as there is no maternity data collected for non-live births.]]>

Thank you for your great help. Can I also assume the code you have given for Nepal DHS 2011 can be applied for Nepal DHS 2006 and Nepal DHS 2016?]]>

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