The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » Indonesia vcal calendar data
Indonesia vcal calendar data [message #3557] Wed, 07 January 2015 14:08 Go to next message
adev is currently offline  adev
Messages: 14
Registered: May 2013
Member
Hello -

I am working with the contraceptive calendar in the IDHS 2002 & 2007. I have managed to extract the calendar data and reshape in long form by month/year, designate the months of pregnancy and birth/termination, set data as time series to count 'spells' of pregnancy, as well as designate stillbirths and miscarriages by length of pregnancy. The code works pretty well and now I am trying to produce estimates of livebirths and stillbirths. I've excluded pregnancies less than 7 months gestation as well as pregnancies that were already ongoing at the beginning of the calendar. Of the remaining pregnancies, my numbers are off the published ones. Here are the numbers compared:
2002: 16,879 LB (my calc) & 15,089 LB (DHS published); 158 SB (my calc) and 147 SB (DHS published)
2007: 18,364 LB (my calc) & 16,504 LB (DHS published); 174 SB (both mine and DHS match here)

I am using the period Jan 1998 to Dec 2002 for DHS 2002 and Jan 2003 - Dec 2007 for DHS2007. I know DHS reports in 0-4 years prior to survey but I think these are the same time periods as I am using. Plus I don't think being off by a couple of months here and there should produce such a difference in the numbers of LBs. I would appreciate any advice on any different inclusion/exclusion criteria I should be employing so I could get close to the published numbers because I would really like to understand how DHS did it.

Thank you!
Alka


Alka Dev
Graduate Fellow
CUNY Institute for Demographic Research
Re: Indonesia vcal calendar data [message #3563 is a reply to message #3557] Thu, 08 January 2015 10:45 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 669
Registered: January 2013
Senior Member
I suspect the difference is due to the time frame being used. In DHS we do specifically use the 5 years preceding the survey, that is months 0-59 preceding the survey, and not the whole calendar. I would recommend selecting on the month being in that range first, and then let us know you if still find differences.
Re: Indonesia vcal calendar data [message #3569 is a reply to message #3563] Mon, 12 January 2015 05:08 Go to previous messageGo to next message
adev is currently offline  adev
Messages: 14
Registered: May 2013
Member
Hello -

Yes I tried to select on months 0-59 preceding the survey and I get closer with live births but also lose stillbirths. I am attaching the do file I used just to create the DHS2002 sample in case you can see any obvious issues. I am calculating months pregnant based on event_time in calendar year and then using that to select pregnancies that were 7 months or longer. I also get different numbers depending on whether I use calendar data on birth history data. But stillbirth estimates are coming directly from calendar data.

Thank you,
Alka Dev


Alka Dev
Graduate Fellow
CUNY Institute for Demographic Research
Re: Indonesia vcal calendar data [message #3646 is a reply to message #3569] Thu, 22 January 2015 09:07 Go to previous messageGo to next message
adev is currently offline  adev
Messages: 14
Registered: May 2013
Member
Hello -

Is it possible to get some insight into DHS calculation of neonatal mortality in the 2002 (or 2007) survey? Basically, regardless of whether I use birth history data or combined calendar data, I do not get close to DHS numbers. For 2002, I have about 146 births that are in the calendar but not in the birth history. So if I only include births that are in the history, I still do not get the 15,089 published number for the 0-4 years (I am using 0-59mos as period for v008 - b3). Also, to get stillbirths, I have to use calendar data so I am inclined toward using calendar data for live births as well, noting that there are births that are in the calendar and not in the history). My number is higher (15,952) for live births and this excludes multiple births.

Other than period and twin exclusions, are there other exclusions I am missing? Also using calendar data, I exclude all pregnancies ongoing at the beginning of the calendar and get about 155 SB while the published number is 147 for the period 0-59 months.

I had posted a do file earlier but I am happy to include a more detailed step by step description if needed.

Thank you!
Alka


Alka Dev
Graduate Fellow
CUNY Institute for Demographic Research
Re: Indonesia vcal calendar data [message #3648 is a reply to message #3557] Thu, 22 January 2015 11:20 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 669
Registered: January 2013
Senior Member
I haven't gone through your code, but here is code that will calculate the number of still births from the calendar. It also calculates live births and total pregnancies of 7 months or more, but these counts exclude twins (for which you need to use the birth history in addition).

* Calculate still births in the last 5 years
gen stillbirths = 0
gen births = 0
gen nlbirths = 0

* 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 appears to be), use the following:
*gen beg = 1
*gen end = 60

* Loop through calendar summing births, non-live pregnancies and stillbirths
forvalues i = 1/80 {
*   Restrict to 60 months preceding survey
    replace births = births+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',1) == "B"
    replace nlbirths = nlbirths+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',1) == "T"
    replace stillbirths = stillbirths+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',7) == "TPPPPPP" 
} 

* total pregnancies in last 5 years
gen totpreg5 = births+nlbirths
* total pregnancies of 7+ months in last 5 years (all live births, plus the stillbirths)
gen totpreg7m = births+stillbirths

* Create weight variable.
gen wgt = v005/1000000

* Set up svyset parameters for complex samples.
svyset v021 [pweight=wgt], strata(v023)

* Produce number of stillbirths
svy: tab stillbirths, cell count

Re: Indonesia vcal calendar data [message #3668 is a reply to message #3648] Sat, 24 January 2015 11:39 Go to previous messageGo to next message
adev is currently offline  adev
Messages: 14
Registered: May 2013
Member
Thank you. Yes, this code does produce the published numbers of stillbriths. It however produces a larger number of total pregnancies lasting 7+ months than the published total. Also unsure how to add in twins (since gestation is unknown in birth hx data). It would mean adding to totpreg5 only. Is there any way to know why the pubished number of totpreg7m is lower than the number one gets using this code?



Alka Dev
Graduate Fellow
CUNY Institute for Demographic Research
Re: Indonesia vcal calendar data [message #3692 is a reply to message #3668] Wed, 28 January 2015 11:42 Go to previous messageGo to next message
Liz-DHS
Messages: 1399
Registered: February 2013
Senior Member
Dear User,
Thank you for your post. One of our experts will respond as soon as possible.
Re: Indonesia vcal calendar data [message #3726 is a reply to message #3668] Mon, 02 February 2015 16:12 Go to previous messageGo to next message
adev is currently offline  adev
Messages: 14
Registered: May 2013
Member
Hello -

Just curious if there is exclusion criteria here that I should be aware of. Unfortunately I cannot move forward unless I can match DHS numbers (using this as a standard against which to compare calculations from other data).

Thank you.


Alka Dev
Graduate Fellow
CUNY Institute for Demographic Research
Re: Indonesia vcal calendar data [message #3727 is a reply to message #3557] Mon, 02 February 2015 16:58 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 669
Registered: January 2013
Senior Member
A few answers to your questions and comments:
1) In the code given, you should not be looking at totpreg5, but at totpreg7m. totpreg5 gave all pregnancies in the last 5 years, not just those of 7 months or more. totpreg7m gives the number of pregnancies of 7 months or more. If you look at totpreg7m you will see it is less (not more) than the number in table 10.6 as it does not include the twins.
2) To include twins in this variable you can add the following code to the code given earlier:
* Compute additional twins in the last 5 years.  One is counted in totpreg7m already, this just counts the 2nd and 3rd, etc.
* First rename birth history variables to facilitate forvalues loop
rename b*_0* b*_* 
gen twins = 0
* loop through the birth history counting the additional twins in the last 5 years
forvalues i = 1/20 {
  * only count second, third, etc. of twins if born in the last 5 years
  replace twins = twins+1 if b3_`i' != . & b3_`i' >= v008-59 & b0_`i' >= 2
}
replace totpreg7m = totpreg7m+twins
tab totpreg7m [iw=wgt]

This code counts all of the additional twins in the last 5 years and adds those to totpreg7m. Note that this is not all twins, but all 'additional' twins as one child has already been counted.
Re: Indonesia vcal calendar data [message #3740 is a reply to message #3727] Wed, 04 February 2015 07:48 Go to previous messageGo to next message
adev is currently offline  adev
Messages: 14
Registered: May 2013
Member
Thank you - I understand the coding now. I was using svy: tab to also look at totpreg7m counts but the numbers come up golden with this code added. The assumption is that all live births are 7months or longer gestation?

Best,
Alka


Alka Dev
Graduate Fellow
CUNY Institute for Demographic Research
Re: Indonesia vcal calendar data [message #3744 is a reply to message #3740] Wed, 04 February 2015 08:14 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 669
Registered: January 2013
Senior Member
For the purposes of calculating perinatal mortality, yes, we assume that all live births are 7 months or longer gestation.
Re: Indonesia vcal calendar data [message #3829 is a reply to message #3744] Fri, 20 February 2015 05:25 Go to previous messageGo to next message
adev is currently offline  adev
Messages: 14
Registered: May 2013
Member
Is it correct that stillbirths of twins are counted as 1 stillbirth since this figure comes from the calendar?

Alka Dev
Graduate Fellow
CUNY Institute for Demographic Research
Re: Indonesia vcal calendar data [message #3830 is a reply to message #3829] Fri, 20 February 2015 10:12 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 669
Registered: January 2013
Senior Member
There are a couple of limitations in the calendar data and the possibility of capturing all of the information we might like. Two specific issues:
1) If there is a stillbirth and a live birth, only the live birth is captured.
2) If there are twins and both are stillbirths, only one is captured.
These, though are relatively rare events, but it does mean that we have very slight under-counts.

[Updated on: Thu, 29 October 2015 12:05]

Report message to a moderator

Re: Indonesia vcal calendar data [message #8430 is a reply to message #3727] Tue, 27 October 2015 02:20 Go to previous messageGo to next message
plnep
Messages: 11
Registered: November 2014
Member
Thanks for all the information.

I have been trying to extract stillbirth information for each women along with the date of birth or the time in which pregnancy ended (Assuming the calendar ending period is the month of interview).

Any ideas on how to approach this problem would be highly appreciated.

Thanks,
plnep

[Updated on: Tue, 27 October 2015 02:21]

Report message to a moderator

Re: Indonesia vcal calendar data [message #8647 is a reply to message #8430] Tue, 24 November 2015 19:23 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 669
Registered: January 2013
Senior Member
See code just added in message 8646 for converting the calendar data into a pregnancy based file.
Re: Indonesia vcal calendar data [message #11396 is a reply to message #3648] Mon, 12 December 2016 01:15 Go to previous messageGo to next message
tege2004@gmail.com is currently offline  tege2004@gmail.com
Messages: 3
Registered: August 2016
Member
Hi i am tegene i tried to understand the code given for still birth calculation but i did not understand it particularly the following part.

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 appears to be), use the following:
*gen beg = 1
*gen end = 60

* Loop through calendar summing births, non-live pregnancies and stillbirths
forvalues i = 1/80 {
* Restrict to 60 months preceding survey
replace births = births+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',1) == "B"
replace nlbirths = nlbirths+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',1) == "T"
replace stillbirths = stillbirths+1 if `i' >= beg & `i' <= end & substr(vcal_1,`i',7) == "TPPPPPP"
}




please is there any one to help me to understand how to find still birth by using calendar? or please tell me the above command with simple language??

Re: Indonesia vcal calendar data [message #11711 is a reply to message #11396] Thu, 02 February 2017 14:07 Go to previous messageGo to next message
Liz-DHS
Messages: 1399
Registered: February 2013
Senior Member
Dear User,
For additional information about the calendar variables please refer to The Calendar Tutorial https://www.dhsprogram.com/data/calendar-tutorial/,The Standard Recode Manual http:// www.dhsprogram.com/publications/publication-dhsg4-dhs-questi onnaires-and-manuals.cfm You can do a search for "calendar". You can also search for other messages in the forum for "calendar" related messages. You can also refer to FA59 http:// dhsprogram.com/publications/publication-FA59-Further-Analysi s.cfm. If you need help with Stata code, please visit http://www.cpc.unc.edu/research/tools/data_analysis/statatut orial.
After reviewing these resources, if you still have questions, please feeel free to post again.
Thanks you!

[Updated on: Wed, 28 February 2018 13:25]

Report message to a moderator

Re: Indonesia vcal calendar data [message #18181 is a reply to message #3648] Mon, 07 October 2019 18:48 Go to previous messageGo to next message
zelalemth is currently offline  zelalemth
Messages: 4
Registered: August 2018
Location: United States
Member
I was trying to convert the STATA code to SAS but I was not getting same results as in the tables. I am not sure if I converted the code correctly.
I appreciate your assistance in advance.

data data1;
set c.RWIR70FL;

* Calculate still births in the last 5 years;
stillbirths = 0;
births = 0;
nlbirths = 0;

* Set length of calendar to use;
callen = v018 + 59;
* If calendar is aligned right (as in original dataset), use the following;
beg = v018;
end = callen;

/* If calendar is aligned left (as it appears to be), use the following;
beg = 1;
end = 60;*/

* Loop through calendar summing births, non-live pregnancies and stillbirths
forvalues i = 1/80 {;
do i = 1 to 80;
* Restrict to 60 months preceding survey;
if i >= beg & i <= end & substr(vcal_1,i,1) = "B" then births = births+1;

if i >= beg & i <= end & substr(vcal_1,i,1) = "T" then nlbirths = nlbirths+1;

if i >= beg & i <= end & substr(vcal_1,i,7) = "TPPPPPP" then stillbirths = stillbirths+1;

end;

* total pregnancies in last 5 years;
totpreg5 = births+nlbirths;
* total pregnancies of 7+ months in last 5 years (all live births, plus the stillbirths);
totpreg7m = births+stillbirths;

* Create weight variable;
sweight = v005/1000000;



run;


* Set up parameters for complex samples and produce number of stillbirths;
proc surveyfreq data = data1;
cluster v021;
strata v023;
weight sweight;
tables stillbirths totpreg7m totpreg5;

run;

[Updated on: Mon, 07 October 2019 18:50]

Report message to a moderator

Re: Indonesia vcal calendar data [message #18183 is a reply to message #18181] Tue, 08 October 2019 09:48 Go to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 669
Registered: January 2013
Senior Member
Please provide the numbers you are getting so that we can compare. The number of stillbirths should match, but the number of prepganncies of 7+ months will not match as the code does not take into account twins. Please also note message 3727 that describes how to add in the twins.
Previous Topic: cannot reproduce TFR using R-package DHS.rates
Next Topic: Using tfr2 to Calculate age specific marital fertility rate
Goto Forum:
  


Current Time: Mon Oct 14 00:24:24 Eastern Daylight Time 2019