File size: 30,451 Bytes
7694c07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
/*------------------------------------------------------------------------------

********************************************************************************

* Lopez, Sautmann, Schaner; AEJ Applied

********************************************************************************



** Analysis file creating tables and data based figures in the paper.

** This version: January, 2021



------------------------------------------------------------------------------*/

clear all
set more off
set matsize 5000
version 13.1
	cap graph set window fontface Times-Roman 

		
********************************************************************************
* Users: Change this section the first time. 
*------------------------------------------
* Define paths: 
*------------

*	global path "../Lopez_Sautmann_Schaner_2020" // use ../ for relative path.

	global data_final= "$path/Data"
	global dofiles_fig   = "$path/Do_Files/Figures"
	global dofiles_tab   = "$path/Do_Files/Tables"
	global dofiles_admin   = "$path/Do_Files/Stata admin files"
	global tables = "$path/Tables"
	global graphs = "$path/Figures"

global prehead1 "\begin{tabular}{l*{"
global prehead2 "}{c}} \hline\hline"

* data set names 
*---------------
global patientdata "LSS_analysis_datasets_20201108.dta"
global censusdata "LSS_CSComCensus.dta"
global doctorendline "LSS_DoctorEndlineInterview.dta"

* SETUP PROGRAM THAT INSTALLS ALL STATA PACKAGES
include "$dofiles_admin/LSS_config_stata.do"

*************************************************************************************************
* LOAD TABLES 
*************************************************************************************************
include "$dofiles_admin/LSS_TablePrograms.do"

* ADDITIONAL CONTROLS + CLUSTERING LEVEL
  * date controls
  global date "DD1-DD35"
  global clinic "CL1-CL59"
  global patient "CC*"
  global cluvar "cscomnum"
  global clulevel "clinic" 
  
#delimit ;  
global footnote0 "\emph{Notes}: Robust standard errors clustered at the $clulevel level in parentheses. 
				 All regressions control for clinic visit date fixed effects. We use double selection 
				 lasso to choose additional controls. Eligible controls include clinic dummies, symptom dummies, duration of illness  
				 (topcoded at the 99th percentile) and its square, patient age and its square, a dummy for patients under 5, patient gender, 
				 a dummy to identify pregnant patients, a dummy to identify whether the patient (versus a caregiver) answered the survey, the gender of the survey 
				 respondent, an ethnicity (Bambara) dummy, a dummy for French speaking respondents, a dummy for literate 
				 respondents, a dummy for respondents with a primary education or less, a dummy to identify patients in the home-based 
				 follow up survey, and pairwise interactions between all previously-listed patient and respondent controls. Missing values are recoded to the sample 
				 mean and separately dummied out. These missing dummies are also used to construct pairwise interactions.";
global footnoteb "\emph{Notes}: Robust standard errors clustered at the $clulevel level in parentheses. 
				 All regressions control for clinic visit date fixed effects. We use double selection 
				 lasso to choose additional controls. See notes to Table 3 for a list of potential controls.";				 
global footnote0_nl "\emph{Notes}: Robust standard errors clustered at the $clulevel level in parentheses. All regressions control for clinic visit date fixed effects.";
global footnote0_nl_new "\emph{Notes}: Robust standard errors clustered at the $clulevel level in parentheses. 
				 All regressions control for clinic visit date fixed effects. Controls include number of symptoms, symptom dummies, 
				 duration of illness (topcoded at the 99th percentile), patient age, a dummy for patients under 5, patient gender, 
				 dummy to identify pregnant patients, a dummy to identify whether the patient (versus a caregiver) answered the survey, 
				 the gender of the survey respondent, an ethnicity (Bambara) dummy, a dummy for French speaking respondents, a dummy for literate 
				 respondents, a dummy for respondents with a primary education or less. Missing values are recoded to the sample mean.";
			 
#delimit cr
global footnote0_alt "\emph{Notes}: Robust standard errors clustered at the $clulevel level in parentheses. All regressions include clinic visit date fixed effects."

global footnote1 "*, **, and *** denote statistical significance at the 10, 5, and 1 percent levels respectively."


