The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Biomarkers » Diastolic measure for India DHS 2019-21 (Error in variable sb18d)
Re: Diastolic measure for India DHS 2019-21 [message #25154 is a reply to message #25139] Wed, 07 September 2022 09:46
 Shireen-DHS Messages: 140Registered: August 2020 Location: USA Senior Member
Hello,

Using the IAPR7CFL.dta file the following Stata code will get you a close match to the percentage (less than 1 percentage point difference from table) and a match with the denominator. This code has a different way to get the valid measurements than what you used in your code.

Thank you.
Best,
Shireen Assaf
The DHS Program

*Stata code:

gen bp_w=.

*each measurement is valid pair if sys and dia >20 and <299
gen valid3 = 0
replace valid3 = 1 if (shb29s>20 & shb29s<299 & shb29d>20 & shb29d<299)
gen valid2 = 0 if valid3==0
replace valid2 = 1 if (shb25s>20 & shb25s<299 & shb25d>20 & shb25d<299) & valid3==0
gen valid1 = 0 if valid2==0 & valid3==0
replace valid1 = 1 if (shb18s>20 & shb18s<299 & shb18d>20 & shb18d<299) & valid2==0 & valid3==0
* 3 valid measurements
gen validbp = 0
replace validbp =1 if (shb18s>20 & shb18s<299 & shb18d>20 & shb18d<299) ///
& (shb25s>20 & shb25s<299 & shb25d>20 & shb25d<299) ///
& (shb29s>20 & shb29s<299 & shb29d>20 & shb29d<299)
* if 3 valid measurements, take average of last two
gen sys = 0
replace sys = ((shb25s+shb29s)/2) if validbp==1
* if < 3 valid measurements, take last valid measurement
if sys== 0 {
replace sys = shb29s if valid3==1
}
if sys==0{
replace sys = shb25s if valid2==1
}
if sys==0 {
replace sys = shb18s if valid1==1
}
gen dia = 0
replace dia = ((shb25d+shb29d)/2) if validbp==1
* if < 3 valid measurements, take last valid measurement
if dia==0 {
replace dia = shb29d if valid3==1
}
if dia==0{
replace dia = shb25d if valid2==1
}
if dia==0 {
replace dia = shb18d if valid1==1
}

*gen variable to exclude women with no valid bp measurements
gen validany = 0
replace validany = 1 if valid1>0 | valid2>0 | valid3>0

*bp for women - restricted to age 15-49, women,
replace bp_w=0 if validany==1
replace bp_w = 1 if ((sys>=140 | dia>=90) | shb21==1) & validany==1
replace bp_w =. if hv104 !=2
replace bp_w=. if hv105<15 | hv105>95
cap label var bp_w "Women who have hypertension"

gen wt=hv005/1000000

tab bp_w [iw=wt]
tab bp_w if hv105<50 [iw=wt]

 Diastolic measure for India DHS 2019-21 By: rburga on Sat, 30 July 2022 18:30 Re: Diastolic measure for India DHS 2019-21 By: Bridgette-DHS on Mon, 01 August 2022 12:06 Re: Diastolic measure for India DHS 2019-21 By: Bridgette-DHS on Tue, 02 August 2022 16:02 Re: Diastolic measure for India DHS 2019-21 By: govind@iips.net on Sun, 04 September 2022 07:14 Re: Diastolic measure for India DHS 2019-21 By: Shireen-DHS on Wed, 07 September 2022 09:46 Re: Diastolic measure for India DHS 2019-21 By: govind@iips.net on Fri, 09 September 2022 04:41 Re: Diastolic measure for India DHS 2019-21 By: Shireen-DHS on Fri, 09 September 2022 08:04 Re: Diastolic measure for India DHS 2019-21 By: SKS on Fri, 21 October 2022 06:49 Re: Diastolic measure for India DHS 2019-21 By: Bridgette-DHS on Wed, 16 November 2022 09:39
 Previous Topic: Hypertension Next Topic: Additonal testing consent fields (Ha64 and HB64) blank
Goto Forum:

Current Time: Tue May 28 19:28:24 Coordinated Universal Time 2024