The SASECRSP Interface Engine

Example 46.2 Using the LIBNAME Statement to Access All Keys

To set up the libref to access all keys, no key options such as PERMNO=, TICKER=, or GVKEY= are specified in the LIBNAME statement and no INSET= option is used. Any of these options cause the SASECRSP engine to limit access to specified keys or specified insets. When no such options are specified, the SASECRSP engine correctly defaults to selecting all keys in the database. Other LIBNAME statement options, such as the RANGE= option, can still be used normally to limit the time span of the data—in other words, to define the date range of observations.

This example does not use key-specifying options. This forces the engine to default to all PERMNOs in the monthly STK database. The range that is specified in the LIBNAME statement behaves normally, and data are limited to the first two months of 1995.

title2 'Define a range inside the data range ';
title3 'My range is ( 19950101-19950228 )';

libname _all_ clear;
libname testit2 sasecrsp "%sysget(CRSP_MSTK)"
        setid=20
        range='19950101-19950228';
data a;
   set testit2.ask(obs=30);
run;

proc print data=a;
run;

The result is shown in Output 46.2.1.

Output 46.2.1: All PERMNOs of ASK Monthly Time Series Data with RANGE= Option

Define a range inside the data range
My range is ( 19950101-19950228 )

Obs PERMNO CALDT ASK
1 10001 19950131 8.00000
2 10001 19950228 8.00000
3 10002 19950131 13.50000
4 10002 19950228 13.50000
5 10003 19950131 2.12500
6 10003 19950228 2.25000
7 10009 19950131 18.00000
8 10009 19950228 18.75000
9 10010 19950131 5.37500
10 10010 19950228 4.87500
11 10011 19950131 14.62500
12 10011 19950228 13.50000
13 10012 19950131 2.25000
14 10012 19950228 2.12500
15 10016 19950131 7.00000
16 10016 19950228 8.50000
17 10018 19950131 1.12500
18 10018 19950228 1.12500
19 10019 19950131 10.62500
20 10019 19950228 11.62500
21 10021 19950131 11.75000
22 10021 19950228 12.00000
23 10025 19950131 18.50000
24 10025 19950228 19.00000
25 10026 19950131 11.00000
26 10026 19950228 11.75000
27 10028 19950131 1.87500
28 10028 19950228 2.00000
29 10032 19950131 12.50000
30 10032 19950228 12.75000