The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Reproductive Health » Kenya 2022 calendar data
Re: Kenya 2022 calendar data [message #27888 is a reply to message #27874] Tue, 17 October 2023 12:29 Go to previous messageGo to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 888
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:

The Stata lines below show how to select the columns of vcal_1 and vcal_2 for the 60 months before the interview, reverse the sequence of columns, and construct pairs of corresponding columns.

Again, I advise against reversing the sequencing of the columns. The tutorials for the calendar are based on the original sequencing, which counts backwards from the month of interview. I know that's counter-intuitive (we usually think of time going from left to right), but you can get used to it. Kind of like navigating with a mirror....

Regarding the contraceptive codes, you can use the DHS-7 manual.

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\KEIR8BFL.DTA", clear

* mbi: months as months before interview. mbi=col-v018
* cmc: months in century month codes. cmc=v017+80-col

* Reduce vcal_1 and vcal_2 to the 60 months before the interview
* Solve mbi=col-v018 for col when mbi is 1, then select 60 columns, then reverse

gen col_1=v018+1

gen vcal_1r=substr(vcal_1,col_1,60)
replace vcal_1r=strreverse(vcal_1r)

gen vcal_2r=substr(vcal_2,col_1,60)
replace vcal_2r=strreverse(vcal_2r)


forvalues lcol=1/60 {
gen pair12_`lcol'=substr(vcal_1r,`lcol',1) + substr(vcal_2r,`lcol',1)
}

* Select, for example, column 20 (in the reversed sequence)
* All observed pairings of vcal_1 and vcal_2 for this column
tab pair12_20
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging
Next Topic: Event file
Goto Forum:
  


Current Time: Sun Nov 24 19:33:31 Coordinated Universal Time 2024