Install any skill in seconds. Free to start, no credit card required.
Get Started Free →brycewang-stanford/stata-accounting-guide
STATA code for empirical accounting and financial economics research
Passed 11 of 21 test cases with the skill, and 6 of 21 without it.
and 6 more in the full report
6 fixed6 passed either way10 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
When building total accruals from annual Compustat data in Stata, I am debating whether to use balance sheet changes or cash flow statement items. Please write Stata code that constructs both metrics for scaled total accruals from Compustat variables.
| Checked | Without skill | With skill |
|---|---|---|
| Constructs cash-flow-based total accruals as (ib - oancf) / l.at. | Passed | Passed |
| Constructs balance-sheet-based accruals using changes in current assets, cash, current liabilities, short-term debt, and income taxes payable (dch_act, dch_che, dch_lct, dch_dlc, dch_txp, dp). | Missed | Passed |
The instructions your model reads when the skill loads.
Generate publication-ready Stata code for empirical accounting research. This skill covers the standard econometric models, variable constructions, and estimation procedures used in top accounting journals (TAR, JAR, JAE, RAS, CAR).
Empirical accounting research has developed a distinctive set of analytical conventions that differ from general econometrics. Researchers work with financial statement data from databases like Compustat and CRSP, construct standardized proxies for earnings quality, accruals, and discretionary behavior, and employ estimation techniques that address the particular endogeneity concerns in archival accounting studies.
This skill provides the Stata implementation for the most commonly used models in accounting research: accrual models (Jones, Modified Jones, performance-matched), earnings management detection, value relevance studies, audit quality analyses, and corporate governance research. Each model includes the variable construction from raw Compustat items, the estimation procedure, and the table formatting expected by accounting journal reviewers.
The code follows the conventions established in influential methodological papers by Dechow, Sloan, and Sweeney (1995), Kothari, Leone, and Wasley (2005), and Ecker, Francis, Kim, Olsson, and Schipper (2006), ensuring alignment with reviewer expectations at major accounting journals.
* ============================================
* Standard Compustat Variable Construction
* ============================================
* Load Compustat annual data
use "raw/compustat_annual.dta", clear
* Fiscal year identifier
gen fyear = year(datadate)
* Key financial variables (Compustat mnemonics)
* Total accruals (balance sheet approach)
gen total_accruals_bs = (dch_act - dch_che) - (dch_lct - dch_dlc - dch_txp) - dp
replace total_accruals_bs = total_accruals_bs / l.at // Scale by lagged assets
* Total accruals (cash flow approach, preferred)
gen total_accruals_cf = (ib - oancf) / l.at
* Key ratios
gen roa = ib / l.at // Return on assets
gen leverage = (dltt + dlc) / at // Financial leverage
gen size = ln(at) // Firm size (log assets)
gen mb = (prcc_f * csho) / ceq // Market-to-book
test cases passed, vs 6 / 21 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.