*************************************************************************************************
/**** NOTE: the creation of the bootstrap files can take several hours. Uncomment line 87 below to start the bootstrap sampling. */
include "$dofiles_admin/LSS_make_bootstrap_repsets.do"

*************************************************************************************************
* FIGURES
*************************************************************************************************

* FIGURE 3: TREATMENT OUTCOMES BY MALARIA RISK, CONTROL GROUP
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	do "$dofiles_fig/3_graph_outcomeXpredpos_control.do"
	
* FIGURE 4: TREATMENT OUTCOMES BY MALARIA RISK AND VOUCHER GROUP
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	do "$dofiles_fig/4_graph_tmtXpredpos.do"

* FIGURE 5: VOUCHERS AND MALARIA TREATMENT
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	do "$dofiles_fig/5_graph_voucher_tmt.do"
	

***************************************************************************************
* APPENDIX B FIGURES
***************************************************************************************	

* FIGURE B1: MISALLOCATION
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	do "$dofiles_fig/B1_graph_misallocation.do"

* FIGURE B2: DISTRIBUTION PREDICTED MALARIA
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1

	do "$dofiles_fig/B2_graph_dist_pred_pos.do"
	
* Figure B3: TREATMENT OUTCOMES BY MALARIA RISK, CONTROL GROUP by HOME TEST STATUS
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	do "$dofiles_fig/B3_graph_outcomeXpredpos_control_home.do"
	
* FIGURE B4: OVERALL IMPACTS ON TREATMENT OUTCOMES -- By bins
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1

    do "$dofiles_fig/B4_graph_vouchersXbins.do"
	

	
**********************************************************************************
* MAIN TABLES
**********************************************************************************


* TABLE 1: CONTROL GROUP TABLE
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	include "$dofiles_tab/1_table_control_group.do"	

* TABLE 2: BALANCE TABLE
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear

la var under5 "Under 5 Years Old"

* VARS IN TABLE 
	* 0. sample frame
	global varlist0 "nobs"
	* 1. patient chars
	global varlist1 "num_symptoms symptomsscreening_1 symptomsscreening_2 symptomsscreening_3 symptomsscreening_4 symptomsscreening_5 symptomsscreening_6 symptomsscreening_7 daysillness99 agepatient under5 genderpatient pregnancy RDTresult_POS pred_mal_pos"
	* 2. respondent / HH chars
	global varlist2 "respondent gender ethnic_bambara speak_french readwrite_fluent_french prischoolorless total_hh_members_H HH_frac_14 HH_frac_job income_percap_H rent_value_H HH_frac_nets"

	include "$dofiles_tab/2_table_balance.do"

	
* TABLE 3: OVERALL IMPACTS ON TREATMENT OUTCOMES
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
g RXnone= 1 - RXtreat_sev_simple_mal
g none=   1 - treat_sev_simple_mal
	la var RXnone "Prescribed"
	la var none "Purchased"	
	la var RXtreat_sev_simple_mal "Prescribed"
	la var treat_sev_simple_mal "Purchased"	
	la var used_vouchers_admin "Used Voucher"
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"		

docpat_theory_lso used_vouchers_admin RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, type(tex) ///
		table("$tables/3_mal_tmt_overall_new_lso.tex") footnote($footnote0 GC, PD, and DD indicate tests of gatekeeping costs, patient-driven, and doctor-driven demand respectively. $footnote1) testof("GC PD PD DD DD") signifevidence("Yes Yes Yes No No") /// 
		prehead1($prehead1) title("Impacts on Malaria Treatment Outcomes") lab(mal_tmt_overall_new) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(.95) cluvar($cluvar) partial($date) lcont($date $clinic $patient) ///
		extrahead(\\ & & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){3-4} \cmidrule(lr){5-6}) 

* TABLE 4: HET IMPACTS ON TREATMENT OUTCOMES
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear

cap prog drop dome
prog define dome
	drop if dropme==1
	la var used_vouchers_admin "Used Voucher"
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"		
la var RXtreat_sev_simple_mal "Prescribed"
la var treat_sev_simple_mal "Purchased"	
end

