global program "EEREV-D-21-00004_Table2"

cap log close
cap log using "$log\log_$program$today", replace

**** REPLICATION OF TABLE 2 ****

clear all
set mem 2g
set more off

/*	
	OUTLINE
	1. CANTON REGRESSIONS
	2. MUNICIPALITY REGRESSIONS
	3. TABLE FOR PAPER
*/

*********************************
***** 1. CANTON REGRESSIONS *****
*********************************

// Import Cantonal data

use $data\EEREV-D-21-00004_Data_Canton1936.dta, clear

// Controls vector

global rdd2 		"rdd_lat rdd_lon rdd_lat_2 rdd_lon_2 rdd_lat_lon"
global sigma 		"lelevation_mean lelevation_std $rdd2 water ldist_de"

// Voting variables 

foreach party in perc_droi_1936_ins perc_abst_1936{

	reg `party' alsace, cluster(ar_1936_enc)
	estimates store `party'_1
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y

	ivreghdfe `party' alsace $sigma, cluster(ar_1936_enc) a(dialect_lux dialect_mos dialect_rhe dialect_pal dialect_als dialect_hau dialect_lor dialect_fra borderfe25) partial($sigma)
	estimates store `party'_2
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y

	ivreghdfe `party' alsace $sigma if sample==1, robust a(dialect_lux dialect_mos dialect_rhe dialect_pal dialect_als dialect_hau dialect_lor dialect_fra borderfe25) partial($sigma)
	estimates store `party'_3
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y
	
}

// Nazi insitutions

foreach party in displaced_all_1946 displaced_intern_1946 displaced_enroled_1946{ 

	reg `party' alsace, cluster(ar_1936_enc) 
	estimates store `party'_1
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y

	ivreghdfe `party' alsace $sigma, cluster(ar_1936_enc) a(dialect_lux dialect_mos dialect_rhe dialect_pal dialect_als dialect_hau dialect_lor dialect_fra borderfe25) partial($sigma)
	estimates store `party'_2
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y

	ivreghdfe `party' alsace $sigma if sample==1, robust a(dialect_lux dialect_mos dialect_rhe dialect_pal dialect_als dialect_hau dialect_lor dialect_fra borderfe25) partial($sigma)
	estimates store `party'_3
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y
	
}

***************************************
***** 2. MUNICIPALITY REGRESSIONS *****
***************************************

// Import Municipality data

use $data\EEREV-D-21-00004_Data_Municipalities.dta, clear

keep if annee==1965

// Conscription

