Home » Topics » Reproductive Health » Variables of table 9.16 in Pakistan (Pregnancy outcomes)
Re: Variables of table 9.16 in Pakistan [message #26025 is a reply to message #26021] |
Mon, 30 January 2023 08:57 |
Janet-DHS
Messages: 895 Registered: April 2022
|
Senior Member |
|
|
Following is a response from DHS staff member, Tom Pullum:
Table 9.16 is based on the calendar but it also borrows some information from the pregnancy history. The following program will match the report, except it is slightly off for pregnancy order. I believe this is because the pregnancy histories do not include events before 1997 (30 years before the survey). Also I just use v149 for the education variable. The program has many comments. Let us know if you have difficulty with it.
* Stata program to construct table 9.16 in the Pakistan 2017 final report
* This table gives the outcome of all pregnancies in the past 5 years.
* Refer to the outcomes generically as BMAS, for Births, Miscarriages, Abortions, Stillbirths
* But the sequence in the table is Births, Stillbirths, Miscarriages, Abortions
* There should be two ways to do this, from the calendar or from the pregnancy history
* However, the approach here is based primarily on the calendar and only uses
* the pregnancy history (and only s215ci and pord97) to get pregnancy order
************************************************************ ***************
program define make_BMAS_from_calendar
* Routine to construct a file with a separate record for each BMAS
* In this survey the BMAS are in vcal_6; C is the symbol for Miscarriage
* mbi: months as months before interview. mbi=col-v018
* cmc: months in century month codes. cmc=v017+80-col
********************************
use "...PKIR71FL.DTA" , clear
********************************
* Keep the variables needed for table 9.16 and vcal_6
keep v0* v149 v190 vcal_6
* Read vcal from left to right, i.e. going back in time from the month of interview.
* Separate out the individual columns (for months) of vcal_6
forvalues lc=1/80 {
gen vcol_`lc'=substr(vcal_6,`lc',1)
}
drop vcal_6
* Make a record for each column of vcal_6
reshape long vcol_,i(v001 v002 v003) j(col)
rename vcol_ vcol
* Reduce to the 60 months before the interview
* Because we will merge with the pregnancy later, delay this step
gen mbi=col-v018
*drop if mbi>60
* Reduce to BMAS
keep if vcol=="B" | vcol=="C" | vcol=="A" | vcol=="S"
gen type=.
replace type=1 if vcol=="B"
replace type=2 if vcol=="S"
replace type=3 if vcol=="C"
replace type=4 if vcol=="A"
label variable type "Type of pregnancy outcome"
label define type 1 "Live birth" 2 "Stillbirth" 3 "Miscarriage" 4 "Abortion"
label values type type
tab type [iweight=v005/1000000]
* cmc needed for calculation of age at outcome
* We do not have the day of the woman's birth; must use cmc, v011
gen cmc=v017+80-col
gen age_at_outcome=int((cmc-v011)/12)
gen age3=1
replace age3=2 if age_at_outcome>=20
replace age3=3 if age_at_outcome>=35
label variable age3 "Age at end of pregnancy"
label define age3 1 "<20" 2 "20-34" 3 "35-49"
* If you want the most recent birth or termination, include the following steps.
* For each woman, you want the event with the highest value of cmc,
* which is the lowest value of negcmc=-cmc
gen negcmc=-cmc
sort v001 v002 v003 negcmc
egen sequence=seq(), by(v001 v002 v003)
gen most_recent=0
replace most_recent=1 if sequence==1
label variable most_recent "Most recent outcome"
drop negcmc sequence
sort v001 v002 v003 cmc
save PK71_BMAS_calendar_temp.dta, replace
* Get pregnancy order and the day of the event from the cmc and pregnancy order
********************************
use "...PKIR71FL.DTA" , clear
********************************
* Some cases are missing day of BMAS; use the imputed value (s215di rather than s215d)
keep v001 v002 v003 s215m_* s215di_* s215y_* s215c_* pord97*
* pord97 is the pregnancy order, from first to most recent
rename *_0* *_*
reshape long s215m_ s215di_ s215y_ s215c_ pord97_, i(v001 v002 v003) j(pidx)
drop if pidx==.
drop pidx
rename *_ *
rename s215c cmc
rename pord97 order
sort v001 v002 v003 cmc
merge v001 v002 v003 cmc using PK71_BMAS_calendar_temp.dta
tab order _merge,m
keep if _merge==3
drop _merge
* Calculate days from the BMAS to the interview
gen days_ago=mdy(v006,v016,v007)-mdy(s215m,s215di,s215y)
* Drop any events than occurred more than five years ago
gen dropcase=0
replace dropcase=1 if days_ago>5*365.25
drop if dropcase==1
drop dropcase
gen pregnancy_order=order
replace pregnancy_order=5 if order>5
label variable pregnancy_order "Pregnancy order"
label define pregnancy_order 5 "5+"
label values pregnancy_order pregnancy_order
tab pregnancy_order type [iweight=v005/1000000], row
* With this file you can calculate all of table 9.16
save PK71_BMAS_calendar.dta, replace
end
************************************************************ ***************
program make_table
use PK71_BMAS_calendar.dta, clear
local lcovars age3 pregnancy_order v025 v149 v190 v024
foreach lc of local lcovars {
tab `lc' type [iweight=v005/1000000], row
}
end
************************************************************ ***************
************************************************************ ***************
************************************************************ ***************
************************************************************ ***************
************************************************************ ***************
************************************************************ ***************
* Execution begins here
* Specify a workspace
cd e:\DHS\programs\calendar_and_discontinuation
make_BMAS_from_calendar
make_table
|
|
|
Goto Forum:
Current Time: Wed Dec 4 11:50:18 Coordinated Universal Time 2024
|