dome

docpat_hettable_theory_lso used_vouchers_admin RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, type(tex) ///
		table("$tables/4_mal_tmt_het_new_lso.tex") footnote($footnoteb Standard errors are based on 1,000 bootstrap replications, with re-sampling at the clinic level. Predicted malaria risk is re-calculated on each bootstrap replication. GC, PD, and DD indicate tests of gatekeeping costs, patient-driven, and doctor-driven demand respectively. $footnote1) /// 
		prehead1($prehead1) title("Impacts on Malaria Treatment Outcomes - Heterogeneity by Predicted Malaria Risk") lab(mal_tmt_het_new) partial($date) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(1) cluvar($cluvar) testofh("GC/DD -- -- DD DD") signifevidenceh("No -- -- No No") testofl("GC/PD PD PD -- --") signifevidencel("Yes Yes Yes -- --") ///
		extrahead(\\ & & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){3-4} \cmidrule(lr){5-6})  ///
		path("$data_final/_bootstrap") setname("bs_cluCSCOM_") dodo(dome) numreps(1000) lcont($date $clinic $patient)

		
* TABLE 5: IMPACTS ON MATCH - TREATMENT AND ILLNESS
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	la var RXexpected_mal_match_any "Overall Match"
	la var expected_mal_match_any "Overall Match"	
g RXexpected_mal_match_anyX= RXexpected_mal_match_any if RXmatch_treat_RDT!=.
g expected_mal_match_anyX= expected_mal_match_any if RXmatch_treat_RDT!=.
	la var expected_mal_match_any_pos "Malaria Positive"
	la var RXexpected_mal_match_any_pos "Malaria Positive"
	la var expected_mal_match_any_neg "Malaria Negative"
	la var RXexpected_mal_match_any_neg "Malaria Negative"
	la var RXexpected_mal_match_anyX "Prescribed"
	la var expected_mal_match_anyX "Purchased"
	la var RXmatch_treat_RDT "Prescribed"
	la var match_treat_RDT "Purchased"		
	
* this table decomposes expected match into E(antimal to malaria+) and E(no antimal to malaria-)
docpat_p1_lso RXexpected_mal_match_any_pos RXexpected_mal_match_any_neg RXexpected_mal_match_any expected_mal_match_any_pos expected_mal_match_any_neg expected_mal_match_any, type(tex) ///
		table("$tables/5_expected_match_decomp_lso.tex") footnote($footnoteb The expected match for malaria positive is equal to predicted malaria risk times the relevant malaria treatment/purchase dummy. The expected match for malaria negative is equal to one minus predicted malaria risk times one minus the malaria prescription/purchase dummy. The overall expected match is the sum of these two variables. $footnote1) /// 
		prehead1($prehead1) title("Impacts on Match Between Treatment and Illness") lab(expected_match_decomp) ///
	    prehead2($prehead2) widc(0.1\linewidth) texwid(1.25) cluvar($cluvar) partial($date) lcont($date $clinic $patient) ///
		extrahead(\\ & \multicolumn{3}{c}{Expected Match: Prescribed} & \multicolumn{3}{c}{Expected Match: Purchased}  \\ \cmidrule(lr){2-4} \cmidrule(lr){5-7}) 

	
**********************************************************************************
* APPENDIX TABLES
**********************************************************************************

* TABLE B1: Clinics' characteristics
* --------------------------------------------------------------------------------
use "$data_final/$censusdata", clear

	do "$dofiles_tab/B1_table_clinic_census.do"		
			
* TABLE B2: HEALTH WORKERS BELIEFS
* --------------------------------------------------------------------------------
use "$data_final/$doctorendline", clear
		
	do "$dofiles_tab/B2_table_means_doctor.do"

* TABLE B3: IMPACT OF PATIENT INFORMATION TREATMENT ON MALARIA TREATMENT
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	la var RXtreat_sev_simple_mal "Prescribed"
	la var treat_sev_simple_mal "Purchased"	
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"	

