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 Go to previous messageGo to previous message
Shireen-DHS is currently offline  Shireen-DHS
Messages: 140
Registered: 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]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Hypertension
Next Topic: Additonal testing consent fields (Ha64 and HB64) blank
Goto Forum:
  


Current Time: Sat Dec 7 19:12:21 Coordinated Universal Time 2024