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

%let mon_tab=%sysfunc(intnx(month, %sysfunc(today()), -13), YYMMN.);

%put &mon_tab.;

%let dt1 = %sysfunc(intnx(month,%sysfunc(today()),-13,beg),MMDDYYD10.);

%let dt2 = %sysfunc(intnx(month,%sysfunc(today()),-13,end),MMDDYYD10.);

%put "&dt1"d. "&dt2"d.;

proc sql;

connect to teradata(user="&username." password="&dbpass" tdpid=aprtera mode=teradata);

create table test as

select * from connection to teradata(

(select a.col1

,sum(b.col2) as tran_sum

from lib1.table1 a right join

(select b.col1, sum(b.col2) as sum_col2 from lib2.table2 b

where b.col3 between "&dt1" and "&dt2" ) c on a.col1=b.col1

group by a.col1

order by a.col1 asc));

disconnect from teradata;

quit;

 

ERROR: Teradata prepare: Column 02-01-2016 not found in lib2.b.

 

Question:

How should those date ranges need to be formatted to avoid error? I am new to teradata database.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Peter_C
Rhodochrosite | Level 12
beware different assumptions in teradata sql, where strings in double quotes are assumed to be column names, like name literals in SAS when validvarnam= any

View solution in original post

1 REPLY 1
Peter_C
Rhodochrosite | Level 12
beware different assumptions in teradata sql, where strings in double quotes are assumed to be column names, like name literals in SAS when validvarnam= any

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
  • 1 reply
  • 501 views
  • 0 likes
  • 2 in conversation