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 #15678 is a reply to message #15665] Wed, 29 August 2018 14:44 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 789
Registered: January 2013
Senior Member
1) The main problem you have is that you cannot reshape births and pregnancies together at the same time. Some of the variables relate to pregnancies (including births, still births, miscarriages and pregnancies) and some just to births. The b*_1 variables and the s2*_1 variables are not about the same pregnancy if the last pregnancy was not a live birth, so you cannot reshape them into the same record - you would be mixing up births and pregnancies.

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
The datasets will be corrected and an updated version of the data will be available in the future.

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
In the last line I restrict the tabulation of the live and still births to exclude stillbirths that are twins of a live birth. This is to match the number of stillbirths from the calendar where a stillbirth that is a twin of a live birth is not shown in the calendar as only one character can be included in any month of the calendar and the births take precedence.

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.

[Updated on: Thu, 30 August 2018 11:39]

Report message to a moderator

 
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 23:57:17 Coordinated Universal Time 2024