BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
yabwon
Onyx | Level 15

Thanks @FreelanceReinh 

So the good news is it is a bug and it can be confirmed...

Bad news it is there not fixed since M5! ... 

 

Here (https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1alyfc9f4qrten10sd5qz5e1w5q.htm) in the table, if you count with mnemonics there is more than 26 operators, maybe IN is 26th? BTW. What happens if you replace "IN" with "#", like:

%if %sysevalf(1 # 1) %then %put OK;

?

 

"YJEVAL" - "something, something EVAL", maybe %YJEVAL() is like "Yet another Junky EVAL"? 😄 😄

 

 

Could you also do test for "1 in (1 2 3)" ? Just to have a full picture for SAS Support team.

 

Bart

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



FreelanceReinh
Jade | Level 19

@yabwon wrote:

Here (https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1alyfc9f4qrten10sd5qz5e1w5q.htm) in the table, if you count with mnemonics there is more than 26 operators, maybe IN is 26th? BTW. What happens if you replace "IN" with "#", like:

%if %sysevalf(1 # 1) %then %put OK;

?

Almost the same as with "IN", but the number changed from 26 to 13:

 

...
YJEVAL: Invalid arithmetic operator 13 encountered.
...

@yabwon wrote:

Could you also do test for "1 in (1 2 3)" ? Just to have a full picture for SAS Support team.


Same messages as in your initial post.

 

SAS has just told me (twice!) that there will be an %IN operator (or at least a "reserved keyword" of this name) in a future SAS release.

6     %macro test / minoperator;
7     %if %sysevalf(1 %IN 1) %then %put OK;
8     %mend;
9
10    %test
NOTE: %IN will become a reserved keyword of the SAS Macro Language in a future release of the SAS System.  Changing the name of this macro will avoid
      future conflicts.
WARNING: Apparent invocation of macro IN not resolved.
NOTE: %IN will become a reserved keyword of the SAS Macro Language in a future release of the SAS System.  Changing the name of this macro will avoid
      future conflicts.
WARNING: Apparent invocation of macro IN not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: 1 %IN 1
ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition.
ERROR: The macro TEST will stop executing.

Maybe that will be more robust.

 

yabwon
Onyx | Level 15

Thanks!

 

From 26 to 13, so maybe my guessing was right 🙂

 

9.4M8 has the same note about %IN, so still not reserved 😄

1    %in
     -
     180
NOTE: %IN will become a reserved keyword of the SAS Macro Language in a future release of the SAS System.  Changing the name of this macro will avoid future conflicts.
WARNING: Apparent invocation of macro IN not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Quentin
Super User

@FreelanceReinh wrote:

NOTE: %IN will become a reserved keyword of the SAS Macro Language in a future release of the SAS System. Changing the name of this macro will avoid future conflicts. 

 

That's interesting!  I remember (I think) Ian Whitlock in a macro class opining about whether or not it would have been a better design decision for the macro language to use % signs for all operators, %AND, %OR, etc.  

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
Quentin
Super User

@yabwon wrote:

"YJEVAL" - "something, something EVAL", maybe %YJEVAL() is like "Yet another Junky EVAL"? 😄 😄

I googled for YJEVAL and found this 20 year old SAS-L thread where a # sign started throwing the error in 9.1 when it was introduced as a mnemonic for IN operator:

https://comp.soft-sys.sas.narkive.com/O2Hj5ReW/pound-sign-causes-macro-problems-in-version-9-1

 

 

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
yabwon
Onyx | Level 15

I went through  that thread in link you posted. Two observations:

1) an %iiF() macrofunction pops-up there too

2) you took part in that discussion 🙂

 

B.

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Tom
Super User Tom
Super User

They had to fix %EVAL() to recognize IN as an operator or else it would never have worked at all.

 

That is because when you write something like

%if &x = 5 %then %do;

That is just an implied call to %EVAL() to evaluate the condition.  

 

Seems like an oversight to me.   It has worked that way since the concept of allowing IN as an operator in the macro language was introduced.

 

Is it something that needs to be fixed? Or just documented.   Find the documentation page for %SYEVALF() on-line and click on the FEEDBACK button and send the SAS documentation team a request that they include the fact that it does not support IN as an operator.

 

 

ChrisNZ
Tourmaline | Level 20
They had to fix %EVAL() to recognize IN as an operator or else it would never have worked at all.

 It seems like a massive oversight to forget to update %sysevalf() as well at the same time.

 

Quentin
Super User

Thanks @yabwon .  Interesting thread, and glad to have the input from others! Agree with you and others that this feels very buggy.  I think it's worth reporting to SAS as a %SYSEVALF bug, and then they can decide whether to fix it or document it as a "feature." : )

Personally, the introduction of the IN operator to the macro language was so buggy for several versions, that I've stayed away from it.  In the context of macro language IN bugs in prior versions, it's not too shocking for find another one.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
yabwon
Onyx | Level 15

I wrote to the SAS Support Team.

 

It was registered as: Case CS0080416

 

Will keep you updated. 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Patrick
Opal | Level 21

@yabwon It might also be worth to provide feedback to the SAS Docu so this feature gets at least documented until fixed.

%SYSEVALF Macro Function

Patrick_0-1708743175936.png

 

Ksharp
Super User

As Kurt and Tom said. %sysevalf() didn't honor IN operator .

Yes. You could report it to SAS to let it  active like %eval().


%macro test3()/minoperator mindelimiter=' ';
%if %sysevalf( %eval(1.1 IN (1.1 2.1 3.1))  )  %then %put [&sysmacroname.] 123!!;
%mend;


%test3()
344
345  %macro test3()/minoperator mindelimiter=' ';
346  %if %sysevalf( %eval(1.1 IN (1.1 2.1 3.1))  )  %then %put [&sysmacroname.] 123!!;
347  %mend;
348
349
350  %test3()
[TEST3] 123!!


yabwon
Onyx | Level 15

I got information form SAS Tech. Support that R&D did not decide to fix the error.  

They decided to update the documentation with something like: "The %SYSEVALF function does not support the IN logical operator in expression."

The updated doc. should be available within a month. 

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Tom
Super User Tom
Super User

Since they are not fixing it perhaps they could also add into the %SYSEVALF() documentation the work around that @Ksharp posted.

 

Something like:

 

To use IN operator inside %SYSEVALF() you will have to use a call to %EVAL() inside your %SYSEVALF() expression.

Example: 

%sysevalf( (&x > 1.3) and not %eval(&x in 999 NA N/A))
yabwon
Onyx | Level 15

Good point, I'll share the idea.

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 29 replies
  • 3088 views
  • 21 likes
  • 11 in conversation