gen doctor_voucher_x_patient_info=doctor_voucher*patient_info
gen patient_voucher_x_patient_info=patient_voucher*patient_info
	
docpat_pat_lso RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, type(tex) ///
		table("$tables/B3_mal_tmt_pat_info_lso.tex") footnote($footnoteb  $footnote1) /// 
		prehead1($prehead1) title("Impacts of Patient Information on Malaria Treatment Outcomes") lab(mal_tmt_pat_info_lso) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(0.8) cluvar($cluvar) ///
		extrahead(\\ & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5}) ///
		partial($date)  lcont($date $clinic $patient)	

* TABLE B4: IMPACT OF DOCTOR INFORMATION TREATMENT ON MALARIA TREATMENT
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	la var RXtreat_sev_simple_mal "Prescribed"
	la var treat_sev_simple_mal "Purchased"	
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"	
	
docpat_doc_lso RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, type(tex) ///
		table("$tables/B4_mal_tmt_doc_info_lso.tex") footnote($footnoteb  $footnote1) /// 
		prehead1($prehead1) title("Impacts of Doctor Information on Malaria Treatment Outcomes") lab(mal_tmt_doc_info_lso) ///
	    prehead2($prehead2) widc(0.1\linewidth) texwid(.8) cluvar($cluvar) ///
		extrahead(\\ & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5}) ///
		partial($date)  lcont($date $clinic $patient)	
		
* TABLE B5: SELECTION INTO SAMPLE TABLE
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	la var has_valid_rdt_H "Has Valid RDT (Home Survey)"
* VARS IN TABLE 
	* 0. sample frame
	global varlist0 "nobs in_home_survey has_valid_rdt_H"
	* 1. patient chars
	global varlist1 "num_symptoms symptomsscreening_1 symptomsscreening_2 symptomsscreening_3 symptomsscreening_4 symptomsscreening_5 symptomsscreening_6 symptomsscreening_7  daysillness99 agepatient under5 genderpatient pregnancy RDTresult_POS pred_mal_pos"
	* 2. respondent / HH chars
	global varlist2 "respondent gender ethnic_bambara speak_french readwrite_fluent_french prischoolorless total_hh_members_H HH_frac_14 HH_frac_job income_percap_H rent_value_H HH_frac_nets"

	include "$dofiles_tab/B5_table_selection.do"

* TABLE B6: DIFFERENCE BETWEEN CONSENTERS AND NON-CONSENTERS FOR RDT
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear	
	drop if dropme==1
	
	do "$dofiles_tab/B6_table_diff_test_consent.do"

* TABLE B7: PREDICTED MALARIA POSITIVITY
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1

	do "$dofiles_tab/B7_table_mal_prob_probit.do"
	
* TABLE B8: OVERALL IMPACTS ON TREATMENT OUTCOMES -- no controls
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	la var RXtreat_sev_simple_mal "Prescribed"
	la var treat_sev_simple_mal "Purchased"	
	la var used_vouchers_admin "Used Voucher"
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"		

docpat_p1_theory used_vouchers_admin RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, extra($date) type(tex) ///
		table("$tables/B8_mal_tmt_overall_nc.tex") footnote($footnote0_nl GC, PD, and DD indicate tests of gatekeeping costs, patient-driven, and doctor-driven demand respectively. $footnote1)  testof("GC PD PD DD DD") signifevidence("Yes Yes Yes No No") /// 
		prehead1($prehead1) title("Impacts on Malaria Treatment Outcomes, No Additional Controls") lab(mal_tmt_overall_new_nc) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(.8) cluvar($cluvar) ///
		extrahead(\\ & & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){3-4} \cmidrule(lr){5-6}) 

* TABLE B9: HET IMPACTS ON TREATMENT OUTCOMES -- no controls
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear

cap prog drop dome
prog define dome
	drop if dropme==1
	la var used_vouchers_admin "Used Voucher"
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"		
	la var RXtreat_sev_simple_mal "Prescribed"
	la var treat_sev_simple_mal "Purchased"	
end

dome

