SAS Accelerator Publishing Agent for Netezza

Prerequisites

SAS Foundation and the SAS/ACCESS Interface to Netezza must be installed before you install and configure the SAS Accelerator Publishing Agent for Netezza.

Overview of the SAS Accelerator Publishing Agent for Netezza

This section describes how to install and configure the SAS Accelerator Publishing Agent for Netezza. The SAS 9.2 Formats Library for Netezza is included with the SAS Accelerator Publishing Agent for Netezza. This section also describes how to install the SAS 9.2 Formats Library.
The SAS Accelerator Publishing Agent and the SAS 9.2 Formats Library are used by both the SAS/ACCESS Interface to Netezza and by the SAS Scoring Accelerator for Netezza.
  • In the SAS/ACCESS Interface to Netezza, a format publishing macro,%INDNZ_PUBLISH_FORMATS, creates or publishes the SAS_PUT() function and formats inside the database.
  • In the SAS Scoring Accelerator for Netezza, a scoring publishing macro,%INDNZ_PUBLISH_MODEL, creates or publishes scoring model functions.
The SAS 9.2 Formats Library for Netezza is a run-time library that is installed on your Netezza system so that the SAS scoring model functions and the SAS_PUT() function created in Netezza can access the routines within its run-time library.
The SAS Accelerator Publishing Agent contains four publishing macros:
  • %INDNZ_PUBLISH_FORMATS
  • %INDNZ_PUBLISH_MODEL
  • %INDNZ_PUBLISH_JAZLIB (TwinFin systems only)
  • %INDNZ_PUBLISH_COMPILEUDF
The %INDNZ_PUBLISH_JAZLIB macro registers the SAS 9.2 Formats Library for TwinFin systems. The %INDNZ_PUBLISH_COMPILEUDF macro registers a utility function in the database. The utility function is then called by the format and scoring publishing macros. You must run these two macros before you run the format and scoring publishing macros.

Function Publishing Process in Netezza

To create the SAS scoring model, SAS_PUT() function, and formats on Netezza Performance Server (NPS) and TwinFin systems, the publishing macros perform the following tasks:
  • Create and transfer the files, using the Netezza External Table interface, to the Netezza server.
    Using the Netezza External Table interface, the source files are loaded from the client to a database table through remote ODBC. The source files are then exported to files (external table objects) on the host. Before transfer, each source file is divided into 32K blocks and converted to hexadecimal values to avoid problems with special characters, such as line feed or quotation marks. After the files are exported to the host, the source files are converted back to text.
  • Compile those source files into object files using a Netezza compiler.
  • Link with the SAS 9.2 Formats Library.
  • Register those object files with the NPS or TwinFin systems.

Netezza Installation and Configuration Steps

  1. Apply Hot Fix B85002 for SAS Table Server Base Components 9.2_M2. This hot fix can be found at http://ftp.sas.com/techsup/dowload/hotfix/HF2/B85.html#B85002.
  2. Move and unpack the SAS 9.2 Formats Library and binary files for the SAS_COMPILEUDF function.
  3. For TwinFin systems, run the %INDNZ_PUBLISH_JAZLIB macro to publish the SAS 9.2 Formats Library for Netezza as an object.
    For more information, see Running the %INDNZ_PUBLISH_JAZLIB Macro.
  4. Run the %INDNZ_PUBLISH_COMPILEUDF macro.

Moving and Unpacking the SAS 9.2 Formats Library and Binary Files

