Skip to content

brycewang-stanford/Auto-Empirical-Research-Skills / skills/18-jusi-aalto-stata-accounting-research

stata-accounting-research

Unverified

STATA code pattern library for empirical archival accounting research. Provides tested syntax from 126 peer-reviewed JAR (Journal of Accounting Research) replication files (2017-2025). Use when the user asks procedural questions like "How do I implement [method]?" or "Show me code for [technique]" — including: entropy balancing, propensity score matching (PSM), difference-in-differences (DiD), regression discontinuity (RDD), instrumental variables (IV), event studies (CAR/BHAR), survival analysis, Fama-MacBeth regressions, bootstrap, quantile regression, reghdfe/xtreg/areg, clustering standard errors, fixed effects, esttab/outreg2 table formatting, winsorization, leads/lags. Users can specify their variables (e.g., treatment, outcomes, controls) and receive adapted syntax. NOTE: This skill provides code patterns from published papers, not research design advice.

FileKindSize
README-original.mdmarkdown2.9 KB
SKILL.mdskill md4.8 KB
references/JAR_55_bbcl.doother59.1 KB
references/JAR_55_chaplinksy-hanley-moon.doother46.3 KB
references/JAR_55_clm.doother95.1 KB
references/JAR_55_elw.doother58.0 KB
references/JAR_55_hlsw.doother104.1 KB
references/JAR_55_kks.doother365.5 KB
references/JAR_55_lzz.doother25.5 KB
references/JAR_55_madsen.doother307.5 KB
references/JAR_55_mr.doother41.5 KB
references/JAR_56_al.doother75.3 KB
references/JAR_56_bch.doother13.5 KB
references/JAR_56_blv.doother24.6 KB
references/JAR_56_csmw.doother27.6 KB
references/JAR_56_en.doother21.2 KB
references/JAR_56_granja.doother107.9 KB
references/JAR_56_htw.doother18.6 KB
references/JAR_56_kmt.doother5.6 KB
references/JAR_56_ksvw.doother8.0 KB
references/JAR_56_llz.doother3.1 KB
references/JAR_56_ls.doother147.5 KB
references/JAR_56_lv2018.doother123.7 KB
references/JAR_57_bht.doother24.4 KB
references/JAR_57_bl.doother22.6 KB
references/JAR_57_bw.doother263.2 KB
references/JAR_57_cct.doother347.1 KB
references/JAR_57_cgw.doother195.8 KB
references/JAR_57_hcp.doother38.0 KB
references/JAR_57_honigsberg.doother99.5 KB
references/JAR_57_lehmann.doother112.8 KB
references/JAR_57_lm.doother85.5 KB
references/JAR_58_bsz.doother36.9 KB
references/JAR_58_ckm.doother52.3 KB
references/JAR_58_eyring.doother58.1 KB
references/JAR_58_gj.doother187.5 KB
references/JAR_58_gsz.doother121.6 KB
references/JAR_58_htyz.doother30.9 KB
references/JAR_58_jansen.doother99.5 KB
references/JAR_58_joshi.doother43.0 KB
references/JAR_58_kvy.doother19.5 KB
references/JAR_58_msz.doother35.0 KB
references/JAR_58_rauter.doother433.2 KB
references/JAR_58_wy.doother64.5 KB
references/JAR_58_zz.doother125.5 KB
references/JAR_59_breuer.doother826.9 KB
references/JAR_59_ctv.doother383.7 KB
references/JAR_59_dess.doother78.4 KB
references/JAR_59_hmo.doother351.6 KB
references/JAR_60_abkp.doother129.9 KB
references/JAR_60_alv.doother35.4 KB
references/JAR_60_at.doother38.5 KB
references/JAR_60_barrios.doother119.6 KB
references/JAR_60_bbin.doother72.9 KB
references/JAR_60_bdem.doother11.6 KB
references/JAR_60_bl.doother43.5 KB
references/JAR_60_bmsw.doother7.7 KB
references/JAR_60_cc.doother20.1 KB
references/JAR_60_cpss.doother15.4 KB
references/JAR_60_cstv.doother175.3 KB
references/JAR_60_dg.doother19.9 KB
references/JAR_60_duguay.doother8.0 KB
references/JAR_60_fhl.doother71.3 KB
references/JAR_60_gls.doother37.0 KB
references/JAR_60_hmryz.doother28.6 KB
references/JAR_60_hst.doother18.3 KB
references/JAR_60_kt.doother10.4 KB
references/JAR_60_mliu.doother28.3 KB
references/JAR_60_nrwx.doother14.6 KB
references/JAR_60_ptwy.doother26.6 KB
references/JAR_60_skim.doother14.7 KB
references/JAR_61_bcdr.doother524.9 KB
references/JAR_61_bkr.doother51.6 KB
references/JAR_61_bls.doother79.2 KB
references/JAR_61_bo.doother29.7 KB
references/JAR_61_ccm.doother48.7 KB
references/JAR_61_cdss.doother3.9 KB
references/JAR_61_cfhll.doother47.1 KB
references/JAR_61_cfmp.doother12.7 KB
references/JAR_61_ckor.doother77.5 KB
references/JAR_61_cllw.doother11.2 KB
references/JAR_61_clm.doother11.0 KB
references/JAR_61_deller.doother368.9 KB
references/JAR_61_dlrtw.doother30.6 KB
references/JAR_61_dlz.doother13.6 KB
references/JAR_61_drs.doother15.8 KB
references/JAR_61_ds.doother197.5 KB
references/JAR_61_glt.doother1.9 KB
references/JAR_61_gyz.doother7.5 KB
references/JAR_61_ll.doother89.3 KB
references/JAR_61_lszz.doother15.9 KB
references/JAR_61_os.doother128.9 KB
references/JAR_61_zureich.doother22.2 KB
references/JAR_62_1_bdsy_banerjee_etal.doother6.6 KB
references/JAR_62_1_bhs_bouwens_etal.doother59.7 KB
references/JAR_62_1_gsz_gu_sun_zhou.doother46.6 KB
references/JAR_62_2_dgzz_defranco_etal.doother1.8 KB
references/JAR_62_2_gmp_grewal_etal.doother37.2 KB
references/JAR_62_2_xyz_xin_etal.doother25.3 KB
references/JAR_62_3_bht_bloomfield_etal.doother16.0 KB
references/JAR_62_3_ccz_cheynel_etal.doother23.3 KB
references/JAR_62_3_kim.doother2.6 KB
references/JAR_62_3_rr_raghunandan_ruchti.doother15.5 KB
references/JAR_62_4_bd_breuer_dehaan.doother15.3 KB
references/JAR_62_4_cc_cadman_carrizosa.doother20.1 KB
references/JAR_62_4_kmsv_kohler_etal.doother91.5 KB
references/JAR_62_4_mps_marra_etal.doother68.0 KB
references/JAR_62_4_raghunandan.doother50.0 KB
references/JAR_62_4_stv_sran_etal.doother41.1 KB
references/JAR_62_4_xu.doother49.4 KB
references/JAR_62_5_aov_abraham_etal.doother418.9 KB
references/JAR_62_5_gibbons.doother80.1 KB
references/JAR_62_5_jiang.doother114.3 KB
references/JAR_62_5_kstz_krueger_etal.doother26.7 KB
references/JAR_62_5_llz_li_lou_zhang.doother6.2 KB
references/JAR_62_5_lrst_lins_etal.doother66.2 KB
references/JAR_62_5_lswy_lin_etal.doother85.2 KB
references/JAR_62_5_lw_li_wang.doother16.6 KB
references/JAR_63_1_blmv_bastiaansen_etal.doother18.5 KB
references/JAR_63_1_cvw_chen_etal.doother61.2 KB
references/JAR_63_1_fgr_frankel_etal.doother30.3 KB
references/JAR_63_1_hrsx_huang_etal.doother35.5 KB
references/JAR_63_1_jia.doother12.0 KB
references/JAR_63_2_bcrw_bakke_etal.doother271.3 KB
references/JAR_63_2_dlr_desimone_etal.doother83.5 KB
references/JAR_63_2_mqtz_mao_etal.doother94.2 KB
references/JAR_63_2_npstv_nessa_etal.doother7.0 KB
references/JAR_63_3_breuer.doother51.4 KB
references/REFERENCES.mdmarkdown30.7 KB

