The SASECRSP Interface Engine

Example 38.4 Specifying Keys by Using the INSET= Option

The INSET= option enables you to select any companies or issues for which you want data. This example selects two CRSP Index Series from the CRSP Indices data, and four securities from the CRSP US Stock data for data extraction. Note that because each CRSP database might be in a different location and must be opened separately, a total of two different librefs are used, one for each database.

data indices;
   indno=1000000; output;  /* NYSE Value-Weighted Market Index */
   indno=1000001; output;  /* NYSE Equal-Weighted Market Index */
run;

libname _all_ clear;
libname ind2 sasecrsp "%sysget(CRSP_MSTK)"
        setid=420
        inset='indices,INDNO,INDNO'
        range='19990101-19990401';

title2 'Total Returns for NYSE Value- and Equal-Weighted Market Indices';
proc print data=ind2.tret label;
run;

Output 38.4.1 shows the result of selecting two CRSP Index Series from the CRSP Indices data.

Output 38.4.1: IND Data Extracted Using INSET= Option

Total Returns for NYSE Value- and Equal-Weighted Market Indices

Obs INDNO Calendar Trading
Date
Total Returns
1 1000000 19990129 0.012419
2 1000000 19990226 -0.024179
3 1000000 19990331 0.028591
4 1000001 19990129 -0.007700
5 1000001 19990226 -0.041183
6 1000001 19990331 0.015101



The following statements select three securities from the CRSP US Stock data by using TICKER keys in the INSET= option for data extraction:

data securities;
   ticker='BAC'; output;  /* Bank of America */
   ticker='DUK'; output;  /* Duke Energy */
   ticker='GSK'; output;  /* GlaxoSmithKline */
run;

libname sec3 sasecrsp "%sysget(CRSP_MSTK)"
        setid=20
        inset='securities,TICKER,TICKER'
        range='19970820-19970920';

title2 'PERMNOs and General Header Info of Selected TICKERs';
proc print data=sec3.stkhead(keep=permno htick htsymbol) label;
run;
title3 'Average Price for Bank of America, Duke and GlaxoSmithKline';
proc print data=sec3.prc label;
run;

Output 38.4.2 shows the STK header data for the TICKER keys that are specified by using the INSET= option.

Output 38.4.2: STK Header Data Extracted Using INSET= Option

PERMNOs and General Header Info of Selected TICKERs

Obs PERMNO Ticker Symbol
Header
Trading Symbol
Header
1 59408 BAC BAC
2 27959 DUK DUK
3 75064 GSK GSK



Output 38.4.3 shows the STK price data for the TICKER keys that are specified by using the INSET= option.

Output 38.4.3: STK Price Data Extracted Using INSET= Option

PERMNOs and General Header Info of Selected TICKERs
Average Price for Bank of America, Duke and GlaxoSmithKline

Obs PERMNO Calendar Trading
Date
Price or Bid/Ask
Average
1 59408 19970829 59.75000
2 27959 19970829 48.43750
3 75064 19970829 39.93750