Skip to content
cccskills
FreePublished on GitHub

stata-accounting-research

Find STATA code examples for empirical accounting research from published replication files. Adapt regression, matching, event study, and table export syntax to your variables, with citations to the papers behind each example.

OriginalShow the original description

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.

Run score Not tested

See how to install

Good for

  • Implement fixed effects regressions in STATA
  • Find published DiD and matching code examples
  • Export regression results as formatted tables
  • Adapt published code to your variable names

Files included (129)

  • SKILL.md4.8 KB
  • README-original.md2.9 KB
  • references/JAR_55_bbcl.do59.1 KB
  • references/JAR_55_chaplinksy-hanley-moon.do46.3 KB
  • references/JAR_55_clm.do95.1 KB
  • references/JAR_55_elw.do58.0 KB
  • references/JAR_55_hlsw.do104.1 KB
  • references/JAR_55_kks.do365.5 KB
  • references/JAR_55_lzz.do25.5 KB
  • references/JAR_55_madsen.do307.5 KB
  • references/JAR_55_mr.do41.5 KB
  • references/JAR_56_al.do75.3 KB
  • references/JAR_56_bch.do13.5 KB
  • references/JAR_56_blv.do24.6 KB
  • references/JAR_56_csmw.do27.6 KB
  • references/JAR_56_en.do21.2 KB
  • references/JAR_56_granja.do107.9 KB
  • references/JAR_56_htw.do18.6 KB
  • references/JAR_56_kmt.do5.6 KB
  • references/JAR_56_ksvw.do8.0 KB
  • references/JAR_56_llz.do3.1 KB
  • references/JAR_56_ls.do147.5 KB
  • references/JAR_56_lv2018.do123.7 KB
  • references/JAR_57_bht.do24.4 KB
  • references/JAR_57_bl.do22.6 KB
  • references/JAR_57_bw.do263.2 KB
  • references/JAR_57_cct.do347.1 KB
  • references/JAR_57_cgw.do195.8 KB
  • references/JAR_57_hcp.do38.0 KB
  • references/JAR_57_honigsberg.do99.5 KB
  • references/JAR_57_lehmann.do112.8 KB
  • references/JAR_57_lm.do85.5 KB
  • references/JAR_58_bsz.do36.9 KB
  • references/JAR_58_ckm.do52.3 KB
  • references/JAR_58_eyring.do58.1 KB
  • references/JAR_58_gj.do187.5 KB
  • references/JAR_58_gsz.do121.6 KB
  • references/JAR_58_htyz.do30.9 KB
  • references/JAR_58_jansen.do99.5 KB
  • references/JAR_58_joshi.do43.0 KB
  • references/JAR_58_kvy.do19.5 KB
  • references/JAR_58_msz.do35.0 KB
  • references/JAR_58_rauter.do433.2 KB
  • references/JAR_58_wy.do64.5 KB
  • references/JAR_58_zz.do125.5 KB
  • references/JAR_59_breuer.do826.9 KB
  • references/JAR_59_ctv.do383.7 KB
  • references/JAR_59_dess.do78.4 KB
  • references/JAR_59_hmo.do351.6 KB
  • references/JAR_60_abkp.do129.9 KB
  • references/JAR_60_alv.do35.4 KB
  • references/JAR_60_at.do38.5 KB
  • references/JAR_60_barrios.do119.6 KB
  • references/JAR_60_bbin.do72.9 KB
  • references/JAR_60_bdem.do11.6 KB
  • references/JAR_60_bl.do43.5 KB
  • references/JAR_60_bmsw.do7.7 KB
  • references/JAR_60_cc.do20.1 KB
  • references/JAR_60_cpss.do15.4 KB
  • references/JAR_60_cstv.do175.3 KB
  • references/JAR_60_dg.do19.9 KB
  • references/JAR_60_duguay.do8.0 KB
  • references/JAR_60_fhl.do71.3 KB
  • references/JAR_60_gls.do37.0 KB
  • references/JAR_60_hmryz.do28.6 KB
  • references/JAR_60_hst.do18.3 KB
  • references/JAR_60_kt.do10.4 KB
  • references/JAR_60_mliu.do28.3 KB
  • references/JAR_60_nrwx.do14.6 KB
  • references/JAR_60_ptwy.do26.6 KB
  • references/JAR_60_skim.do14.7 KB
  • references/JAR_61_bcdr.do524.9 KB
  • references/JAR_61_bkr.do51.6 KB
  • references/JAR_61_bls.do79.2 KB
  • references/JAR_61_bo.do29.7 KB
  • references/JAR_61_ccm.do48.7 KB
  • references/JAR_61_cdss.do3.9 KB
  • references/JAR_61_cfhll.do47.1 KB
  • references/JAR_61_cfmp.do12.7 KB
  • references/JAR_61_ckor.do77.5 KB
  • references/JAR_61_cllw.do11.2 KB
  • references/JAR_61_clm.do11.0 KB
  • references/JAR_61_deller.do368.9 KB
  • references/JAR_61_dlrtw.do30.6 KB
  • references/JAR_61_dlz.do13.6 KB
  • references/JAR_61_drs.do15.8 KB
  • references/JAR_61_ds.do197.5 KB
  • references/JAR_61_glt.do1.9 KB
  • references/JAR_61_gyz.do7.5 KB
  • references/JAR_61_ll.do89.3 KB
  • references/JAR_61_lszz.do15.9 KB
  • references/JAR_61_os.do128.9 KB
  • references/JAR_61_zureich.do22.2 KB
  • references/JAR_62_1_bdsy_banerjee_etal.do6.6 KB
  • references/JAR_62_1_bhs_bouwens_etal.do59.7 KB
  • references/JAR_62_1_gsz_gu_sun_zhou.do46.6 KB
  • references/JAR_62_2_dgzz_defranco_etal.do1.8 KB
  • references/JAR_62_2_gmp_grewal_etal.do37.2 KB
  • references/JAR_62_2_xyz_xin_etal.do25.3 KB
  • references/JAR_62_3_bht_bloomfield_etal.do16.0 KB
  • references/JAR_62_3_ccz_cheynel_etal.do23.3 KB
  • references/JAR_62_3_kim.do2.6 KB
  • references/JAR_62_3_rr_raghunandan_ruchti.do15.5 KB
  • references/JAR_62_4_bd_breuer_dehaan.do15.3 KB
  • references/JAR_62_4_cc_cadman_carrizosa.do20.1 KB
  • references/JAR_62_4_kmsv_kohler_etal.do91.5 KB
  • references/JAR_62_4_mps_marra_etal.do68.0 KB
  • references/JAR_62_4_raghunandan.do50.0 KB
  • references/JAR_62_4_stv_sran_etal.do41.1 KB
  • references/JAR_62_4_xu.do49.4 KB
  • references/JAR_62_5_aov_abraham_etal.do418.9 KB
  • references/JAR_62_5_gibbons.do80.1 KB
  • references/JAR_62_5_jiang.do114.3 KB
  • references/JAR_62_5_kstz_krueger_etal.do26.7 KB
  • references/JAR_62_5_llz_li_lou_zhang.do6.2 KB
  • references/JAR_62_5_lrst_lins_etal.do66.2 KB
  • references/JAR_62_5_lswy_lin_etal.do85.2 KB
  • references/JAR_62_5_lw_li_wang.do16.6 KB
  • references/JAR_63_1_blmv_bastiaansen_etal.do18.5 KB
  • references/JAR_63_1_cvw_chen_etal.do61.2 KB
  • references/JAR_63_1_fgr_frankel_etal.do30.3 KB
  • references/JAR_63_1_hrsx_huang_etal.do35.5 KB
  • references/JAR_63_1_jia.do12.0 KB
  • references/JAR_63_2_bcrw_bakke_etal.do271.3 KB
  • references/JAR_63_2_dlr_desimone_etal.do83.5 KB
  • references/JAR_63_2_mqtz_mao_etal.do94.2 KB
  • references/JAR_63_2_npstv_nessa_etal.do7.0 KB
  • references/JAR_63_3_breuer.do51.4 KB
  • references/REFERENCES.md30.7 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Scope and Limitations

