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 or next quarter) issued within a specified window (e.g., WINDOW = 60 days) before the selected date (DATE), and computes the consensus at median and mean. This macro also extracts unadjusted actual EPS and put estimate and actual on the same per share basis. Please see Overview of Thomson-Reuters IBES for why this is the preferred method.

The output includes the mean and median of analysts’ EPS forecasts, the number of analysts forecasts, and the actual EPS. Please note the actual EPS is “street” EPS from I/B/E/S and may be different from reported EPS from Compustat (see I/B/E/S FAQ). With these outputs, you are able to compute earnings surprises easily.

This macro is modified from Post-Earnings Announcement Drift program on WRDS. I thank the author, Denys Glushkov, who is my favorite SAS programmer.

I looked into I/B/E/S database more closely and noted a few facts:

  • Since 1998 only 1.3% of analysts’ forecasts are reported on the primary basis (v.s. 74.4% before 1998), making the variable basis not important any more;
  • During the period from the issuance date of an individual quarterly EPS forecast to the announcement date of the actual EPS, stock split or reverse stock split happens in only 0.6% of observations. Thus, putting estimate and actual on the same per share basis is not important if you specify a short window, e.g., 60 days.
  • anndats in I/B/E/S Actuals Detail refers to the earnings announcement data. It is supposed to be the same with rdq in Compustat Quarterly. However, this is not true in 20% of observations. WRDS suggests that rdq is more accurate (See here).


This entry was posted in SAS. Bookmark the permalink.