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 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 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 for annual sales data for IBM (GVKEY=6066):

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

The following options can be used in the LIBNAME libref SASEXCCM statement:

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 use. If no GVKEY= options are specified, all GVKEYs in the database are selected.

For example, the following statement accesses the CCM database for 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 GVKEY and IID (Compustat’s Permanent Issue Identifier) by concatenating the two with a '.' and enclosing them in double quotes. There is no limit to the number of GVIIDKEY= options that you can use. 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 for 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 use. If no PERMNO= options are specified, all PERMNOS in the database are selected.

For example, the following statements access the STK database for 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 use. If no INDNO= options are specified, all INDNOs in the database are selected.

For example, the following statements access the IND database for 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 you want. Specify a string in CRSP standard notation for crsp_itemlist. See the section Data Reference: Introduction for overview information about items, groups, and reporting formats. Reference sections 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 with 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:

  • Applicable and populated footnote items are added 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.

  • Applicable and populated data code items are added 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.

  • Applies the list of keysets to all items in the list without a keyset already specified. 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 for 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: