After you install the formats
that SAS supplies in libraries inside the Netezza data warehouse and
publish any custom format definitions that you created in SAS, you
can access the SAS_PUT( ) function with your SQL queries.
If the SQLMAPPUTTO=
system option is set to SAS_PUT and you submit your program from a
SAS session, the SAS SQL processor maps PUT function calls to SAS_PUT( )
function references that Netezza understands.
This example illustrates
how the PUT function is mapped to the SAS_PUT( ) function using
implicit pass-through. The SELECT DISTINCT clause executes inside
Netezza, and the processing is distributed across all available data
nodes. Netezza formats the price values with the $DOLLAR8.2 format
and processes the SELECT DISTINCT clause using the formatted values.
options sqlmapputto=sas_put;
%put &mapconn;
libname dblib netezza &mapconn;
/*-- Set SQL debug global options --*/
/*----------------------------------*/
options sastrace=',,,d' sastraceloc=saslog;
/*-- Execute SQL using Implicit Passthru --*/
/*-----------------------------------------*/
proc sql noerrorstop;
title1 'Test SAS_PUT using Implicit Passthru ';
select distinct
PUT(PRICE,Dollar8.2) AS PRICE_C
from dblib.mailorderdemo;
quit;
These lines are written
to the SAS log.
options sqlmapputto=sas_put;
%put &mapconn;
user=dbitext password=xxxx server=spubox database=TESTDB
sql_functions="EXTERNAL_APPEND=WORK.dbfuncext" sql_functions_copy=saslog;
libname dblib netezza &mapconn;
NOTE: Libref DBLIB was successfully assigned, as follows:
Engine: NETEZZA
Physical Name: spubox
/*-- Set SQL debug global options --*/
/*----------------------------------*/
options sastrace=',,,d' sastraceloc=saslog;
/*-- Execute SQL using Implicit Passthru --*/
/*-----------------------------------------*/
proc sql noerrorstop;
title1 'Test SAS_PUT using Implicit Passthru ';
select distinct
PUT(PRICE,Dollar8.2) AS PRICE_C
from dblib.mailorderdemo
;
NETEZZA: AUTOCOMMIT is NO for connection 1
NETEZZA: AUTOCOMMIT turned ON for connection id 1
NETEZZA_1: Prepared: on connection 1
SELECT * FROM mailorderdemo
NETEZZA: AUTOCOMMIT is NO for connection 2
NETEZZA: AUTOCOMMIT turned ON for connection id 2
NETEZZA_2: Prepared: on connection 2
select distinct cast(sas_put(mailorderdemo."PRICE", 'DOLLAR8.2') as char(8))
as PRICE_C from mailorderdemo
NETEZZA_3: Executed: on connection 2
Prepared statement NETEZZA_2
ACCESS ENGINE: SQL statement was passed to the DBMS for fetching data.
Test SAS_PUT using Implicit Passthru 9
13:42 Thursday, May 7, 2013
PRICE_C
_______
$10.00
$12.00
$13.59
$48.99
$54.00
$8.00
$14.00
$27.98
$13.99
quit;