This skill is a code pattern library, not a methodological advisor.

Can DoCannot Do
Show how published papers implemented methodsExplain when to use one method over another
Provide tested STATA syntaxAdvise on identification strategy
Indicate which robustness tests accompany analysesDiscuss research design trade-offs
Cite source papers for code patternsRecommend optimal research design

When users ask methodology questions (e.g., "Should I use entropy balancing or PSM?", "How do I address endogeneity?", "Is my identification strategy valid?"):

  1. Acknowledge the limitation: "This skill provides code patterns from published papers, not research design guidance."
  2. Show how different papers approached similar problems (code examples)
  3. Suggest consulting methodology references: Breuer & deHaan (2024) for fixed effects, Angrist & Pischke for causal inference, or the user's methodologist/advisor
  4. Offer to show multiple implementations so the user can see variation in approaches

Workflow

Use references/REFERENCES.md as the primary index, then read targeted .do files.

Stage 1: Index Search

Search references/REFERENCES.md to identify relevant papers. The index contains structured metadata:

  • Primary Method: STATA commands used (reghdfe, psmatch2, stcox, etc.)
  • Identification Strategy: DiD, PSM, IV, RDD, Event Study, etc.
  • Robustness/Special Features: Winsorization levels, clustering specs, placebo tests, etc.

Example queries on REFERENCES.md:

  • "entropy balancing" → finds JAR_60_alv, JAR_60_bl, JAR_61_ds, JAR_62_5_llz, JAR_63_2_npstv
  • "stacked DiD" → finds JAR_61_ds, JAR_62_5_aov, JAR_62_5_gibbons
  • "Cox hazard" → finds JAR_59_ctv, JAR_62_2_xyz