The SAS 9.2 Formats Library and the binary files for the SAS_COMPILEUDF function are contained in a self-extracting TAR file on the SAS Software Depot. The location of the TAR file, the README file, and possibly other files, is contained in the ordersummary.html file that accompanies the software. Your order e-mail contains the path to the ordersummary.html file. To move and unpack the TAR file, follow these steps:
  1. Using a method of your choice, transfer one of these files to your Netezza system:
    • For NPS systems, accelnetzfmt_nps.sh
    • For TwinFin systems, accelnetzfmt_twinfin.sh
  2. After the accelnetzfmt_nps.sh or accelnetzfmt_twinfin.sh file has been transferred to the Netezza machine, log in as the user who owns the Netezza software (usually the “nz” ID).
  3. Use the following commands at the UNIX prompt to unpack the TAR file.
    mkdir –p /nz/extensions
    chmod 755 /nz/extensions
    cd /nz/extensions
    chmod 755 accelnetzfmt_nps.sh | /accelnetzfmt_twinfin.sh
    path_to_self-extracting_tar_file/accelnetzfmt_nps.sh | /accelnetzfmt_twinfin.sh
    After the script runs and the files are unpacked, the target directories should look similar to these.
    For Netezza NPS systems:
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/bin/InstallAccelNetzFmt.sh
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/SAS_CompileUDF.o_diab_ppc
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/SAS_CompileUDF.o_x86
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/libjazxfbrs_diab_ppc.a
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/libjazxfbrs_x86.a
    For Netezza TwinFin systems:
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/bin/InstallAccelNetzFmt.sh
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/SAS_CompileUDF.o_spu10
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/SAS_CompileUDF.o_x86
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/libjazxfbrs_spu10.so
    /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2-1.8/lib/libjazxfbrs_x86.so
    There also is a symbolic link such that /nz/extensions/SAS/SASFormatsLibraryForNetezza/9.2 points to the latest version.

Running the %INDNZ_PUBLISH_JAZLIB Macro

Overview of Publishing the SAS 9.2 Formats Library

For NPS systems, the SAS 9.2 Formats Library is built as a static object and is linked to the scoring and format functions by the SAS_COMPILEUDF function. No further actions are needed to publish the SAS 9.2 Formats Library.
For TwinFin systems, the SAS 9.2 Formats Library is a shared library and must be published and registered as an object in the Netezza database. The library is linked to the scoring and format publishing macros through a DEPENDENCIES statement when the scoring model functions or formats are created.
You must run the %INDNZ_PUBLISH_JAZLIB macro to publish and register the SAS 9.2 Formats Library. The %INDNZ_PUBLISH_JAZLIB macro publishes and registers the SAS 9.2 Formats Library for Netezza in the database as the sas_jazlib object.

%INDNZ_PUBLISH_JAZLIB Macro Run Process

To run the %INDNZ_PUBLISH_JAZLIB macro, start SAS 9.2 and submit the following commands in the Enhanced Editor or Program Editor:
%indnzpj;
%let indconn=SERVER=yourservername USER=youruserid PW=yourpwd DB=database;
%indnz_publish_jazlib(database=saslib, outdir=c:\fmtlib, action=create);

%INDNZPJ Macro

The %INDNZPJ macro searches the autocall library for the indnzpj.sas file. The indnzpj.sas file contains all the macro definitions that are used in conjunction with the %INDNZ_PUBLISH_JAZLIB macro. The indnzpj.sas file should be in one of the directories listed in the SASAUTOS= system option in your configuration file. If the indnzpj.sas file is not present, the %INDNZPJ macro call (%INDNZPJ; statement) issues the following message:
macro indnzpj not defined

INDCONN Macro Variable

The INDCONN macro variable is used to provide credentials to connect to Netezza. You must specify server, user, password, and database information to access the machine on which you have installed the Netezza data warehouse. You must assign the INDCONN macro variable before the %INDNZ_PUBLISH_JAZLIB macro is invoked.
Tip
The INDCONN macro variable is not passed as an argument to the %INDNZ_PUBLISH_JAZLIB macro. This information can be concealed in your SAS job. For example, you can place it in an autoexec file and apply permissions to the file so others cannot access the user credentials.
Here is the syntax for the value of the INDCONN macro variable for the %INDNZ_PUBLISH_JAZLIB macro:
SERVER=<'>twinfin-server<'> USER=<'>userid<'> PASSWORD=<'>password<'>
DATABASE=<'>database<'>
SERVER=<'>twinfin-server<'>
specifies the server name or IP address of the TwinFin server to which you want to connect. This server accesses the database that contains the tables and views that you want to access. If the server name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
USER=<'>userid<'>
specifies the Netezza user name (also called the user ID) that you use to connect to your database. If the user name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
PASSWORD=<'>password<'>
specifies the password that is associated with your Netezza user name. If the password contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
Tip:You can use only PASSWORD= or PW= for the password argument. Other aliases such as PASS= or PWD= are not supported and cause errors.
DATABASE=<'>database<'>
specifies the name of the database on the TwinFin server that contains the tables and views that you want to access. If the database name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.

