The SASECRSP Interface Engine

Example 39.4 Specifying Keys Using the INSET= Option

The INSET= option enables you to select any companies and/or issues you want data for. This example selects two CRSP Index Series from the Indices database, two companies from the CCM database, and four securities from the Stock database for data extraction. Note that because each CRSP database might be in a different location and has to be opened separately, a total of three 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 39.4.1 shows the result of selecting two CRSP Index Series from the Indices database.

Output 39.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


This example selects two companies from the CCM database.

data companies;
   permco=8045;  output;  /* Oracle */
   permco=20483; output;  /* Citigroup */
run;

libname comp2 sasecrsp "%sysget(CRSP_CST)"
        setid=200
        inset='companies,PERMCO,PERMCO'
        range='20040101-20040531';

title2 'Using the Link Info of Selected PERMCOs';
proc print data=comp2.link label;
run;

title3 'To Show Dividends Per Share for Oracle and Citigroup';
proc print data=comp2.div label;
run;

Output 39.4.2 shows the result of selecting two companies from the CCM database by using the CCM LINK data and the INSET= option.

Output 39.4.2: CCM LINK Data Extracted By Using INSET= Option

Using the Link Info of Selected PERMCOs

Obs GVKEY First date link
is valid
Last date link
is valid
CRSP PERMNO linked CRSP PERMCO linked Link type
code
Linking Flag
1 12142 19860312 20991231 10104 8045 LC BBB
2 3243 19861029 20991231 70519 20483 LC BBB


Output 39.4.3 shows the result of selecting two companies from the CCM database by using the CCM DIV data and the INSET= option.

Output 39.4.3: CCM DIV Data Extracted By Using INSET= Option

Using the Link Info of Selected PERMCOs
To Show Dividends Per Share for Oracle and Citigroup

Obs GVKEY Calendar Trading
Date
Dividends Per share
1 12142 20040130 0.0000
2 12142 20040227 0.0000
3 12142 20040331 0.0000
4 12142 20040430 0.0000
5 12142 20040528 0.0000
6 3243 20040130 0.4000
7 3243 20040227 0.0000
8 3243 20040331 0.0000
9 3243 20040430 0.4000
10 3243 20040528 0.0000


This example selects three securities from the Stock database by using TICKERs 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 39.4.4 shows the STK header data for the TICKERs specified by using the INSET= option.

Output 39.4.4: 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 39.4.5 shows the STK price data for the TICKERs specified by using the INSET= option.

Output 39.4.5: 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