docpat_hettable_theory used_vouchers_admin RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, extrac($date) type(tex) ///
		table("$tables/B9_mal_tmt_het_nc.tex") footnote($footnote0_nl Standard errors based GC, PD, and DD indicate tests of gatekeeping costs, patient-driven, and doctor-driven demand respectively. $footnote1) /// 
		prehead1($prehead1) title("Impacts on Malaria Treatment Outcomes - Heterogeneity by Predicted Malaria Risk, No Additional Controls") lab(mal_tmt_het_new_nc) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(.8) cluvar($cluvar) testofh("GC/DD -- -- DD DD") signifevidenceh("No -- -- No No") testofl("GC/PD PD PD -- --") signifevidencel("Yes Yes Yes -- --")  ///
		extrahead(\\ & & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){3-4} \cmidrule(lr){5-6}) /// 
		path("$data_final/_bootstrap") setname("bs_cluCSCOM_") dodo(dome) numreps(1000)
		


		
* TABLE B10: OVERALL IMPACTS ON TREATMENT OUTCOMES -- NO LASSO
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1      

	sum pregnancy 
	replace pregnancy=r(mean) if pregnancy==.
	sum ethnic_bambara
	replace ethnic_bambara=r(mean) if ethnic_bambara==.
global mycont0 "date_1-date_35"
global covariates "num_symptoms symptomsscreening_1 symptomsscreening_2 symptomsscreening_3 symptomsscreening_4 symptomsscreening_5 symptomsscreening_6 daysillness99 agepatient under5 genderpatient pregnancy MSSpregnancy respondent gender ethnic_bambara MSSethnic_bambara speak_french readwrite_fluent_french prischoolorless"	
global mycont "$mycont0 $covariates" 

	la var RXtreat_sev_simple_mal "Prescribed"
	la var treat_sev_simple_mal "Purchased"	
	la var used_vouchers_admin "Used Voucher"
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"		

docpat_p1_theory used_vouchers_admin RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, extra($mycont) type(tex) ///
		table("$tables/B10_mal_tmt_overall_nl.tex") footnote($footnote0_nl_new GC, PD, and DD indicate tests of gatekeeping costs, patient-driven, and doctor-driven demand respectively. $footnote1)  testof("GC PD PD DD DD") signifevidence("Yes Yes Yes No No") /// 
		prehead1($prehead1) title("Impacts on Malaria Treatment Outcomes") lab(mal_tmt_overall_nl) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(.8) cluvar($cluvar) ///
		extrahead(\\ & & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){3-4} \cmidrule(lr){5-6}) 

* TABLE B11: HET IMPACTS ON TREATMENT OUTCOMES -- NO LASSO
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear

cap prog drop dome
prog define dome
	drop if dropme==1
	la var used_vouchers_admin "Used Voucher"
	la var RXtreat_severe_mal "Prescribed"
	la var treat_severe_mal "Purchased"		
	la var RXtreat_sev_simple_mal "Prescribed" 
	la var treat_sev_simple_mal "Purchased"	

	sum pregnancy 
	replace pregnancy=r(mean) if pregnancy==.
	sum ethnic_bambara
	replace ethnic_bambara=r(mean) if ethnic_bambara==.         
end

dome

global covariates "num_symptoms symptomsscreening_1 symptomsscreening_2 symptomsscreening_3 symptomsscreening_4 symptomsscreening_5 symptomsscreening_6 daysillness99 agepatient under5 genderpatient pregnancy MSSpregnancy respondent gender ethnic_bambara MSSethnic_bambara speak_french readwrite_fluent_french prischoolorless"	
global mycont "$mycont0 $covariates" 

