Example 40.10 Selecting Time Series Using CROSSLIST= Option and WHERE=TICK
Instead of having a Fame namelist with the ticker symbols for companies whose data you are interested in, you can designate an input SAS data set (INSETA) that specifies the tickers to select. Specify your selection by using the WHERE clause in the INSET= option as shown in the following example:
data inseta;
length tick $5;
/* need $5 so SPALN is not truncated */
tick='AOL'; output;
tick='C'; output;
tick='CPQ'; output;
tick='CVX'; output;
tick='F'; output;
tick='GM'; output;
tick='HWP'; output;
tick='IBM'; output;
tick='SPALN'; output;
tick='SUNW'; output;
tick='XOM'; output;
run;
libname lib10 sasefame "%sysget(FAME_DATA)"
convert=(frequency=business technique=constant)
range='07jul1997'd - '25jul1997'd
inset=( inseta where=tick )
crosslist=
( {adjust, close, high, low, open, volume,
uclose, uhigh, ulow,uopen,uvolume} );
data trout;
/* eleven companies with unique TICKs specified in INSETA */
set lib10.training;
keep IBM: ;
run;
title1 'TRAINING DB, Pricing Timeseries for Eleven Tickers in CROSSLIST=';
title2 'Using INSET with WHERE=TICK.';
proc print data=trout;
run;
proc contents data=trout;
run;
Output 40.10.1 and Output 40.10.2 show the results.
Output 40.10.1
Listing of OUT=TROUT Using CROSSLIST= and INSET= Options in the Training Fame Data
0.5 |
47.2500 |
47.7500 |
47.0000 |
47.5000 |
94.500 |
95.500 |
94.000 |
95.000 |
129012 |
64506 |
0.5 |
47.8750 |
47.8750 |
47.2500 |
47.2500 |
95.750 |
95.750 |
94.500 |
94.500 |
102796 |
51398 |
0.5 |
48.0938 |
48.3438 |
47.6563 |
48.0000 |
96.188 |
96.688 |
95.313 |
96.000 |
177276 |
88638 |
0.5 |
47.8750 |
48.0938 |
47.0313 |
47.3438 |
95.750 |
96.188 |
94.063 |
94.688 |
127900 |
63950 |
0.5 |
47.8750 |
48.6875 |
47.8125 |
47.9063 |
95.750 |
97.375 |
95.625 |
95.813 |
137724 |
68862 |
0.5 |
47.6250 |
48.2188 |
47.0000 |
47.8125 |
95.250 |
96.438 |
94.000 |
95.625 |
128976 |
64488 |
0.5 |
48.0000 |
48.1250 |
46.6875 |
47.4375 |
96.000 |
96.250 |
93.375 |
94.875 |
149612 |
74806 |
0.5 |
48.8125 |
49.0000 |
47.6875 |
47.8750 |
97.625 |
98.000 |
95.375 |
95.750 |
215440 |
107720 |
0.5 |
49.8125 |
50.8750 |
48.5625 |
48.9063 |
99.625 |
101.750 |
97.125 |
97.813 |
315504 |
157752 |
0.5 |
52.2500 |
52.6250 |
50.0000 |
50.0000 |
104.500 |
105.250 |
100.000 |
100.000 |
463480 |
231740 |
0.5 |
51.8750 |
53.1563 |
51.0938 |
52.6250 |
103.750 |
106.313 |
102.188 |
105.250 |
328184 |
164092 |
0.5 |
51.5000 |
51.7500 |
49.6875 |
50.0313 |
103.000 |
103.500 |
99.375 |
100.063 |
368276 |
184138 |
0.5 |
52.5625 |
53.5000 |
51.5938 |
52.1875 |
105.125 |
107.000 |
103.188 |
104.375 |
219880 |
109940 |
0.5 |
53.9063 |
54.2188 |
52.2500 |
52.8125 |
107.813 |
108.438 |
104.500 |
105.625 |
204088 |
102044 |
0.5 |
53.5000 |
54.2188 |
52.8125 |
53.9688 |
107.000 |
108.438 |
105.625 |
107.938 |
146600 |
73300 |
Output 40.10.2
Contents of OUT=TROUT Using CROSSLIST= and INSET= Options in the Training Fame Data
IBM.ADJUST |
Num |
8 |
IBM.CLOSE |
Num |
8 |
IBM.HIGH |
Num |
8 |
IBM.LOW |
Num |
8 |
IBM.OPEN |
Num |
8 |
IBM.UCLOSE |
Num |
8 |
IBM.UHIGH |
Num |
8 |
IBM.ULOW |
Num |
8 |
IBM.UOPEN |
Num |
8 |
IBM.UVOLUME |
Num |
8 |
IBM.VOLUME |
Num |
8 |
Copyright © SAS Institute Inc. All rights reserved.