The SASEFAME Interface Engine

Example 41.16 Reading Time Series by Defining Fame Expression Groups in the INSET= Option with the KEEP= Clause

To keep all the numeric time series that are listed in the expressions given in the input data set, INSETA, use the INSET=( setname KEEPLIST=fame_expression_group ) and WILDCARD=? options. The following statements show how to select time series that are specified in a KEEP expression group and are written to the SAS output data set:

data inseta; /* Use this for d8690 training database */
   length express $52;
   express='cvx.close;'; output;
   express='{ibm.high,ibm.low,ibm.close};'; output;
   express='mave(ibm.close,30);'; output;
   express='crosslist({gm,f,c},{volume});'; output;
   express='cvx.close+ibm.close;'; output;
   express='ibm.close;'; output;
   express='sum(pep.volume);'; output;
   express='mave(pep.close,20);'; output;
run;

title1 'TRAINING DB, Pricing Timeseries for Expressions in INSET=';
proc print
   data=inseta;
run;

Output 41.16.1 shows the expressions that are stored as observations in the input data set, INSETA.

Output 41.16.1: Listing of INSETA Defining Fame Expression Group

TRAINING DB, Pricing Timeseries for Expressions in INSET=

Obs express
1 cvx.close;
2 {ibm.high,ibm.low,ibm.close};
3 mave(ibm.close,30);
4 crosslist({gm,f,c},{volume});
5 cvx.close+ibm.close;
6 ibm.close;
7 sum(pep.volume);
8 mave(pep.close,20);


The following statements show how to use the INSET= option to keep all time series that are represented in the input data set, INSETA, as the group variable EXPRESS:

libname libX sasefame "%sysget(FAME_DATA)"
   wildcard="?"
   convert=(frequency=business technique=constant)
   range='23jul1997'd - '25jul1997'd
   inset=( inseta KEEP=express)
   ;


data trout;
   set libX.trainten;
run;

title1 'TRAINING DB, Pricing Timeseries for Expressions in INSET=';
proc print data=trout;
run;

proc contents data=trout;
run;

Output 41.16.2 and Output 41.16.3 show the results.

Output 41.16.2: Listing of TROUT Using INSETA with KEEP=EXPRESS

TRAINING DB, Pricing Timeseries for Expressions in INSET=

Obs DATE C.VOLUME VOLUME GM.VOLUME IBM.CLOSE IBM.HIGH IBM.LOW SASTEMP1 SASTEMP3 SASTEMP5 SASTEMP6 SASTEMP8
1 23JUL1997 33791.88 45864.05 37392 52.5625 53.5000 51.5938 76.8125 47.0894 129.375 52.5625 37.6118
2 24JUL1997 41828.85 29651.34 27771 53.9063 54.2188 52.2500 76.8750 47.4289 130.781 53.9063 37.6250
3 25JUL1997 46979.83 36716.77 24969 53.5000 54.2188 52.8125 78.0000 47.7392 131.500 53.5000 37.6546


Output 41.16.3: Listing of Contents of TROUT

Alphabetic List of Variables and Attributes
# Variable Type Len Format Informat Label
2 C.VOLUME Num 8      
1 DATE Num 8 DATE9. 9. Date of Observation
4 GM.VOLUME Num 8      
5 IBM.CLOSE Num 8      
6 IBM.HIGH Num 8      
7 IBM.LOW Num 8      
8 SASTEMP1 Num 8      
9 SASTEMP3 Num 8      
10 SASTEMP5 Num 8      
11 SASTEMP6 Num 8      
12 SASTEMP8 Num 8      
3 VOLUME Num 8