Author Archives: Kai Chen

SAS macro to get analysts EPS consensus for a given fiscal period end (DATADATE) by a selected date (DATE)

Update: contains error! will update later. I write this macro to compute analysts’ quarterly EPS consensus on a selected date (DATE) for a given fiscal quarter end (DATADATE). This macro can be easily modified for other types of estimates (e.g., annual EPS). This macro … Continue reading

Posted in SAS | Comments Off on SAS macro to get analysts EPS consensus for a given fiscal period end (DATADATE) by a selected date (DATE)

Link Audit Analytics, Compustat, CRSP and I/B/E/S

The following program is used to link each financial restatement in Audit Analytics to Compustat, CRSP, and I/B/E/S. The resultant dataset aa contains unique identifiers of Audit Analytics (res_notify_key), Compustat (gvkey), CRSP (permno), and I/B/E/S (ibtic). Please note this program … Continue reading

Posted in SAS | 15 Comments

Regression with a large dummy-variable set (e.g., firm and year fixed effects) in Stata

I run a regression in Stata with a Compustat dataset that contains fyear and gvkey. I want to add firm and year fixed effects, so I type the following command: regress DV IV i.fyear i.gvkey But Stata returns the error … Continue reading

Posted in Stata | Leave a comment

Stata command to create Fama-French industry classifications based on SIC codes

[Update on January 18, 2023] I was advised that the installation command in the original post didn’t work anymore. The author now instructed users, on his website, to find packages here. You can download a package, as well as its help … Continue reading

Posted in Stata | 30 Comments

Fuzzy match in Stata

Nice article. http://ebp-projects.isr.umich.edu/NCRN/papers/wasi_flaaen_statarecordlinkageutilities.pdf Author’s website: http://www-personal.umich.edu/~nwasi/programs.html For installation, type the following command in Stata: net from http://www-personal.umich.edu/~nwasi/programs net install stnd_compname.pkg Update on August 30, 2018—The foregoing URLs seem broken. Please use the following command to install the package: net from http://www.stata-journal.com/software/sj15-3 net … Continue reading

Posted in Stata | 2 Comments

Calculate CFO tenure with Execucomp in Stata

Nice article and nice blog! Happy to find that someone built a similar blog. https://robsonglasscock.wordpress.com/2014/04/01/determining-cfo-tenure-with-execucomp-data/

Posted in Stata | 1 Comment

Calculate market value of equity: use CRSP or Compustat?

I encountered a problem today: I had to calculate market value of equity. On Compustat Quarterly I found three variables that seemed to be what I need: PRCCQ, CSHOQ, and MKVALTQ. On CRSP, I found two variables: PRC and SHROUT. So … Continue reading

Posted in Learning Resources | 9 Comments

Calculate delta (pay-performance sensitivity), vega (risktaking incentives), and firm-specific wealth (inside equity) for executives on Execucomp

Several papers use measures of delta (pay-performance sensitivity), vega (risktaking incentives), and firm-specific wealth (inside equity) for executives on Execucomp. For example, 1.  Core, J., Guay, W., 2002. Estimate the value of employee stock option portfolios and their sensitivities to price … Continue reading

Posted in SAS | 51 Comments

Look into CRSP/Compustat link table

The link history table (CCMXPF_LNKHIST) is the primary table used for WRDS CCM web queries. In this post, I explain this table in detail. Background We know that a company may issue multiple securities, one of which is considered primary … Continue reading

Posted in Learning Resources, SAS | 45 Comments

Errors in CRSP, Compustat and other popular data source

I find a web page providing references for articles that study specific aspects of CRSP, Compustat and other popular sources of data used in academic research. https://www.kellogg.northwestern.edu/researchcomputing/crsp-cstat-references.htm Some interesting topics include: error rates in CRSP and COMPUSTAT, differences between COMPUSTAT and CRSP … Continue reading

Posted in Learning Resources | 3 Comments