docpat_hettable_theory used_vouchers_admin RXtreat_sev_simple_mal treat_sev_simple_mal RXtreat_severe_mal treat_severe_mal, extrac($mycont) type(tex) ///
		table("$tables/B11_mal_tmt_het_nl.tex") footnote($footnote0_nl_new GC, PD, and DD indicate tests of gatekeeping costs, patient-driven, and doctor-driven demand respectively. $footnote1) /// 
		prehead1($prehead1) title("Impacts on Malaria Treatment Outcomes - Heterogeneity by Predicted Malaria Risk") lab(mal_tmt_het_nl) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(.8) cluvar($cluvar) testofh("GC/DD -- -- DD DD") signifevidenceh("No -- -- No No") testofl("GC/PD PD PD -- --") signifevidencel("Yes Yes Yes -- --") ///
		extrahead(\\ & & \multicolumn{2}{c}{Any Malaria Treatment} & \multicolumn{2}{c}{Severe Malaria Treatment}  \\ \cmidrule(lr){3-4} \cmidrule(lr){5-6}) ///
		dodo(dome) path("$data_final/_bootstrap") setname("bs_cluCSCOM_") numreps(1000)
		
* TABLE B12: VOUCHERS AND MALARIA TREATMENT
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
docpat_theory_lso treat_severe_mal_voucher treat_severe_mal_NOvoucher treat_simple_mal_voucher treat_simple_mal_NOvoucher , type(tex) ///
		table("$tables/B12_vouchers_tmt_lso.tex") footnote($footnoteb DD and PD indicates a test of doctor and patient-driven demand respectively. $footnote1) testof("DD DD PD PD") signifevidence("No No No Yes") /// 
		prehead1($prehead1) title("Use of Voucher for Purchased Malaria Treatment") lab(vouchers_tmt) ///
	    prehead2($prehead2) widc(0.1\linewidth) texwid(.8) cluvar($cluvar) partial($date) lcont($date $clinic $patient)

* TABLE B13: Stockpiling: Taking medication at home survey - lasso
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1

gen taking_ACT_simple= taking_ACT_t if treat_simple_mal==1

label var taking_ACT_t "All Prescribed ACTs"
label var taking_ACT_simple "Prescribed ACT for Simple Malaria"

docpat_p1_lso taking_ACT_t taking_ACT_simple, type(tex) ///
		table("$tables/B13_stockpiling_lso.tex") footnote($footnoteb The first column is limited to individuals who purchased an ACT treatment at the CSCom as part of either simple or severe malaria treatment. The second column is limited to individuals who purchased an ACT as part of simple malaria treatment. $footnote1) /// 
		prehead1($prehead1) title("Share of Patients Taking An ACT at Home Survey") lab(stockpiling) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(1) cluvar($cluvar) partial($date) lcont($date $clinic $patient)
		
* TABLE B14: IMPACT OF INFORMATION TREATMENT ON TESTING
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
gen no_voucher=.
	replace no_voucher=1 if doctor_voucher==0 & patient_voucher==0
	replace no_voucher=0 if doctor_voucher==1 | patient_voucher==1
gen pat_infoXno_voucher=patient_info*no_voucher
gen pat_infoXdoc_voucher=patient_info*doctor_voucher
gen pat_infoXpat_voucher=patient_info*patient_voucher
gen doctor_voucher_x_patient_info= doctor_voucher*patient_info
gen patient_voucher_x_patient_info = patient_voucher*patient_info
gen reported_Malaria_test_RX=reported_Malaria_test if RXtreat_sev_simple_mal==1
gen reported_RDT_RX=reported_RDT if RXtreat_sev_simple_mal==1
gen reported_GE_FS_RX=reported_GE_FS if RXtreat_sev_simple_mal==1
	la var reported_Malaria_test_RX "Any Malaria Test"
	la var reported_RDT_RX "RDT Test"
	la var reported_GE_FS_RX "Microscopy Test"
	la var RXtreat_sev_simple_mal "Prescribed Antimalarial"
	la var treat_sev_simple_mal "Purchased Antimalarial"
	la var reported_Malaria_test "Any Malaria Test"
	la var reported_GE_FS "Microscopy Test"
	la var reported_RDT "RDT Test"

