The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Service Provision Assessment (SPA) » Creating some variables (SPA)
Creating some variables [message #23331] Tue, 24 August 2021 15:49 Go to next message
ashraf is currently offline  ashraf
Messages: 3
Registered: August 2021
Member
Dear Sara and SPA experts,
I am trying to replicate table 3.5 and 3.7 of Afghanistan SPA 2018-19 report in Stata. I was unable to create the first two variables -Sterilization equipment and equipment for high-level disinfection of table 3.5 and variable "X ray machine" of table 3.7. My codes are:
gen wgt=facwt/1000000
*Sterilization equipment
gen str=0
replace str=1 if (q201==1 | q201==2) & ((q501a_03==1 & q501b_03==1) | (q501a_05==1 & q501b_05==1) | (q501a_06==1 & q501a_07==1 & q501b_07==1))
tab str [iw=wgt]
*High level disinfection
gen hidis=0
replace hidis=1 if (q201==1 | q201==2) & ((q501a_03==1 & q501b_03==1) | (q501a_05==1 & q501b_05==1) | (q501a_06==1 & q501a_07==1 & q501b_07==1) | (q501a_10==1 & inrange(q502g_5,1,3)))
tab hidis [iw=wgt]
*X ray machine
gen xray=0
replace xray=1 if (q881a_1==1 & q881b_1==1) | (q881a_2==1 & q881b_2==1)
tab xray [iw=wgt]

It looks like I am using the correct variables according to the footnotes of the tables, but I am not getting the same % as the final report table. I want to get the same % of the report table.
I would greatly appreciate any help with this matter.

Regards,
Ashraf
Re: Creating some variables [message #23342 is a reply to message #23331] Wed, 25 August 2021 11:18 Go to previous messageGo to next message
SaraDHS is currently offline  SaraDHS
Messages: 44
Registered: December 2020
Member
Dear ashraf,

Please compare the footnotes from the table to the question numbers in the questionnaire and the way the variables are coded in the dataset. In some cases, there may be country-specific questions that have different numbers, or may be q501_01 vs q501_1. One cannot simply copy the same code from one country to another. In the case of sterilization equipment and high level disinfection equipment, please correct your code using the footnotes, the questionnaire, and the dataset. If you do this, you should get the same numbers as the final report.

For the xray machine, in Afghanistan, this is limited to 1) facilities which use xray for tb diagnosis AND 2) facilities which provide laboratory services AND 3) have a functional digital xray machine OR a functional xray machine with unexpired film.

Best of luck,
Sara


Sara Riese, PhD Senior Demographic and Health Researcher, DHS Program
Re: Creating some variables [message #23349 is a reply to message #23342] Thu, 26 August 2021 08:35 Go to previous messageGo to next message
ashraf is currently offline  ashraf
Messages: 3
Registered: August 2021
Member
Dear Sara,
Thanks a lot for your kindest support and I was able to create the variables except "equipment for high level disinfection" of table 3.5.
I have tried to create this variable according to the footnote, and questionnaire but unable to match with the report table.
The code is:
gen sw=facwt/1000000
gen ste=0
replace ste=1 if (q201==1 | q201==2) & ((q501a_1==1 & q501b_1==1) | (q501a_3==1 & q501b_3==1) | (q501a_6==1))
tab ste [iw=sw]

Would it be possible to get the correct code of this variable?

Regards,
Ashraf




Re: Creating some variables [message #23367 is a reply to message #23349] Mon, 30 August 2021 08:16 Go to previous messageGo to next message
SaraDHS is currently offline  SaraDHS
Messages: 44
Registered: December 2020
Member
Dear Ashraf,
You are using incorrect variables. Please doublecheck the notes in the table and the questionnaire with the variables you used to define high level disinfection. If you recreate the definition as described in the footnotes with the correct variables, you will get the same value as the final report.

Best,
Sara


Sara Riese, PhD Senior Demographic and Health Researcher, DHS Program
Re: Creating some variables [message #23375 is a reply to message #23342] Tue, 31 August 2021 02:23 Go to previous messageGo to next message
ashraf is currently offline  ashraf
Messages: 3
Registered: August 2021
Member
Dear Sara,
Thanks for your response. According to the footnotes, and questionnaire I have tried with the following code to create variable "equipment for high level disinfection" of table 3.5 in Afghanistan SPA 2018-19.
gen wgt=facwt/1000000
gen hlvlds=0
replace hlvlds=1 if (q201==1 | q201==2) & ((q501a_3==1 & q501b_3==1) | (q501a_5==1 & q501b_5==1) | (q501a_6==1) | inrange (q502g_5,3,5))
tab hlvlds [iw=wgt]

Unfortunately, I am not getting the % as of the table. Please help me to create this variable.

Regards,
Ashraf
Re: Creating some variables [message #23379 is a reply to message #23375] Tue, 31 August 2021 09:20 Go to previous message
SaraDHS is currently offline  SaraDHS
Messages: 44
Registered: December 2020
Member
Dear ashraf,

The definition provided in the footnotes is:
Facility reports that some instruments are processed in the facility, and the facility has an electric pot or other pot with heat source for high-level disinfection by boiling or high-level disinfection by steaming, or else facility has chlorine, formaldehyde, CIDEX, or glutaraldehyde for chemical high-level disinfection available somewhere in the facility on the day of the survey.

Let's look at the dataset, questionnaire and your code:

replace hlvlds=1 if (q201==1 | q201==2) /// Facility reports that some instruments are processed in the facility. Good, this is correct.
& ((q501a_3==1 & q501b_3==1) /// As described in the questionnaire, q501a_3 and q501b_3 are asking about an electric dry heat stabilizer. This is not included in the definition. An electric pot, boiler, or steamer is q501a_4.
| (q501a_5==1 & q501b_5==1) | (q501a_6==1) | /// Again, look at the questionnaire and the data set and correct your code. Does q501_5 have both a and b? Is the definition saying "facility has functioning other pot OR heat source"? Because that is what your code is telling Stata.
inrange (q502g_5,3,5)) ///If you use q502g you need to also use q501a_9, which says that the facility uses any chemicals for HLD, then define which chemicals fall within the definition.

If you correct your code according to the definition and the dataset, you will get the same % as in the final report.

Best,
Sara


Sara Riese, PhD Senior Demographic and Health Researcher, DHS Program
Previous Topic: Replicating table 3.3 and 3.7 in Tanzania SPA 2014-15
Next Topic: Creating two variable
Goto Forum:
  


Current Time: Sat Apr 20 06:46:28 Coordinated Universal Time 2024