Home » Topics » Reproductive Health » Variables of table 9.16 in Pakistan (Pregnancy outcomes)
Variables of table 9.16 in Pakistan [message #25896] |
Fri, 30 December 2022 00:33 |
waqas.hameed1@gmail.com
Messages: 7 Registered: July 2021
|
Member |
|
|
Dear Sir/Madam
There is table 9.16 in our Pakistan Demographic and Health Survey report of 2017-18 that shows results of pregnancy outcomes (abortion, miscarriage and stillbirth).
I want to use this variables for further analysis. However, I don't see their codes on DHS Github and I'm unable to find these variables in the IR or BR files.
Would appreciate help in this regard.
Thank you
|
|
|
|
|
|
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: 911 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
|
|
|
|
|
Re: Variables of table 9.16 in Pakistan [message #26133 is a reply to message #26092] |
Fri, 10 February 2023 08:59 |
Janet-DHS
Messages: 911 Registered: April 2022
|
Senior Member |
|
|
Following is a response from DHS staff member, Tom Pullum:
The following program has some similarities to the one I posted to construct Table 9.16 but it gives the number of months with "P" before the month in which a birth, stillbirth, abortion, or miscarriage occurs. If the data are perfect, the month of conception will be the first month with a "P". However, the woman may not know when she actually became pregnant. It can happen that an abortion or miscarriage in the data is not preceded by ANY months with P. DHS would usually say that the duration of the pregnancy is one plus the number of preceding months of "P".
* Stata program to calculate the months pregnant (P) preceding BMAS codes.
* Illustrate with PKIR71FL.dta and all pregnancies in vcal_6.
* Refer to the outcomes generically as BMAS, for Births, Miscarriages, Abortions, Stillbirths
* Sequence them as in the table in the final report (Births, Stillbirths, Miscarriages, Abortions)
* An interval is censored if it is so close to the beginning of the calendar (the early months) that
* it is impossible to be sure of the number of preceding months of P's
************************************************************ ***************
program calc_interval_length
* Construct a file with a separate record for each BMAS
* We look for strings that end in B, C, A, or S and are preceded (chronologically) by P's
* Allow for possible codes C, A that are not preceded by P
* mbi: months as months before interview. mbi=col-v018
* cmc: months in century month codes. cmc=v017+80-col
keep v001 v002 v003 v005 v017 v018 vcal_6
* Calculate the number of P's that immediately precede the BMAS, allowing for 0 to 11
* Index the event by col, not cmc or mbi, and allow col to go from 1 to 79
* To reduce to events and intervals that are entirely included in the 60 months before the interview,
* in the loop below replace "80" with "60+v018"
quietly forvalues lcol=1/80 {
gen type_`lcol'=.
replace type_`lcol'=1 if substr(vcal_6,`lcol',1)=="B"
replace type_`lcol'=2 if substr(vcal_6,`lcol',1)=="S"
replace type_`lcol'=3 if substr(vcal_6,`lcol',1)=="C"
replace type_`lcol'=4 if substr(vcal_6,`lcol',1)=="A"
gen interval_`lcol'= .
replace interval_`lcol'= 0 if substr(vcal_6,`lcol'+1,1)~="P" & `lcol'+1<=80
replace interval_`lcol'= 1 if substr(vcal_6,`lcol'+1,1) =="P" & substr(vcal_6,`lcol'+2,1)~="P" & `lcol'+2<=80
replace interval_`lcol'= 2 if substr(vcal_6,`lcol'+1,2) =="PP" & substr(vcal_6,`lcol'+3,1)~="P" & `lcol'+3<=80
replace interval_`lcol'= 3 if substr(vcal_6,`lcol'+1,3) =="PPP" & substr(vcal_6,`lcol'+4,1)~="P" & `lcol'+4<=80
replace interval_`lcol'= 4 if substr(vcal_6,`lcol'+1,4) =="PPPP" & substr(vcal_6,`lcol'+5,1)~="P" & `lcol'+5<=80
replace interval_`lcol'= 5 if substr(vcal_6,`lcol'+1,5) =="PPPPP" & substr(vcal_6,`lcol'+6,1)~="P" & `lcol'+6<=80
replace interval_`lcol'= 6 if substr(vcal_6,`lcol'+1,6) =="PPPPPP" & substr(vcal_6,`lcol'+7,1)~="P" & `lcol'+7<=80
replace interval_`lcol'= 7 if substr(vcal_6,`lcol'+1,7) =="PPPPPPP" & substr(vcal_6,`lcol'+8,1)~="P" & `lcol'+8<=80
replace interval_`lcol'= 8 if substr(vcal_6,`lcol'+1,8) =="PPPPPPPP" & substr(vcal_6,`lcol'+9,1)~="P" & `lcol'+9<=80
replace interval_`lcol'= 9 if substr(vcal_6,`lcol'+1,9) =="PPPPPPPPP" & substr(vcal_6,`lcol'+10,1)~="P" & `lcol'+10<=80
replace interval_`lcol'=10 if substr(vcal_6,`lcol'+1,10)=="PPPPPPPPPP" & substr(vcal_6,`lcol'+11,1)~="P" & `lcol'+11<=80
replace interval_`lcol'=11 if substr(vcal_6,`lcol'+1,11)=="PPPPPPPPPPP" & substr(vcal_6,`lcol'+12,1)~="P" & `lcol'+12<=80
}
reshape long type_ interval_, i(v001 v002 v003) j(col)
rename *_ *
drop if type==.
label variable type "Type of pregnancy outcome"
label define type 1 "Live birth" 2 "Stillbirth" 3 "Miscarriage" 4 "Abortion"
label values type type
label variable interval "Preceding months of P"
replace interval=99 if interval==.
label define interval 99 "Censored"
label values interval interval
tab interval type
tab interval type [iweight=v005/1000000]
save PK71_BMAS_months_pregnant.dta, replace
end
***************************************************************************
***************************************************************************
***************************************************************************
***************************************************************************
* Execution begins here
* Specify a workspace
cd e:\DHS\programs\calendar_and_discontinuation
********************************
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\PKIR71FL.DTA" , clear
* In this survey the BMAS are in vcal_6; C is the symbol for Miscarriage
********************************
calc_interval_length
Here is the unweighted table:
Preceding |
months of | Type of pregnancy outcome
P | Live birt Stillbirt Miscarria Abortion | Total
-----------+--------------------------------------------+----------
0 | 0 0 315 70 | 385
1 | 0 0 786 95 | 881
2 | 0 0 684 49 | 733
3 | 0 0 266 19 | 285
4 | 0 0 128 10 | 138
5 | 0 0 73 2 | 75
6 | 67 71 0 0 | 138
7 | 181 89 0 0 | 270
8 | 13,007 172 0 0 | 13,179
9 | 13 0 0 0 | 13
Censored | 1,581 45 49 7 | 1,682
-----------+--------------------------------------------+----------
Total | 14,849 377 2,301 252 | 17,779
|
|
|
Goto Forum:
Current Time: Thu Dec 26 19:00:35 Coordinated Universal Time 2024
|