// ----- basic environment --------//

clear
use  workhouse_bench.dta

merge m:1 IO using alpha_90.dta
drop _merge

sort alpha
_pctile alpha, nq(2)
return list   

gen alpha_0_two=1 if alpha<r(r1)	
replace alpha_0_two=0 if alpha_0_two==.	

gen alpha_1_two=1 if alpha>r(r1)	
replace alpha_1_two=0 if alpha_1_two==.

forvalues i=0(1)1{
gen fin1_up_alpha_`i'_two=alpha_`i'_two*upstream_fin1
}

forvalues i=0(1)1{
gen fin2_up_alpha_`i'_two=alpha_`i'_two*upstream_fin2
}

forvalues i=0(1)1{
gen fin3_up_alpha_`i'_two=alpha_`i'_two*upstream_fin3
}

forvalues i=0(1)1{
gen fin4_up_alpha_`i'_two=alpha_`i'_two*upstream_fin4
}

xtreg dvar   fin1_up_alpha_*_two    in_I in_K in_S tfp_lp  if dvar<0.985
est store m1
xtreg dvar   fin2_up_alpha_*_two    in_I in_K in_S tfp_lp  if dvar<0.985 
est store m2
xtreg dvar   fin4_up_alpha_*_two    in_I in_K in_S tfp_lp  if dvar<0.985
est store m3
esttab  m* using "Table_3_1.rtf",  ///
    p star(* 0.1 ** 0.05 *** 0.01) r2  drop(in_I in_K in_S tfp_lp) nogap replace
