The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Reproductive Health » Contraceptive calendar - programme to decode vcal_1 and vcal_2?
Re: Contraceptive calendar - programme to decode vcal_1 and vcal_2? [message #9238 is a reply to message #9231] Thu, 25 February 2016 22:57 Go to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 795
Registered: January 2013
Senior Member
There is no one way or one most useful format for the calendar data. For some things the current format is the most useful, but for others a long format is more useful. And because there are many different analyses that can be performed with the calendar data we do not expect to have a single set of code for the calendar similar to the unmet need code.

We are still working on a tutorial for using the contraceptive calendar which will give more details of different ways to analyze the calendar, but in the meantime, here is some simple code for converting the calendar into long format:

forvalues i = 1/80 {
  gen vcal1_`i' = substr(vcal_1,`i',1)
  gen vcal2_`i' = substr(vcal_2,`i',1)
}
keep caseid v001 v002 v003 v005 v008 v011 v017 v018 v019 vcal1* vcal2*
reshape long vcal1_ vcal2_, i(caseid) j(i)
gen cmc=v017+80-i
gen age=int((cmc-v011)/12)


Also, please see the user forum post about alignment issues in the calendar. Some recode datasets have the calendar misaligned. Using the code in the post mentioned, you can realign the calendar when necessary. Do the realignment before running the code above.
 
Read Message
Read Message
Read Message
Previous Topic: Re: Peru individual survey documentation + calendar
Next Topic: Peru individual survey documentation + calendar
Goto Forum:
  


Current Time: Mon May 13 14:27:26 Coordinated Universal Time 2024