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_60_bdem.do

View on GitHub
********************************************************************************
** BDEM_2_Add_Var_Creation - creation of additional variables for final analyses 												
********************************************************************************

********************************************************************************
** 1. Read in dataset (from SAS) - 3,349 attempted ICOs 
********************************************************************************

use dataset_merged_all_test, clear /*Read in dataset of 3,349 ICOs */

********************************************************************************
** 2. Create / re-label (additional) variables used in main empirical analysis  
********************************************************************************

**** 2A. White paper disclosure variables *****

	*** Create log page count and standardized measure of white paper length
	gen ln_wp_page_count = log(wp_page_count)
	sum wp_page_count, d
	gen wp_norm = (wp_page_count - `r(min)') / (`r(max)'-`r(min)')
	label var wp_norm "Whitepaper Length"
	label var ln_wp_page_count "Whitepaper Length" 

	*** Create combined github/sourcecode indicator variable
	gen github_sourcecode = 1 if sourcecode_ind==1 | github_benchy==1   
	replace github_sourcecode = 0 if github_sourcecode==.
	label var github_sourcecode "Sourcecode Disclosure"

	*** Create technical white paper indicator variable
	gen wp_tech_whitepaper = wp_LaTex
	replace wp_tech_whitepaper = 0 if wp_LaTex==. & wp_page_count!=.
	label var wp_tech_whitepaper "Technical Whitepaper"
		
	*** Create white paper vesting disclosures indicator variable
	gen wp_vesting_ind = 1 if wp_min_Vesting_months>0 & wp_min_Vesting_months!=.
	replace wp_vesting_ind = 0 if wp_min_Vesting_months ==0
	replace wp_vesting_ind = 0 if (wp_min_Vesting_months == . & wp_Div_Dist!=.)
	label var wp_vesting_ind "Token Vesting Disclosure"	

	replace wp_min_Vesting_months=0 if (wp_Div_Dist!=. & wp_min_Vesting_months==.)
	gen wp_vesting_mths = wp_min_Vesting_months
	replace wp_vesting_mths = 0 if (wp_min_Vesting_months ==. & wp_Div_Dist!=.)
	label var wp_vesting_mths "FTAP min vesting (in mths)"
	
	*** Create insider tokens disclosure indicator variable
	gen wp_token_dist_ftap_ind = 1 if( wp_token_dist_FTAP>=0 & wp_Div_Dist!=.)
	replace wp_token_dist_ftap_ind = 0 if (wp_token_dist_FTAP==. & wp_Div_Dist!=.)
	label var wp_token_dist_ftap_ind "Insider Tokens Disclosure"
		
	*** Create use of proceeds disclosure indicator variable 
	replace wp_UOP = 1 if (wp_prod_development_allocation!=. | wp_marketing_allocation!=.)
	replace wp_UOP = 0 if (wp_UOP==. & wp_Div_Dist!=.)
	label var wp_UOP "Use of Proceeds"

	*** Create team identity to indicator (note: team_identity var measure % of ICO team members identified) 
	replace team_identity = 1 if (team_identity>0.25) & team_identity!=.
	replace team_identity = 0 if (team_identity<=0.25) & team_identity!=.
	label var team_identity "ICO Team Identity Disclosures"
		
	*** Create social media presence indicator variable
	gen social_media_presence = 1 if twitter_indicator==1 | telegram_indicator==1
	replace social_media_presence = 0 if social_media_presence == . 
	label var social_media_presence "Social Media Presence"

	** Generate Disclosure Index
	gen tdisc = (wp_UOP + wp_norm + github_sourcecode + wp_tech_whitepaper + wp_product_roadmap_info + team_identity + wp_token_dist_ftap_ind + wp_vesting_ind + video_presentation + social_media_presence) 
	egen tdisc_r = xtile(tdisc), n(10)
	sum tdisc_r, d
	gen tdisc_norm = (tdisc_r - `r(min)') / (`r(max)'-`r(min)')
	label var tdisc_norm "Disclosure Index"


	** Generate Disclosure Index (without vesting & insider tokens disclosure - for cross-sectional tests)
	gen tdisc3 = (wp_UOP + wp_norm + github_sourcecode + wp_tech_whitepaper + wp_product_roadmap_info + team_identity + video_presentation + social_media_presence) 
	egen tdisc3_r = xtile(tdisc3), n(10)
	sum tdisc3_r, d
	gen tdisc3_norm = (tdisc3_r - `r(min)') / (`r(max)'-`r(min)')
	label var tdisc3_norm "Disclosure Index - exc. FTAP & vesting"

	** Prinicpal Components of Disclosure measures
	pca wp_UOP wp_norm github_sourcecode wp_tech_whitepaper wp_product_roadmap_info team_identity wp_token_dist_ftap_ind  wp_vesting_ind video_presentation social_media_presence, mineigen(1) 
	predict pc1 pc2
	sum pc1, d
	label var pc1 "Disclosure PC 1"
	sum pc2, d
	label var pc2 "Disclosure PC 2"
			
			
	**** 2B. Other Controls & Partitioning variables *****
		
	*** Create utility token variable (from WP disclosure / ICO description)
	gen wp_sec_token = 1 if (wp_Div_Dist==1 | wp_Rev_share==1 | wp_BB_and_Burn==1)
	replace wp_sec_token=0 if (wp_sec_token==. & wp_Div_Dist!=.)
	label var wp_sec_token "Security Token"
	gen wp_util_token = 1 if wp_sec_token !=1
	replace wp_util_token = 0 if wp_sec_token==1 
	replace wp_util_token = . if wp_sec_token==.
	label var wp_util_token "Utility Token" 
		
	*** Create log of first day ICO return variables 
	gen ln_ret_1d_open_to_close = ln(ret_1d_open_to_close +1)
	label var ln_ret_1d_open_to_close "First Day ICO return"

			
	*** Create retvol control		
	replace retvol_1w = retvol_1m if retvol_1w==. & retvol_1m!=.
	label var retvol_1w  "volatility 1w"
	gen lretvol_1w = ln(1+retvol_1w)

	*** Create quintile of vesting months for cross-section
	egen vesting_mths_quintile = xtile(wp_min_Vesting_months), n(5)
	replace vesting_mths_quintile = vesting_mths_quintile/5
	label var vesting_mths_quintile "Token Vesting Period"
		

	**** 2C. Rating Variable *****

	** Create normalized variables of ratings (consistent with disclosure index)
	su rating_adj, d
	gen rating_adj_norm = (rating_adj - `r(min)') / (`r(max)'-`r(min)')
	label var rating_adj_norm "Rating (Adjusted)"
			
			
	**** 2D. Long-term outcome measures / controls ***** 

	** Create 6mth returns **
	gen eret_6mp = ret_6mp - eth_ret_6m
	replace eret_6mp = eret_6mp/100
	gen leret_6mp = ln(1+eret_6mp)*100

	** Create failure outcome-variable consistent with Howell et al. (2020)*/
	gen failure = 0 
	replace failure = 1 if Listed==0				
	replace failure = 1 if active_website_ind ==0 	
	replace failure = 1 if (Listed==1 & last_date <= date("01oct2018","DMY")) 


	** Create "Size" control variable (using multiple sources)
	gen mv_raw1 = mv_mm*1000000
	gen mv_raw2 = total_supply_coinmarketcap*close*1000000
	gen mv_raw3 = total_supply_coinmarketcap*close_lag1*1000000
	gen mv_raw4 = total_supply_coinmarketcap*ico_price*1000000
	gen total_sold = tokens_for_sale_icobench*ico_price
	gen total_supply_usd2 = total_supply_usd*1000000
	egen size_temp = rowfirst(mv_raw1 mv_raw2 mv_raw3 mv_raw4 soft_cap_usd_icobench hard_cap_usd_icobench total_sold total_supply_usd2)
	gen size = ln(1+size_temp)

	save dataset_for_analysis, replace
	
