ccm_panel schema¶
Derived monthly panel produced by src/assayinganomalies/transforms/. One row per (date, permno).
Identifiers: date (month-end), permno
Which CRSP tape defines these columns¶
Seven CRSP columns mean subtly different things depending on crsp_format
(config.crsp_format, see tutorial ch. 1).
A panel built from the frozen legacy tape (SIZ, Flat File Format 1.0, ends
Dec 2024) and one built from the current tape (CIZ, Format 2.0) are
reproducible to the research conclusion, not to the basis point. The per-column story:
| Column | SIZ | CIZ |
|---|---|---|
ret |
msf.ret with MATLAB's delisting overlay applied (dlret replaces or compounds into ret on the delisting month) |
mthret as delivered: daily-compounded, payouts reinvested on the ex-date, and CRSP's own delisting adjustment already inside it. No overlay |
ret_x_dl |
msf.ret before the overlay — genuinely different from ret |
== ret, always. There is no "before"; stated explicitly so no caller has to know the tape |
dlret |
msedelist.dlret, both an input and an output of the overlay — it can move to a neighbouring month and can create a panel row |
stkdelists.delret, informational only: annotated on the delisting month, never applied, never compounded, never carried forward |
shrcd |
Read from mseexchdates on the as-of name window |
Derived from the security-info codes (sharetype/securitytype/securitysubtype/usincflg, then issuertype ACOR→10, CORP→11). 99.9974% agreement; unmapped → NaN |
exchcd |
Read from mseexchdates; 0 means "not on a listed exchange" |
Derived from primaryexch N/A/Q → 1/2/3, gated on conditionaltype='RW' AND tradingstatusflg='A'. The listed-exchange cross-tab is perfectly diagonal; ARCA/BATS and other unmapped venues get NaN, never 0 |
cfacpr |
msf.cfacpr |
mthcumfacpr, re-based relative to SIZ on ~2–3% of rows |
cfacshr |
msf.cfacshr |
mthcumfacshr, same re-basing caveat |
Two more differences worth knowing, since they are absences rather than columns:
volis on the SIZ scale under both tapes — CIZ'smthvolis 100× and is divided by 100 on ingest. Daily volume was never rescaled.- The monthly
spreadcannot be built under CIZ at all:msf_v2has nobid/ask/bidlo/askhicolumns.tcostis unaffected — it is built from the daily file.
Everything else in this document — momentum, issuance, industries, COMPUSTAT, the daily aggregates, betas — is computed from the canonical columns above and so is defined identically under both tapes.
CRSP-derived (from transforms/crsp_monthly.py)¶
ret— delisting-adjusted return (SIZ) / return as delivered by CRSP (CIZ) — see the tape table aboveret_x_dl,retx,me,prc,shrout— raw CRSP fields (ret_x_dl= return before delisting adjustment;== retunder CIZ)dlret— delisting return (applied under SIZ, informational under CIZ)shrcd,exchcd— share / exchange codes (read under SIZ, derived under CIZ)cfacpr,cfacshr— cumulative price / share adjustment factorsR12_2,R60_13,R6_1— momentum windowsiss_me,iss_shrout— issuance metricsff10,ff17,ff49— Fama-French industry codesnyse_flag— NYSE listing indicator (gains 4,050 stock-months under CIZ and loses none)
COMPUSTAT annual (from transforms/compustat.py, aligned to June FY+1)¶
Each linked annual filing becomes available at the end of June of the calendar
year after its fiscal year-end (datadate). Its values are stored on the
panel row of that June and on no other row (attach_annual_records): every
column below is NULL in the other eleven months. A record is attached whole, so
all values on a June row come from one filing:
- no filing for a year → every annual column is NULL in that June, even if an older filing exists;
- a field missing from the filing stays NULL; it is not taken from an older filing;
- a stock with no panel row in that June has no values from that record;
- after a CCM link moves to a new permno, the new permno starts at its first linked filing's June.
This is MATLAB's June-only annual matrix. The build records the layout in the
metadata table (key annual_layout, value "june").
Monthly values. aa.fill_months(x) carries each stock's last value forward
for at most 11 calendar months, so a June value runs through the following May
and never longer (MATLAB's FillMonths). aa.load(..., fill_annual=True)
applies it to the annual columns it loads; the default load returns them as
stored. A signal built from the stored columns has values once a year, so a
sort on it trades each June; built from filled columns it has values every
month and the sort trades every month (tutorial Ch 13, "When a sort trades").
Two things a fill cannot do: it adds no rows, and a stock with no panel row in
the June gets nothing from that record until its next June. Such stocks are
rare. MATLAB, and versions of this panel that stored the columns filled June
to May, gave them the record's values from their first month.
Databases built before this layout hold the columns filled June to May and
have no annual_layout record. aa.load of an annual or provenance column
(also inside an expression, or through *) raises aa.AnnualLayoutError on
them, as does aa add-compustat-vars --annual, and the stages
compute-nmv-anomalies and validate-bm-hml stop with an error that names
the same command. Rebuild with
aa setup-database --start-from transform-compustat (it reuses the staged
extracts; no WRDS login). SQL written by hand against ccm_panel is not
checked: it returns whatever layout the database has.
An earlier layout forward-filled each column separately with no expiry. Quarterly columns (next section) follow their own RDQ rules, are stored filled, and are unaffected.
be— book equity (SE + DT - PS). Davis-Fama-French historical book equity replaces it where available for the same permno-June, and a DFF value without a Compustat filing forms a BE-only record on that June rowbm— book-to-market (BE / ME of the December before the June)fin_firm— financial firm flag (CRSP SIC 6000-6999, every month)at,lt,gp,ib,ni,oancf,capx,sich— raw accountingoc— operating costs (COGS + XSGA)d— total debt (DLC + DLTT)inv_capital— investment (PPEGT + INVT)fcf— free cash flow (NI + DP - WCAPCH - CAPX)div— dividends + repurchases (DVC + PRSTKCC)wcap— working capital (ACT - LCT)cfo— cash flow from operations (12-component sum or OANCF)mib— noncontrolling (minority) interest, raw CompustatMIB; carried for your own signals (no built-in signal reads it), on the June row like the rest of the record
Provenance of the annual record (for source-age analysis). Like the values,
these are on the June row only; aa.load(..., fill_annual=True) does not
fill them:
comp_datadate— fiscal period end (datadate) of the Compustat filing supplying the annual columns; NULL outside the June row and when there is no filingcomp_avail_date— June month-end that filing became available, which is the row's own date; NULL outside the June row and when there is no filingbe_source—'compustat'or'dff'(Davis-Fama-French historical book equity); NULL whenbeis NULLbe_avail_date— June month-endbebecame available (equalscomp_avail_datewhenbe_source = 'compustat'); NULL whenbeis NULL
fin_firm is not part of the record: it is the CRSP-SIC flag for every month.
COMPUSTAT quarterly (derived on a forward-filled monthly grid)¶
Each raw quarterly input (SEQQ, CEQQ, PSTKQ, ATQ, LTQ, TXDITCQ, REVTQ, COGSQ,
IBQ, EPSPXQ, NIQ, CHEQ, MIBQ, XRDQ) is first placed at its RDQ month end and forward-filled
independently, from its own first announcement to its own last announcement plus
two months (build_quarterly_monthly_panel, mirroring
makeCOMPUSTATVariables.m). The variables below are then computed on that
monthly grid, so lags are measured in months and a month can combine input
vintages from different quarters. Deriving them per quarter and forward-filling
the results is not equivalent.
beq— quarterly book equity (SE fallback chain, thennansum(SE, DT, -PS))gpq— quarterly gross profit (REVTQ - COGSQ)roa— return on assets (IBQ / ATQ three months back, so it moves within a quarter)sue— standardized unexpected earnings; evaluated at report months from EPSPXQ at prior report months, then spread forward two monthsdroe— change in ROE ((IBQ - IBQ at the 4th prior report month) / BEQ at the previous report month), spread forward two monthssue2— SUE variant on IBQ levels ((IBQ[i] - IBQ[i-12]) / std(IBQ[i-24:3:i-3])); dense monthly from 1971-01droa— change in ROA ((IBQ[i] - mean(IBQ[i-12..i-1])) / ATQ[i]); dense monthly from 1971-01amonth— dense 0/1 announcement-month indicator (isfinite(IBQ) & IBQ changed); 0, not NULL, outside announcement months
Raw quarterly columns on the same RDQ-placed, forward-filled grid:
ibq,niq,ltq,cheq— income before extraordinary items, net income, total liabilities and cash (read by the NMV roe and distress signals)mibq— noncontrolling (minority) interest, quarterlyxrdq— R&D expense, quarterly (the quarter's own figure, not year-to-date)
mibq and xrdq are carried for your own signals; no built-in signal reads them.
CRSP daily aggregates (from transforms/crsp_daily.py, monthly snapshots)¶
rvol_21,rvol_126,rvol_252— realized volatility (rolling std of daily returns)amihud— Amihud (2002) illiquidity (|ret|/dollar_volume, trailing 21 days)maxret— maximum daily return within the calendar month (Bali/Cakici/Whitelaw MAX). MATLAB'sdretmaxmaxes share volume here; corrected hereidiovol— idiosyncratic volatility (FF3 residual std, 252-day rolling)
Betas (from transforms/betas.py, monthly)¶
bfp— Frazzini-Pedersen (2014) beta (corr-based, 60/40 shrinkage to 1)bols— OLS benchmark beta (1yr daily, no shrinkage)bdim— Dimson beta (OLS with 1 lag of market, sum of coefficients)bsw— Welch beta (OLS with winsorized returns)bvck— Vasicek beta (OLS with cross-sectional shrinkage toward mean)bstd— Standard beta (Dimson with 60/40 shrinkage to 1)
Trading costs (from transforms/tcosts.py, monthly)¶
tcost— effective half-spread: the average of the available low-frequency estimators (Gibbs, Corwin-Schultz, Abdi-Ranaldo, Kyle-Obizhaeva), overlaid by TAQ/ISSM high-frequency spreads where they exist, winsorized at 99.9%, then nearest-neighbour filled on ME andIffVOL3rank. NASDAQ Gibbs/VoV are excluded through 1982-12 and NASDAQ HL/CHL through 1992-12; MATLAB's exclusion typo dropped NASDAQ Gibbs/VoV for the whole sample and is corrected heretcost_gibbs— Gibbs-only filled half-spread, kept because MATLAB fills the Gibbs leg before winsorizing and before the exchange exclusions, so it is not a subset oftcost
User-added Compustat columns¶
aa add-compustat-vars --annual xrd --quarterly ... (or
aa.add_compustat_vars(...)) adds raw Compustat columns to this panel after
the build, under their Compustat names, at the end of the column list
(float64). They differ per database, so they are not listed above; aa
show-config lists the ones this database has (the config table key
compustat_extra_vars).
- Annual (comp.funda) columns are aligned like
at: a fiscal-year filing is available at the end of June of the next calendar year and its value is stored on that June row only.aa.load(..., fill_annual=True)fills them like the built-in annual columns. Refused (aa.AnnualLayoutError) on a database built before the June-only layout. - Quarterly (comp.fundq) columns are aligned like
ibq: placed at the end of the RDQ month and forward-filled until two months past the last announcement.
A name already in this schema is refused. A later aa setup-database (also
with --full-refresh) and a rebuild of transform-compustat write them again.
See tutorial Ch 5, "Adding your own Compustat variables after the build".
Database tables¶
crsp_msf: Raw CRSP monthly (mirrored from WRDS —crsp.msfunder SIZ,crsp.msf_v2under CIZ; the DuckDB table name is the same either way)ccm_panel: This panelcrsp_dsf: Raw CRSP daily stock file (crsp.dsf/crsp.dsf_v2; aliased onto identical columns under both tapes)crsp_daily_panel: Daily panel with derived variables (rvol, amihud, idiovol)ts_data: Time-series store (Fama-French monthly factors)ts_data_daily: Daily Fama-French factorsbetas: Standalone beta estimates (6 variants, monthly × permno)nmv_anomalies: Novy-Marx/Velikov (2016) 23 anomaly signals (monthly × permno)cz_anomalies: Chen-Zimmerman anomaly signals (~212 firm characteristics)cz_signal_info: Signal metadata (authors, publication year, weighting, holding period, etc.)ccm_link: The cleaned CRSP-Compustat link (crsp.ccmxpf_lnkhist), written bytransform-compustat: one row per primary link (linktypeLC or LU) with a permno, columnsgvkey,permno,permco,linkdt,linkenddt,linktype,linkprim; open links (nolinkenddt) close on 31 December ofsample_end. The table every Compustat link in the build uses;aa.merge_on_linkattaches permnos to your own gvkey-keyed data through itcompustat_funda,compustat_fundq: Raw Compustat annual and quarterly extracts- Raw CRSP auxiliary tables, under their bare WRDS names:
ccmxpf_lnkhist(the raw linkccm_linkis cleaned from) under both tapes;msfhdr,msedelist,dsedelist,mseexchdates,stocknamesunder SIZ;stkdelists,stksecurityinfohist,stocknames_v2under CIZ