SAS macro to count the number of analysts following a firm

This macro is used to count the number of analysts who followed a specific firm. Although this is a commonly used measure in literature, prior studies often give a vague description on what they do. The question is—what does “analysts following a firm” really mean?

First, it is only meaningful to count the number at a specified date.

Second, how to define “an analyst is actually following a firm”? I use the following definition: if an analyst issued any forecast (EPS or stock price or sales, anything) within a certain window (e.g., 180 days) before the specified date, then the analyst will be counted in. This definition ensures that the analyst is “actively” following the firm.

That is why my macro requires two arguments: DATE and WINDOW. This macro is used to answer such question—at a specified date, how many analysts are actively following Firm A, B, …?


This entry was posted in SAS. Bookmark the permalink.

2 Responses to SAS macro to count the number of analysts following a firm

  1. Ruohan says:

    Dear Kai Chen

    Thank you so much for your sharing, that’s really helpful.
    I wonder if it is possible for you to share the code that calculates analyst past three forecast accuracy. I could not find any resources and not sure whether I did wrong.
    I would be grateful if you could share this.

    Thank you so much



  2. Susan Hu says:


    Thanks for sharing this. I am relatively new to SAS. I am wondering how to use this code to calculate analyst following for multiple(10-20) dates for a specific firm?

Leave a Reply

Your email address will not be published. Required fields are marked *