**********************************************************************************
******************************************************************
** BDEM_3_Main_Tables - Main regressions reported in manuscript **												**
******************************************************************

set seed 1339487731
use dataset_for_analysis, clear /*Read in dataset for analysis (check: 3,349 ICOs) */
	
********************************************************************************
** MAIN RESULTS - REGRESSIONS    
********************************************************************************

*** Create fixed effects and clustering variables
encode Industry_FE_desc, gen(industry_f)
encode region, gen(region_f)
gen reg_qtr = region_f*qtr_index
tab region_f, gen(reg_ind)
tab industry_f, gen(ind_fe)

*** Define controls and disclosure variables for regressions 
global CONTROLS1 "wp_util_token log_num_members_benchy Soft_cap preico_indicator bonuses_indicator usa_restricted_ind btc_mom_3m"
global DISCLOSURE "ln_wp_page_count wp_tech_whitepaper wp_product_roadmap_info team_identity wp_token_dist_ftap_ind wp_vesting_ind wp_UOP github_sourcecode video_presentation social_media_presence"
global CONTROLS_sec "size lretvol_1w ln_ret_1d_open_to_close"


********************************************************************************
*****																	   *****
*****   Table 4: RAISED ON DISCLOSURE MEASURES 				               *****
*****																	   *****
********************************************************************************;

