Each file includes a unique gvkey (Global Company Key) as the permanent identifier. Annual files have datadate (fiscal year end date) and fyr (fiscal year month). Essential Compustat data items (annual):
: WRDS, Compustat, empirical finance, data management, SAS, Python, Fama-French factors 1. Introduction Empirical research in finance and accounting relies heavily on standardized, historical financial statement data. Compustat (originally from Standard & Poor’s, now part of S&P Global Market Intelligence) provides over 50 years of annual and quarterly fundamentals for publicly traded companies. The Wharton Research Data Services (WRDS) platform acts as a unified delivery system, offering seamless access to Compustat alongside CRSP, OptionMetrics, IBES, and others. This paper serves both as a tutorial and a methodological reference for researchers who need to extract, clean, and merge WRDS Compustat data. wrds compustat
Abstract Wharton Research Data Services (WRDS) Compustat is a cornerstone database for empirical research in corporate finance, accounting, and asset pricing. This paper provides a comprehensive guide to using WRDS Compustat, covering its data architecture (annual, quarterly, monthly, and daily files), key data items (e.g., AT – total assets, SALE – sales, NI – net income), and linkage to other databases (CRSP, IBES, Eventus). We detail access methods including web query, SAS, Python (via wrds package), and R. Common pitfalls—such as look-ahead bias, survivorship bias, improper handling of missing values, and adjusting for stock splits and dividends—are discussed with replicable code examples. Finally, we present a step-by-step empirical replication of a classic Fama–French (1993) factor construction using Compustat and CRSP data, demonstrating the workflow from raw data extraction to final regression analysis. Each file includes a unique gvkey (Global Company
Note : Market equity (ME) is best obtained from CRSP monthly file ( mktcap or PRC * SHROUT ), then linked via CCM. 4.1 Web Query Interface WRDS web query is suitable for small extracts. Choose Compustat - Annual Updates , select GVKEY, DATADATE, AT, LT, SALE, and filter indfmt=‘INDL’ and consol=‘C’ (consolidated) and popsrc=‘D’ (domestic US). 4.2 SAS (most common legacy method) libname comp ‘/wrds/comp/sasdata/’; data annual; set comp.funda; where indfmt eq ‘INDL’ and consol eq ‘C’ and popsrc eq ‘D’; keep gvkey datadate fyr at lt ceq sale; if at > 0; run; 4.3 Python (recommended for modern workflows) import wrds import pandas as pd db = wrds.Connection() db.create_pgpass_file() This paper serves both as a tutorial and