********************************************************************************
*
* Figure A3: Crop value by election year
*
********************************************************************************
 
global program "FigureA3"

cap log close
cap log using "$log_files/log_$program$today", replace

clear all
set mem 2g
set more off
set matsize 11000
set scheme s1color

***************************
***** 1. PREPARE DATA *****
***************************

// Get data

use "$data/Data_County", clear

// Controls definition

global geog 		"railroad_dens ldist_capital ldist_largest" // 
global demo 		"urban_dum perc_pop_dstr lpop_total perc_white perc_male21 perc_below21 perc_native perc_literate newsp_circ_elig" 
global demo_cont	"perc_pop_dstr lpop_total perc_white perc_male21 perc_below21 perc_native perc_literate newsp_circ_elig" 
global econ 		"perc_farm perc_manuf dlog_avbasket ldist_silver ldist_gold" 
global econ_cont	"perc_farm perc_manuf dlog_avbasket ldist_silver ldist_gold" 
global econ_p 		"perc_farm perc_manuf log_avbasket ldist_silver ldist_gold" 
global vote 		"lag_margin_pres_ttl" 			
global demo_add		"urban_dum lpop_total larea perc_white perc_below21 perc_native perc_literate newsp_circ_elig pop_male2144 pop_male4564 pop_male6599 perc_catholic perc_black"

// Keep election years
	
keep if year == 1880 | year == 1884 | year == 1888 | year == 1892 | year == 1896 | year == 1900  

// Collapse data by year

collapse (mean) basket, by(year)

// Tsset

tsset year

// Get log basket

gen log_basket = log(basket)

****************************
***** 2. EXPORT FIGURE *****
****************************

twoway connect log_basket year, scheme(burd) ///
	lwidth(medium)  ///
	ytitle("(log) Value of Crop Basket") title(" ") graphregion(color(white)) ///
	xtitle("Year") xlabel(1880(4)1900) legend(off) subtitle("") ylabel(, angle(0) format(%9.1f)) yscale(r(13.47 14.03)) xscale(r(1879 1901))
graph export "$figures/$program.pdf", replace
 
cap log close

