These are some topics in my mind. I will write up when I find time. Use Python to remove boilerplate paragraph in firm-initiated press releases Calculate earnings surprises Chow test Access to WRDS

Posted in Uncategorized | Leave a comment

Use Python to calculate the tone of financial texts

I find two internet resources for this task (thank both authors): https://iangow.wordpress.com/2014/07/22/get-tone-from-corporate-disclosures-postgresql-python-and-r/ http://conjugateprior.org/software/ca-in-python/ The first solution is way more efficient than the second, but the second is more straightforward. The first needs extra knowledge of PostgreSQL and R besides Python. I … Continue reading

Posted in Python | 4 Comments

How to remove duplicates GVKEY-DATADATE when extracting firm-quarters from Compustat Quarterly (FUNDQ)?

In the definition of datafqtr, WRDS notes that: Note: Companies that undergo a fiscal-year change may have multiple records with the same datadate. Compustat delivers those multiple records with the same datadate but each record relates to a different fiscal … Continue reading

Posted in Learning Resources | 1 Comment

If beginning year and ending year are known, how to fill in years in between?

Question: Suppose two companies A and B are connected in some years. Say, right now the data structure is the following: Company 1 Company 2 Starting Year Ending Year A B 2000 2006 A C 1998 2003 C D 1995 … Continue reading

Posted in SAS | Leave a comment

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

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 currently extracts unadjusted quarterly EPS estimates (current … 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 | 9 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

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

See ffind written by Judson Caskey. Here is his website: https://sites.google.com/site/judsoncaskey/data The syntax is as follows (download Help file here): ffind sic, newvar(ffi) type(30) type(30) means Fama_French 30 industries classification. Type must be 5, 10, 12, 17, 30, 38, 48 or … Continue reading

Posted in Stata | 15 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

Posted in Stata | Leave a comment

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 | Leave a comment