The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Reproductive Health » Kenya 2022 calendar data
Kenya 2022 calendar data [message #27774] Mon, 02 October 2023 09:01 Go to next message
md2022 is currently offline  md2022
Messages: 7
Registered: October 2023
Member
I am working with Kenya 2022 DHS calendar data and running into some issues. I am wondering if anyone else has encountered this and figured out a way to remedy it. I am trying to trim and reverse vcal_1 and vcal_2. This works perfectly for vcal_1, however, when I do it for vcal_2 the string is always much shorter and the reasons for discontinuation are not aligned with vcal_1. I realized that it seems vcal_2 does not have the same number of white spaces, specifically that the length of the string does not seem to match what is mentioned in v019. Has anyone had to add white spaces to their variables to make them aligned? If so, how do you determine the additional number of white spaces needed.

Photos attached to hopefully provide more clarity. Vcal_1[471] and vcal_2[471] as well as Vcal_1[156] and vcal_2[156] show the original data that hasn't been cleaned and the length of vcal_2 is clearly much shorter than vcal_1. The other screenshot is showing the same issue with the Kenya data (I also tested this out and saw the same with Rwanda 2020 data).
Re: Kenya 2022 calendar data [message #27827 is a reply to message #27774] Fri, 06 October 2023 16:51 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 698
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:

I believe the problem is that vcal_2 is mostly blanks, including varying numbers of leading blanks and trailing blanks, and the purpose of the "trim" string commands is to remove leading and/or trailing blanks. The safest solution may be to not use the trim command on vcal_2. With v017 and v018 (see below) you should be able to identify the columns you want to keep, such as the 60 columns before the month of interview, using the substr command. Then you can reverse those 60 columns (warning: that's risky).

Here are the relationships among mbi, cmc, col, v017, and v018, where col is the column of the vcal variables:

* mbi: months as months before interview. mbi=col-v018
* cmc: months in century month codes. cmc=v017+80-col
Re: Kenya 2022 calendar data [message #27874 is a reply to message #27827] Mon, 16 October 2023 07:10 Go to previous messageGo to next message
md2022 is currently offline  md2022
Messages: 7
Registered: October 2023
Member
Hi there,

Thank you for getting back to me. If I trim and reverse vcal_1, which seems necessary for analysis, how can I also incorporate vcal_2 if I cannot trim the variable? I understand using v018 to understand its intended length, but it is already not aligned in the uncleaned data. Even with the raw variables vcal_2 does not align with vcal_1, making association difficult/impossible.

I also wanted to ask if I should be using the recode manual from DHS7 for the Kenya 2022 data for the contraceptive code - there is no recode manual for DHS8 which is Kenya's most recent.

Thank you!

Re: Kenya 2022 calendar data [message #27883 is a reply to message #27827] Tue, 17 October 2023 07:40 Go to previous messageGo to next message
md2022 is currently offline  md2022
Messages: 7
Registered: October 2023
Member
Hello,

Thank you again for your support. I am going through the previous DHS calendar data and would also like to confirm the code and recodes for the Kenya DHS's (2022, 2014, 2008/09, 2003, 1998, 1993, 1989). It is a bit unclear using the recode manuals (found here: https://dhsprogram.com/publications/publication-dhsg4-dhs-qu estionnaires-and-manuals.cfm) which recodes align with which years and whether I should be using the recode manual or the questionnaire. For example, in the recodes, the implant/Norplant is coded as N (which does not exist in the questionnaire as a code) whereas in the questionnaires it is 11 (which does not exist as a code in the recode). However, when I go into the dataset (here the 2014 Kenya dataset) it says that both 'N' and '11' exist as codes and I also included '1' to make sure the 11's and 1's were not being confused in the string. I have attached a photo for reference.

It would be great to get confirmation to ensure I am not using the wrong codes for the contraceptive methods overtime.
Re: Kenya 2022 calendar data [message #27888 is a reply to message #27874] Tue, 17 October 2023 12:29 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 698
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
Re: Kenya 2022 calendar data [message #27895 is a reply to message #27888] Wed, 18 October 2023 05:17 Go to previous messageGo to next message
md2022 is currently offline  md2022
Messages: 7
Registered: October 2023
Member
Thank you for the code and suggestion of not reversing. I will also use DHS7 for the most recent Kenyan DHS. For the other survey years (1989-2014) should I also use DHS7? As the screenshot attached here shows and I mentioned earlier, it appears the codes do not align with the questionnaire or the recode manuals e.g., 11, 5, and N as the implant.

Thank you!
Re: Kenya 2022 calendar data [message #27933 is a reply to message #27883] Mon, 23 October 2023 15:27 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 698
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum and Senior DHS staff members, Trevor Croft:

The file https://www.dhsprogram.com/data/Calendar-Tutorial/upload/Sta ta/Calendar%20recoding.do includes country specific recoding for the calendar variables. However, looking at that file we don't see any Kenya specific recoding. You need to look at the standard codes in the recode manual (not the questionnaire as they are recoded from the questionnaire). You don't need to go back through each prior round, just get the list from the latest recode manual.

Here is the recoding that is done:
{ Columns and their codes !!
{ 1---------------------->2-----------------> }
acalstrs = "BPT0634~712LMY5~K8~9XJ? 1236~74N08FADX5~~Z?"; { questionnaire }
vcalstrs = "BPT0123~56789WN~LC~EMS? 123456789CFADWM??K?"; { recode file }


If the code from the questionnaire is found in acalstrs, then the equivalent code from vcalstrs is assigned in the recode. The tilde's are place holders for odes that are no longer used.

Equivalently, here is the recoding that is done for the calendar, written in a different form:

recode q -> r; { Questionnaire to recode file }
"6" -> "1"; { 1 Pill }
"3" -> "2"; { 2 IUD }
"4" -> "3"; { 3 Injection }
// "0" -> "~" { 4 Diaphragm, not used unless included in country }
"7" -> "5"; { 5 Condom }
"1" -> "6"; { 6 Female, male sterilization }
"2" -> "7"; { 7 Female, male sterilization }
"L" -> "8"; { 8 Rhythm/Periodic abstinence }
"M" -> "9"; { 9 Withdrawal }
"Y" -> "W"; { 10 Other }
"5" -> "N"; { 11 Norplant/implants }
// "0" -> "~"; { 12 Long term Abstinence - not used unless included in country }
"K" -> "L"; { 13 Lactational amenorrhea (LAM) }
"8" -> "C"; { 14 Female condom }
// "0" -> "~"; { 15 Foam or jelly, not used unless included in country }
"9" -> "E"; { 16 Emergency contraception }
"X" -> "M"; { 17 Other modern method }
"J" -> "S"; { 18 Standard Days (SDM) }
// "0" -> "~"; { 19 CS methods }
// "0" -> "~"; { 20 CS methods }
endrecode;

Your comments about code 11 either do not refer to the calendar (perhaps they refer to V312?) or suggest that you are misinterpreting the calendar. Each position in the calendar is a single character. It is impossible to have code 11 in a single character.
Re: Kenya 2022 calendar data [message #27941 is a reply to message #27933] Tue, 24 October 2023 09:34 Go to previous message
md2022 is currently offline  md2022
Messages: 7
Registered: October 2023
Member
Hi there,

Thank you for the response. I just want to confirm I am understanding correctly: should I only be using the current recode even for older calendar data? I was previously trying to match the recode to the survey of that year - e.g., use the recode manual from 2008 for a 2008 DHS survey. However, should I only be using the most recent recode (DHS7 recode manual and what is below) for all calendar survey years? This would make sense as I was exploring an older DHS (circa 2004) and saw N coded in the calendar data although N was not in the recode for that time period but I just want to confirm this is the correct interpretation.

Many thanks for your support on this!
Previous Topic: Merging
Next Topic: Event file
Goto Forum:
  


Current Time: Sat Apr 27 07:27:15 Coordinated Universal Time 2024