Previous Page | Next Page

The SASECRSP Interface Engine

Example 35.5 Specifying Ranges for Individual Keys with the INSET= Option

Insets enable you to define options specific to each individual key. This example uses an inset to select four PERMNOs and specifies a different date restriction for each PERMNO.

title2 'INSET=testin2 uses date ranges along with PERMNOs:';
title3 '10107, 12490, 14322, 25788';
title4 'Begin dates and end dates for each permno are used in the INSET';

data testin2;
   permno = 10107; date1 = 19980731; date2 = 19981231; output;
   permno = 12490; date1 = 19970101; date2 = 19971231; output;
   permno = 14322; date1 = 19950731; date2 = 19960131; output;
   permno = 25778; date1 = 19950101; date2 = 19950331; output;
run;

libname _all_ clear;
libname mstk2 sasecrsp "%sysget(CRSP_MSTK)"
        setid=20
        inset='testin2,PERMNO,PERMNO,DATE1,DATE2';

data b;
   set mstk2.prc;
run;

proc print data=b;
run;

Output 35.5.1 shows CRSP Stock price time series data selected by PERMNO in the INSET= option, where each PERMNO has its own time span specified in the INSET= option.

Output 35.5.1 PRC Monthly Time Series Using INSET= Option
 
INSET=testin2 uses date ranges along with PERMNOs:
10107, 12490, 14322, 25788
Begin dates and end dates for each permno are used in the INSET

Obs PERMNO CALDT PRC
1 10107 19980731 109.93750
2 10107 19980831 95.93750
3 10107 19980930 110.06250
4 10107 19981030 105.87500
5 10107 19981130 122.00000
6 10107 19981231 138.68750
7 12490 19970131 156.87500
8 12490 19970228 143.75000
9 12490 19970331 137.25000
10 12490 19970430 160.50000
11 12490 19970530 86.50000
12 12490 19970630 90.25000
13 12490 19970731 105.75000
14 12490 19970829 101.37500
15 12490 19970930 106.00000
16 12490 19971031 98.50000
17 12490 19971128 109.50000
18 12490 19971231 104.62500
19 14322 19950731 32.62500
20 14322 19950831 32.37500
21 14322 19950929 36.87500
22 14322 19951031 34.00000
23 14322 19951130 39.37500
24 14322 19951229 39.00000
25 14322 19960131 41.50000
26 25778 19950131 49.87500
27 25778 19950228 57.25000
28 25778 19950331 59.37500

Previous Page | Next Page | Top of Page