pregnancy interval in months variable [message #9782] |
Tue, 17 May 2016 08:28 ![Go to next message Go to next message](/theme/default/images/down.png) |
Sami
Messages: 27 Registered: May 2016 Location: Nepal
|
Member |
|
|
Dear DHS forum:
My name is Sami. I have been trying to reproduce table number 8.4 as shown in Nepal Demographic and Health Survey 2011 report, page number 117. I used NPIR60FL and NPBR60FL data files and with the help of massage number 8646 and 8648, I have been able to re produce similar table but I am still struggling to calculate previous pregnancy interval in months.
which variables I should be using to calculate pregnancy interval in months that match with number of pregnancies of 7+ months' duration.
I would be thankful if you can guide me through to calculate this.
Regards
|
|
|
|
|
|
|
|
Re: pregnancy interval in months variable [message #15652 is a reply to message #15637] |
Mon, 27 August 2018 16:34 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
A response from Senior Data Processing Expert, Mr. Guillermo Rojas:
Quote:
To calculate the pregnancy interval for that table it is necessary to use the calendar. Essentially from the beginning of the calendar look month by month for a birth "B" or termination "T". Once one of them are found, position in the month before the start of the pregnancy for that birth/termination and count the number of months until another birth or termination is found. In the case of births assume that duration of pregnancy is 9 months. In the case of terminations look for the first character different from a pregnancy "P" after the month where the "T" was found. It is also important to take into consideration the date of the last birth/termination before the beginning of the calendar because that needs to be used to compute the duration for births/terminations that occurred in the last 5 years (59 months), but the previous birth/termination occurred before the calendar.
You may also want to visit the Calendar Tutorial
Thank you!
|
|
|
Re: pregnancy interval in months variable [message #15657 is a reply to message #15652] |
Mon, 27 August 2018 22:40 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
Sami
Messages: 27 Registered: May 2016 Location: Nepal
|
Member |
|
|
Dear Expert,
Thank you for your response. As suggested previously, i have used following code, but i have not been able to compute pregnancy interval in months. Can you please advise any variables/code i can use to compute pregnancy interval in months?
The code i have used is as follow:
* Using Nepal DHS 2011
use "C:\Data\DHS_Stata\NPIR60FL.DTA" , clear
gen pregs = 0
forvalues i = 1/80 {
gen cmc`i' = v017 + 80 - `i'
gen event`i' = substr(vcal_1, `i', 1)
gen type`i' = .
replace type`i' = 1 if substr(vcal_1,`i',1) == "B"
replace type`i' = 3 if substr(vcal_1,`i',1) == "T"
replace type`i' = 2 if substr(vcal_1,`i',7) == "TPPPPPP"
replace pregs = pregs+1 if (substr(vcal_1,`i',1) == "B" | substr(vcal_1,`i',1) == "T")
}
* Drop cases with no pregnancies
drop if pregs == 0
* Decide what variables you want to keep first before the reshape, modify this list as you need to add extra variables.
keep caseid v001 v002 v003 v005 v008 v011 v013 v017 v018 v019 v021 v022 v023 cmc* event* type*
* The reshape is really really really slow if you don't select variables and cases first, and will most likely fail otherwise.
reshape long cmc event type, i(caseid) j(ix)
lab def type 1 "Birth" 2 "Stillbirth" 3 "Miscarriage/abortion"
lab val type type
lab var type "Type of pregnancy"
lab var cmc "Century month code of event"
lab var event "Calendar event code"
* Set length of calendar to use
gen callen = v018 + 59
* If calendar is aligned right (as in original dataset), use the following:
gen beg = v018
gen end = callen
* If calendar is aligned left (as it is in some datasets), use the following:
*gen beg = 1
*gen end = 60
* Include only the five year period
keep if ix >= beg & ix <= end
* check the pregnancy types
tab type [iw=v005/1000000]
* Note that this will not match the 5444 pregnancies of 7+ months as that includes twins.
* This file excludes twins, but i believe that is what you really need.
* keep only births and stillbirths
keep if type == 1 | type == 2
***********add the twins***************
* sort by case identifiers and century month code of pregnancy end
sort v001 v002 v003 cmc
* save this file
save "pregnancies of 7 months or more.dta"
* Open birth history
use "C:\Data\DHS_Stata\NPBR60FL.DTA", clear
* Sort according to ID and CMC of birth
clonevar cmc = b3
sort v001 v002 v003 cmc
save "births.dta"
* Reopen the pregnancies files and merge in the twins
use "pregnancies of 7 months or more.dta",clear
merge 1:m v001 v002 v003 cmc using "births.dta", keep(master match) keepusing(b*)
tab type [iw=v005/1000000]
Thank you so much
|
|
|
Re: pregnancy interval in months variable [message #15662 is a reply to message #15657] |
Tue, 28 August 2018 09:16 ![Go to previous message Go to previous message](/theme/default/images/up.png) |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
Sami, here is another response from another source:
Quote:
It seems we have to use calendar variable (pos( VCAL(1)[i:1], "T" or "P") for still birth and check whether still birth or pregnancies are 7+ months of pregnancies. It seems straight forward for live births assuming all births are 7+ months of pregnancies.
|
|
|