The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Service Provision Assessment (SPA) » STATA code for replicating table 2.4 in BHFS 2017 (Bangladesh Health Facility Survey 2017 report weighted table)
STATA code for replicating table 2.4 in BHFS 2017 [message #23032] Mon, 28 June 2021 09:54 Go to next message
rubyathhasan is currently offline  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 #23035 is a reply to message #23032] Mon, 28 June 2021 13:36 Go to previous messageGo to next message
Shireen-DHS is currently offline  Shireen-DHS
Messages: 140
Registered: August 2020
Location: USA
Senior Member
Hello,

To create the weight variable, you must divide the appropriate weight by 1 million. For table 2.4 you need the facility file. I am using BDFC7IFLSP.dta for the 2017 Health Facility Survey.

*generate weight variable for facility file
gen wt=facwt/1000000

*Table 2.4

*weighted
tab factype [iw=wt]
tab ftype [iw=wt]
tab region [iw=wt]

*to get unweighted, you must first drop the facilities that have no weight
drop if wt==.
tab factype
tab ftype
tab region

You can use the facility weight for other tables in the report reported at the facility level such as table 3.2
For Table 3.2 you need to code the facilities that offer the services. I show you two examples. You would need to look at question 102 in the questionnaire to know which service is offered and you also need to checked the service specific sections for instance question 1201 for child curative care and question 1401 for ANC. You can do the same for the other services.


*Table 3.2
*Child curative care
gen childfacil = 0
replace childfacil=1 if (q102_03==1 & inrange(q1201a,1,31))
tab childfacil [iw=wt]

*ANC services
gen ancfacil =0
replace ancfacil=1 if (q102_05==1 & inrange(q1401,1,31))
tab ancfacil [iw=wt]

Hope this answers your question.

Best,
Shireen Assaf
The DHS Program
Re: STATA code for replicating table 2.4 in BHFS 2017 [message #23053 is a reply to message #23035] Sat, 03 July 2021 02:59 Go to previous messageGo to next message
rubyathhasan is currently offline  rubyathhasan
Messages: 2
Registered: June 2021
Member
Dear Shireen,

Thanks a lot for your kindest support and I was able to recreate the tables with your help.

Unfortunately, I am stuck again with Table 8.1 - I partly analyzed it and requesting for help to recreate the section "Percentage of facilities offering services for diabetes that have: Guidelines for the diagnosis and management of diabetes, Trained staff (last 24 months), Trained staff (ever)". If possible asking for your help, please.


Regards,
Rubyath
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 Go to previous message
SaraDHS is currently offline  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
Previous Topic: SPA facility sampling frame access
Next Topic: Question about variables starting with "q" and "c"
Goto Forum:
  


Current Time: Wed Dec 4 13:09:10 Coordinated Universal Time 2024