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

 

Dear Team, 

 

a

am getting below error : 

 

ERROR: CLI describe error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "case" was found following "else
rstf.END_TS end". Expected tokens may include: "FROM". SQLSTATE=42601

1 ACCEPTED SOLUTION

Accepted Solutions
r_behata
Barite | Level 11

Looks like Your Case statement Nesting is incorrect . try expanding all the scenarios like this :

 

case 
	when dt.DATE_TIME_KEY+900 < rstf.END_TS then 
                            dt.DATE_TIME_KEY+900
	when dt.DATE_TIME_KEY+900 > rstf.END_TS then rstf.END_TS 
	when dt.DATE_TIME_KEY > START_TS then dt.DATE_TIME_KEY
	when dt.DATE_TIME_KEY < START_TS then rstf.START_TS
end 

View solution in original post

3 REPLIES 3
r_behata
Barite | Level 11

Looks like Your Case statement Nesting is incorrect . try expanding all the scenarios like this :

 

case 
	when dt.DATE_TIME_KEY+900 < rstf.END_TS then 
                            dt.DATE_TIME_KEY+900
	when dt.DATE_TIME_KEY+900 > rstf.END_TS then rstf.END_TS 
	when dt.DATE_TIME_KEY > START_TS then dt.DATE_TIME_KEY
	when dt.DATE_TIME_KEY < START_TS then rstf.START_TS
end 
Tom
Super User Tom
Super User

In addition to your messed up CASE statement (statements?)  are you really trying to SUM() dates?  

What is in the variables DATE_TIME_KEY, END_TS and START_TS ?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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