DATA Step, Macro, Functions and more

The "<>" operator is interpreted as "MAX".

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

The "<>" operator is interpreted as "MAX".

Hi All

 

I am wondering if anyone knows why I sometimes get the following note when using the "<>" ('unequal') operator in a data step procedure:

NOTE: The "<>" operator is interpreted as "MAX".

 

Sometimes this happens in a proc sql as well...


Accepted Solutions
Solution
‎10-20-2016 12:29 AM
Respected Advisor
Posts: 4,644

Re: The "<>" operator is interpreted as "MAX".


All Replies
Solution
‎10-20-2016 12:29 AM
Respected Advisor
Posts: 4,644

Re: The "<>" operator is interpreted as "MAX".

The "<>" operator doesn't have the same meaning everywhere

 

See

 

http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p00iah2thp63bmn1lt20...

PG
Contributor
Posts: 31

Re: The "<>" operator is interpreted as "MAX".

Ah Thank you

 

This basically explains it:   Note: In a WHERE statement or clause, the <> operator is equivalent to NE. 

 

 

Super User
Posts: 17,794

Re: The "<>" operator is interpreted as "MAX".

In a data step, <> is the max function.

In SQL it is Not Equals.

 

In most languages <> means not equals, so SAS warns you otherwise. I would use a max function to avoid the message. 

Super User
Posts: 10,490

Re: The "<>" operator is interpreted as "MAX".

Things like this are one reason I use the GE LE and NE instead of >= or <= or <>, different possible interprtations and having to remember is it >= or =>.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 560 views
  • 1 like
  • 4 in conversation