Running the %INDTD_PUBLISH_MODEL Macro

%INDTD_PUBLISH_MODEL Macro Run Process

To run the %INDTD_PUBLISH_MODEL macro, complete the following steps:
  1. Create a traditional scoring model by using SAS Enterprise Miner or an analytic store scoring model using the SAS Factory Miner HPFOREST or HPSVM component.
  2. Test your connection to Teradata with a local utility such as BTEQ.
  3. Start SAS and submit the following command in the Program Editor or Enhanced Editor:
    %let indconn = server=myserver user=myuserid password=xxxx database=mydb;
    For more information, see the INDCONN Macro Variable.
  4. If you use the SAS Embedded Process, run the %INDTD_CREATE_MODELTABLE macro.
    For more information, see Creating a Model Table.
  5. Run the %INDTD_PUBLISH_MODEL macro.
    Messages are written to the SAS log that indicate whether the scoring functions or files were successfully created.
    For more information, see %INDTD_PUBLISH_MODEL Macro Syntax.

INDCONN Macro Variable

The INDCONN macro variable is used to provide the credentials to connect to Teradata. You must assign the INDCONN macro variable before the %INDTD_PUBLISH_MODEL or the %INDTD_CREATE_MODELTABLE macros are invoked.
The syntax for the value of the INDCONN macro variable depends on whether you are using Teradata single sign-on (SSO) authentication for Kerberos.
  • Here is the syntax for the value of the INDCONN macro variable if you are not using Teradata single sign-on (SSO) authentication:
    SERVER=server USER=userid | userid@LDAP PASSWORD=password
    DATABASE=database
  • Here is the syntax for the value of the INDCONN macro variable if you are using Teradata single sign-on (SSO) authentication:
    SERVER=server <USER=@KRB5 | userid@KRB5 > <PASSWORD=password>
    DATABASE=database
    Note: If you are using Teradata single sign-on (SSO) authentication and do not specify a user ID and password, the publishing macros use your Kerberos authentication information to generate connection credentials.
Arguments

SERVER=server

specifies the Teradata server name or the IP address of the server host.

USER=userid | userid@LDAP or userid@KRB5 | @KRB5

specifies the Teradata user name (also called the user ID) that is used to connect to the database.

Restriction If you are using Teradata single sign-on (SSO) authentication with Kerberos, USER= must match the operating system identity of the user that is running SAS. Specifying another user ID (sometimes called “sign-on as”) is not supported with Kerberos.
Requirement If you are not using Teradata single sign-on (SSO) authentication, you must specify both userid and password.
Note If you are using Teradata single sign-on (SSO) authentication, and do not specify a user ID and password, the publishing macros will use your Kerberos authentication information to generate connection credentials.
Tip If you are using Teradata single sign-on (SSO) authentication, you can specify either userid@KRB5 or @KRB5. Using @KRB5 forces the publishing process to use Kerberos authentication.

PASSWORD=password

specifies the password that is associated with your Teradata user ID.

Requirement If you are not using Teradata single sign-on (SSO) authentication, you must specify both a user ID and a password. If you are using Teradata single sign-on (SSO) authentication, password is optional.
Tip Use only PASSWORD=, PASS=, or PW= for the password argument. PWD= is not supported and causes an error to occur.

DATABASE=database

specifies the Teradata database that contains the tables and views that you want to access.

Default Your current database
Requirements You must specify the DATABASE= argument if you use the SAS Embedded Process.
The maximum database name length is 128 characters, and it must be a valid Teradata database name.
Here is an example of using the INDCONN macro variable without single sign-on authentication.
indconn = server=servref user=johndoe password=xxxx database=2016db;
Here are some examples of using the INDCONN macro variable with single sign-on authentication.
indconn = server=servref user=johndoe@krb5 database=2016db;
indconn = server=servref user=johndoe@krb5 database=2016db;
indconn = server=servref user=@krb5 database=2016db;
indconn = server=servref user=johndoe@krb5;
Here is an example of using the INDCONN macro variable where single sign-on authentication will be generated by your Kerberos ticket information.
indconn=server=servref database=2016db;
For more information, see “Authentication Using Kerberos” in SAS/ACCESS for Relational Databases: Reference.
Tip
The INDCONN macro variable is not passed as an argument to the %INDTD_PUBLISH_MODEL macro. This information can be concealed in your SAS job. For example, you can place it in an autoexec file and apply permissions on that file so that others cannot access the user credentials.