%INDNZ_PUBLISH_JAZLIB Macro Syntax

%INDNZ_PUBLISH_JAZLIB(
<DATABASE=database>
<, ACTION=CREATE | REPLACE | DROP>
<, OUTDIR=diagnostic-output-directory>
);
Arguments
DATABASE=database
specifies the name of a Netezza database to which the SAS 9.2 Formats Library is published as the sas_jazlib object.
Default: SASLIB
Interaction:The database that is specified by the DATABASE= argument takes precedence over the database that you specify in the INDCONN macro variable.
Tip:The object name for the SAS 9.2 Formats Library is sas_jazlib
ACTION=CREATE | REPLACE | DROP
specifies that the macro performs one of the following actions:
CREATE
creates a new SAS 9.2 Formats Library.
REPLACE
overwrites the current SAS 9.2 Formats Library, if a SAS 9.2 Formats Library by the same name is already registered, or creates a new SAS 9.2 Formats Library if one is not registered.
DROP
causes the SAS 9.2 Formats Library to be dropped from the Netezza database.
Default:CREATE
Tip:If the SAS 9.2 Formats Library was published previously and you specify ACTION=CREATE or REPLACE, no warning is issued. Also, if you specify ACTION=DROP and the SAS 9.2 Formats Library does not exist, no warning is issued.
OUTDIR=diagnostic-output-directory
specifies a directory that contains diagnostic files.
Tip: Files that are produced include an event log that contains detailed information about the success or failure of the publishing process.

Running the %INDNZ_PUBLISH_COMPILEUDF Macro

Overview of the %INDNZ_PUBLISH_COMPILEUDF Macro

The %INDNZ_PUBLISH_COMPILEUDF macro creates three functions:
  • SAS_COMPILEUDF. This function facilitates the scoring and format publishing macros. The SAS_COMPILEUDF function compiles the scoring model and format source files into object files. This compilation uses a Netezza compiler and occurs through the SQL interface using an appropriate compiler for the NPS or TwinFin system. After that, the scoring and format publishing macros register those object files with the NPS. For NPS systems, the SAS_COMPILEUDF function also creates a link to the SAS 9.2 Formats Library for Netezza. This link is needed for scoring and format publishing.
  • SAS_DIRECTORYUDF and SAS_HEXTOTEXTUDF. These functions are used when the scoring and format publishing macros transfer source files from the client to the host using the Netezza External Tables interface. SAS_DIRECTORYUDF creates and deletes temporary directories on the host. SAS_HEXTOTEXTUDF converts the files from hexadecimal back to text after the files are on the host. For more information about the file transfer process, see Function Publishing Process in Netezza.
You have to run the %INDNZ_PUBLISH_COMPILEUDF macro only one time.
The SAS_COMPILEUDF, SAS_DIRECTORYUDF, and SAS_HEXTOTEXTUDF functions must be published before the %INDNZ_PUBLISH_FORMATS or %INDNZ_PUBLISH_MODEL macros are run. Otherwise, these macros fail.
Note: To publish the SAS_COMPILEUDF, SAS_DIRECTORYUDF, and SAS_HEXTOTEXTUDF functions, you must have the appropriate Netezza user permissions to create these functions in either the SASLIB database (default) or in the database that is used in lieu of SASLIB. For more information, see Netezza Permissions for the SAS Accelerator Publishing Agent.

%INDNZ_PUBLISH_COMPILEUDF Macro Run Process

To run the %INDNZ_PUBLISH_COMPILEUDF macro to publish the SAS_COMPILEUDF, SAS_DIRECTORYUDF, and SAS_HEXTOTEXTUDF functions, follow these steps:
  1. Create either a SASLIB database or a database to be used in lieu of the SASLIB database.
    This database is where the SAS_COMPILEUDF, SAS_DIRECTORYUDF, and SAS_HEXTOTEXTUDF functions are published. You specify this database in the DATABASE argument of the %INDNZ_PUBLISH_COMPILEUDF macro. For more information about how to specify the database that is used in lieu of SASLIB, see %INDNZ_PUBLISH_COMPILEUDF Macro Run Process.
  2. Start SAS 9.2 and submit the following commands in the Enhanced Editor or Program Editor.
    %indnzpc;
    %let indconn = server=yourserver user=youruserid password=yourpwd
       database=database;
    %indnz_publish_compileudf(
       database=database,
       action=create,
       outdir=youroutputdirectory);
    
