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 uses the macro ICLINK. In order to use this macro, you need to add the following line to your file in your WRDS home directory (see here for details):

options sasautos=('/wrds/wrdsmacros/', SASAUTOS) MAUTOSOURCE;


This entry was posted in SAS. Bookmark the permalink.

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

  1. CC says:

    Hi Kai,
    Your posts are super helpful and I really enjoyed reading them.
    For this post, I have got one question:
    Could we access the file in home directory via PC SAS Connect? Or has to use SSH to access and change file?


    • Kai Chen says:

      We have to use SSH to access the file. I usually use Cyberduck, a FTP-like app on my Mac to access and edit this file. If you are familiar with Linux-like command line, you can simply access and edit this file via Terminal (or anything equivalent on PC). Also ensure you are SSHing the right server ( since WRDS is transitioning to its new Cloud server recently.

  2. June says:

    Hi Kai,
    Thank you for your material. It helps me a lot!
    I am wondering how to identify the year the restated financial statements were originally issued?
    Thank you in advance!

  3. Eva says:

    Hi Kai,

    Correct me if I am wrong. The following code will delete the duplicate observations. But why you only keep the first.permno? Shouldn’t we keep the ones with highest scores? Further, when two duplicate observations have the same score, why we should keep the first.permno?


    data ibeslink; set ibeslink;
    by permno ticker; if first.permno;

  4. Razoo says:

    Dear Chen,

    Thank you very much for the code.

    Could you please post a code for linking between compustat and audit analytics without CRSP and I/B/E/S?

    Thank you very much again,

  5. Hui Tian says:

    Dear Kai,
    Many thanks for the codes and they really help a lot!
    Can I ask a dumb question about how to find “the linking header table between GVKEY and IBES ticker (IBTIC) in its SECURITY table (located in /wrds/comp/sasdata/na/security/)”.
    Is this Security table still available on WRDS? I could not find this table in my WRDS account. Do you have an Internet link for this table?
    Thank you very much!!

    • Benny Wang says:

      I use FileZilla to download data, and now you can find SECURITY table under this route: /wrdslin/comp/sasdata/naa/security/security.sas7bdat

  6. Leice says:

    Dear Kai,
    Thanks deeply for your post.
    I want to ask a question on the mapping between AuditAnalytics and Compustat. It looks like the only keeps one CIK record for each gvkey, so I guess it’s the header CIK. But I think the CIK in AA is historical. Do you think there would be some observations lost if we simply match these two sets by the CIK code?
    Thanks very much!

  7. Roger Li says:

    Dear Prof.Chen,

    Thank you for posting and sharing your code!

    I want to ask two question regarding the merge between the Compstat and IBES dataset. My aim is to match the earning forecast and the actual earnings. However, there will be two issues. The first one is that firm has different share classes and IBES also include the forecast of different securities of a firm. I wonder is there any way to adjust that? Another question is regarding the shares outstanding. I remembered that you mentioned in another blog that we should use the shares outstanding in Compustat. But I wonder in this case, should we use the CRSP shares outstanding since it will bypass the stock split if we use the unadjust file of IBES? And if we do so, how can we deal with the difference between the different shares outstanding since the earning-per-share data is based on the shares outstanding from Compustat.

    Thank you for your help in advance!

    Best regards,

Leave a Reply

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