Home » Topics » Service Provision Assessment (SPA) » Replicating table 3.3 and 3.7 in Tanzania SPA 2014-15 (2014-15 TSPA)
Replicating table 3.3 and 3.7 in Tanzania SPA 2014-15 [message #23294] |
Tue, 17 August 2021 12:07 |
shakim
Messages: 10 Registered: January 2021
|
Member |
|
|
Dear DHS Experts and SPA Users,
I am trying to replicate some variables of table 3.3 and table 3.7 from Tanzania SPA 2014-15 in Stata. My code is:
Table 3.3-
*Improved water source:
gen water=0
replace water=1 if q330==1 | q330==2 | q330==3 | q330==4 | q330==5 | q330==7 | q330==9 | q330==10 & q331==2
*Communication equipment
gen commu1=0
replace commu1=1 if q311==1 & q312==1
gen commu2=0
replace commu2=1 if q315==1 & q314==1
gen commun=0
replace commun=1 if commu1==1 | commu2==1
*Emergency transport
gen emergen_transport=0
replace emergen_transport=1 if (q450==1 & q453==1) | q453==1
Table 3.7-
*Liver or renal function test
gen q832 9=.
recode q832 (1=1) (2=0), gen (lrtest)
*X ray machine
gen xrmachine=0
replace xrmachine=1 if q881a_2==1 & q881b_2==1 & q881c_2==1
According to the questionnaire, it looks like I am looking the right variable, but for some reason I am not getting the percentages as of the table. Do I need to consider anything else? I would greatly appreciate any help on this matter.
Many thanks
|
|
|
Re: Replicating table 3.3 and 3.7 in Tanzania SPA 2014-15 [message #23300 is a reply to message #23294] |
Wed, 18 August 2021 11:13 |
SaraDHS
Messages: 46 Registered: December 2020
|
Member |
|
|
Hello Shakim,
Recreating the SPA tables can be a challenge, as the construction of variables can change from country to country. If you want to recreate the tables, first make sure you are using the facility weights.
gen wt=facwt/1000000
Your code for the specific items in the tables is close. I have checked the CSPro code that was used to create the tables originally, and recreated it below. These all match within 1%.
*WATER
gen water=0
replace water=1 if inlist(q330,1,2,10) | (inlist(q330,3, 4, 5, 7, 9) & inlist(q331, 1, 2))
tab water [iw=wt]
*COMMUNICATION EQUIPMENT
gen commu1=0
replace commu1=1 if q311==1 & q312==1
gen commu2=0
replace commu2=1 if q315==1 & q314==1
gen commu3=0
replace commu3=1 if q317==1 & q318==1
gen commu4=0
replace commu4=1 if q315a==1
gen commun=0
replace commun=1 if commu1==1 | commu2==1 | commu3==1 | commu4==1
tab commun [iw=wt]
*EMERGENCY TRANSPORT
gen emergen_transport=0
replace emergen_transport=1 if (q450==1 & q453==1) | q452==1
tab emergen_transport [iw=wt]
*LIVER OR RENAL FUNCTION TEST
gen lrt=0
replace lrt =1 if q834==1 & q835==1
tab lrt [iw=wt]
*XRAY MACHINE
gen xray=0
replace xray=1 if (q881a_1==1 & q881b_1==1) | (q881a_2==1 & q881b_2==1)
tab xray [iw=wt]
Best of luck with your work!
Sara
Sara Riese, PhD
Senior Demographic and Health Researcher, DHS Program
|
|
|
|
Re: Replicating table 3.3 and 3.7 in Tanzania SPA 2014-15 [message #23317 is a reply to message #23315] |
Mon, 23 August 2021 13:20 |
SaraDHS
Messages: 46 Registered: December 2020
|
Member |
|
|
Dear Shakim,
Below is the code to create these variables for Nepal. Please pay special attention to the titles and footnotes provided in these tables, as they provide descriptions for country-specific definitions of the variables. In most, but not all, of the cases, adapting the code to match the provided definition was all that needed to be done.
Best of luck,
Sara
*Regular electricity
gen elec=0
replace elec=1 if q340==1 & q341==1
replace elec=1 if regexm(q343, "A") & q345==1 & q346==1
replace elec=1 if regexm(q343, "B") & q345==1 & q346==1
replace elec=1 if regexm(q343, "C")
replace elec=1 if regexm(q343, "D") & q346b==1
tab elec [iw=wt],m
*Soap and running water or else alcohol-based hand disinfectant
gen swatrub=0
*In Nepal, methylated alcohol was included as an "alcohol-based hand disinfectant"
replace swatrub=1 if (q710_02==1 & q710_01==1) | q710_03==1 | q710_15==1
tab swatrub [iw=wt]
*In the title of Table 3.7.3, it states that this is among PHCCs and hospitals, so you need to limit each to only these types of facilities.
*Xray machine
gen xray=.
replace xray=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace xr=1 if xray==0 & ((q881b_1==1 & q881c_1==1) | (q881b_2==1 & q881c_2==1 & q881b_3==1 & q881c_3==1))
tab xray [iw=wt]
*Full blood count
gen blood_count=.
replace blood_count=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace blood_count=1 if blood_count==0 & ((q834==1 & q835==1) | (q802eb_1==1 & q802ec_1==1 & q802eb_2==1 & q802eb_3==1 & q802ec_3==1))
tab blood_count [iw=wt]
*Liver or renal function test
gen lrt=.
replace lrt=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace lrt =1 if lrt==0 & q833==1 & ((q834==1 & q835==1) |(q835c==1 & q835d==1))
tab lrt [iw=wt]
Sara Riese, PhD
Senior Demographic and Health Researcher, DHS Program
|
|
|
Re: Replicating table 3.3 and 3.7 in Tanzania SPA 2014-15 [message #23328 is a reply to message #23317] |
Tue, 24 August 2021 14:28 |
foysal
Messages: 9 Registered: August 2021
|
Member |
|
|
Dear Sara,
Thanks for your response and I was able to get the same % as tables except the variable- X ray machine, full blood count, liver or renal function test".
Here is the codes with the output.
gen wt=facwt/1000000
*Xray machine
gen xray=.
replace xray=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace xr=1 if xray==0 & ((q881b_1==1 & q881c_1==1) | (q881b_2==1 & q881c_2==1 & q881b_3==1 & q881c_3==1))
tab xray [iw=wt]
xray | Freq. Percent Cum.
------------+-----------------------------------
0 | 49.745353 37.16 37.16
1 | 84.1219059 62.84 100.00
------------+-----------------------------------
Total | 133.867259 100.00
In the report table the % is 63.0 (table 3.7.3).
*Full blood count
gen blood_count=.
replace blood_count=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace blood_count=1 if blood_count==0 & ((q834==1 & q835==1) | (q802eb_1==1 & q802ec_1==1 & q802eb_2==1 & q802eb_3==1 & q802ec_3==1))
tab blood_count [iw=wt]
blood_count | Freq. Percent Cum.
------------+-----------------------------------
0 | 35.4440796 26.48 26.48
1 | 98.4231793 73.52 100.00
------------+-----------------------------------
Total | 133.867259 100.00
In the final report table the % is 66.9 (table 3.7.3).
**Liver or renal function test
gen lrt=.
replace lrt=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace lrt =1 if lrt==0 & q833==1 & ((q834==1 & q835==1) |(q835c==1 & q835d==1))
tab lrt [iw=wt]
lt | Freq. Percent Cum.
------------+-----------------------------------
0 | 70.8263274 52.91 52.91
1 | 63.0409315 47.09 100.00
------------+-----------------------------------
Total | 133.867259 100.00
In the report the % is 46.5 (table 3.7.3).
How can I get the same % of this variables as the table?
Regards,
Shakim
|
|
|
Re: Replicating table 3.3 and 3.7 in Tanzania SPA 2014-15 [message #23329 is a reply to message #23328] |
Tue, 24 August 2021 14:34 |
shakim
Messages: 10 Registered: January 2021
|
Member |
|
|
Dear Sara,
Thanks for your response and I was able to get the same % as tables except the variable- X ray machine, full blood count, liver or renal function test".
Here is the codes with the output.
gen wt=facwt/1000000
*Xray machine
gen xray=.
replace xray=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace xr=1 if xray==0 & ((q881b_1==1 & q881c_1==1) | (q881b_2==1 & q881c_2==1 & q881b_3==1 & q881c_3==1))
tab xray [iw=wt]
xray | Freq. Percent Cum.
------------+-----------------------------------
0 | 49.745353 37.16 37.16
1 | 84.1219059 62.84 100.00
------------+-----------------------------------
Total | 133.867259 100.00
In the report table the % is 63.0 (table 3.7.3).
*Full blood count
gen blood_count=.
replace blood_count=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace blood_count=1 if blood_count==0 & ((q834==1 & q835==1) | (q802eb_1==1 & q802ec_1==1 & q802eb_2==1 & q802eb_3==1 & q802ec_3==1))
tab blood_count [iw=wt]
blood_count | Freq. Percent Cum.
------------+-----------------------------------
0 | 35.4440796 26.48 26.48
1 | 98.4231793 73.52 100.00
------------+-----------------------------------
Total | 133.867259 100.00
In the final report table the % is 66.9 (table 3.7.3).
**Liver or renal function test
gen lrt=.
replace lrt=0 if inrange(factype,1,7) | inrange(factype,12,14)
replace lrt =1 if lrt==0 & q833==1 & ((q834==1 & q835==1) |(q835c==1 & q835d==1))
tab lrt [iw=wt]
lt | Freq. Percent Cum.
------------+-----------------------------------
0 | 70.8263274 52.91 52.91
1 | 63.0409315 47.09 100.00
------------+-----------------------------------
Total | 133.867259 100.00
In the report the % is 46.5 (table 3.7.3).
How can I get the same % of this variables as the table?
Regards,
Shakim
|
|
|
|
Goto Forum:
Current Time: Wed Dec 4 03:07:25 Coordinated Universal Time 2024
|