For general information about this feature, see SQL Pass-Through Facility.
Here are the SQL pass-through facility specifics for the Snowflake interface.
snow.snow alias is used.cards inputThis example connects to Snowflake and then disconnects from it.
proc sql noerrorstop;
connect to snow as x1(server=mysrv1 port=2406
user=mysur1 password='mypwd1' database=mydb1);
disconnect from x1;
quit;
This next example connects to Snowflake, executes some SQL statements, and then disconnects from Snowflake.
proc sql noerrorstop;
connect to snow as x1(server=mysrv1 port=2406
user=mysur1 password='mypwd1' database=mydb1);
execute ( CREATE TABLE t1 ( no int primary key, state varchar(10) ) ) by x1;
execute ( INSERT INTO t1 values (1, 'USA') ) by x1;
execute ( INSERT INTO t1 values (2, 'CHN') ) by x1;
select * from connection to x1 (SELECT * FROM t1 ORDER BY no);
disconnect from x1;
quit;
The Snowflake engine
can process CREATE TABLE table-name AS
SELECT in a single step. Using the DBIDIRECTEXEC system
option, the SQL procedure can pass CREATE TABLE AS SELECT statements
to Snowflake. By default, the system option is specified for the Snowflake
engine. In this example, the schema is specified in the DSN.
options sastrace=',,,d' sastraceloc=saslog nostsuffix msglevel=i;
libname x snow dsn='snowflake' user=sasuser pw=XXXXXXXX schema=myschema;
proc delete data=x.class1; run;
proc delete data=x.class2; run;
data x.class1;
set sashelp.class;
run;
proc sql;
create table x.class2 as select * from x.class1;
quit;
Here is how the above code is passed.
CREATE TABLE "SCHEMA1"."class2" AS
SELECT TXT_1."Name", TXT_1."Sex", TXT_1."Age", TXT_1."Height", TXT_1."Weight"
FROM "SCHEMA1"."class1" TXT_1
If the NODBIDIRECTEXEC option is specified, the statement is executed in multiple steps, transferring the data to and from SAS.
CREATE TABLE "SCHEMA1"."class2"
("Name" VARCHAR(8),"Sex" VARCHAR(1),"Age" DOUBLE,"Height" DOUBLE,"Weight" DOUBLE)
INSERT INTO "SCHEMA1"."class2"
("Name","Sex","Age","Height","Weight")
VALUES ( ? , ? , ? , ? , ? )