{smcl}
{com}{sf}{ul off}{txt}
{com}. 
. **** REPLICATION OF FIGURE B3 ****
. 
. clear all
{res}{txt}
{com}. set mem 2g
{txt}{bf:set memory} ignored.
{p 4 4 2}
Memory no longer
needs to be set in modern Statas;
memory adjustments are performed on the fly
automatically.
{p_end}

{com}. set more off
{txt}
{com}. 
. /*      
>         OUTLINE
>         1. CORRELATION GRAPH - RELIGION
>         2. CORRELATION GRAPH - LANGUAGE
> */
. 
. *******************************************
. ***** 1. CORRELATION GRAPH - RELIGION *****
. *******************************************
. 
. // Import municipality data
. 
. use $data\EEREV-D-21-00004_Data_Municipalities.dta, clear
{txt}
{com}. 
. drop if annee!=1969
{txt}(11,053 observations deleted)

{com}. drop if dep!=57 & dep!=67 & dep!=68
{txt}(0 observations deleted)

{com}. 
. keep ct_1936_str ar_1936_str com church_cath church_prot church_jewi
{txt}
{com}. 
. g church_data=1*(church_cath!=. & church_prot!=. & church_jewi!=.)
{txt}
{com}. 
. // Collapse data
. 
. collapse (sum) church_cath church_prot (mean) church_data, by(ct_1936_str ar_1936_str)
{res}{txt}
{com}. drop if church_data!=1 // Full cantons
{txt}(75 observations deleted)

{com}. drop church_data
{txt}
{com}. 
. // Merge with aggregate data
. 
. merge m:1 ct_1936_str ar_1936_str using $data\EEREV-D-21-00004_Data_Canton1936.dta
{res}{txt}(label {bf:{txt}ar_1936_enc} already defined)

{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}              75
{txt}{col 9}from master{col 30}{res}               0{txt}  (_merge==1)
{col 9}from using{col 30}{res}              75{txt}  (_merge==2)

{col 5}Matched{col 30}{res}              17{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop if _merge==2 // no church data
{txt}(75 observations deleted)

{com}. drop _merge
{txt}
{com}. 
. // Generate variables
. 
. g church_data=(church_prot*100)/(church_prot+church_cath)
{txt}
{com}. g census_data=(perc_prot_1936*100)/(perc_cath_1936+perc_prot_1936)
{txt}
{com}. 
. // Graph
. 
. pwcorr church_data census_data, sig o // Corr=0.9690

             {txt}{c |} church~a census~a
{hline 13}{c +}{hline 18}
 church_data {c |} {res}  1.0000 
             {txt}{c |}
             {c |}{res}       17
             {txt}{c |}
 census_data {c |} {res}  0.9690   1.0000 
             {txt}{c |}{res}   0.0000
             {txt}{c |}{res}       17       17
             {txt}{c |}

{com}. 
. twoway ///
>         (scatter church_data census_data) ///   
>         (lfit church_data census_data, lp(dash) lcolor(maroon)), /// 
>         ytitle("Church data: Protestant churches (%)", margin(vsmall)) ylabel(0(30)60, angle(0) format(%5.0f)) yscale(r(-6 66)) ///
>         xlabel(0(40)80, format(%5.0f)) xscale(r(-8 88)) /// 
>         xtitle("INSEE (1956): Protestants 1936 (%)", margin(small)) ///
>         legend(off) title("Religion", ring(0)) graphregion(color(white)) name(religion, replace) //
{res}{txt}
{com}. 
. *******************************************
. ***** 2. CORRELATION GRAPH - LANGUAGE *****
. *******************************************
. 
. // Import municipality data
. 
. use $data\EEREV-D-21-00004_Data_Municipalities.dta, clear
{txt}
{com}. 
. drop if annee!=1969
{txt}(11,053 observations deleted)

{com}. drop if dep!=57 & dep!=67 & dep!=68
{txt}(0 observations deleted)

{com}. 
. keep ct_1936_str ar_1936_str com p_french_name pop_1936
{txt}
{com}. 
. // Collapse data
. 
. collapse (mean) p_french_name [w=pop_1936], by(ct_1936_str ar_1936_str)
{txt}(analytic weights assumed)
{res}{txt}
{com}. 
. // Merge with aggregate data
. 
. merge m:1 ct_1936_str ar_1936_str using $data\EEREV-D-21-00004_Data_Canton1936.dta
{res}{txt}(label {bf:{txt}ar_1936_enc} already defined)

{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}               0
{txt}{col 5}Matched{col 30}{res}              92{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. 
. // Graph
. 
. pwcorr perc_fran_1936 p_french_name, sig o // 0.8653

             {txt}{c |} p~n_1936 p_fren~e
{hline 13}{c +}{hline 18}
perc_fr~1936 {c |} {res}  1.0000 
             {txt}{c |}
             {c |}{res}       92
             {txt}{c |}
p_french_n~e {c |} {res}  0.8653   1.0000 
             {txt}{c |}{res}   0.0000
             {txt}{c |}{res}       92       92
             {txt}{c |}

{com}. 
. twoway ///
>         (scatter p_french_name perc_fran_1936) ///      
>         (lfit p_french_name perc_fran_1936, lp(dash) lcolor(maroon) range(0 60)), ///
>         ytitle("Birth data: French family name (%)", margin(vsmall)) ylabel(0(7)14, angle(0) format(%5.0f)) yscale(r(-1.4 15.4)) ///
>         xlabel(0(30)60, format(%5.0f)) xscale(r(-6 66)) /// 
>         xtitle("INSEE (1956): French-speaking only", margin(small)) ///
>         legend(off) title("Language", ring(0)) graphregion(color(white)) name(language, replace) //     
{res}{txt}
{com}. 
. graph combine religion language ///
>         , c(2) graphregion(color(white)) imargin(vsmall) //ycommon
{res}{txt}
{com}. graph export "$results\\$program.png", replace width(7200) height(3000)
{txt}{p 0 4 2}
file {bf}
D:\Dropbox\SVLACHOS\Research\Malgre_nous\Replication_files\Results\EEREV-D-21-00004_FigureB3.png{rm}
saved as
PNG
format
{p_end}

{com}. 
. cap log close
{smcl}
{com}{sf}{ul off}