This section shows how to use the INSET= option to define a group of selected series that are generated by Fame expressions. It is important to use the LENGTH statement to avoid truncating the longest expression in the group defined by the BY variable EXPRESS.
Note: The EXPRESS variable is assigned the character string expression and is shown in Table 3. The following statements create an input data set, INSETA, and print it:
data inseta; /* Use this for training database */
length express $52;
express='{ibm.high,ibm.low,ibm.close};'; output;
express='crosslist({gm,f,c},{volume});'; output;
express='cvx.close;'; output;
express='mave(ibm.close,30);'; output;
express='cvx.close+ibm.close;'; output;
express='ibm.close;'; output;
express='close * shares/sum(close * shares);'; output;
express='sum(pep.volume);'; output;
express='mave(pep.close,20);'; output;
run;
proc print
data=inseta;
run;
Next you can name the input data set that you want to use in the INSET= option, followed by the KEEP= variable that specifies the expression group you want to keep. Only series variables that are defined in the selected expression group are output to the output data set. You can define up to eight different expression groups in an INSET= option.
libname lib5 sasefame "C:\PROGRA~1\FAME10\util"
wildcard="?"
convert=(frequency=business technique=constant)
range='23jul1997'd - '25jul1997'd
inset=( inseta KEEP=express)
;
data trout;
set lib5.trainten;
run;
title1 'TRAINING DB, Pricing Time Series for Expressions in INSET=';
title2 'OUT=TROUT from the PRINT Procedure';
proc print data=trout;
run;
Table 3 shows the eight expressions that are defined in INSETA.
Table 3: SAS Input Data Set, INSETA, Defined for Use in the INSET= Option
| Observation | 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); |
Table 4 shows the output data set, TROUT. The output data set names each derived variable SASTEMPn by appending the number, n, to match the observation number of the input data set’s expression for that variable. For example, SASTEMP1 names the series derived by 'cvx.close' in observation 1, and SASTEMP3 names the series derived by the expression 'mave(ibm.close,30);' in observation 3. Because SASTEMP2 is a simple name list of three series, the original series names are used.
Table 4: TRAINING DB, Pricing Timeseries for Expressions in INSETA for OUT=TROUT from the PRINT Procedure
| DATE | C.VOLUME | VOLUME | GM.VOLUME | IBM.CLOSE | IBM.HIGH |
|---|---|---|---|---|---|
| 23JUL1997 | 33791.88 | 45864.05 | 37392 | 52.5625 | 53.5000 |
| 24JUL1997 | 41828.85 | 29651.34 | 27771 | 53.9063 | 54.2188 |
| 25JUL1997 | 46979.83 | 36716.77 | 24969 | 53.5000 | 54.2188 |
| IBM.LOW | SASTEMP1 | SASTEMP3 | SASTEMP5 | SASTEMP6 | SASTEMP8 |
| 51.5938 | 38.4063 | . | 90.9688 | 52.5625 | . |
| 52.2500 | 38.4375 | . | 92.3438 | 53.9063 | . |
| 52.8125 | 39.0000 | . | 92.5000 | 53.5000 | . |
Note that SASTEMP3 and SASTEMP8 have no observations in the date range July 23, 1997, to July 25, 1997, so the missing value symbol '.' appears for those observations.