use "/Users/natashasarin/Dropbox/Z__Natamir/Natasha_Research/Banks/Bailout_2016/data_20160627.dta", clear

gen big6 = 0 
replace big6 = 1 if permno == 86868 | permno == 47896 | permno == 69032 | permno == 59408 | permno == 38703 | permno == 70519

gen crisis = . 
\*replace crisis = 0 if year >= 2002 & year <= 2006 
replace crisis = 1 if (year >= 2007 & year < 2010) | (year == 2010 & month == 1) 
replace crisis = 2 if (year >= 2010) | (year == 2010 & month > 1) 
replace crisis = 3 if year == 2015 & month == 12 & day == 31*\

gen crisis = . 
replace crisis = 0 if (year >= 2002 & year <= 2007)
replace crisis = 1 if (year>=2010 & year <= 2015) 

by crisis permno, sort: egen tier_one_average = mean(bhck7204)
by crisis permno, sort: gen output_indicator = _n 
br ticker crisis permno tier_one_average if output_indicator == 1 & big6 == 1 