********************************************************************************
**	MASTER DOFILE															  **
**	BAILEY AND DUQUETTE "HOW JOHNSON FOUGHT THE WAR ON POVERTY"				  **
**																			  **
********************************************************************************


capture log close
set more off
clear all
version 11.2
set mem 10g
set matsize 800

********************************************************************************
* 	Define filepaths & macros												   *
********************************************************************************

	// CHANGE FILE PATH TO LOCATION ON USER'S MACHINE
local FILEPATH "your file path"
global data "`FILEPATH'/data" // Data global
global data2 "`FILEPATH'/data"
global dofiles "`FILEPATH'/dofiles"
global output "`FILEPATH'/output"
global temp "`FILEPATH'/temp"

log using "$output/bailey_duquette_master.txt", text replace


		

** STATE-LEVEL FUNDING FORMULA AND POLITICAL ECONOMY ***************************
						
	
do "$dofiles/chart_alloc_spent.do"				/*Chart funding predicted by
												index formula vs. amount spent
												at the state level */ 
													
	** Data Inputs **
	//"$data/deg45_plot_extend.txt"
	//"$data2/poverty_full_data"

	** Data Output **
	//"$temp/extend"
	//"$temp/alloc_spent_`scale'`y'.ps" 
	//"$charts/alloc_spent_`y'_`scale'.pdf"
													
													
	
do "$dofiles/state_index_reg_aew.do"			/*Regress state-level CAP spending
												on index predictions, output
												both panels of Table 1.*/ 
													
	** Data Inputs **
	//"$data2/poverty_full_data"

	** Data Output **
	//"$output/panel3.log"
	//"$output/clio3_indexA.txt"
	//"$output/clio3_indexB.txt"
													
													
	
** COUNTY LEVEL FUNDING AND POLITICAL ECONOMY **********************************
do "$dofiles/map_counties.do"					/*Create county-level maps of CAP
												funding, and other variables for
												our reference (share nonwhite,
												poverty variables, etc).*/
													
	** Data Inputs **
	//"$data/ICPSR3/02896-0074-Data"
	//"$data2/poverty_full_county2"
	//"$data/counties_shapefile/US_counties_19591231.shp"			
	//"$data2/county_db"
	//"$data2/haines_noagg"
	//"$temp/fedc_map"
	//"$temp/county_coord" 

	** Data Output **
	//"$temp/haines_noagg"
	//"$temp/fedc_map"
	//"$temp/county_db"
	//"$temp/county_coord"
	//"$output/map_`var'_`schemename'.pdf"										
													
	
do "$dofiles/table2_final_aew.do"			/* Main county regression tables
												#2 (whole country) and 3 (south only)_
												Output used in Bailey and Duquette:
												table2_new.xls and table3_new.xls */
													
	** Data Inputs **
	//"$data2/poverty_full_county2"

	** Data Output **
	//"$output/table2_final.txt"
	//"$output/table2_new.xls"
	//"$output/table3_new.xls"
													
													
	
do "$dofiles/table2_final_r1.do"			/* Main county regression table: 
												use plantation instead of sc */ 
													
	** Data Inputs **
	//"$data2/poverty_full_county2"

	** Data Output **
	//"$output/table2_final_r1.txt"
	//"$output/table2a_uw_r1.xls"
	//"$output/table2b_uw_r1.xls"
	//"$output/table2c_uw_r1.xls"
	//"$output/table3a_uw_r1.xls"
	//"$output/table3b_uw_r1.xls" 
	//"$output/table3c_uw_r1.xls"												
													
														
do "$dofiles/table2_final_r2.do"			/* Main county regression table 
												+ controls for 1960 election */ 
													
	** Data Inputs **
	//"$data2/poverty_full_county2"

	** Data Output **
	//"$output/table2_final_r2.txt"
	//"$output /table2a_uw_r2.xls"
	//"$output /table2b_uw_r2.xls"
	//"$output/table2c_uw_r2.xls"					
	//"$output/table3a_uw_r2.xls"
	//"$output/table3b_uw_r2.xls"
	//"$output/table3c_uw_r2.xls"
													
													
	
do "$dofiles/table2_final_r3.do"			/*Main county regression table: 
											    add sharecroppers in 59*/ 

													
	** Data Inputs **
	//"$data2/poverty_full_county2"
	
	** Data Output **
	//"$output/table2_final_r3.xls.txt"
	//"$output/table2a_uw_r3.xls.xls"
	//"$output/table2b_uw_r3.xls.xls"
	//"$output/table2c_uw_r3.xls.xls" 
	//"$output/table3a_uw_r3.xls.xls" 
	//"$output/table3b_uw_r3.xls.xls"
	//"$output/table3c_uw_r3.xls.xls" 												
													
	
do "$dofiles/panel_turnout.do"				/* Turnout over time by CAP spending */ 
													
	** Data Inputs **
	//"$data2/poverty_full_county_panel_turnout"
	
	** Data Output **
	//"$temp/balpal_turnout_tabled2"
	//"$output/turnout_panel_1.xls"
	//"$output/turnout_panel_2.xls"
	//"$output/turnout_panel_3.xls"
													
													
	
do "$dofiles/sumstats_table_d2.do"			/* Output summary statistics for balanced
												panel of turnout and demshare rates
												by election*/
													
	** Data Inputs **
	//"$data2/balpal_turnout_tabled2"

	** Data Output **
	//"$output/table_d2.txt"	
													
													
	







