The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Service Provision Assessment (SPA) » Creating two variable (SPA )
Creating two variable [message #23350] Thu, 26 August 2021 09:20 Go to next message
rasel is currently offline  rasel
Messages: 2
Registered: August 2021
Member
Dear DHS,

I am working with the 2017/18 Haiti SPA survey and looking to create two variable -sterilization equipment (table A.3.1) and full blood count (table 3.7) using the footnotes and questionnaire. Unfortunately, I am not getting the % of the final report table.
My STATA code is:
gen wgt=facwt/1000000
*Sterilization equipment
gen steril=0
replace steril=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 steril [iw=wgt]
*Full blood count
gen blcount=0
replace blcount=1 if ((q834==1 & q835==1) | (q802a_1==1 & q802b_1==1 & q802c_1==1))
tab blcount [iw=wgt]
Do I need to consider anything else? Would it be possible to get the codes of these variables? I would greatly appreciate any help with this matter.

Many thanks
Re: Creating two variable [message #23369 is a reply to message #23350] Mon, 30 August 2021 08:31 Go to previous messageGo to next message
SaraDHS is currently offline  SaraDHS
Messages: 44
Registered: December 2020
Member
Dear rasel,

Please pay attention to the way variables are named in the dataset. For example here, in your code for full blood count, you are using q802a_1, however, in the Haiti dataset, that variable should be q802a_01. In addition, in Haiti the only criterion for this variable is the hematology analyzer, although this was not included in the footnotes. You can remove the part of your code about the blood chemistry analyser, and you should get the same % as in the final report.

For sterilization, the definition is not clear from the footnotes, so here is the appropriate code:

replace steril=1 if (q201==1 | q201==2) & ((q501a_04==1 & q501b_04==1) | (q501a_01==1 & q501b_01==1) | (q501a_02==1 & q501b_02==1 & q501a_07==1 & q501b_07==1))

For most countries, if you compare final report table footnotes, the dataset, and the variable names, you should be able to recreate the variables to match the final report %.

Best of luck,
Sara


Sara Riese, PhD Senior Demographic and Health Researcher, DHS Program
Re: Creating two variable [message #23376 is a reply to message #23369] Tue, 31 August 2021 02:35 Go to previous messageGo to next message
rasel is currently offline  rasel
Messages: 2
Registered: August 2021
Member
Dear Sara,

Thanks for your help and I was able to recreate variables.
Now, I want to create the variable regular electricity of table 3.3 in DR Congo SPA 2017-18. I have tried with the following codes:
gen sw=facwt/1000000
gen q343a=regexm(q343, "A")
gen q343b=regexm(q343, "B")
gen q343c=regexm(q343, "C")
gen q343d=regexm(q343, "D")
gen ect=0
replace ect=1 if q340==1 & q341==1
replace ect=1 if (q343a==1 | q343b==1) & q345==1 & q346==1
replace ect=1 if q343c==1
replace ect=1 if q343d==1
tab ect [iw=sw]
But unable to match the % with the report table. I wish your help to create this variable.

Regards,
Rasel
Re: Creating two variable [message #23380 is a reply to message #23376] Tue, 31 August 2021 09:26 Go to previous message
SaraDHS is currently offline  SaraDHS
Messages: 44
Registered: December 2020
Member
Dear rasel,
Please review previous posts before posting a duplicate question. This question has already been posted and responded to here: https://userforum.dhsprogram.com/index.php?t=tree&goto=2 3316&#page_top

Best,
Sara


Sara Riese, PhD Senior Demographic and Health Researcher, DHS Program
Previous Topic: Creating some variables
Next Topic: SPA variables
Goto Forum:
  


Current Time: Fri Apr 19 07:47:45 Coordinated Universal Time 2024