You can use the ANALYZE_TABLE
function using explicit pass-through and PROC SQL or you can use other
DB2 query tools such as the Command Line Processor. Use the ANALYZE_TABLE
function in the FROM clause in any SQL expression to run the scoring
model.
Note: Before using the ANALYZE_TABLE
function with the SAS Embedded Process, you must create the model
table with the %INDB2_CREATE_MODELTABLE macro. Then, you must publish
the files to the model table with the %INDB2_PUBLISH_MODEL macro.
For more information,
see Creating a Model Table.
The syntax of the ANALYZE_TABLE
function is as follows:
FROM input-table ANALYZE_TABLE (IMPLEMENTATION
'PROVDER=SAS’;
ROUTINE_SOURCE_TABLE=schema-name.model-table-name;
ROUTINE_SOURCE_NAME="model-name";
')
- input-table
-
specifies the input
table that is used by the ANALYZE_TABLE function.
- schema-name
-
specifies the name
of the schema where the scoring model files are published.
- model-table-name
-
specifies the name
of the model table where the sasscore_modelname.ds2 and sasscore_modelname_ufmt.xml scoring files were published with the
%INDB2_CREATE_MODELTABLE macro.
Requirement |
The table name that you specify for this function must
be the same table name that is used in the %INDB2_CREATE_MODELTABLE
macro. For more information,
see %INDB2_CREATE_MODELTABLE Macro Syntax. |
- model-name
-
specifies the name
of the model.
Here is an example using
PROC SQL.
proc sql;
connect to db2 (user=userid password=xxxx database=mydatabase);
create table work.sas_score_out1 as select * from connection to db2
(WITH T1 as (SELECT * from SCORE_INPUT_TABLE where X1 < 1.0)
SELECT * from T1 ANALYZE_TABLE
(IMPLEMENTATION 'PROVIDER=SAS;
ROUTINE_SOURCE_TABLE=myschema.SAS_PUBLISH_MODEL;
ROUTINE_SOURCE_NAME="Intr_Tree";') );
disconnect from db2;
quit;