BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

I have access to the EDW database GRP_A (that I am trying to access via SAS)

not sure how can I find the libref for GRP_A....also what would the SERVER, mode=teradata(i guess), DATABASE be?

I do not see the database under the list of Libraries (under Servers under my user)

 

proc sql;
CONNECT TO TERADATA(USER="new_Sas_user_4" PASSWORD="xxxx" SERVER="???" mode=teradata DATABASE="???");
create table base as select * from connection to teradata(
select BRAND,
PLAN,
count(*) as count
from GRP_A.table_name
where plan in ('ontario')
group by 1,2;
disconnect from teradata;
quit;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
new_sas_user_4
Quartz | Level 8

I was able to use the Teradata Passthough using Teradata sytax within the passthrough code.

The error was because I was using today()-1 (SAS syntax) within the passthrough...when I changed into current_Date-1...it worked 🙂

PROC SQL;
CONNECT TO TERADATA(USER="new_sas_user_4" PASSWORD="xxxx" );
create table base as select * from connection to teradata(
select a,b,c
count(*) as count
from GRP_A.table_name
where current_date-1 between date1 and date2 and prov in ('Ontario')
group by 1,2,3);
disconnect from teradata;
quit;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

I don't quite follow what your setup is.

But if you have an existing SAS libref named GRP_A that is using the TERADATA engine to connection to a teradata database/schema  you should be able to see the schema name in the view SASHELP.VLIBNAM.

 

You can use this macro to help you get what schema it is using into a macro variable so that you can use that name in your explicit passthru SQL.

https://github.com/sasutils/macros/blob/master/dblibchk.sas

new_sas_user_4
Quartz | Level 8

I was able to use the Teradata Passthough using Teradata sytax within the passthrough code.

The error was because I was using today()-1 (SAS syntax) within the passthrough...when I changed into current_Date-1...it worked 🙂

PROC SQL;
CONNECT TO TERADATA(USER="new_sas_user_4" PASSWORD="xxxx" );
create table base as select * from connection to teradata(
select a,b,c
count(*) as count
from GRP_A.table_name
where current_date-1 between date1 and date2 and prov in ('Ontario')
group by 1,2,3);
disconnect from teradata;
quit;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 858 views
  • 0 likes
  • 2 in conversation