clear
set more off
set mem 40m
#delimit ;
use http://dss.ucsd.edu/~ssaiegh/data_IO.dta;

gen gdp_cap=gdplag/population;
gen pop_mil=population/1000000;

gen sample=(rated_2!=. & chga_demo!=. &
currentacctlag!=. & gdpcapgrowthlag!=. & res_gdplag!=. &
inflatwdi1!=. & l_trade_gdp!=. & resourcelag!=. & default!=. & flow1!=.);

/* Sample used in Analysis */;

drop if sample==0;

/* Comparison of Means */;

/* Natural Resources */;

ttest resource if rated_2==1, by(chga_demo) unequal;

/* Current Account */;

ttest currentacct if rated_2==1, by(chga_demo) unequal;

/* GDP Growth */;

ttest gdpcapgrowth if rated_2==1, by(chga_demo) unequal;

/* GDP  */;

ttest res_gdp if rated_2==1, by(chga_demo) unequal;

/* Inflation */;

ttest inflatwdi1 if rated_2==1, by(chga_demo) unequal;

/* GDP per Capita */;

ttest gdp_cap if rated_2==1, by(chga_demo) unequal;


/* Trade */;

ttest l_trade_gdp if rated_2==1, by(chga_demo) unequal;


/* Default */;

ttest default if rated_2==1, by(chga_demo) unequal;

/* Population */

ttest pop_mil if rated_2==1, by(chga_demo) unequal;


/* Moody's Ratings */;

ttest moodyrating if rated_2==1, by(chga_demo) unequal;

/* S&P Ratings */;

ttest sprating if rated_2==1, by(chga_demo) unequal;