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

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

**** REPLICATION OF TABLE 8 ****

clear all
set mem 2g
set more off

/*	
	OUTLINE
	1. TRUST REGRESSIONS
	2. VOTE REGRESSIONS
	3. TABLE FOR PAPER
*/

********************************
***** 1. TRUST REGRESSIONS *****
********************************

// Import survey data

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

keep if dep_inc==1

// Clustering

egen cluster=group(birthyr alsace)

// Regressions

foreach i in 1 2 4 5 6 9 11{ // 
	
	ivreghdfe confiance`i' alsace c.born_1908_1913#c.alsace ///
		if birthyr>=1908 & birthyr<=1927 & sexe==1, cluster(cluster) a(i.birthyr#i.sexe i.nationalite_pop i.religion i.anciennete i.annee) //

	estimates store G0confiance`i'
	qui sum confiance`i' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y

}

// Fixed effects

estfe . G0confiance*, labels(nationalite_pop "Individual controls" annee "Survey year FE" birthyr#sexe "YoB $ \times $ gender FE")
return list

*******************************
***** 2. VOTE REGRESSIONS *****
*******************************

// Vote

foreach var in proximiteFN proximiteRPR proximitePS proximiteUDF proximiteECO proximiteCOM proximiteNA{ // 

	ivreghdfe `var' alsace c.born_1908_1913#c.alsace ///
		if birthyr>=1908 & birthyr<=1927 & sexe==1, cluster(cluster) a(i.birthyr#i.sexe i.nationalite_pop i.religion i.anciennete i.annee)

	estimates store G0`var'
	qui sum `var' if e(sample)
	scalar mean_y=r(mean)
	estadd scalar mean_y
}

// Fixed effects

estfe . G0proximite*, labels(nationalite_pop "Individual controls" annee "Survey year FE" birthyr#sexe "YoB $ \times $ gender FE")
return list

******************************
***** 5. TABLE FOR PAPER *****
******************************

// Labels

la var born_1908_1913 "[0.3em] Born 1908-1913" 

// Trust

estout G0proximiteCOM G0proximitePS G0proximiteECO G0proximiteUDF G0proximiteRPR G0proximiteFN G0proximiteNA ///
	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(3 %9.0fc %9.0fc)) ///
	collabels(none) ///
	mlabels(, span none prefix(\multicolumn{@span}{c}{) suffix(})) ///
	msign(--) starlevels(* .1 ** .05 *** .01) ///
	keep(alsace c.born_1908_1913#c.alsace) /// 
	order(alsace c.born_1908_1913#c.alsace) ///
	title(Party proximity and trust in institutions: Baseline results) ///
	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{1}{c}{(7)}\\" ///
	"%\hline" ///
	"\cmidrule(lr){2-8}" ///
	"& \multicolumn{7}{c}{Panel A: Party proximity. \textit{Which party do you feel closer to, or less distant from}}\\" ///
	"%\hline" ///
	"%\cmidrule(lr){1-8}" /// %\hline" ///
	"%\multicolumn{1}{l}{\textit{Dep. Variable}} 			&\multicolumn{7}{c}{\textit{Which party do you feel closer to}} \\" ///
	"\cmidrule(lr){2-8}" ///  \cmidrule(lr){9-9}
	"\multicolumn{1}{l}{\textit{Dep. Variable}} 	&\multicolumn{1}{c}{\textit{Communist}}	&\multicolumn{1}{c}{\textit{Socialist}} 	&\multicolumn{1}{c}{\textit{Ecologist}}	&\multicolumn{1}{c}{\textit{Liberal}}	&\multicolumn{1}{c}{\textit{Conservative}}	&\multicolumn{1}{c}{\textit{Radical right}}	&\multicolumn{1}{c}{\textit{None}}  		\\" ///
	"\hline") ///
	posthead("\\") ///
	prefoot("\\" ///
	"\hline") ///
	postfoot("")

// Vote

estout G0confiance1 G0confiance2 G0confiance4 G0confiance5 G0confiance6 G0confiance9 G0confiance11 /// 
	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(3 %9.0fc %9.0fc)) ///	
	collabels(none) ///
	mlabels(, span none prefix(\multicolumn{@span}{c}{) suffix(})) ///
	msign(--) starlevels(* .1 ** .05 *** .01) ///
	keep(alsace c.born_1908_1913#c.alsace) /// 
	order(alsace c.born_1908_1913#c.alsace) /// 
	prehead("\\") ///
	posthead("%\hline" ///
	"\cmidrule(lr){2-8}" /// 
	"& \multicolumn{7}{c}{Panel B: Trust in institutions. \textit{Would you say you rather trust or distrust in}}\\" ///
	"%\hline" ///
	"%\multicolumn{1}{l}{\textit{Dep. Variable}} 			&\multicolumn{7}{c}{\textit{Would you say you rather trust or distrust}} \\" /// 
	"\cmidrule(lr){2-8}" ///
	"\multicolumn{1}{l}{\textit{Dep. Variable}} 	&\multicolumn{1}{c}{\textit{Schooling}}	&\multicolumn{1}{c}{\textit{Judicial}} 	&\multicolumn{1}{c}{\textit{Police}}	&\multicolumn{1}{c}{\textit{Church}}	&\multicolumn{1}{c}{\textit{Army}}	&\multicolumn{1}{c}{\textit{Political}}	&\multicolumn{1}{c}{\textit{Elected}}  		\\" /// 
	"	&\multicolumn{1}{c}{\textit{system}} 	&\multicolumn{1}{c}{\textit{system}}  	&\multicolumn{1}{c}{} 					&\multicolumn{1}{c}{}  					&\multicolumn{1}{c}{}				&\multicolumn{1}{c}{\textit{parties}} 	&\multicolumn{1}{c}{\textit{politicians}}	\\" /// 
	"\hline" ///
	"\\") ///
	prefoot("\\" ///
	"\hline") //

estout G0confiance1 G0confiance2 G0confiance4 G0confiance5 G0confiance6 G0confiance9 G0confiance11 /// 
	using "$results\\$program.tex", append style(tex) type label ///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	collabels(none) ///
	mlabels(, span none prefix(\multicolumn{@span}{c}{) suffix(})) ///
	msign(--) starlevels(* .1 ** .05 *** .01) ///
	drop(*) /// 
	indicate( ///
	"Individual controls = 0.nationalite_pop" ///	
	"Survey year FE = 0.annee" ///	
	"Year-of-birth FE = 0.birthyr#0.sexe" ///
	, labels(Yes )) ///
	prehead("") ///
	posthead("\\" ///
	"\hline") ///
	prefoot("") ///
	postfoot("\hline" "\hline" ///
	"\end{tabular*}" /// 
	"\end{scriptsize}" ///
	"\begin{tablenotes}[normal,flushleft]" ///
	"\begin{scriptsize}" ///
	"\item \emph{Notes}:" /// 
	"Reduced-form estimates of the effect of Wehmacht eligibility on political preferences. " ///
	"Data comes from the Interregional survey of political phenomena (\textit{Enqu\^ete interr\'egionale des ph\'enomenes politiques}). " ///
	"The unit of observation is an individual. " ///
	"Standard errors clustered at year-of-birth $ \times $ region level in parentheses. " ///
	"Panel A: Results with party proximity as the outcome; " ///
	"Panel B: Results with measures of trust in institutions are the outcome. " ///
	"Each column presents the estimation for a different party/insitution. " ///
	"Year-of-birth $ \times $ gender fixed effects are included in all specifications. " ///
	"* significant at 10\%; ** at 5\%; *** at 1\%. " ///	
	"\end{scriptsize}" ///
	"\end{tablenotes}" ///
	"\end{threeparttable} " ///
	"\end{center}" ///
	"\end{table}") //

cap log close
