The SASEXCCM Interface Engine

The LIBNAME libref SASEXCCM Statement

  • LIBNAME libref SASEXCCM ’physical-name’ SETID=crsp_setidnumber options;

The LIBNAME statement assigns a SAS library reference (libref) to the physical path of the directory of CRSP data files where the CRSP database that you want to open is located. The required physical-name argument must end in a slash for UNIX environments and a backslash for Windows environments. The required SETID=crsp_setidnumber argument specifies the CRSP database that you want to read from. Choose one SETID from these values: 10, 20, 250, 400, 420, 440, and 460. For example, the following statement accesses the CCM database and retrieves the annual sales data for IBM (GVKEY=6066):

   LIBNAME myLib SASEXCCM 'physical-name' SETID=250
      GVKEY=6066   /* IBM */
      ITEMLIST='SALE';

You can specify the following options:

GVKEY=crsp_gvkey

selects the companies or issues whose data you want to retrieve. Specify the GVKEY (Compustat’s permanent SPC identifier) for the crsp_gvkey. There is no limit to the number of GVKEY= options that you can specify. If no GVKEY= options are specified, all GVKEYs in the database are selected.

For example, the following statement accesses the CCM database to retrieve annual sales data for IBM (GVKEY=6066) and Microsoft (GVKEY=12141):

   LIBNAME myLib sasexccm 'physical-name'
      SETID=250
      GVKEY=6066   /* IBM */
      GVKEY=12141  /* MSFT */
      ITEMLIST='SALE';
GVIIDKEY='crsp_gviidkey'

selects the companies and issues whose data you want to retrieve. Specify both the GVKEY and the IID (Compustat’s permanent issue identifier) by concatenating the two with a '.' and enclosing them in double quotation marks. There is no limit to the number of GVIIDKEY= options that you can specify. The following members use GVIIDKEY access: IDXCST_HIS, MTHSEC, SECHIST, SECURITY, SEC_MDIVFN, SEC_MSPTFN, SEC_MTHSPT, SEC_SPIND, SEC_TS_ITM, and SPIDX_CST.

For example, the following statements access the CCM database to retrieve the security member that gives security header information for Microsoft issue ID=01, IBM issue ID=01, and some other companies’ issues shown in the GVIIDKEY= options:

   LIBNAME crsp sasexccm 'physical-name'
      SETID=250
      GVIIDKEY="12141.01" /* MSFT issue id 01 */
      GVIIDKEY="6066.01"  /* IBM issue id 01 */
      GVIIDKEY="6008.01"  /* INTC issue id 01 */
      GVIIDKEY="12142.01" /* ORCL issue id 01 */
      GVIIDKEY="62634.01" /* YHOO issue id 01 */
      GVIIDKEY="5047.01"  /* GE issue id 01 */
      GVIIDKEY="7866.01"  /* NYT issue id 01 */
      GVIIDKEY="7866.02"  /* NYTAB issue id 02 */
      ITEMLIST="DLDTEI;DLRSNI;DSCI;EPF;EXCHG;IID;IID_SEQ_NUM;ISIN;SBEGDT;SENDDT;SCUSIP;
               !SEDOL;SSECSTAT;TIC;TPCI";
    data headersecurity;
       set crsp.security;
    run;

PERMNO=crsp_permno

selects the companies or issues whose data you want to retrieve. Specify a CRSP company issue’s PERMNO for the crsp_permno. There is no limit to the number of PERMNO= options that you can specify. If no PERMNO= options are specified, all PERMNOs in the database are selected.

For example, the following statements access the STK database to retrieve monthly shares data for IBM (PERMNO=12490) and Microsoft (PERMNO=10107):

   LIBNAME myLib sasexccm 'physical-name'
      SETID=20
      PERMNO=12490   /* IBM */
      PERMNO=10107  /* MSFT */
      ITEMLIST="MSHROUT.*;MSHRFLG.*";
   data mshares_all;
      set myLib.mshares;
   run;
INDNO=crsp_indno

selects the time series or the group data from the index whose data you want to retrieve. Specify a CRSP Index’s INDNO for the crsp_indno. There is no limit to the number of INDNO= options that you can specify. If no INDNO= options are specified, all INDNOs in the database are selected.

For example, the following statements access the IND database to retrieve monthly consumer price index data (INDNO=1000709):

   LIBNAME myLib sasexccm 'physical-name'
      SETID=420
      INDNO=1000709  /* Consumer Price Index */
      ITEMLIST=
       "MREBAL.*;MRBBEGDT.*;MRBENDDT.*;MRUSDCNT.*;MMINID.*;MMAXID.*;MMINSTAT.*";

   data mindts_all;
      set myLib.mindhdr;
      set myLib.mrebal;
   run;
ITEMLIST="crsp_itemlist"

specifies the items and groups of interest for selection based on keysets, which define the reporting format that you want. Specify a string in CRSP standard notation for crsp_itemlist. For an overview of items, groups, and reporting formats, see the section Data Reference: Introduction. Reference sections that are based on CRSP documentation follow the overview. For more information, see the CRSPAccess User Guide for the CRSP/Compustat Merged Database, the CRSP US Stock and Indices Database, and the CRSP US Treasury Database.

The CRSP standard notation has the form

  [global_section:]list_section

The list_section consists of a semicolon-delimited string of list elements in the form

  list_element[;list_element]

Each list_element can be an item or group name. You can also specify a particular keyset for the item or group by appending a period and its keyset number. For example, “sale.2” selects the sales item for keyset 2, which contains the industrial format, consolidated information, and standardized summary data from the latest annual filing.

The optional global_section holds flags that modify all elements in the list section. The following flags are recognized:

f

adds applicable and populated footnote items for every item selected. For example, “f:sale;at;ceq” selects sales, total assets, and common equity items with default keysets and available footnotes for the selected items.

d

adds applicable and populated data code items for every item selected. For example, “d:sale;at;ceq” selects sales, total assets, and common equity items with default keysets and available data codes for the selected items.

k.list

applies the list of keysets to all items in the list that do not have a specified keyset. The list can be either * to select all available keysets or #-#,#... to select keysets by their number. For example, “k.1:sale;at;ceq” selects the default keyset, keyset 1, for all items.

The following LIBNAME statement shows how to access the CCM database to retrieve the annual sales data and quarterly total assets data for IBM (GVKEY=6066) and Microsoft (GVKEY=12141):

   LIBNAME myLib sasexccm 'physical-name'
      SETID=250
      GVKEY=6066   /* IBM */
      GVKEY=12141  /* MSFT */
      ITEMLIST='f:sale;actq';

After the libref is assigned, you can access any of the available groups (members) within the opened database:

STK daily

See the section Daily STK Data Groups for more information about groups in the Daily Stock Database, SETID 10.

STK mthly

See the section Monthly STK Data Groups for more information about groups in the Monthly Stock Database, SETID 20.

CCM

See the section CCM Data Groups for more information about groups in the CRSP/Compustat Merged Databases, SETID 250.

IND mthly grp

See the section Monthly IND Group Data Group Names for more information about groups in the Monthly Indices Group Data Database, SETID 400.

IND mthly ts

See the section Monthly IND Time Series Data Group Names for more information about groups in the Monthly Indices Time Series Database, SETID 420.

IND daily grp

See the section Daily IND Group Data Group Names for more information about groups in the Daily Indices Group Data Database, SETID 440.

IND daily ts

See the section Daily IND Time Series Data Group Names for more information about groups in the Daily Indices Time Series Database, SETID 460.