STATA code for replicating table 2.4 in BHFS 2017 [message #23032] |
Mon, 28 June 2021 09:54 |
rubyathhasan
Messages: 2 Registered: June 2021
|
Member |
|
|
Dear,
I am trying to reproduce table 2.4 from Bangladesh Health Facility Survey 2017 in Stata. Would it be possible to get the code?
Also, it is mentioned in the report that these background weights are also considered when data analysis was done for the various domains, may I please get an example code for percent distribution calculation where the weight is used (for example, table 3.2) - just to understand how to include information of weight in the analysis.
Thank you!
|
|
|
|
|
Re: STATA code for replicating table 2.4 in BHFS 2017 [message #23068 is a reply to message #23053] |
Thu, 08 July 2021 12:44 |
SaraDHS
Messages: 46 Registered: December 2020
|
Member |
|
|
Greetings Rubyath,
In order to recreate table 8.1 in the final report, you can use the code below.
use "BDPV7IFLSP.DTA", clear //the Provider file, which has the training variables
*training in the past 24 months
gen diab_train_24=0
replace diab_train_24=1 if p207==1 & p208==1
*training ever
gen diab_train_ever=0
replace diab_train_ever=1 if p207==1 & (p208==1 | p208==2)
*Collapse by facility
collapse (mean) diab_train_24 diab_train_ever, by(facil)
*recode so any facility with at least one staff member trained is coded as 1
recode diab_train_24 0.0001/1=1
recode diab_train_ever 0.0001/1=1
sort facil
save "BPdiabprov.dta", replace
*Merge the collapsed provider file with the facility file
merge 1:1 facil using "BDFC7IFLSP.dta"
*Generate a code for facilities which have any diabetes services
gen anydiabserv=0
replace anydiabserv=1 if inrange(q2301,1,3)
*Code guidelines variable
gen guidelines=0
replace guidelines=1 if q2303==1 | q2305==1
*Generate weight variables for facilities
gen fwt = facwt/1000000
egen strata = group(factype region)
svyset [iw=fwt], psu(facil) strata(strata) singleunit(centered)
*Proportions below are the same as in the "total" row in table 8.1 final report
svy: tab guidelines if anydiabserv==1
svy: tab diab_train_24 if anydiabserv==1
svy: tab diab_train_ever if anydiabserv==1
*To exclude CCs, just recode the factype variable to exclude the CCs, and tab the variables of interest by the recoded variables
I hope this is helpful for your analysis.
Best,
Sara
Sara Riese, PhD
Senior Demographic and Health Researcher, DHS Program
|
|
|