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;
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;
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.
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;
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!
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.
Ready to level-up your skills? Choose your own adventure.