BookmarkSubscribeRSS Feed
DSC2010
Calcite | Level 5

I am trying to run the following case statement in SAS  but keep getting an error:

,CASE

WHEN ((MM,&EOY.) - (MM,Start_Date)) > Term_Length__months_ THEN 'Term_Length__months_'

ELSE ((MM,&EOY.) - (MM,Start_Date)) END AS Flow_Months_2019

,CASE

WHEN ((MM,&EOY.) - (MM,Start_Date)) > Term_Length__months_ THEN '0'

ELSE Term_Length__months_ - ((MM,&EOY.) - (MM,Start_Date)) END AS Flow_Months_Contract

 

 

 

ERROR 79-322: Expecting a (.

ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, ), *, **, +, -, '.', /, <, <=, <>, =, >, >=, AND, EQ, EQT,

GE, GET, GT, GTT, LE, LET, LT, LTT, NE, NET, NOT, OR, ^, ^=, |, ||, ~, ~=.

4 REPLIES 4
rudfaden
Pyrite | Level 9

Please post a minimal working example

PaigeMiller
Diamond | Level 26

Show us the log of the entire PROC SQL, and the preceding PROC or DATA step, where this error happens. Click on the {i} icon and paste the log into the window that appears — DO NOT SKIP THIS STEP.

--
Paige Miller
Tom
Super User Tom
Super User

No wonder SAS is confused. Your code looks really strange to me also.

What does this mean?

((MM,&EOY.) - (MM,Start_Date)) 
ballardw
Super User

Making a complete guess that

(MM,&EOY.)is intended to do something like calculate the number of months(??) from a given value to "end of year" then the actual calculation is missing. In MM and &EOY. are supposed to be date values then perhaps you are missing a function like INTCK.

 

If the values are NOT SAS date values then you need to provide:

values of MM, &EOY. and START_date and make sure we can tell whether the values are character or numeric.

 

If the values ARE supposed to  be SAS date values then you need to tell us what this is supposed to actual do as the likely functions involved, INTCK or possibly INTNX, require an INTERVAL, such as 'month' to use.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 641 views
  • 0 likes
  • 5 in conversation