Stage 2: Code Extraction

Read only the identified .do files to extract actual syntax. This reduces context usage and improves accuracy.

Stage 3: Adaptation and Citation

  1. Adapt patterns to the user's variable names and research context
  2. Cite source: "Based on [Authors] ([Year]), JAR Volume"

Fallback: Direct Grep Patterns

For very specific syntax queries (e.g., "how does absorb() handle singletons?"), grep .do files directly:

TaskGrep Pattern
Panel regressionsreghdfe|xtreg|areg
Fixed effectsabsorb\(|i\.year|i\.firm
Clusteringcluster\(|vce\(cluster
Matching/PSMpsmatch2|teffects|cem|ebalance|pscore
IV regressionxtivreg|ivregress|ivreg2
DiDpost.*treat|treat.*post|parallel.*trend
RDDrdrobust|rddensity
Event studiesCAR|BHAR|abnormal.*return
Survivalstcox|streg|stset
Fama-MacBethfama.?macbeth|newey.*west
Bootstrapbootstrap|bsample
Quantile regressionqreg|sqreg|bsqreg
Table outputesttab|outreg2|eststo
Winsorizationwinsor|winsor2

Corpus Overview

126 STATA .do files from JAR Volumes 55-63 (2017-2025). See references/REFERENCES.md for complete catalog with paper titles and authors.

File Naming Convention

  • V55-61: JAR_{volume}_{shortcode}.do
  • V62-63: JAR_{volume}_{issue}_{shortcode}_{authors}.do

Volume Coverage

VolumeYearPapers
5520179
56201812
5720199
58202013
5920214
60202222
61202322
62202425
63202510

Standard Patterns

Clustering and Fixed Effects

* Firm and year FE with firm-clustered SEs (most common)
reghdfe depvar indepvar controls, absorb(firm year) cluster(firm)

* Industry-year FE
reghdfe depvar indepvar controls, absorb(ind_year) cluster(firm)

Output Conventions

eststo clear
eststo: reghdfe depvar indepvar controls, absorb(firm year) cluster(firm)
esttab using "table.tex", replace star(* 0.10 ** 0.05 *** 0.01) se

Winsorization

winsor2 varlist, cuts(1 99) replace

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

a1

FreeSummary

Turn a broad research idea into clear, testable questions. Compare familiar and less conventional approaches, structure the selected question around its population and methods, and assess variables, feasibility, and potential theoretical contributions.

  • Turn a research topic into testable questions
  • Narrow an overly broad research question
  • Compare alternative research angles
brycewang-stanford/Auto-Empirical-Research-Skills4.8KUpdated Oct 20, 2026

a2

FreeSummary

Helps build a research framework by comparing theories, mapping relationships between variables, and deriving testable hypotheses. Explores less conventional options, examines weaknesses and competing explanations, and produces diagrams with anticipated reviewer objections.

  • Comparing theories for a research question
  • Deriving hypotheses from relationships between variables
  • Examining weaknesses and anticipated reviewer objections
brycewang-stanford/Auto-Empirical-Research-Skills4.8KUpdated Oct 20, 2026

a5

FreeSummary

Clarify the philosophical assumptions behind a research project and check whether they fit the proposed methods. Get a reasoned research stance, draft proposal wording, and guidance for explaining how the researcher's background and values shape the study.

  • Clarifying philosophical foundations for a research proposal
  • Explaining why the chosen research methods fit the study
  • Drafting a statement about the researcher's position
brycewang-stanford/Auto-Empirical-Research-Skills4.8KUpdated Oct 20, 2026

academic-paper

FreeSummary

Plan and draft academic papers through specialized agent roles covering literature, arguments, citations, and review. Get chapter guidance, revision roadmaps, Traditional Chinese and English abstracts, and documents formatted as LaTeX, DOCX, PDF, or Markdown.

  • Planning a paper chapter by chapter
  • Drafting a paper from research materials
  • Turning reviewer comments into a revision roadmap
brycewang-stanford/Auto-Empirical-Research-Skills4.8KUpdated Oct 20, 2026

Turn a detailed outline into a philosophy or interdisciplinary manuscript. Draft chapters with repeated quality reviews, check terminology and arguments across sections, and prepare the manuscript, evaluation reports, abstract, and metadata for submission.

  • Draft a full paper from a detailed outline
  • Review argument and citation quality chapter by chapter
  • Check terminology and argument flow across chapters
brycewang-stanford/Auto-Empirical-Research-Skills4.8KUpdated Oct 20, 2026

Simulate academic peer review through five reviewer roles tailored to the paper's field. Receive separate critiques, an editorial decision, and a prioritized revision roadmap, or check whether a revised manuscript addresses earlier comments.

  • Review a manuscript before journal submission
  • Examine research methods and statistical validity
  • Challenge core arguments and alternative explanations
brycewang-stanford/Auto-Empirical-Research-Skills4.8KUpdated Oct 20, 2026

See all skills by brycewang-stanford

Report a problem with this skill