DATA Step, Macro, Functions and more

How do SAS/Access connections work?

Posts: 43

How do SAS/Access connections work?

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




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;


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.



Super Contributor
Posts: 1,636

Re: How do SAS/Access connections work?

Hi ,

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

Respected Advisor
Posts: 3,167

Re: How do SAS/Access connections work?

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.


Super User
Posts: 5,876

Re: How do SAS/Access connections work?

Agree with and 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
Super User
Posts: 3,909

Re: How do SAS/Access connections work?

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

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:

Ask a Question
Discussion stats
  • 4 replies
  • 1 like
  • 5 in conversation