The DHS Program User Forum
Discussions regarding The DHS Program data and results
Today's Messages (on)  | Unanswered Messages (off)

Forum: Reproductive Health
 Topic: Matching most recent sexual activity (women) in India_2019/21
Re: Matching most recent sexual activity (women) in India_2019/21 [message #25274 is a reply to message #25105] Tue, 27 September 2022 01:42
mahfuz.ru.pops@gmail.com is currently offline  mahfuz.ru.pops@gmail.com
Messages: 11
Registered: July 2022
Member
Hi Brigette,
Currently I have used the updated NFHS-5 data and my calculations have matched with your calculations. Thanks for your assistance, and sorry for making confusion.

Best wishes
Mahfuz
Re: Matching most recent sexual activity (women) in India_2019/21 [message #25285 is a reply to message #25102] Tue, 27 September 2022 19:53
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hello,

Try this one. It will hopefully point you in the right direction. The denominator matches (not sure if my approach is correct), but not all the percentages (for the categories) match.


cls
clear all
set matsize 800
set maxvar 32000
set mem 1g
cd "C:\Users\..."
use caseid v000 v001 v002 v003 v004 v005 v006 v007 v008 v008a v009 v010 v011 v012 v013 v021 v022 v023 v024 v025 sdist v106 v107 v130 v131 v149 v150 v151 v152 v155 v157 v158 v159 v190 v312 v313 v384a v384b v384c v501 v502 v511 v513 v531 v527 v528 v529 v536 v714 v716 v717 v171a using"IAIR7DFL.dta", clear
set more off

********************************************************************************

sort v001 v002 v003

*** ======================================================================== ***

gen hhid =substr(caseid,1,12)
gen wt=v005/1000000
gen weight=wt
svyset v021 [pweight = wt], strata(v023) singleunit(centered)

*** ======================================================================== ***

** Timing of last sexual intercourse
cap label drop recent_sex
cap drop recent_sex
gen recent_sex=9
replace recent_sex = 0 if v527<107
replace recent_sex = 1 if v528 <= 28 & !inlist(recent_sex,0)
replace recent_sex = 2 if v527>=128 & v527<400 & !inlist(recent_sex,0,1)
replace recent_sex = 3 if v527>=400 & v527<994 & !inrange(recent_sex,1,2)
replace recent_sex = 4 if v531 == 0
replace recent_sex = 9 if v527==998
label var recent_sex "Timing of last sexual intercourse"
label define recent_sex 0"Within the last week" 1"Within the past 4 weeks" 2"Within 1 year" 3"One or more years" 4"Never had sexual intercourse" 9"Missing"
label val recent_sex recent_sex

tab recent_sex if inlist(v171a,0,3) [iw=wt], m
svy: tab v190 recent_sex if inlist(v171a,0,3), percent format(%9.1f) miss row

svy: tab v190 recent_sex if inlist(v171a,0,3), count format(%9.0f) miss //Table 3.6 is the first time we get "108,014": https://dhsprogram.com/pubs/pdf/FR375/FR375.pdf

*** ======================================================================== ***

cap label drop time
cap drop time*
gen time=6 if v536==0
replace time=1 if v527<107
replace time=2 if v527>=107 & v527<128
replace time=3 if v527>=128 & v527<400
replace time=4 if v527>=400 & v527<998
replace time=5 if v527==998
replace time=5 if time==.

label define time 1 "<1 week" 2 ">1 week, <1 month" 3 ">1 month, <1 year" 4 "1+ years" 5 "Missing" 6 "Never"
label values time time

gen time12=0 if time<=6
replace time12=1 if time<=2
label variable time12 "< 1 month"

gen time123=0 if time<=6
replace time123=1 if time<=3
label variable time123 "< 1 year"

tab1 time time12 time123 [iweight=v005/1000000], m

***************************

svy: tab v190 time if inlist(v171a,0,3), percent format(%9.1f) miss row

********************************************************************************

keep if inlist(v171a,0,3)

****************************

svy: tab v190 time, percent format(%9.1f) miss row
svy: tab v190 recent_sex, percent format(%9.1f) miss row

********************************************************************************
********************************************************************************

exit



Current Time: Tue Sep 27 21:00:44 Coordinated Universal Time 2022