docpat_pat_aux_lso reported_Malaria_test reported_RDT reported_GE_FS reported_Malaria_test_RX reported_RDT_RX reported_GE_FS_RX, type(tex) ///
		table("$tables/B14_mal_testing_info_RX_lso.tex") footnote($footnoteb  $footnote1) /// 
		prehead1($prehead1) title("Impacts of Patient Information on Malaria Testing at the Clinic") lab(mal_testing_info_RX_lso) ///
	    prehead2($prehead2) widc(0.1\linewidth) texwid(1.3) cluvar($cluvar) ///
		extrahead(\\ & \multicolumn{3}{c}{All Patients} & \multicolumn{3}{c}{If Prescribed Antimalarial}  \\ \cmidrule(lr){2-4} \cmidrule(lr){5-7}) ///
		partial($date)  lcont($date $clinic $patient)
	
		
* TABLE B15: IMPACTS ON COSTS TO PATIENTS AND CLINIC REVENUE -- PATIENT LEVEL
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear

cap prog drop dome
prog define dome
	drop if dropme==1 
g reported_cost_mal= reported_totalcost if RXtreat_sev_simple_mal
g reported_cost_sev= reported_totalcost if RXtreat_severe_mal
	la var reported_totalcost "Patient Costs"
	la var reported_cost_mal "Malaria Patients"
	la var reported_cost_sev "Severe Malaria Patients"	
	la var reported_totalcost_pre "Clinic Revenues"
end

dome 

docpat_pantable_lso reported_totalcost_pre reported_totalcost, type(tex) ///
		table("$tables/B15_cost_overall_lso.tex") footnote($footnoteb In Panel B, standard errors are based on 1,000 bootstrap replications, with re-sampling at the clinic level. Predicted malaria risk is re-calculated on each bootstrap replication. All variables measured in CFA top-coded at the 99th percentile. CFA610 $\approx$ USD1. Malaria cases classified based on doctor prescriptions. $footnote1) /// 
		prehead1($prehead1) title("Impacts on Clinic Revenues and Patient Costs (CFA)") lab(cost_overall) ///
	    prehead2($prehead2) widc(0.12\linewidth) texwid(.8) cluvar($cluvar) /// 
		path("$data_final/_bootstrap") setname("bs_cluCSCOM_") dodo(dome) numreps(1000) partial($date) lcont($date $clinic $patient)
		
		
* TABLE B16: IMPACTS ON MATCH :: TREATMENT AND ILLNESS - RDT SUB-SAMPLE
* --------------------------------------------------------------------------------
use "$data_final/$patientdata", clear
	drop if dropme==1
	
	la var RXexpected_mal_match_any "Overall Match"
	la var expected_mal_match_any "Overall Match"	
g RXexpected_mal_match_anyX= RXexpected_mal_match_any if RXmatch_treat_RDT!=.
g expected_mal_match_anyX= expected_mal_match_any if RXmatch_treat_RDT!=.
	la var expected_mal_match_any_pos "Malaria Positive"
	la var RXexpected_mal_match_any_pos "Malaria Positive"
	la var expected_mal_match_any_neg "Malaria Negative"
	la var RXexpected_mal_match_any_neg "Malaria Negative"
	la var RXexpected_mal_match_anyX "Prescribed"
	la var expected_mal_match_anyX "Purchased"
	la var RXmatch_treat_RDT "Prescribed"
	la var match_treat_RDT "Purchased"		
	
docpat_p1_lso RXexpected_mal_match_anyX expected_mal_match_anyX RXmatch_treat_RDT match_treat_RDT, type(tex) ///
		table("$tables/B16_expected_match_lso.tex") footnote($footnoteb In columns 3 and 4 match quality is equal to 1 if an individual is malaria positive and was prescribed/bought an antimalarial or is malaria negative and was not prescribed/did not buy an antimalarial and is zero otherwise. In columns 1-2 the value of one is replaced with either the probability an individual is positive (for antimalarial receipt) or the probability an individual is negative (for non-receipt). $footnote1) /// 
		prehead1($prehead1) title("Impacts on Match Between Treatment and Illness - RDT Sub-Sample") lab(expected_match_lso) ///
	    prehead2($prehead2) widc(0.1\linewidth) texwid(1.25) cluvar($cluvar) partial($date) lcont($date $clinic $patient) ///
		extrahead(\\ &  \multicolumn{2}{c}{Expected Match} & \multicolumn{2}{c}{Actual Match} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5})