references/JAR_55_chaplinksy-hanley-moon.do

View on GitHub

clear
set more off


*************************************************************************************
* to run the code for all our analyses below, the following three datasets are needed
* FINAL_SAMPLE: our main dataset with IPO, EGC, all financial data
* IND_MTB_FF17: Industry M/B and P/E data at the famafrench 17 industry levels
* HIGHTECH: SIC codes for hightech industries 
*************************************************************************************


******* TABLE 2: Sumary Statistics

use FINAL_SAMPLE, clear

* three sets of IPO firms
* egcbyrev==1, Actual EGC IPOs "after" the Act
* egcbyrev==0, EGC-qualifying IPOs "before" the Act
* egcbyrev==. (missing), all other IPOs that do not qaulity EGC status

keep if !missing(egcbyrev)

*mean and median difference test results are by default [egcbyrev==0 - egcbyrec==1], so reverse the order on purpose
*to get results for [egcbyrev==1 - egcbyrec==0]
gen reverse_egcbyrev=!egcbyrev


est clear
estpost summ sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n acctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter if egcbyrev==1, detail  
esttab using full_summ_byEGC.csv, cell("mean(fmt(2)) p50(lab(median)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant replace

estpost summ sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n acctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter if egcbyrev==0, detail
esttab using full_summ_byEGC.csv, cell("mean(fmt(2)) p50(lab(median)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant append

*mean difference test
estpost ttest sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n wacctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter , by(reverse_egcbyrev) 
esttab using full_summ_byEGC.csv, cell("b(lab(mean diff) star fmt(2))") nonumber nonotes eqlabels("") noconstant label star(* 0.10 ** 0.05 *** 0.01) append

*median difference test
median sale, by(reverse_egcbyrev)
median sale_CPIadj1, by(reverse_egcbyrev)
median asset, by(reverse_egcbyrev)
median booklev, by(reverse_egcbyrev)
median ppenet_asset, by(reverse_egcbyrev)
median rnd_asset, by(reverse_egcbyrev)
median drnd, by(reverse_egcbyrev)
median salegr, by(reverse_egcbyrev)
median age, by(reverse_egcbyrev)
median unprofitable, by(reverse_egcbyrev)
median dum_VC, by(reverse_egcbyrev)
median proceeds, by(reverse_egcbyrev)
median proceeds_CPIadj1, by(reverse_egcbyrev)
median avrg_uwmktsh, by(reverse_egcbyrev)
median diffdate, by(reverse_egcbyrev)
median dp, by(reverse_egcbyrev)
median dp_p, by(reverse_egcbyrev)
median acctlegalpct, by(reverse_egcbyrev)
median wgspreadpct_new, by(reverse_egcbyrev)
median totfeepct, by(reverse_egcbyrev)
median ir, by(reverse_egcbyrev)
median totcost, by(reverse_egcbyrev)
median nasdaq90d, by(reverse_egcbyrev)
median nreg_filter, by(reverse_egcbyrev)


******* TABLE 3 & 4: Propensity Score Matching + OLS or Diff-in-diff

use FINAL_SAMPLE, clear

keep if !missing(egcbyrev)

drop if missing(acctlegalpct) & egcatipo!=1
drop if missing(wgspreadpct_new) & egcatipo!=1 
drop if missing(dp)  & egcatipo!=1

gen treated=(src==0)
gen post=(idate>=date("4/5/2012","MDY",2003))
gen treated_post=treated*post

*For matching, we use FF17 instead of FF50
drop famafrench
do famafrench17

joinby famafrench yr qt using IND_MTB_FF17, unmatched(master) update
tab _merge
drop _merge

label var indprc_earn17 "Ind P/E"

bys famafrench: egen negcipos=sum(egcipo)
tab famafrench egcipo


*psmtch for each ff industry
*aggregate several ff industries when those industries do not have enough control IPOs to match with

gen sample=.

foreach i of numlist 7 11 16 17 {
	di "famafrench `i'"
	psmatch2 egcipo lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if famafrench==`i', n(1) logit norepla
	replace sample=_weight if famafrench==`i'
}

gen pscore=_pscore

psmatch2 egcipo lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15, n(1) logit norepla
replace sample=_weight if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15
replace pscore=_pscore if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15


*restrict to the psmatch sample
keep if !missing(sample)
tab egcipo

gen reverse_egcipo=!egcipo


******* TABLE 3, Panel A

est clear
estpost summ lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if egcipo==1, detail  
esttab using psmmatchedsample.csv, cell("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) p50(lab(median) fmt(3)) max(fmt(3)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant replace

estpost summ lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if egcipo==0, detail
esttab using psmmatchedsample.csv, cell("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) p50(lab(median) fmt(3)) max(fmt(3)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant append

estpost ttest lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17, by(reverse_egcipo) 
esttab using psmmatchedsample.csv, cell("b(lab(mean diff) star fmt(3)) t(lab(t-stat) fmt(2))") nonumber nonotes eqlabels("") noconstant label star(* 0.10 ** 0.05 *** 0.01) append


******* TABLE 3, Panel B: OLS

est clear
eststo: xi: reg totfeepct egcbyrev lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==0, robust cluster(ff_yr_qt) 
eststo: xi: reg totfeepct egcbyrev lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==1, robust cluster(ff_yr_qt) 
eststo: xi: reg ir egcbyrev dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==0, robust cluster(ff_yr_qt) 
eststo: xi: reg ir egcbyrev dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==1 , robust cluster(ff_yr_qt) 

esttab using psm_ols.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* TABLE 4: Diff-in-Diff

est clear

eststo: xi: reg acctlegalpct treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg wgspreadpct_new treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg totfeepct treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg ir treated_post treated post dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench , robust cluster(ff_yr_qt) 
eststo: xi: reg totcost treated_post treated post dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
esttab using psm_dd.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* TABLE 5: Regression Discontinuity with SRC (After the Act)

use FINAL_SAMPLE, clear

*restrict the sample to actual EGCs after the Act
keep if egcbyrev==1

gen nosrc=(proceeds>75)
gen x = proceeds-75
gen nosrc_x=nosrc*x

label var nosrc "Non-SRC"
label var x "(Proceeds-75)"
label var nosrc_x "Non-SRC x (Proceeds-75)"
label var ir "Initial Return"
label var proceeds "Proceeds"


est clear
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=50 & proceeds<=100, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=30 & proceeds<=120, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=0 & proceeds<=150, robust cluster(ff_yr_qt) 
esttab using rd_ir.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 2: McCrary Test of Proceeds

preserve
keep if proceeds>=0 & proceeds<=300
DCdensity proceeds, breakpoint(75) generate(Xj Yj r0 fhat se_fhat) 
graph export McCrary.png, replace
restore


******* Figure 3: Regression Discontinuity around SRC Threshold

preserve
drop if ir>100
twoway (scatter ir proceeds, mcolor(gs10) msize(tiny)) ///
(lfit ir proceeds if proceeds<=75, lcolor(navy) lwidth(medthick)) ///
(lfit ir proceeds if proceeds>75, lcolor(maroon) lwidth(medthick)) ///
if proceeds>=50 & proceeds<=100, xline(75, lcolor(gs6) lpattern(dash)) legend(off) xtitle(Proceeds) ytitle(Initial Return (%)) yscale(range(-30,100)) ylabel(-20(20)100)
graph export rd.png, replace
restore


******* TABLE 5: Regression Discontinuity with SRC (Before the Act)
use FINAL_SAMPLE, clear

*restrict the sample to EGC-qualifying IPOs before the Act
keep if egcbyrev==0

gen nosrc=(proceeds>75)
gen x = proceeds-75
gen nosrc_x=nosrc*x

label var nosrc "Non-SRC"
label var x "(Proceeds-75)"
label var nosrc_x "Non-SRC x (Proceeds-75)"
label var ir "Initial Return"
label var proceeds "Proceeds"


est clear
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=50 & proceeds<=100, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=30 & proceeds<=120, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=0 & proceeds<=150, robust cluster(ff_yr_qt) 
esttab using rd_ir_preAct.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 2: McCrary Test of Proceeds

preserve
keep if proceeds>=0 & proceeds<=300
DCdensity proceeds, breakpoint(75) generate(Xj Yj r0 fhat se_fhat) 
graph export McCrary_preAct.png, replace
restore


******* Figure 3: Regression Discontinuity around SRC Threshold

preserve
drop if ir>100
twoway (scatter ir proceeds, mcolor(gs10) msize(tiny)) ///
(lfit ir proceeds if proceeds<=75, lcolor(navy) lwidth(medthick)) ///
(lfit ir proceeds if proceeds>75, lcolor(maroon) lwidth(medthick)) ///
if proceeds>=50 & proceeds<=100, xline(75, lcolor(gs6) lpattern(dash)) legend(off) xtitle(Proceeds) ytitle(Initial Return (%)) yscale(range(-30,100)) ylabel(-20(20)100)
graph export rd_preAct.png, replace
restore


******* Table 6: JOBS Act Provisions

use FINAL_SAMPLE, clear

keep if egcipo==1

gen ttw_yes=1 if  testwaters==1 & egcatipo==1
replace ttw_yes=0 if  testwaters==0 & egcatipo==1
replace ttw_yes=0 if  testwaters==-1 & egcatipo==1

gen ttw_no=1 if testwaters==0 & egcatipo==1
replace ttw_no=0 if testwaters==1 & egcatipo==1
replace ttw_no=0 if testwaters==-1 & egcatipo==1

gen ttw_yesmay=1 if testwaters==1  & egcatipo==1
replace ttw_yesmay=1 if testwaters==-1 & egcatipo==1
replace ttw_yesmay=0 if testwaters==0 & egcatipo==1

gen soxvoted_yes=0
replace soxvoted_yes=1 if sox_yes==1
replace soxvoted_yes=1 if voted_yes==1

gen soxvoted_no=0
replace soxvoted_no=1 if sox_no==1
replace soxvoted_no=1 if voted_no==1

gen soxvoted_yesmay=0
replace soxvoted_yesmay=1 if sox_yes==1
replace soxvoted_yesmay=1 if sox_may==1
replace soxvoted_yesmay=1 if voted_yes==1
replace soxvoted_yesmay=1 if voted_may==1

gen egcchoice_yes=confidential_yes+sox_yes+execcomp_yes+voted_yes+newrule_yes+financial_yes+ttw_yes
gen egcchoice_no=confidential_no+sox_no+execcomp_no+voted_no+newrule_no+financial_no+ttw_no
gen egcchoice_may=sox_may+execcomp_may+voted_may+newrule_may+financial_may
gen egcchoice_yesmay=confidential_yesmay+sox_yesmay+execcomp_yesmay+voted_yesmay+newrule_yesmay+financial_yesmay+ttw_yesmay


gen period=.
replace period=1 if idate>=date("4/5/2012","MDY",2012) & idate<date("4/4/2013","MDY",2012)
replace period=2 if idate>=date("4/5/2013","MDY",2012) & idate<date("4/4/2014","MDY",2012)
replace period=3 if idate>=date("4/5/2014","MDY",2012) & idate<date("4/30/2015","MDY",2012)


tab confidential if egcatipo==1 
bys period: tab confidential if egcatipo==1 

tab testwaters if egcatipo==1 
bys period: tab testwaters if egcatipo==1 

tab financial if egcatipo==1 
bys period: tab financial if egcatipo==1 

tab execcomp if egcatipo==1 
bys period: tab execcomp if egcatipo==1 

tab sox if egcatipo==1 
bys period: tab sox if egcatipo==1 

tab voted if egcatipo==1 
bys period: tab voted if egcatipo==1 

tab newrule if egcatipo==1 
bys period: tab newrule if egcatipo==1 

tabstat egcchoice_may if egcatipo==1
tabstat egcchoice_may if egcatipo==1,  by(period)

tabstat egcchoice_no if egcatipo==1
tabstat egcchoice_no if egcatipo==1, by(period)

tabstat egcchoice_yes if egcatipo==1
tabstat egcchoice_yes if egcatipo==1, by(period)



******* Table 7: Determinants of Disclosure Choices

label var egcchoice_no "Number of 'No' Choices"

joinby sic using HIGHTECH, unmatched(master)
tab _merge
drop _merge
replace hightech=0 if missing(hightech)

drop famafrench
gen famafrench=1
replace famafrench=2 if hightech==1
replace famafrench=3 if dum_biopharma==1

est clear

eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh, robust 
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.period, robust  
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.famafrench, robust  
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.famafrench i.period, robust 

esttab using disclosure.csv, pr2 ar2 notes eqlabels("") nonumber replace depvars star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 1 & Table 1: Sample of IPOs

use FINAL_SAMPLE, clear
drop mo qt
gen mo=month(idate)
gen qt=1 if mo==1|mo==2|mo==3
replace qt=2 if mo==4|mo==5|mo==6
replace qt=3 if mo==7|mo==8|mo==9
replace qt=4 if mo==10|mo==11|mo==12
gen ipo=1
gen control=(egcbyrev==0)
gen egcc=(egcbyrev==1)
gen nonq=(missing(egcbyrev))
gen nonsrc=(src==0)
collapse (sum) ipo control egcc nonq src nonsrc, by(yr qt)
browse



******* Figure 4: Residual IR 

use FINAL_SAMPLE, clear

keep if !missing(egcbyrev)

xi: reg ir dp lnproceeds_res unprofitable lnage avrg_uwmktsh diffdate nasdaq90d nreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
predict ir_res, res

drop mo qt
gen mo=month(idate)
gen qt=1 if mo==1|mo==2|mo==3
replace qt=2 if mo==4|mo==5|mo==6
replace qt=3 if mo==7|mo==8|mo==9
replace qt=4 if mo==10|mo==11|mo==12

collapse (count) nipos=ir (mean) ir_res, by(yr)
browse


clear
set more off


*************************************************************************************
* to run the code for all our analyses below, the following three datasets are needed
* FINAL_SAMPLE: our main dataset with IPO, EGC, all financial data
* IND_MTB_FF17: Industry M/B and P/E data at the famafrench 17 industry levels
* HIGHTECH: SIC codes for hightech industries 
*************************************************************************************


******* TABLE 2: Sumary Statistics

use FINAL_SAMPLE, clear

* three sets of IPO firms
* egcbyrev==1, Actual EGC IPOs "after" the Act
* egcbyrev==0, EGC-qualifying IPOs "before" the Act
* egcbyrev==. (missing), all other IPOs that do not qaulity EGC status

keep if !missing(egcbyrev)

*mean and median difference test results are by default [egcbyrev==0 - egcbyrec==1], so reverse the order on purpose
*to get results for [egcbyrev==1 - egcbyrec==0]
gen reverse_egcbyrev=!egcbyrev


est clear
estpost summ sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n acctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter if egcbyrev==1, detail  
esttab using full_summ_byEGC.csv, cell("mean(fmt(2)) p50(lab(median)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant replace

estpost summ sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n acctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter if egcbyrev==0, detail
esttab using full_summ_byEGC.csv, cell("mean(fmt(2)) p50(lab(median)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant append

*mean difference test
estpost ttest sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n wacctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter , by(reverse_egcbyrev) 
esttab using full_summ_byEGC.csv, cell("b(lab(mean diff) star fmt(2))") nonumber nonotes eqlabels("") noconstant label star(* 0.10 ** 0.05 *** 0.01) append

*median difference test
median sale, by(reverse_egcbyrev)
median sale_CPIadj1, by(reverse_egcbyrev)
median asset, by(reverse_egcbyrev)
median booklev, by(reverse_egcbyrev)
median ppenet_asset, by(reverse_egcbyrev)
median rnd_asset, by(reverse_egcbyrev)
median drnd, by(reverse_egcbyrev)
median salegr, by(reverse_egcbyrev)
median age, by(reverse_egcbyrev)
median unprofitable, by(reverse_egcbyrev)
median dum_VC, by(reverse_egcbyrev)
median proceeds, by(reverse_egcbyrev)
median proceeds_CPIadj1, by(reverse_egcbyrev)
median avrg_uwmktsh, by(reverse_egcbyrev)
median diffdate, by(reverse_egcbyrev)
median dp, by(reverse_egcbyrev)
median dp_p, by(reverse_egcbyrev)
median acctlegalpct, by(reverse_egcbyrev)
median wgspreadpct_new, by(reverse_egcbyrev)
median totfeepct, by(reverse_egcbyrev)
median ir, by(reverse_egcbyrev)
median totcost, by(reverse_egcbyrev)
median nasdaq90d, by(reverse_egcbyrev)
median nreg_filter, by(reverse_egcbyrev)


******* TABLE 3 & 4: Propensity Score Matching + OLS or Diff-in-diff

use FINAL_SAMPLE, clear

keep if !missing(egcbyrev)

drop if missing(acctlegalpct) & egcatipo!=1
drop if missing(wgspreadpct_new) & egcatipo!=1 
drop if missing(dp)  & egcatipo!=1

gen treated=(src==0)
gen post=(idate>=date("4/5/2012","MDY",2003))
gen treated_post=treated*post

*For matching, we use FF17 instead of FF50
drop famafrench
do famafrench17

joinby famafrench yr qt using IND_MTB_FF17, unmatched(master) update
tab _merge
drop _merge

label var indprc_earn17 "Ind P/E"

bys famafrench: egen negcipos=sum(egcipo)
tab famafrench egcipo


*psmtch for each ff industry
*aggregate several ff industries when those industries do not have enough control IPOs to match with

gen sample=.

foreach i of numlist 7 11 16 17 {
	di "famafrench `i'"
	psmatch2 egcipo lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if famafrench==`i', n(1) logit norepla
	replace sample=_weight if famafrench==`i'
}

gen pscore=_pscore

psmatch2 egcipo lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15, n(1) logit norepla
replace sample=_weight if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15
replace pscore=_pscore if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15


*restrict to the psmatch sample
keep if !missing(sample)
tab egcipo

gen reverse_egcipo=!egcipo


******* TABLE 3, Panel A

est clear
estpost summ lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if egcipo==1, detail  
esttab using psmmatchedsample.csv, cell("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) p50(lab(median) fmt(3)) max(fmt(3)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant replace

estpost summ lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if egcipo==0, detail
esttab using psmmatchedsample.csv, cell("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) p50(lab(median) fmt(3)) max(fmt(3)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant append

estpost ttest lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17, by(reverse_egcipo) 
esttab using psmmatchedsample.csv, cell("b(lab(mean diff) star fmt(3)) t(lab(t-stat) fmt(2))") nonumber nonotes eqlabels("") noconstant label star(* 0.10 ** 0.05 *** 0.01) append


******* TABLE 3, Panel B: OLS

est clear
eststo: xi: reg totfeepct egcbyrev lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==0, robust cluster(ff_yr_qt) 
eststo: xi: reg totfeepct egcbyrev lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==1, robust cluster(ff_yr_qt) 
eststo: xi: reg ir egcbyrev dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==0, robust cluster(ff_yr_qt) 
eststo: xi: reg ir egcbyrev dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==1 , robust cluster(ff_yr_qt) 

esttab using psm_ols.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* TABLE 4: Diff-in-Diff

est clear

eststo: xi: reg acctlegalpct treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg wgspreadpct_new treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg totfeepct treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg ir treated_post treated post dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench , robust cluster(ff_yr_qt) 
eststo: xi: reg totcost treated_post treated post dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
esttab using psm_dd.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* TABLE 5: Regression Discontinuity with SRC (After the Act)

use FINAL_SAMPLE, clear

*restrict the sample to actual EGCs after the Act
keep if egcbyrev==1

gen nosrc=(proceeds>75)
gen x = proceeds-75
gen nosrc_x=nosrc*x

label var nosrc "Non-SRC"
label var x "(Proceeds-75)"
label var nosrc_x "Non-SRC x (Proceeds-75)"
label var ir "Initial Return"
label var proceeds "Proceeds"


est clear
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=50 & proceeds<=100, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=30 & proceeds<=120, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=0 & proceeds<=150, robust cluster(ff_yr_qt) 
esttab using rd_ir.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 2: McCrary Test of Proceeds

preserve
keep if proceeds>=0 & proceeds<=300
DCdensity proceeds, breakpoint(75) generate(Xj Yj r0 fhat se_fhat) 
graph export McCrary.png, replace
restore


******* Figure 3: Regression Discontinuity around SRC Threshold

preserve
drop if ir>100
twoway (scatter ir proceeds, mcolor(gs10) msize(tiny)) ///
(lfit ir proceeds if proceeds<=75, lcolor(navy) lwidth(medthick)) ///
(lfit ir proceeds if proceeds>75, lcolor(maroon) lwidth(medthick)) ///
if proceeds>=50 & proceeds<=100, xline(75, lcolor(gs6) lpattern(dash)) legend(off) xtitle(Proceeds) ytitle(Initial Return (%)) yscale(range(-30,100)) ylabel(-20(20)100)
graph export rd.png, replace
restore


******* TABLE 5: Regression Discontinuity with SRC (Before the Act)
use FINAL_SAMPLE, clear

*restrict the sample to EGC-qualifying IPOs before the Act
keep if egcbyrev==0

gen nosrc=(proceeds>75)
gen x = proceeds-75
gen nosrc_x=nosrc*x

label var nosrc "Non-SRC"
label var x "(Proceeds-75)"
label var nosrc_x "Non-SRC x (Proceeds-75)"
label var ir "Initial Return"
label var proceeds "Proceeds"


est clear
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=50 & proceeds<=100, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=30 & proceeds<=120, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=0 & proceeds<=150, robust cluster(ff_yr_qt) 
esttab using rd_ir_preAct.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 2: McCrary Test of Proceeds

preserve
keep if proceeds>=0 & proceeds<=300
DCdensity proceeds, breakpoint(75) generate(Xj Yj r0 fhat se_fhat) 
graph export McCrary_preAct.png, replace
restore


******* Figure 3: Regression Discontinuity around SRC Threshold

preserve
drop if ir>100
twoway (scatter ir proceeds, mcolor(gs10) msize(tiny)) ///
(lfit ir proceeds if proceeds<=75, lcolor(navy) lwidth(medthick)) ///
(lfit ir proceeds if proceeds>75, lcolor(maroon) lwidth(medthick)) ///
if proceeds>=50 & proceeds<=100, xline(75, lcolor(gs6) lpattern(dash)) legend(off) xtitle(Proceeds) ytitle(Initial Return (%)) yscale(range(-30,100)) ylabel(-20(20)100)
graph export rd_preAct.png, replace
restore


******* Table 6: JOBS Act Provisions

use FINAL_SAMPLE, clear

keep if egcipo==1

gen ttw_yes=1 if  testwaters==1 & egcatipo==1
replace ttw_yes=0 if  testwaters==0 & egcatipo==1
replace ttw_yes=0 if  testwaters==-1 & egcatipo==1

gen ttw_no=1 if testwaters==0 & egcatipo==1
replace ttw_no=0 if testwaters==1 & egcatipo==1
replace ttw_no=0 if testwaters==-1 & egcatipo==1

gen ttw_yesmay=1 if testwaters==1  & egcatipo==1
replace ttw_yesmay=1 if testwaters==-1 & egcatipo==1
replace ttw_yesmay=0 if testwaters==0 & egcatipo==1

gen soxvoted_yes=0
replace soxvoted_yes=1 if sox_yes==1
replace soxvoted_yes=1 if voted_yes==1

gen soxvoted_no=0
replace soxvoted_no=1 if sox_no==1
replace soxvoted_no=1 if voted_no==1

gen soxvoted_yesmay=0
replace soxvoted_yesmay=1 if sox_yes==1
replace soxvoted_yesmay=1 if sox_may==1
replace soxvoted_yesmay=1 if voted_yes==1
replace soxvoted_yesmay=1 if voted_may==1

gen egcchoice_yes=confidential_yes+sox_yes+execcomp_yes+voted_yes+newrule_yes+financial_yes+ttw_yes
gen egcchoice_no=confidential_no+sox_no+execcomp_no+voted_no+newrule_no+financial_no+ttw_no
gen egcchoice_may=sox_may+execcomp_may+voted_may+newrule_may+financial_may
gen egcchoice_yesmay=confidential_yesmay+sox_yesmay+execcomp_yesmay+voted_yesmay+newrule_yesmay+financial_yesmay+ttw_yesmay


gen period=.
replace period=1 if idate>=date("4/5/2012","MDY",2012) & idate<date("4/4/2013","MDY",2012)
replace period=2 if idate>=date("4/5/2013","MDY",2012) & idate<date("4/4/2014","MDY",2012)
replace period=3 if idate>=date("4/5/2014","MDY",2012) & idate<date("4/30/2015","MDY",2012)


tab confidential if egcatipo==1 
bys period: tab confidential if egcatipo==1 

tab testwaters if egcatipo==1 
bys period: tab testwaters if egcatipo==1 

tab financial if egcatipo==1 
bys period: tab financial if egcatipo==1 

tab execcomp if egcatipo==1 
bys period: tab execcomp if egcatipo==1 

tab sox if egcatipo==1 
bys period: tab sox if egcatipo==1 

tab voted if egcatipo==1 
bys period: tab voted if egcatipo==1 

tab newrule if egcatipo==1 
bys period: tab newrule if egcatipo==1 

tabstat egcchoice_may if egcatipo==1
tabstat egcchoice_may if egcatipo==1,  by(period)

tabstat egcchoice_no if egcatipo==1
tabstat egcchoice_no if egcatipo==1, by(period)

tabstat egcchoice_yes if egcatipo==1
tabstat egcchoice_yes if egcatipo==1, by(period)



******* Table 7: Determinants of Disclosure Choices

label var egcchoice_no "Number of 'No' Choices"

joinby sic using HIGHTECH, unmatched(master)
tab _merge
drop _merge
replace hightech=0 if missing(hightech)

drop famafrench
gen famafrench=1
replace famafrench=2 if hightech==1
replace famafrench=3 if dum_biopharma==1

est clear

eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh, robust 
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.period, robust  
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.famafrench, robust  
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.famafrench i.period, robust 

esttab using disclosure.csv, pr2 ar2 notes eqlabels("") nonumber replace depvars star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 1 & Table 1: Sample of IPOs

use FINAL_SAMPLE, clear
drop mo qt
gen mo=month(idate)
gen qt=1 if mo==1|mo==2|mo==3
replace qt=2 if mo==4|mo==5|mo==6
replace qt=3 if mo==7|mo==8|mo==9
replace qt=4 if mo==10|mo==11|mo==12
gen ipo=1
gen control=(egcbyrev==0)
gen egcc=(egcbyrev==1)
gen nonq=(missing(egcbyrev))
gen nonsrc=(src==0)
collapse (sum) ipo control egcc nonq src nonsrc, by(yr qt)
browse



******* Figure 4: Residual IR 

use FINAL_SAMPLE, clear

keep if !missing(egcbyrev)

xi: reg ir dp lnproceeds_res unprofitable lnage avrg_uwmktsh diffdate nasdaq90d nreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
predict ir_res, res

drop mo qt
gen mo=month(idate)
gen qt=1 if mo==1|mo==2|mo==3
replace qt=2 if mo==4|mo==5|mo==6
replace qt=3 if mo==7|mo==8|mo==9
replace qt=4 if mo==10|mo==11|mo==12

collapse (count) nipos=ir (mean) ir_res, by(yr)
browse


clear
set more off


*************************************************************************************
* to run the code for all our analyses below, the following three datasets are needed
* FINAL_SAMPLE: our main dataset with IPO, EGC, all financial data
* IND_MTB_FF17: Industry M/B and P/E data at the famafrench 17 industry levels
* HIGHTECH: SIC codes for hightech industries 
*************************************************************************************


******* TABLE 2: Sumary Statistics

use FINAL_SAMPLE, clear

* three sets of IPO firms
* egcbyrev==1, Actual EGC IPOs "after" the Act
* egcbyrev==0, EGC-qualifying IPOs "before" the Act
* egcbyrev==. (missing), all other IPOs that do not qaulity EGC status

keep if !missing(egcbyrev)

*mean and median difference test results are by default [egcbyrev==0 - egcbyrec==1], so reverse the order on purpose
*to get results for [egcbyrev==1 - egcbyrec==0]
gen reverse_egcbyrev=!egcbyrev


est clear
estpost summ sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n acctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter if egcbyrev==1, detail  
esttab using full_summ_byEGC.csv, cell("mean(fmt(2)) p50(lab(median)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant replace

estpost summ sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n acctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter if egcbyrev==0, detail
esttab using full_summ_byEGC.csv, cell("mean(fmt(2)) p50(lab(median)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant append

*mean difference test
estpost ttest sale sale_CPIadj1 asset booklev ppenet_asset rnd_asset drnd salegr age unprofitable dum_VC ///
proceeds proceeds_CPIadj1 avrg_uwmktsh diffdate dp_p dp_n wacctlegalpct wgspreadpct_new totfeepct ir totcost ///
nasdaq90d nreg_filter , by(reverse_egcbyrev) 
esttab using full_summ_byEGC.csv, cell("b(lab(mean diff) star fmt(2))") nonumber nonotes eqlabels("") noconstant label star(* 0.10 ** 0.05 *** 0.01) append

*median difference test
median sale, by(reverse_egcbyrev)
median sale_CPIadj1, by(reverse_egcbyrev)
median asset, by(reverse_egcbyrev)
median booklev, by(reverse_egcbyrev)
median ppenet_asset, by(reverse_egcbyrev)
median rnd_asset, by(reverse_egcbyrev)
median drnd, by(reverse_egcbyrev)
median salegr, by(reverse_egcbyrev)
median age, by(reverse_egcbyrev)
median unprofitable, by(reverse_egcbyrev)
median dum_VC, by(reverse_egcbyrev)
median proceeds, by(reverse_egcbyrev)
median proceeds_CPIadj1, by(reverse_egcbyrev)
median avrg_uwmktsh, by(reverse_egcbyrev)
median diffdate, by(reverse_egcbyrev)
median dp, by(reverse_egcbyrev)
median dp_p, by(reverse_egcbyrev)
median acctlegalpct, by(reverse_egcbyrev)
median wgspreadpct_new, by(reverse_egcbyrev)
median totfeepct, by(reverse_egcbyrev)
median ir, by(reverse_egcbyrev)
median totcost, by(reverse_egcbyrev)
median nasdaq90d, by(reverse_egcbyrev)
median nreg_filter, by(reverse_egcbyrev)


******* TABLE 3 & 4: Propensity Score Matching + OLS or Diff-in-diff

use FINAL_SAMPLE, clear

keep if !missing(egcbyrev)

drop if missing(acctlegalpct) & egcatipo!=1
drop if missing(wgspreadpct_new) & egcatipo!=1 
drop if missing(dp)  & egcatipo!=1

gen treated=(src==0)
gen post=(idate>=date("4/5/2012","MDY",2003))
gen treated_post=treated*post

*For matching, we use FF17 instead of FF50
drop famafrench
do famafrench17

joinby famafrench yr qt using IND_MTB_FF17, unmatched(master) update
tab _merge
drop _merge

label var indprc_earn17 "Ind P/E"

bys famafrench: egen negcipos=sum(egcipo)
tab famafrench egcipo


*psmtch for each ff industry
*aggregate several ff industries when those industries do not have enough control IPOs to match with

gen sample=.

foreach i of numlist 7 11 16 17 {
	di "famafrench `i'"
	psmatch2 egcipo lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if famafrench==`i', n(1) logit norepla
	replace sample=_weight if famafrench==`i'
}

gen pscore=_pscore

psmatch2 egcipo lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15, n(1) logit norepla
replace sample=_weight if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15
replace pscore=_pscore if famafrench==1 | famafrench==2 | famafrench==3 | famafrench==5 |  famafrench==6 | famafrench==8 | famafrench==12 |  famafrench==13 |  famafrench==14 | famafrench==15


*restrict to the psmatch sample
keep if !missing(sample)
tab egcipo

gen reverse_egcipo=!egcipo


******* TABLE 3, Panel A

est clear
estpost summ lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if egcipo==1, detail  
esttab using psmmatchedsample.csv, cell("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) p50(lab(median) fmt(3)) max(fmt(3)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant replace

estpost summ lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17 if egcipo==0, detail
esttab using psmmatchedsample.csv, cell("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) p50(lab(median) fmt(3)) max(fmt(3)) count(fmt(0))") label nonumber nonotes eqlabels("") noconstant append

estpost ttest lnproceeds lnsale unprofitable salegr lnage booklev ppenet_asset rnd_asset avrg_brmktsh nasdaq90d indprc_earn17, by(reverse_egcipo) 
esttab using psmmatchedsample.csv, cell("b(lab(mean diff) star fmt(3)) t(lab(t-stat) fmt(2))") nonumber nonotes eqlabels("") noconstant label star(* 0.10 ** 0.05 *** 0.01) append


******* TABLE 3, Panel B: OLS

est clear
eststo: xi: reg totfeepct egcbyrev lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==0, robust cluster(ff_yr_qt) 
eststo: xi: reg totfeepct egcbyrev lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==1, robust cluster(ff_yr_qt) 
eststo: xi: reg ir egcbyrev dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==0, robust cluster(ff_yr_qt) 
eststo: xi: reg ir egcbyrev dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench if src==1 , robust cluster(ff_yr_qt) 

esttab using psm_ols.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* TABLE 4: Diff-in-Diff

est clear

eststo: xi: reg acctlegalpct treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg wgspreadpct_new treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg totfeepct treated_post treated post lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
eststo: xi: reg ir treated_post treated post dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench , robust cluster(ff_yr_qt) 
eststo: xi: reg totcost treated_post treated post dp_p dp_n lnproceeds_res unprofitable drnd lnage avrg_brmktsh lndiffdate nasdaq90d lnnreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
esttab using psm_dd.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* TABLE 5: Regression Discontinuity with SRC (After the Act)

use FINAL_SAMPLE, clear

*restrict the sample to actual EGCs after the Act
keep if egcbyrev==1

gen nosrc=(proceeds>75)
gen x = proceeds-75
gen nosrc_x=nosrc*x

label var nosrc "Non-SRC"
label var x "(Proceeds-75)"
label var nosrc_x "Non-SRC x (Proceeds-75)"
label var ir "Initial Return"
label var proceeds "Proceeds"


est clear
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=50 & proceeds<=100, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=30 & proceeds<=120, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=0 & proceeds<=150, robust cluster(ff_yr_qt) 
esttab using rd_ir.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 2: McCrary Test of Proceeds

preserve
keep if proceeds>=0 & proceeds<=300
DCdensity proceeds, breakpoint(75) generate(Xj Yj r0 fhat se_fhat) 
graph export McCrary.png, replace
restore


******* Figure 3: Regression Discontinuity around SRC Threshold

preserve
drop if ir>100
twoway (scatter ir proceeds, mcolor(gs10) msize(tiny)) ///
(lfit ir proceeds if proceeds<=75, lcolor(navy) lwidth(medthick)) ///
(lfit ir proceeds if proceeds>75, lcolor(maroon) lwidth(medthick)) ///
if proceeds>=50 & proceeds<=100, xline(75, lcolor(gs6) lpattern(dash)) legend(off) xtitle(Proceeds) ytitle(Initial Return (%)) yscale(range(-30,100)) ylabel(-20(20)100)
graph export rd.png, replace
restore


******* TABLE 5: Regression Discontinuity with SRC (Before the Act)
use FINAL_SAMPLE, clear

*restrict the sample to EGC-qualifying IPOs before the Act
keep if egcbyrev==0

gen nosrc=(proceeds>75)
gen x = proceeds-75
gen nosrc_x=nosrc*x

label var nosrc "Non-SRC"
label var x "(Proceeds-75)"
label var nosrc_x "Non-SRC x (Proceeds-75)"
label var ir "Initial Return"
label var proceeds "Proceeds"


est clear
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=50 & proceeds<=100, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=30 & proceeds<=120, robust cluster(ff_yr_qt) 
eststo: xi: reg ir nosrc x nosrc_x unprofitable drnd lnage lndiffdate nasdaq90d lnnreg_filter i.famafrench if proceeds>=0 & proceeds<=150, robust cluster(ff_yr_qt) 
esttab using rd_ir_preAct.csv, pr2 ar2 nonotes eqlabels("") nonumber noconstant replace depvars drop(_I*) star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 2: McCrary Test of Proceeds

preserve
keep if proceeds>=0 & proceeds<=300
DCdensity proceeds, breakpoint(75) generate(Xj Yj r0 fhat se_fhat) 
graph export McCrary_preAct.png, replace
restore


******* Figure 3: Regression Discontinuity around SRC Threshold

preserve
drop if ir>100
twoway (scatter ir proceeds, mcolor(gs10) msize(tiny)) ///
(lfit ir proceeds if proceeds<=75, lcolor(navy) lwidth(medthick)) ///
(lfit ir proceeds if proceeds>75, lcolor(maroon) lwidth(medthick)) ///
if proceeds>=50 & proceeds<=100, xline(75, lcolor(gs6) lpattern(dash)) legend(off) xtitle(Proceeds) ytitle(Initial Return (%)) yscale(range(-30,100)) ylabel(-20(20)100)
graph export rd_preAct.png, replace
restore


******* Table 6: JOBS Act Provisions

use FINAL_SAMPLE, clear

keep if egcipo==1

gen ttw_yes=1 if  testwaters==1 & egcatipo==1
replace ttw_yes=0 if  testwaters==0 & egcatipo==1
replace ttw_yes=0 if  testwaters==-1 & egcatipo==1

gen ttw_no=1 if testwaters==0 & egcatipo==1
replace ttw_no=0 if testwaters==1 & egcatipo==1
replace ttw_no=0 if testwaters==-1 & egcatipo==1

gen ttw_yesmay=1 if testwaters==1  & egcatipo==1
replace ttw_yesmay=1 if testwaters==-1 & egcatipo==1
replace ttw_yesmay=0 if testwaters==0 & egcatipo==1

gen soxvoted_yes=0
replace soxvoted_yes=1 if sox_yes==1
replace soxvoted_yes=1 if voted_yes==1

gen soxvoted_no=0
replace soxvoted_no=1 if sox_no==1
replace soxvoted_no=1 if voted_no==1

gen soxvoted_yesmay=0
replace soxvoted_yesmay=1 if sox_yes==1
replace soxvoted_yesmay=1 if sox_may==1
replace soxvoted_yesmay=1 if voted_yes==1
replace soxvoted_yesmay=1 if voted_may==1

gen egcchoice_yes=confidential_yes+sox_yes+execcomp_yes+voted_yes+newrule_yes+financial_yes+ttw_yes
gen egcchoice_no=confidential_no+sox_no+execcomp_no+voted_no+newrule_no+financial_no+ttw_no
gen egcchoice_may=sox_may+execcomp_may+voted_may+newrule_may+financial_may
gen egcchoice_yesmay=confidential_yesmay+sox_yesmay+execcomp_yesmay+voted_yesmay+newrule_yesmay+financial_yesmay+ttw_yesmay


gen period=.
replace period=1 if idate>=date("4/5/2012","MDY",2012) & idate<date("4/4/2013","MDY",2012)
replace period=2 if idate>=date("4/5/2013","MDY",2012) & idate<date("4/4/2014","MDY",2012)
replace period=3 if idate>=date("4/5/2014","MDY",2012) & idate<date("4/30/2015","MDY",2012)


tab confidential if egcatipo==1 
bys period: tab confidential if egcatipo==1 

tab testwaters if egcatipo==1 
bys period: tab testwaters if egcatipo==1 

tab financial if egcatipo==1 
bys period: tab financial if egcatipo==1 

tab execcomp if egcatipo==1 
bys period: tab execcomp if egcatipo==1 

tab sox if egcatipo==1 
bys period: tab sox if egcatipo==1 

tab voted if egcatipo==1 
bys period: tab voted if egcatipo==1 

tab newrule if egcatipo==1 
bys period: tab newrule if egcatipo==1 

tabstat egcchoice_may if egcatipo==1
tabstat egcchoice_may if egcatipo==1,  by(period)

tabstat egcchoice_no if egcatipo==1
tabstat egcchoice_no if egcatipo==1, by(period)

tabstat egcchoice_yes if egcatipo==1
tabstat egcchoice_yes if egcatipo==1, by(period)



******* Table 7: Determinants of Disclosure Choices

label var egcchoice_no "Number of 'No' Choices"

joinby sic using HIGHTECH, unmatched(master)
tab _merge
drop _merge
replace hightech=0 if missing(hightech)

drop famafrench
gen famafrench=1
replace famafrench=2 if hightech==1
replace famafrench=3 if dum_biopharma==1

est clear

eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh, robust 
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.period, robust  
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.famafrench, robust  
eststo: xi: reg egcchoice_no lnproceeds_res unprofitable lnage booklev ppenet_asset rnd_asset avrg_brmktsh i.famafrench i.period, robust 

esttab using disclosure.csv, pr2 ar2 notes eqlabels("") nonumber replace depvars star(* 0.10 ** 0.05 *** 0.01) label b(%9.3f)


******* Figure 1 & Table 1: Sample of IPOs

use FINAL_SAMPLE, clear
drop mo qt
gen mo=month(idate)
gen qt=1 if mo==1|mo==2|mo==3
replace qt=2 if mo==4|mo==5|mo==6
replace qt=3 if mo==7|mo==8|mo==9
replace qt=4 if mo==10|mo==11|mo==12
gen ipo=1
gen control=(egcbyrev==0)
gen egcc=(egcbyrev==1)
gen nonq=(missing(egcbyrev))
gen nonsrc=(src==0)
collapse (sum) ipo control egcc nonq src nonsrc, by(yr qt)
browse



******* Figure 4: Residual IR 

use FINAL_SAMPLE, clear

keep if !missing(egcbyrev)

xi: reg ir dp lnproceeds_res unprofitable lnage avrg_uwmktsh diffdate nasdaq90d nreg_filter crisis i.famafrench, robust cluster(ff_yr_qt) 
predict ir_res, res

drop mo qt
gen mo=month(idate)
gen qt=1 if mo==1|mo==2|mo==3
replace qt=2 if mo==4|mo==5|mo==6
replace qt=3 if mo==7|mo==8|mo==9
replace qt=4 if mo==10|mo==11|mo==12

collapse (count) nipos=ir (mean) ir_res, by(yr)
browse


brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 323kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall