The columns in the output
table are available to use in any SQL query expression.
select * from mymodel_out;
select em_classification from mymodel_out;
The output
table is written to an SPD Server table. To use the output data in
a SAS session, use a LIBNAME statement to access the SPD Server table.
In
addition, a SampleSQL.txt file is produced when the %INDSP_RUN_MODEL macro runs. This file can be found in the output directory
(OUTDIR argument) that you specify in the macro.
The SampleSQL.txt file
contains SPD Server SQL and DS2 code that can be used to query the
model output table. The SampleSQL.txt file code is specific to the
scoring model that was run against the specified input table.
To run the code in the
SampleSQL.txt file, you need only to include this file within a PROC
SQL statement.
proc sql;
%inc 'SampleSQL.txt';
quit;
The following example
assumes the model name that you used is
almush01
.
The output table is
almush01_out
. The
CONNECT TO and EXECUTE... BY statements are SPD Server SQL statements.
The code within the EXECUTE block is DS2 code that executes in SPD
Server through SQL.
/* Model almush01 run 14JUN13 7:41:42 PM */
/* Input is table almush01; Output is table almush01_out. */
/* Running model with 1 thread. */
connect to sasspds(dbq="model" host="myhost" serv="1234" user="anonymous");
execute(reset dialect=ds2) by sasspds;
execute(
ds2_options sas tkgmac scond=none;
thread almush01_thr / overwrite=yes;
dcl package modSPDS.almush01_pkg scorepkg();
dcl char( 32) "EM_CLASSIFICATION";
dcl double "EM_EVENTPROBABILITY";
dcl double "EM_PROBABILITY";
dcl double "G_CAPCOLOR";
dcl double "G_GILLCOLO";
dcl double "G_HABITAT";
dcl double "G_ODOR";
dcl double "G_POPULAT";
dcl double "G_RINGTYPE";
dcl double "G_SPOREPC";
dcl double "G_STALKCBR";
dcl double "G_STALKROO";
dcl double "G_STALKSAR";
dcl double "G_VEILCOLO";
dcl double "H11";
dcl double "H12";
dcl double "H13";
dcl char( 1) "I_TARGET";
dcl double "P_TARGETE";
dcl double "P_TARGETP";
dcl double "S_G_CAPCOLOR";
dcl double "S_G_GILLCOLO";
dcl double "S_G_HABITAT";
dcl double "S_G_ODOR";
dcl double "S_G_POPULAT";
dcl double "S_G_RINGTYPE";
dcl double "S_G_SPOREPC";
dcl double "S_G_STALKCBR";
dcl double "S_G_STALKROO";
dcl double "S_G_STALKSAR";
dcl double "S_G_VEILCOLO";
dcl char( 1) "U_TARGET";
dcl char( 4) "_WARN_";
method run();
set dataSPDS.almush01;
scorepkg.score("BRUISES",
"CAPCOLOR",
"GILLCOLO",
"GILLSIZE",
"HABITAT",
"ODOR",
"POPULAT",
"RINGNUMB",
"RINGTYPE",
"SPOREPC",
"STALKCBR",
"STALKROO",
"STALKSAR",
"STALKSHA",
"VEILCOLO",
"EM_CLASSIFICATION",
"EM_EVENTPROBABILITY",
"EM_PROBABILITY",
"G_CAPCOLOR",
"G_GILLCOLO",
"G_HABITAT",
"G_ODOR",
"G_POPULAT",
"G_RINGTYPE",
"G_SPOREPC",
"G_STALKCBR",
"G_STALKROO",
"G_STALKSAR",
"G_VEILCOLO",
"H11",
"H12",
"H13",
"I_TARGET",
"P_TARGETE",
"P_TARGETP",
"S_G_CAPCOLOR",
"S_G_GILLCOLO",
"S_G_HABITAT",
"S_G_ODOR",
"S_G_POPULAT",
"S_G_RINGTYPE",
"S_G_SPOREPC",
"S_G_STALKCBR",
"S_G_STALKROO",
"S_G_STALKSAR",
"S_G_VEILCOLO",
"U_TARGET",
"_WARN_");
output;
end;
endthread;
data dataSPDS.almush01_out (overwrite=yes);
keep ID EM_CLASSIFICATION EM_EVENTPROBABILITY EM_PROBABILITY;
dcl thread almush01_thr st;
method run();
set from st threads=1;
output;
end;
enddata;
) by sasspds;
For more information
about SPD Server SQL language, see the SAS Scalable Performance
Data Server: User’s Guide. For more information
about the DS2 language, see the SAS DS2 Language Reference.