I need help to match company identifiers across multiple financial databases.
I have a database with 133,622 observations. In this database, I have CUSIP (8-digits), CUSIP (9-digists) and ISIN as company identifiers. For my research, I need to merge this database with three other databases, which are IBES for security analysts forecast information, COMPUSTAT for firm income and spending information, and CRSP for stock information. Because these three databases use different unique firm identifiers, please see the table below. I need to identify the corresponding GVKEY, PERMNO, and IBES ticker for the CUSIP in the primary database. The issue with CUSIP is that it changes over time for a company. So, for company A the CUSIP used in 2001 may be different to its CUSIP in 2003 or later.
I will provide you with the primary database with four columns: CUSIP (8-digits), CUSIP (9-digists), ISIN, and a date. The output I’m looking for is the primary database with three additional columns, GVKEY, PERMNO, and IBES ticker.
I can also provide you with one file that specify the match between CUSIP (9-digits) and GVKEY and PERMNO for different time period. Since GVKEY and PERMNO do not change over time, we can use this file to track the different CUSIP used for a firm across different years.
In fact, there are already SAS code developed by WRDS to match IBES ticker and CRSP PERMNO. Since I always use STATA for my research and not familiar with SAS. I need help to process these.
The SAS code to match IBES ticker to PERMNO
The SAS code to add PERMNO to Compustat data
Attached are two files:
1. A sample of the primary database with firm identifiers and date
2. A sample of the database showing the link between CUSIP, GVKEY, and PERMNO