If you use explicit pass-through
(direct connection to Netezza), you can use the SAS_PUT( )
function call in your SQL program.
This example shows the
same query from Implicit Use of the SAS_PUT( ) Function and explicitly uses the SAS_PUT( )
function call.
options sqlmapputto=sas_put sastrace=',,,d' sastraceloc=saslog;
proc sql noerrorstop;
title1 'Test SAS_PUT using Explicit Passthru';
connect to netezza (user=dbitest password=XXXXXXX database=testdb
server=spubox);
select * from connection to netezza
(select distinct cast(sas_put("PRICE",'DOLLAR8.2') as char(8)) as
"PRICE_C" from mailorderdemo);
disconnect from netezza;
quit;
The following lines
are written to the SAS log.
options sqlmapputto=sas_put sastrace=',,,d' sastraceloc=saslog;
proc sql noerrorstop;
title1 'Test SAS_PUT using Explicit Passthru';
connect to netezza (user=dbitest password=XXXXXXX database=testdb server=spubox);
select * from connection to netezza
(select distinct cast(sas_put("PRICE",'DOLLAR8.2') as char(8)) as
"PRICE_C" from mailorderdemo);
Test SAS_PUT using Explicit Passthru 2
17:13 Thursday, May 7, 2011
PRICE_C
_______
$27.98
$10.00
$12.00
$13.59
$48.99
$54.00
$13.98
$8.00
$14.00
disconnect from netezza;
quit;
Note: If you explicitly use the
SAS_PUT( ) function in your code, it is recommended that you
use double quotation marks around a column name to avoid any ambiguity
with the keywords. For example, if you did not use double quotation
marks around the column name, DATE, in this example, all date values
would be returned as today's date.
select distinct
cast(sas_put("price", 'dollar8.2') as char(8)) as "price_c",
cast(sas_put("date", 'date9.1') as char(9)) as "date_d",
cast(sas_put("inv", 'best8.') as char(8)) as "inv_n",
cast(sas_put("name", '$32.') as char(32)) as "name_n"
from mailorderdemo;