%indtdpm;
%let indconn = server="terabase" user="user1" password="open1" database="mydb";
%indtd_publish_model( dir=C:\SASIN\baseball1, modelname=baseball1);
This sequence
of macros generates a separate .c file for each output parameter of
interest. Each output stub calls into a shared scoring main which
is compiled first. The %INDTD_PUBLISH_MODEL macro also produces a
text file of Teradata CREATE FUNCTION commands as shown in the following
example.
Note: This file is
shown for illustrative purposes. The text file that is created by
the %INDTD_PUBLISH_MODEL macro cannot be viewed and is deleted after
the macro is complete.
CREATE FUNCTION baseball1_EM_eventprobablility
(
"CR_ATBAT" float,
"CR_BB" float,
"CR_HITS" float,
"CR_HOME" float,
"CR_RBI" float,
"CR_RUNS" float,
"DIVISION" varchar(31),
"LEAGUE" varchar(31),
"NO_ASSTS" float,
"NO_ATBAT" float,
"NO_BB" float,
"NO_ERROR" float,
"NO_HITS" float,
"NO_HOME" float,
"NO_OUTS" float,
"NO_RBI" float,
"NO_RUNS" float,
"YR_MAJOR" float
)
RETURNS float
LANGUAGE C
NO SQL
PARAMETER STYLE SQL
NOT DETERMINISTIC
CALLED ON NULL INPUT
EXTERNAL NAME 'SL!"jazxfbrs"'
'!CI!tkcsparm!c:\SASIN\baseball1\tkcsparm.h'
'!CS!baseball1_EM_eventprobability!c:\SASIN\baseball1\EM_eventprobability.c';
After
the scoring functions are installed, they can be invoked in Teradata
using SQL, as illustrated in the following example. Each output value
is created as a separate function call in the select list.
select baseball1_EM_eventprobability
(
"CR_ATBAT",
"CR_BB",
"CR_HITS",
"CR_HOME",
"CR_RBI",
"CR_RUNS",
"DIVISION",
"LEAGUE",
"NO_ASSTS",
"NO_ATBAT",
"NO_BB",
"NO_ERROR",
"NO_HITS",
"NO_HOME",
"NO_OUTS"
) as homeRunProb from MLBTera;