After the SAS_COMPILEUDF function is published, the model or format publishing macros can be run to publish the scoring model or format functions.

%INDNZPC Macro

The %INDNZPC macro is an autocall library that initializes the %INDNZ_PUBLISH_COMPILEUDF macro.

INDCONN Macro Variable

The INDCONN macro variable provides the credentials to make a connection to Netezza. You must specify the server, user, password, and database information to access the machine on which you have installed the Netezza database. You must assign the INDCONN macro variable before the %INDNZ_PUBLISH_COMPILEUDF macro is invoked.
The value of the INDCONN macro variable for the %INDNZ_PUBLISH_COMPILEUDF macro has this format.
SERVER=<'>server<'> USER=<'>userid<'> PASSWORD=<'>password<'>
DATABASE=SASLIB | <'>database<'>
SERVER=<'>server<'>
specifies the server name or IP address of the NPS or TwinFin server to which you want to connect. This server accesses the database that contains the tables and views that you want to access. If the server name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
USER=<'>userid<'>
specifies the Netezza user name (also called the user ID) that you use to connect to your database. If the user name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
PASSWORD=<'>password<'>
specifies the password that is associated with your Netezza user name. If the password contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
Tip:You can use only PASSWORD= or PW= for the password argument. Other aliases such as PASS= or PWD= are not supported and cause errors.
DATABASE=SASLIB | <'>database<'>
specifies the name of the database on the NPS or TwinFin server that contains the tables and views that you want to access. If the database name contains spaces or nonalphanumeric characters, you must enclose it in quotation marks.
Default:SASLIB
Interaction:If the SAS_COMPILEUDF function is published in a database other than SASLIB, then that database name should be used instead of SASLIB for the DBCOMPILE argument in the %INDNZ_PUBLISH_FORMATS and %INDNZ_PUBLISH_MODEL macros. Otherwise, the %INDNZ_PUBLISH_FORMATS and %INDNZ_PUBLISH_MODEL macros fail when calling the SAS_COMPILEUDF function during the publishing process. If a database name is not specified, the default is SASLIB. For documentation on the %INDNZ_PUBLISH_FORMATS and %INDNZ_PUBLISH_MODEL macros, see the Documentation for Publishing SAS Scoring Models and Formats in Netezza.

%INDNZ_PUBLISH_COMPILEUDF Macro Syntax

%INDNZ_PUBLISH_COMPILEUDF (
<DATABASE=database-name>
<, ACTION=CREATE | REPLACE | DROP>
<, OUTDIR=diagnostic-output-directory>
);
Arguments
DATABASE=database-name
specifies the name of a Netezza database to which the SAS_COMPILEUDF is published.
Default: SASLIB
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 %INDNZ_PUBLISH_COMPILEUDF Macro Run Process.
ACTION=CREATE | REPLACE | DROP
specifies that the macro performs one of the following actions:
CREATE
creates a new SAS_COMPILEUDF function.
REPLACE
overwrites the current SAS_COMPILEUDF function, if a SAS_COMPILEUDF function by the same name is already registered, or creates a new SAS_COMPILEUDF function if one is not registered.
DROP
causes the SAS_COMPILEUDF function to be dropped from the Netezza database.
Default: CREATE
Tip:If the SAS_COMPILEUDF function was published previously and you specify ACTION=CREATE or REPLACE, no warning is issued. Also, if you specify ACTION=DROP and the SAS_COMPILEUDF function does not exist, no warning is issued.
OUTDIR=diagnostic-output-directory
specifies a directory that contains diagnostic files.
Tip: Files that are produced include an event log that contains detailed information about the success or failure of the publishing process.

Netezza Permissions for the SAS Accelerator Publishing Agent

