I am looking to connect a CSV dataset I imported through 'proc import' with a dataset I am pulling from proc sql. Is there a way to toss my proc import file into proc sql? or vice versa?
here is where I'm at:
proc import datafile = 'filepath'
out = dataname
dbms = CSV
replace
;
run;
proc sql
connect to netezza as dbcon
(server="url" database=sandbox user=me password="&password.");
create table work as
select distinct * from connection to dbcon
(
select distinct a.*
from
dataname as a
left join
sqltable as b
on
a.number = b.number
);
quit;
I am currently receiving this error message but I am unsure where my syntax is wrong:
ERROR: CLI prepare error: ERROR: relation does not exist database.ADMIN.dataname
SQL statement: select distinct a.*, b.* from dataname as a left join sqltable as b on a.number and b.number.
After you connect to Netezza using the CONNECT TO
statement, anything you have inside brackets such as:
select ... from connection to dbcon (...);
exec (...) by dbcon;
Is inside the Netezza box. The dataset you created called dataname
is present in the work library where your SAS Session is running.
So the question can be solved in a few ways:
Insert into
in SASYou can usually translate a connect to
statement into a libname statement as follows:
libname dbcon netezza server="url" database=sandbox user=me password="&password.";
If you create dataname
in the dbcon library then your second query should work, provided you have permissions to create tables in the sandbox
database.