// litgov4-13 cfb 0309 capt log close set more off local jobname litgov4-13 local basedir "/Users/baum/Documents/Chuck/ ChuckLitGov4/" log using "`basedir'/`jobname'", replace cd "`basedir'" local ts 9408 local in1 dirinfo_full_hazard`ts'.dta local ou1 pj0331_`ts'.dta // merge in missing case details local extdir "/Users/baum/Documents/chuck/ ChuckLitGov4/Paper_datasets9403" local extdir2 "/Users/baum/Documents/chuck/ ChuckLitGov4/" local in2 "case_input_file`ts'" // pull in est2a from 4-7a local in3 "litgov4_est2a`ts'" use "`extdir'/`in2'", clear egen cc = tag(case_code) keep if cc tempname ciftemp save `ciftemp', replace use "`extdir2'/`in3'", clear keep if cc // scrap old departed, insider indicators & stkholding. tenure, entrench vars drop departed dir_code insider stkholding tenure entrench su l case_code tempname ciftemp2 save `ciftemp2', replace use `in1', clear merge n:1 case_code using `ciftemp' drop _merge merge n:1 case_code using `ciftemp2' egen ccc = tag(case_code) tab _merge ccc l case_code survmax if _merge == 1 & ccc tab survmax if _merge == 3 & ccc drop if _merge == 1 drop if survmax == 0 drop _merge drop if year == 2007 tab survmax if ccc tab survmax suit_year drop if suit_year < 4 & survmax == suit_year tab survmax suit_year desc su // create variables not present bys idircase: g age = age_yr_0 + _n - 1 // tab restatement // g byte restate = (restatement=="Y") * revise definition of gaap // tab gaapviolation // g byte gaap = (gaapviolation=="Y") * define "other GAAP" variable // g othgaap = gaap & !restate // tab othgaap restate su restate gaap othgaap // generate director type code / insider coding tab status_yr gen dir_code = substr(status_yr, 1, 3) gen insider = . replace insider = 0 if dir_code == "IND" replace insider = 1 if inlist(dir_code, "CEO", "EMP", "FOR") tab dir_code insider // generate ceo indicator and audit committee indicator drop ceo g byte ceo = (dir_code == "CEO" & !mi(dir_code)) tabstat ceo, by(smpl) stat(N mean) bys case_code: egen minceo = min(idircase) if ceo bys case_code: egen maxceo = max(idircase) if ceo g delceo = maxceo - minceo egen ctag2 = tag(case_code) if !mi(delceo) count if !mi(delceo) & delceo>0 & ctag2 l case_code minceo maxceo delceo if !mi(delceo) & delceo>0 & ctag2,sep(0) // g ceochair = (ceo_chair_0 == "CEOCHAIR") // director stockholding: express as percentage g stkholding = 100 * shares_yr0 / shares_out_yr0 tabstat stkholding, stat(N mean q) by(suit_year) tab join_board g tenure = max(year - join_board, 0) tab tenure g entrench = log(tenure + 1) tabstat entrench, by(suit_year) // g settled = !(dismissed | ongoing) save `ou1', replace log close log2html "`basedir'/`jobname'", replace set more on