BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
andrewjmdata
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20
I'm pretty sure that those tables exist as long as the connection lives (that's until a DISCONNECT FROM or a PROC SQL QUIT).
You could verify this by fetching the data using SELECT * FROM CONNECTION TO...
Data never sleeps

View solution in original post

5 REPLIES 5
Oligolas
Barite | Level 11

Hi,

 

we use Oracle but...

there is a "SAS Access Interface to Microsoft SQL Server" chapter in the SAS documentation:

http://support.sas.com/documentation/cdl/en/acreldb/65247/HTML/default/viewer.htm#n0gz66qe8msnkyn1jg...

 

libname mydblib sqlsvr
   noprompt="uid=testuser;
   pwd=testpass;
   dsn=sqlservr;"
   stringdates=yes;

proc print data=mydblib.customers;
   where state='CA';
run;
________________________

- Cheers -

andrewjmdata
Obsidian | Level 7

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

Oligolas
Barite | Level 11

Hi, I don't know you'll have to give it a try

________________________

- Cheers -

LinusH
Tourmaline | Level 20
I'm pretty sure that those tables exist as long as the connection lives (that's until a DISCONNECT FROM or a PROC SQL QUIT).
You could verify this by fetching the data using SELECT * FROM CONNECTION TO...
Data never sleeps
andrewjmdata
Obsidian | Level 7

Thanks, I was nicely surprised to see it did work. Many thanks!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1326 views
  • 0 likes
  • 3 in conversation