*********************************
******* PANEL A: RAISED *********
*********************************

**** Column (1): Raised on raw Disclosure Measures 
reghdfe Raised $DISCLOSURE $CONTROLS1, keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)

**** Column (2): Raised on aggregated disclosure measure (decile) 
reghdfe Raised tdisc_norm $CONTROLS1, keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)

**** Column (3): Raised on the first Two Principal Components of Disclosure Index
reghdfe Raised pc1 pc2 $CONTROLS1, keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)


*********************************
******* PANEL B: USD Raised  ****
*********************************
	
**** Column (1): Log USD Raised on raw Disclosure Measures 
reghdfe log_usdraise $DISCLOSURE $CONTROLS1 if log_usdraise!=0, keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr) 

**** Column (2): Log USD Raised on aggregated disclosure measure (decile) 
reghdfe log_usdraise tdisc_norm $CONTROLS1 if log_usdraise!=0,  keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr) 

**** Column (3): Log USD Raised on the first Two Principal Components of Disclosure Index
reghdfe log_usdraise pc1 pc2 $CONTROLS1 if log_usdraise!=0, keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)



********************************************************************************
*****																	   *****
*****   Table 5: Cross-Sectional results: Internal Governance              *****
*****																	   *****
********************************************************************************

**** Column (1): Interaction with vesting indicator
reghdfe Raised c.tdisc3_norm##c.wp_vesting_ind $CONTROLS1,  keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr) 

**** Column (2): Interaction with vesting months 
reghdfe Raised c.tdisc3_norm##c.vesting_mths_quintile $CONTROLS1,  keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr) 



********************************************************************************
*****																	   *****
*****   Table 6: Cross-Sectional results: Information Intermediaries       *****
*****																	   *****
********************************************************************************
			
*** Column (1): Determinants of being rated
reghdfe rating_ind tdisc_norm $CONTROLS1, keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)
		
*** Column (2): Rating (continuous) on disclosure index
reghdfe rating_adj_norm tdisc_norm $CONTROLS1, keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)

*** Column (3): Continuous rating on predicting Failure (note - run on sample with tdisc_norm not missing)
reghdfe failure rating_adj_norm $CONTROLS1 if tdisc_norm!=., keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)

*** Column (4): Continuous rating on 6mth returns
winsor2 leret_6mp, replace cuts(0 99) 	/* NOTE: winsorize extreme returns. This does not impact inferences */ 
reghdfe leret_6mp rating_adj_norm $CONTROLS1 $CONTROLS_sec if (tdisc_norm!=. & Listed==1), keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr)

**** Column (5): Raised on tdisc_norm interact with Rating Indicator 
reghdfe Raised c.tdisc_norm##c.rating_ind $CONTROLS1,  keepsingletons a(region_f industry_f qtr_index) cl(reg_qtr) 

********************************************************************************
************************        END			************************************
********************************************************************************





















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