%INDTD_PUBLISH_MODEL Macro Syntax

Arguments

DIR=input-directory-path

specifies the directory where the scoring model program, the properties file, the analytic store file (if analytic store scoring), and the format catalog are located.

This is the directory that is created by the SAS Enterprise Miner Score Code Export node or the SAS Factory Miner HPFOREST or HPSVM components. This directory contains the score.sas file, the score.xml file or (if analytic store scoring) score.sasast file, and (if user-defined formats were used) the format catalog.
Restriction You must use a fully qualified pathname.
Interaction If you do not use the default directory that is created by SAS Enterprise Miner, you must specify the DATASTEP=, XML= or (if analytic store scoring) STORE=, and (if needed) FMTCAT= arguments.
See Special Characters in Directory Names

MODELNAME=name

specifies the name that is prepended to each output function to ensure that each scoring function name is unique on the Teradata database. If you use the SAS Embedded Process, the model name is part of the .ds2 and .xml scoring filenames.

Restrictions The scoring function name is a combination of the model name and the output variable name. The maximum scoring function name length is 128 characters. For more information, see Scoring Function Names.
If you use scoring functions, the model name must be a valid SAS name that is 10 characters or fewer. If you use the SAS Embedded Process, the model name can be up to 128 characters. For more information about valid SAS names, see the topic on rules for words and names in SAS Language Reference: Concepts.
Interaction Only the EM_ output variables are published as Teradata scoring functions. For more information about the EM_ output variables, see Fixed Variable Names and Scoring Function Names.

MECHANISM=STATIC | EP

specifies whether scoring functions or scoring files are created. MECHANISM= can have one of the following values:

STATIC

specifies that scoring functions are created.

These scoring functions are used in an SQL query to run the scoring model.
See Using Scoring Functions to Run Scoring Models

EP

specifies that scoring files are created.

These scoring files are used by the SAS Embedded Process to run the scoring model. A single entry in the model table is inserted for each new model. The entry contains both the score.sas and score.xml in separate columns. The scoring process includes reading these entries from the table and transferring them to each instance of the SAS Embedded Process for execution.
Requirement If you specify MECHANISM=EP, you must also specify the MODELTABLE= argument.
Note The SAS Embedded Process might require a later release of Teradata than function-based scoring. For more information, see the SAS Foundation system requirements documentation for your operating environment.
See Using the SAS Embedded Process to Run Scoring Models
Default If either a score.sasast file exists or you specify STORE=analytic-store-filename, the default is EP. Otherwise, the default is STATIC.
Interaction If you specify MECHANISM=STATIC and either a score.sasast file exists or you specify STORE=analytic-store-filename, an error occurs.
See STORE=analytic-store-filename

MODELTABLE=model-table-name

specifies the name of the model table where the scoring files are published.

Default sas_model_table
Restriction This argument is available only when using the SAS Embedded Process.
Requirements The name of the model table must be the same as the name specified in the %INDTD_CREATE_MODELTABLE macro. For more information, see the MODELTABLE argument in %INDTD_CREATE_MODELTABLE Macro Syntax.
The maximum table name length is 128 characters, and it must be a valid Teradata table name.

DATASTEP=score-program-filename

specifies the name of the scoring model program file that was created by using the SAS Enterprise Miner Score Code Export node or the SAS Factory Miner HPFOREST or HPSVM component.

Default score.sas
Restriction Only DATA step programs that are produced by the SAS Enterprise Miner Score Code Export node or the SAS Factory Miner HPFOREST or HPSVM component can be used.
Interaction If you use the default score.sas file that is created by the SAS Enterprise Miner Score Code Export node or the SAS Factory Miner HPFOREST or HPSVM component, you do not need to specify the DATASTEP= argument.

XML=xml-filename

specifies the name of the properties XML file that was created by the SAS Enterprise Miner Score Code Export node.

Default score.xml
Restrictions Only XML files that are produced by the SAS Enterprise Miner Score Code Export node can be used. This argument is not applicable for analytic store models that are generated by SAS Factory Miner.
If you use scoring functions to run scoring models, the maximum number of output variables is 128. If you use the SAS Embedded Process, the maximum is 2048.
Interaction If you use the default score.xml file that is created by the SAS Enterprise Miner Score Code Export node, you do not need to specify the XML= argument.

STORE=analytic-store-filename

specifies the filename of the analytic store.