foreach party in perc_i_full{

	reg `party' alsace, cluster(ct_1936_enc) 
	estimates store `party'_1
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y

	ivreghdfe `party' alsace $sigma, cluster(ct_1936_enc) a(dialect_lux dialect_mos dialect_rhe dialect_pal dialect_als dialect_hau dialect_lor dialect_fra borderfe25) partial($sigma)
	estimates store `party'_2
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y
	
	ivreghdfe `party' alsace $sigma if sample==1, cluster(ct_1936_enc) a(dialect_lux dialect_mos dialect_rhe dialect_pal dialect_als dialect_hau dialect_lor dialect_fra borderfe25) partial($sigma)
	estimates store `party'_3
	qui sum `party' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y
	
}

******************************
***** 3. TABLE FOR PAPER *****
******************************

// Unconditional 

estout perc_droi_1936_ins_1 perc_abst_1936_1 displaced_all_1946_1 displaced_intern_1946_1 displaced_enroled_1946_1 perc_i_full_1 ///
	using "$results\\$program.tex", replace style(tex) type label ///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	stats(mean_y N N_clust, lab("Mean dep. variable" "Observations" "Clusters") fmt(2 %9.0fc 0)) ///
	collabels(none) ///
	mlabels(, span none prefix(\multicolumn{@span}{c}{) suffix(})) ///
	msign(--) starlevels(* .1 ** .05 *** .01) ///
	keep(alsace) ///
	order(alsace) ///
	title(Estimation strategy: Pre-War voting and Nazi policies) ///
	prehead( ///
	"\begin{table}[t!]" ///
	"\begin{center}" ///
	"\begin{threeparttable}" ///
	"\begin{scriptsize}" ///
	"\caption{@title\label{$program}}" ///
	"\begin{tabular*}{\columnwidth}{@{\extracolsep{\stretch{1}}}l*{@M}{c}@{}}" ///
	"\hline" "\hline" ///
	"&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)}  &\multicolumn{1}{c}{(3)} &\multicolumn{1}{c}{(4)} &\multicolumn{1}{c}{(5)} &\multicolumn{1}{c}{(6)}\\" ///
	"	&\multicolumn{2}{c}{Pre-War voting (1936)} &\multicolumn{3}{c}{Nazi policies \citep{maitre1958aspects}} &\multicolumn{1}{c}{Municipality-level}\\" ///
	"\cmidrule(lr){2-3} \cmidrule(lr){4-6} \cmidrule(lr){7-7}" ///
	"\multicolumn{1}{l}{\textit{Dep. Variable}} &\multicolumn{1}{c}{Right-wing}  	&\multicolumn{1}{c}{Abstention} &\multicolumn{1}{c}{Deported}   &\multicolumn{1}{c}{Incarcerated} &\multicolumn{1}{c}{Wehrmacht}   &\multicolumn{1}{c}{Wehrmacht}   \\" /// 
	"\cmidrule(lr){2-7}" ///
	"& \multicolumn{6}{c}{Panel A: Unconditional differences}\\") ///
	posthead("\hline" ///
	"\\") ///
	prefoot("\\") ///
	postfoot("\\")

// Conditional

estout perc_droi_1936_ins_2 perc_abst_1936_2 displaced_all_1946_2 displaced_intern_1946_2 displaced_enroled_1946_2 perc_i_full_2 ///
	using "$results\\$program.tex", append style(tex) type label ///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	stats(mean_y N N_clust, lab("Mean dep. variable" "Observations" "Clusters") fmt(2 %9.0fc 0)) ///
	collabels(none) ///
	mlabels(, span none prefix(\multicolumn{@span}{c}{) suffix(})) ///
	msign(--) starlevels(* .1 ** .05 *** .01) ///
	keep(alsace) /// 
	order(alsace) /// 
	prehead("%\hline" ///
	"\cmidrule(lr){2-7}" ///
	"& \multicolumn{6}{c}{Panel B: Conditional on geography and dialect}\\") ///
	posthead("\hline" ///
	"\\") ///
	prefoot("\\") ///
	postfoot("\\")

// Conditional: Estimation sample

estout perc_droi_1936_ins_3 perc_abst_1936_3 displaced_all_1946_3 displaced_intern_1946_3 displaced_enroled_1946_3 perc_i_full_3 ///
	using "$results\\$program.tex", append style(tex) type label ///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	stats(mean_y N N_clust, lab("Mean dep. variable" "Observations" "Clusters") fmt(2 %9.0fc 0)) ///
	collabels(none) ///
	mlabels(, span none prefix(\multicolumn{@span}{c}{) suffix(})) ///
	msign(--) starlevels(* .1 ** .05 *** .01) ///
	keep(alsace) /// 
	order(alsace) /// 
	prehead("%\hline" ///
	"\cmidrule(lr){2-7}" ///
	"& \multicolumn{6}{c}{Panel C: Conditional on geography and dialect (estimation sample)}\\") /// 
	posthead("\hline" ///
	"\\") ///
	prefoot("\\") /// 
	postfoot("\hline" "\hline" ///
	"\end{tabular*}" /// 
	"\end{scriptsize}" ///
	"\begin{tablenotes}[normal,flushleft]" ///
	"\begin{scriptsize}" ///
	"\item \emph{Notes}:" /// 
	"Differences in pre-War voting, Nazi policies, and ferility between Alsace and Moselle. " ///
	"In Columns (1) to (5) the unit of observation is a 1936 canton; in Column (6) it is a municipality. " ///
	"Panel A: Unconditional differences; " ///
	"Panel B: Differences conditional on geography and dialects; " ///
	"Panel C: Differences conditional on geography and dialects (estimation sample). " ///
	"Column (1): Vote for right-wing parties in the 1936 parliament election. " ///
	"Column (2): Abstention in the 1936 parliament election. " ///
	"Column (3): Fraction of 1936 population that was deported. " ///	
	"Column (4): that was incarcerated. " ///
	"Column (5): that was conscripted to the Wehrmacht \citep{maitre1958aspects}. " ///
	"Column (6): that was conscripted to the Wehrmacht \citep{ministere1945basrhin}. " ///	
	"Geography and dialects controls included in Panels B and C: " ///
	"access to waterways (binary), elevation (log mean, log std.dev.), distance to Germany (log km), 25km border segment fixed-effects, " ///
	"historical dialect fixed effects, and a quadratic polynomial in latitude and longitude ($ x+y+x^2+y^2+xy $). " ///
	"Standard errors clustered at the arrondissement level in parentheses in Columns (1) to (5) of Panels A and B; " ///
	"robust standard errors in Columns (1) to (5) of Panel C; " ///
	"standard errors clustered at the canton level in Column (6). " ///
	"* significant at 10\%; ** at 5\%; *** at 1\%. " ///	
	"\end{scriptsize}" ///
	"\end{tablenotes}" ///
	"\end{threeparttable}" ///
	"\end{center}" ///
	"\end{table}")

cap log close
