BookmarkSubscribeRSS Feed
BobD
Fluorite | Level 6

Does anyone know what happens behind the scenes with SAS/Access connections to Teradata via a LIBNAME statement?

For example, consider this code block:

libname TDATA teradata user=xxx password=xxx server='myserver' database='MYDB';

data a;

   set TDATA.table1

       TDATA.table2

       TDATA.table3;

run;

The question is: how many database connections are made?  Does SAS understand this as a UNION operation and convert it as such using one connection, or does it make three separate database connections?  If so, then what about SAS MERGE operations, or syntax like this:

data a;

   set TDATA.table1;

   set TDATE.table2;

run;

I'm asking because our environment is going to enforce a new rule that no more that five concurrent sessions are allowed per user ID.  I need to understand how sessions are allocated in SAS so we can review our code and advise our users of this change.

Thanks,

Bob

4 REPLIES 4
Linlin
Lapis Lazuli | Level 10

Hi ,

I think only one connection. Once you have the libname assigned, you have access to all the tables in the library.

Haikuo
Onyx | Level 15

I don't have the answer, but one way to find it out quick and easy is to check with your Teradata DBA, after running your test code, just ask for the log or let DBA check it for you.

Haikuo

LinusH
Tourmaline | Level 20

Agree with https://communities.sas.com/people/Linlin and https://communities.sas.com/people/Hai.kuo about no of connections.

About what SAS actually sends down to the database is fairly documented for each Access engine.

For SAS datasteps, I think that WHERE, BY and pehaps KEEP/DROP dataset options are sent to the source. The rest of the data step syntax differ so much from SQL, so it would be quite cumbersome to translate to Teradata SQL.

So in your case, I don't think SAS will let Teradata know that there is UNION kind of thing going on, it will trigger two table scans, stream the result sequentially to the data step, which handles the processing.

To actually see what is sent to Teradata, use the SASTRACE options.

Data never sleeps
SASKiwi
PROC Star

Check the SAS/ACCESS documentation for Teradata (V 9.3 here):

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

There are options for using more than one database connection simultaneously to speed up queries - generally for loading data, but you can set the minimum and maximum connections allowed:

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

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
  • 4 replies
  • 1041 views
  • 1 like
  • 5 in conversation