BookmarkSubscribeRSS Feed
Arun_shSAS
Fluorite | Level 6

Hi All,

I am running below Teradata code using passthrough but facing some error:

 

SELECT *
FROM ABC LEFT JOIN BCD on A.ABC = B.BCD
WHERE MONTH > concat( cast(extract(year from add_months((DATE - extract(day from DATE)) ,-9)) as varchar(4)), SUBSTR(cast(100 + extract( month from add_months((DATE - extract(day from DATE)) ,-9)) as varchar (3)) ,2 ,2) )

 

I am not sure if we can use add_months in SAS, if not how can we resolve this?

4 REPLIES 4
LinusH
Tourmaline | Level 20

Always (always!) when you run into problem with code, show the log!

And given that this is pass-thru, usually it's not a SAS issue.

But are you tring to use something from the local SAS session?, not clear from your post.

Data never sleeps
RW9
Diamond | Level 26 RW9
Diamond | Level 26

So which is it?  You say you are using passthrough, if so this piece of code you present here will be sent to the database, and the database will execute it.  Therefore it will use the functions available to the database.

You then proceed to say that you can't use add_months in SAS, which is true as add_months is not a SAS function, but as the code is not being run in SAS per your first statement, this is not relevant?

Please clarify what you mean, where is the code running, what logs you get etc.

Arun_shSAS
Fluorite | Level 6

Yes, this is the teradata script i am running and expecting all the teradata function like add_month, cast can run through pass through.

 

Error : 

ERROR: Teradata execute: Syntax error: expected something between '('
and cast.

 

LinusH
Tourmaline | Level 20
Still, where's the (complete) log?
Given the code you presented you are/should use explicit pass through. And then your syntax problem is something for a Teradata forum to help you with.
Data never sleeps

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 774 views
  • 0 likes
  • 3 in conversation