Home » Topics » Reproductive Health » Pregnancy duration
Re: Pregnancy duration [message #9503 is a reply to message #9443] |
Tue, 05 April 2016 14:00 |
Trevor-DHS
Messages: 805 Registered: January 2013
|
Senior Member |
|
|
Here is a simple set of code for getting the duration of pregnancy for each birth in the calendar (with caveats noted below). This uses the IR file:
local callen = 80
* create separate variables for every month
forvalues i = 1/`callen' {
gen vcal1_`i' = substr(vcal_1,`i',1)
* Calculate duration of pregnancy if there is a birth in this month
gen vcalp_`i' = indexnot(substr(vcal_1,`i'+1,`callen'-`i'),"P") if substr(vcal_1,`i',1) == "B"
* Note that cases with duration 0 are truncated cases where we do not know the length of the pregnancy
}
* reshape the data file into variables for each month
reshape long vcal1_ vcalp_, i(caseid) j(i)
lab var vcalp_ "Duration of pregnancy"
lab def vcalp 0 "Unknown duration"
lab val vcalp_ vcalp
* Keep only the births
keep if vcal1_ == "B"
* CMC date of birth
gen cmc=v017+80-i
You would need to match this up with the births in the birth history, which you can do using the CMC date of birth.
Two issues, though:
1) This only gets the duration of pregnancy for births and their pregnancy that are completely within the calendar. Any pregnancy starting before the calendar will not have a duration.
2) I would not trust the duration of pregnancy from the calendar calculated this way. The calendar was not designed to collect accurate duration of pregnancy. It can only be calculated in months this way and is likely to be reported as 9 months in most cases.
|
|
|
|
|
Pregnancy duration
By: SARAMBE on Tue, 29 March 2016 07:06
|
|
|
Re: Pregnancy duration
By: Liz-DHS on Wed, 30 March 2016 08:45
|
|
|
Re: Pregnancy duration
By: SARAMBE on Wed, 30 March 2016 11:23
|
|
|
Re: Pregnancy duration
By: user-rhs on Mon, 04 April 2016 18:01
|
|
|
Re: Pregnancy duration
By: SARAMBE on Tue, 05 April 2016 06:08
|
|
|
Re: Pregnancy duration
By: user-rhs on Tue, 05 April 2016 10:50
|
|
|
Re: Pregnancy duration
By: SARAMBE on Tue, 05 April 2016 12:56
|
|
|
Re: Pregnancy duration
By: Liz-DHS on Tue, 05 April 2016 13:24
|
|
|
Re: Pregnancy duration
By: user-rhs on Tue, 12 April 2016 12:33
|
|
|
Re: Pregnancy duration
By: SARAMBE on Wed, 13 April 2016 03:58
|
|
|
Re: Pregnancy duration
|
Goto Forum:
Current Time: Sat Dec 28 16:52:11 Coordinated Universal Time 2024
|