There are two sets of permissions involved with the SAS Accelerator Publishing Agent software.
The first set of permissions is needed to publish the SAS 9.2 Formats Library for Netezza and the SAS_COMPILEUDF, SAS_DIRECTORYUDF, and SAS_HEXTOTEXTUDF functions. These permissions must be granted before the %INDNZ_PUBLISH_JAZLIB and %INDNZ_PUBLISH_COMPILEUDF macros are run. Without these permissions, running these macros fails.
The following table summarizes the permissions that are needed by the person who publishes the formats library and the functions.
Permission Needed
Authority Required to Grant Permission
Examples
CREATE LIBRARY permission to run the %INDNZ_PUBLISH_JAZLIB macro that publishes the SAS 9.2 Formats Library (sas_jazlib object)
System Administrator or Database Administrator
Note: If you have SYSADM or DBADM authority, then you have these permissions. Otherwise, contact your database administrator to obtain these permissions.
GRANT CREATE LIBRARY
TO fmtlibpublisherid
CREATE FUNCTION permission to run the %INDNZ_PUBLISH_COMPILEUDF macro that publishes the SAS_COMPILEUDF, SAS_DIRECTORYUDF, and the SAS_HEXTOTEXTUDF functions
GRANT CREATE FUNCTION TO
compileudfpublisherid
The second set of permissions is needed by the person who runs the scoring publishing macro, %INDNZ_PUBLISH_MODEL, or the format publishing macro, %INDNZ_PUBLISH_FORMATS. The person who runs these macros is not necessarily the same person who runs the %INDNZ_PUBLISH_JAZLIB and %INDNZ_PUBLISH_COMPILEUDF macros. These permissions are most likely needed by the scoring model or format publishing developer. Without these permissions, the publishing of the scoring model functions and the SAS_PUT() function and formats fails.
Note: Permissions must be granted for every scoring model and format publisher and for each database that the scoring model and format publishing uses. Therefore, you might need to grant the above permissions multiple times. After the Netezza permissions are set appropriately, the scoring model or format publishing macros can be run.
Note: When permissions are granted to specific functions, the correct signature, including the sizes for numeric and string data types, must be specified.
The following table summarizes the permissions that are needed by the person who runs the scoring or format publishing macro.
Permission Needed
Authority Required to Grant Permission
Examples
EXECUTE permission for the SAS 9.2 Formats Library
System Administrator or Database Administrator
Note: If you have SYSADM or DBADM authority, then you have these permissions. Otherwise, contact your database administrator to obtain these permissions.
GRANT EXECUTE ON SAS_JAZLIB TO
 scoringorfmtpublisherid
EXECUTE permission for the SAS_COMPILEUDF function
GRANT EXECUTE ON SAS_COMPILEUDF
 TO scoringorfmtpublisherid
EXECUTE permission for the SAS_DIRECTORYUDF function
GRANT EXECUTE ON SAS_DIRECTORYUDF
 TO scoringorfmtpublisherid
EXECUTE permission for the SAS_HEXTOTEXTUDF function
GRANT EXECUTE ON 
 SAS_HEXTOTEXTUDF
 TO scoringorfmtpublisherid
CREATE FUNCTION, CREATE TABLE, CREATE TEMP TABLE, and CREATE EXTERNAL TABLE permissions to run the scoring and format publishing macros
GRANT CREATE FUNCTION TO 
scoringorfmtpublisherid

GRANT CREATE TABLE TO 
scoringorfmtpublisherid

GRANT CREATE TEMP TABLE TO 
scoringorfmtpublisherid

GRANT CREATE EXTERNAL TABLE TO 
scoringorfmtpublisherid

Documentation for Publishing SAS Scoring Models and Formats in Netezza

For information about how to publish SAS scoring models, see the SAS Scoring Accelerator for Netezza: User's Guide located at http://support.sas.com/documentation/onlinedoc/scornet/index.html.
For information about how to publish the SAS_PUT() function and formats, see “Deploying and Using SAS Formats in Netezza” in the SAS/ACCESS 9.2 for Relational Databases: Reference located at http://support.sas.com/documentation/onlinedoc/access/index.html.