(View the complete code for this example.)
Instead of accessing the local Fame training database, as shown in Example 47.10, this example shows how to access the remote Fame training database that is located on a remote Fame MCADBS server whose host name is "txa006". First, specify an explicit connection by using the CONNECT=YES option. Then name the connection in the AS_NAME= option, specify the host name of the remote MCADBS server in the ON_HOST= option, and specify the service to use in the TO_SERVICE= option. In addition, specify the user name and password for the connection by using the USER= and PASS= options. Designate an input SAS data set (INSETZ) that specifies the tickers to select, and specify your selection by using the WHERE clause in the INSET= option as follows:
option validvarname=any;
data insetz;
length tick $6;
/* need $6 so DJ30IN is not truncated */
tick='C'; output;
tick='CVX'; output;
tick='DJ30IN'; output;
tick='F'; output;
tick='HPQ'; output;
tick='IBM'; output;
tick='INTC'; output;
tick='KO'; output;
tick='ORCL'; output;
tick='PEP'; output;
tick='SPX'; output;
tick='XOM'; output;
tick='YUM'; output;
run;
libname lib10 sasefame "C:\PROGRA~1\FAME\util"
debug=on
connect=yes to_service="2961" on_host="txa006" as_name="C"
user="famekff" pass="XXXXXXXXX"
convert=(frequency=business technique=constant)
range='07jul1997'd - '25jul1997'd
inset=( insetz where=tick )
crosslist=
( {adjust, close, high, low, open, volume,
uclose, uhigh, ulow, uopen, uvolume} );
data trout;
/* thirteen companies with unique TICKs specified in INSETZ */
/* Use tr since this is the MCADBS dbid for the training.db */
set lib10.tr;
keep DATE IBM: ; /* only keep IBM for brevity of output results */
run;
title1 'TRAINING DB, Pricing Timeseries for IBM';
title2 'Using INSET with WHERE=TICK.';
proc print data=trout;
run;
proc contents data=trout;
run;
Output 47.18.1 and Output 47.18.2 show the results.
Output 47.18.1: Listing of OUT=TROUT Using CROSSLIST= and INSET= Options in the Fame MCADBS Remote TRAINING Data
| TRAINING DB, Pricing Timeseries for IBM |
| Using INSET with WHERE=TICK. |
| Obs | DATE | IBM.ADJUST | IBM.CLOSE | IBM.HIGH | IBM.LOW | IBM.OPEN | IBM.UCLOSE | IBM.UHIGH | IBM.ULOW | IBM.UOPEN | IBM.UVOLUME | IBM.VOLUME |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 07JUL1997 | 0.5 | 47.2500 | 47.7500 | 47.0000 | 47.5000 | 94.500 | 95.500 | 94.000 | 95.000 | 129012 | 64506 |
| 2 | 08JUL1997 | 0.5 | 47.8750 | 47.8750 | 47.2500 | 47.2500 | 95.750 | 95.750 | 94.500 | 94.500 | 102796 | 51398 |
| 3 | 09JUL1997 | 0.5 | 48.0938 | 48.3438 | 47.6563 | 48.0000 | 96.188 | 96.688 | 95.313 | 96.000 | 177276 | 88638 |
| 4 | 10JUL1997 | 0.5 | 47.8750 | 48.0938 | 47.0313 | 47.3438 | 95.750 | 96.188 | 94.063 | 94.688 | 127900 | 63950 |
| 5 | 11JUL1997 | 0.5 | 47.8750 | 48.6875 | 47.8125 | 47.9063 | 95.750 | 97.375 | 95.625 | 95.813 | 137724 | 68862 |
| 6 | 14JUL1997 | 0.5 | 47.6250 | 48.2188 | 47.0000 | 47.8125 | 95.250 | 96.438 | 94.000 | 95.625 | 128976 | 64488 |
| 7 | 15JUL1997 | 0.5 | 48.0000 | 48.1250 | 46.6875 | 47.4375 | 96.000 | 96.250 | 93.375 | 94.875 | 149612 | 74806 |
| 8 | 16JUL1997 | 0.5 | 48.8125 | 49.0000 | 47.6875 | 47.8750 | 97.625 | 98.000 | 95.375 | 95.750 | 215440 | 107720 |
| 9 | 17JUL1997 | 0.5 | 49.8125 | 50.8750 | 48.5625 | 48.9063 | 99.625 | 101.750 | 97.125 | 97.813 | 315504 | 157752 |
| 10 | 18JUL1997 | 0.5 | 52.2500 | 52.6250 | 50.0000 | 50.0000 | 104.500 | 105.250 | 100.000 | 100.000 | 463480 | 231740 |
| 11 | 21JUL1997 | 0.5 | 51.8750 | 53.1563 | 51.0938 | 52.6250 | 103.750 | 106.313 | 102.188 | 105.250 | 328184 | 164092 |
| 12 | 22JUL1997 | 0.5 | 51.5000 | 51.7500 | 49.6875 | 50.0313 | 103.000 | 103.500 | 99.375 | 100.063 | 368276 | 184138 |
| 13 | 23JUL1997 | 0.5 | 52.5625 | 53.5000 | 51.5938 | 52.1875 | 105.125 | 107.000 | 103.188 | 104.375 | 219880 | 109940 |
| 14 | 24JUL1997 | 0.5 | 53.9063 | 54.2188 | 52.2500 | 52.8125 | 107.813 | 108.438 | 104.500 | 105.625 | 204088 | 102044 |
| 15 | 25JUL1997 | 0.5 | 53.5000 | 54.2188 | 52.8125 | 53.9688 | 107.000 | 108.438 | 105.625 | 107.938 | 146600 | 73300 |
Output 47.18.2: Contents of OUT=TROUT Using CROSSLIST= and INSET= Options in the Fame MCADBS Remote TRAINING Data
| Alphabetic List of Variables and Attributes | ||||||
|---|---|---|---|---|---|---|
| # | Variable | Type | Len | Format | Informat | Label |
| 1 | DATE | Num | 8 | DATE9. | 9. | Date of Observation |
| 2 | IBM.ADJUST | Num | 8 | |||
| 3 | IBM.CLOSE | Num | 8 | |||
| 4 | IBM.HIGH | Num | 8 | |||
| 5 | IBM.LOW | Num | 8 | |||
| 6 | IBM.OPEN | Num | 8 | |||
| 7 | IBM.UCLOSE | Num | 8 | |||
| 8 | IBM.UHIGH | Num | 8 | |||
| 9 | IBM.ULOW | Num | 8 | |||
| 10 | IBM.UOPEN | Num | 8 | |||
| 11 | IBM.UVOLUME | Num | 8 | |||
| 12 | IBM.VOLUME | Num | 8 | |||
The DEBUG=ON option gives tracing information in the SAS log that shows the Fame CHLI commands that are used to communicate with the remote server. This debugging information can be useful in explaining the communication between the client and server machines. An abbreviated version of the SAS log follows:
NOTE: Libref LIB10 was successfully assigned as follows:
Engine: SASEFAME
Physical Name: C:\PROGRA~1\FAME\util
155
156 data trout;
157 set lib10.tr;
NOTE: The SASEFAME engine is using Version 11.43000 of the HLI.
len4=0
FAME COMMAND line 913 is:
OPEN <ACCESS READ> tr ON C; OVERWRITE ON; GLUE DOT;
ITEM ALIAS ON
STATUS from first OPEN is: 0
FAME COMMAND line 1255 is: GLUE DOT; LOOP FOR LCV IN CROSSLIST
({C,CVX,DJ30IN,F,HPQ,IBM,INTC,KO,ORCL,PEP,SPX,XOM,YUM},{ADJUST,CLOSE,HIGH,LOW,
OPEN,VOLUME,UCLOSE,UHIGH,ULOW,UOPEN,UVOLUME}); NEW WORK'LCV = LCV; END LOOP;
STATUS from LOOP for LCV in CROSSLIST is: 0
setting the dbkey to the wkkey which is: 0
STATUS from cfmopcn is: 0
cfmopdc dbname line 1459 is: tr
STATUS from cfmopdc is: 0
C.ADJUST -- SERIES (NUMERIC by BUSINESS)
FAME COMMAND line 2300 is: IGNORE ON;
C.CLOSE -- SERIES (NUMERIC by BUSINESS)
.
.
.
YUM.VOLUME -- SERIES (NUMERIC by BUSINESS)
FAME COMMAND line 2300 is: IGNORE ON;
entering fmoinfo, nobs=-1
C.ADJUST -- SERIES (NUMERIC by BUSINESS)
C.CLOSE -- SERIES (NUMERIC by BUSINESS)
.
.
.
IBM.ADJUST -- SERIES (NUMERIC by BUSINESS)
IBM.CLOSE -- SERIES (NUMERIC by BUSINESS)
IBM.HIGH -- SERIES (NUMERIC by BUSINESS)
IBM.LOW -- SERIES (NUMERIC by BUSINESS)
IBM.OPEN -- SERIES (NUMERIC by BUSINESS)
IBM.UCLOSE -- SERIES (NUMERIC by BUSINESS)
IBM.UHIGH -- SERIES (NUMERIC by BUSINESS)
IBM.ULOW -- SERIES (NUMERIC by BUSINESS)
IBM.UOPEN -- SERIES (NUMERIC by BUSINESS)
IBM.UVOLUME -- SERIES (NUMERIC by BUSINESS)
IBM.VOLUME -- SERIES (NUMERIC by BUSINESS)
.
.
.
YUM.UOPEN -- SERIES (NUMERIC by BUSINESS)
YUM.UVOLUME -- SERIES (NUMERIC by BUSINESS)
YUM.VOLUME -- SERIES (NUMERIC by BUSINESS)
entering fmoinfo, nobs=-1
entering fmoinfo, nobs=8637
158 run;
entering fmoinfo, nobs=8637
inside fmoinfo, nobs=8637
NOTE: There were 8637 observations read from the data set LIB10.TR.
NOTE: The data set WORK.TROUT has 8637 observations and 144 variables.
Because you specify the DEBUG=ON option, the SAS log includes the Fame commands and reports the status of the Fame CHLI commands that are issued during the execution of the SAS DATA step. The first Fame command shown is OPEN; it is important to note that instead of using training in the SAS SET statement, it is necessary to use the database ID, tr. For the MCADBS server, a list of databases is given in the mcadbs.config file, which for the host txa006 contains the following information:
# The databases to open
OPEN %OL% %FAME%\util\training.db TR
# Clients refer to this as TR.
The first OPEN command listed in the SAS log (inside the FAME command) refers to the named connection, C:
OPEN <ACCESS READ> tr ON C;
So the connection is named C, which is specified in the AS_NAME= option in the SASEFAME LIBNAME statement.