I have written code in proc sql using the execute command to run sql code. This all works well and I can create perm/temp files in the SQL db.
For our production version we will only be able to create temp tables (#tablename/##tablename). What I will need to do is bring this temp file into actual sas to create a report and then output to client (Excel/PowerBI). I am conscious that the temp table will only exist for the execute(….) by sqlserver session. Do you know how I can do this?
Thanks
Andrew
Hi,
we use Oracle but...
there is a "SAS Access Interface to Microsoft SQL Server" chapter in the SAS documentation:
libname mydblib sqlsvr
noprompt="uid=testuser;
pwd=testpass;
dsn=sqlservr;"
stringdates=yes;
proc print data=mydblib.customers;
where state='CA';
run;
- Cheers -
Thanks.
This might be specific to SQLServer, but does your method mean temporary tables can be pulled into SAS as well?
In SQLServer they are denoted by #tablename and only exist for the session of the user.
Cheers
Andrew
Hi, I don't know you'll have to give it a try
- Cheers -
Thanks, I was nicely surprised to see it did work. Many thanks!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.