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 eight possible values: 10, 20, 100, 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';

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

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 Compustat 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';
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;
TREASNO=crsp_treasno

selects the treasury data items you want to retrieve by TREASNO. Specify a CRSP US Treasury’s TREASNO for the crsp_treasno. There is no limit to the number of TREASNO= options that you can use. If no TREASNO= options are specified, all TREASNOS in the database are selected.

For example, the following statements access the TRS database for monthly ASK and BID time series data for TREASNOS 202999 and 203666:

   LIBNAME myLib sasexccm 'physical-name'
      SETID=100
      TREASNO=202999 TREASNO=203666
      ITEMLIST="TMASK.*;TMBID.*";
   data mtrsts_all;
      set myLib.trs_mth_ts;
   run;
TCUSIP=crsp_tcusip

selects the treasury data items you want to retrieve. Specify a CRSP US Treasury TCUSIP for the crsp_tcusip. There is no limit to the number of TCUSIP= options that you can use. If no TCUSIP= options are specified, all TCUSIPS in the database are selected.

For example, the following statements access the TRS database for monthly ASK and BID time series data for TCUSIPs 9128272B and 912795XK:

   LIBNAME myLib sasexccm 'physical-name'
      SETID=100
      TCUSIP='9128272B' TCUSIP='912795XK'
      ITEMLIST="TMASK.*;TMBID.*";
   data mtrsts_all;
      set myLib.trs_mth_ts;
   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 full LIBNAME example 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';



Note: This procedure is experimental.