Default score.sasast
Restriction Only analytic store files that are produced by the SAS Factory Miner HPFOREST or HPSVM components can be used.
Interactions If an analytic store file exists in the input directory (DIR=), the %INDTD_PUBLISH_MODEL macro attempts to publish that object. Alternatively, you can specify the name of the analytic store in the STORE= argument.
If you specify MECHANISM=STATIC and either a score.sasast file exists or you specify STORE=analytic-store-filename, an error occurs.
See DIR=input-directory-path
MECHANISM=STATIC | EP

DATABASE=database-name

specifies the name of a Teradata database to which the scoring functions and formats or the scoring files are published.

Default The database specified in the INDCONN macro variable or your current database
Requirements If you use the SAS Embedded Process, the name of the database must be the same as the database that is specified in the %INDTD_CREATE_MODELTABLE macro. For more information, see the DATABASE argument in %INDTD_CREATE_MODELTABLE Macro Syntax.
The maximum database name length is 128 characters, and it must be a valid Teradata database name.
Interaction The database that is specified by the DATABASE argument takes precedence over the database that you specify in the INDCONN macro variable. For more information, see %INDTD_PUBLISH_MODEL Macro Run Process.
Tip You can publish the scoring functions and formats or the scoring files to a shared database where other users can access them.

FMTCAT=format-catalog-filename

specifies the name of the format catalog file that contains all user-defined formats that were created by the FORMAT procedure and that are referenced in the DATA step scoring model program.

Restriction Only format catalog files that are produced by the SAS Enterprise Miner Score Code Export node or the SAS Factory Miner HPFOREST or HPSVM component can be used.
Interactions If you use the default format catalog that is created by the SAS Enterprise Miner Score Code Export node or the SAS Factory Miner HPFOREST or HPSVM component, you do not need to specify the FMTCAT= argument.
If you do not use the default catalog name (FORMATS) or the default library (WORK or LIBRARY) when you create user-defined formats, you must use the FMTSEARCH system option to specify the location of the format catalog. For more information, see PROC FORMAT in Base SAS Procedures Guide.
Note The analytic store file includes format catalog information. However, you can specify a different format catalog by using the FMTCAT= argument.

ACTION=CREATE | REPLACE | DROP

specifies one of the following actions that the macro performs:

CREATE

creates new functions or files.

REPLACE

overwrites the current functions or files, if functions or files with the same name are already registered.

DROP

causes all functions or files for this model to be dropped from the Teradata database.

Default CREATE
Tip If the function or file has been previously defined and you specify ACTION=CREATE, you receive warning messages from Teradata. If the function or file has been previously defined and you specify ACTION=REPLACE, no warnings are issued.

MODE=PROTECTED | UNPROTECTED

specifies whether the running code is isolated in a separate process in the Teradata database so that a program fault does not cause the database to stop.

Default PROTECTED
Restriction This argument is valid only when MECHANISM=STATIC. It has no effect if you specify MECHANISM=EP. All models published with MECHANISM=EP run in protected mode.
Tip After a function is validated in PROTECTED mode, it can be republished in UNPROTECTED mode. This can result in a significant performance gain.

OUTDIR=diagnostic-output-directory

specifies a directory that contains diagnostic files.

Produced files include an event log that contains detailed information about the success or failure of the publishing process and sample SQL code (SampleSQL.txt). For more information about the SampleSQL.txt file, see Scoring Function Names.
Tip This argument is useful when testing your scoring models.
See Special Characters in Directory Names

Modes of Operation

The %INDTD_PUBLISH_MODEL macro has two modes of operation: protected and unprotected. You specify the mode by setting the MODE= argument.
Note: The MODE= argument is valid only when MECHANISM=STATIC. It has no effect if you specify MECHANISM=EP. All models published with MECHANISM=EP run in protected mode.
The default mode of operation is protected. Protected mode means that the macro code is isolated in a separate process in the Teradata database, and any error does not cause the database to stop. It is recommended that you run the %INDTD_PUBLISH_MODEL macro in protected mode during acceptance tests. The SAS Embedded Process always operates in its own process, which is equivalent to fenced mode functions. An optimized data transport mechanism allows the SAS Embedded Process to provide fenced mode protection with speed that is as good as or better than unfenced functions.
When the %INDTD_PUBLISH_MODEL macro is ready for production, you can run the macro in unprotected mode. Note that you could see a performance advantage when you run in unprotected mode.