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

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

**** REPLICATION OF FIGURE B1 ****

clear all
set mem 2g
set more off

/*	
	OUTLINE
	1. MERGE DATA
	2. GRAPH
*/

*************************
***** 1. MERGE DATA *****
*************************

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

drop if annee!=1969
drop if dep!=57 & dep!=67 & dep!=68

merge m:1 ct_1936_str ar_1936_str using $data\EEREV-D-21-00004_Data_Canton1936.dta
drop _merge

********************
***** 2. GRAPH *****
********************

// Scatter - Insee 1956

preserve

collapse (mean) displaced_war_1946 perc_i_full [w=pop_1936], by(ct_1936_enc dep)

sum displaced_war_1946 perc_i_full, d
pwcorr displaced_war_1946 perc_i_full, sig o

twoway ///
	(scatter perc_i_full displaced_war_1946) /// 	
	(lfit perc_i_full displaced_war_1946, lp(dash) lcolor(maroon) range(0 8)), ///  (% of 1936 pop)
	ytitle("Wehrmacht conscription: Index data", margin(vsmall)) ylabel(0(6)12, angle(0) format(%5.0f)) xlabel(0(4)8, format(%5.0f)) yscale(r(-1.2 13.2)) xscale(r(-.8 8.8)) /// 
	xtitle("Wehrmacht conscription: INSEE (1956) data", margin(small)) /// (% of 1946 pop)
	legend(off) title("INSEE (1956) (Sub-district level)", ring(0)) graphregion(color(white)) name(insee, replace) //	

restore

// Scatter - Casualties

sum perc_casualties perc_i_full if perc_casualties!=., d
pwcorr perc_casualties perc_i_full, sig o

twoway ///
	(scatter perc_i_full perc_casualties) /// 	
	(lfit perc_i_full perc_casualties, lp(dash) lcolor(maroon) range(0 8)), ///  (% of 1936 pop)
	ytitle("Wehrmacht conscription: Index data", margin(vsmall)) ylabel(0(20)40, angle(0) format(%5.0f)) xlabel(0(4)8, format(%5.0f)) yscale(r(-4 44)) xscale(r(-.8 8.8)) /// 
	xtitle("Wehrmacht casualties", margin(small)) /// (% of 1946 pop)
	legend(off) title("Casualties (Municipality level)", ring(0)) graphregion(color(white)) name(casualties, replace) //

// Combine graphs
	
graph combine insee casualties ///
	, c(2) graphregion(color(white)) imargin(vsmall) //ycommon
graph export "$results\\$program.png", replace width(7200) height(3000)

cap log close
