BookmarkSubscribeRSS Feed
BruceBrad
Lapis Lazuli | Level 10

Where do pages like https://answerpoint.blog/sas-not-equal-operator-guide come from? I could see two major errors before I gave up. Is this AI or human-written junk?

 

( "<>" does not mean 'not equal' in SAS data step code (though it does in SQL), and  " . ne 100" does not return false). 

8 REPLIES 8
PaigeMiller
Diamond | Level 26

The article tells you it comes from someone named Peter Schneider.

--
Paige Miller
Kurt_Bremser
Super User

@PaigeMiller wrote:

The article tells you it comes from someone named Peter Schneider.


It links to the youtube channel of Schneider, but I find absolutely no reference to an author within the text.

The whole website shows no impressum or similar, making it look very suspicious.

data_null__
Jade | Level 19

It means MAX in a data step.  SAS even tells you so.  The MIN and MAX operators are somewhat obscure.

 

58         data _null_;
59            x = 4 <> 3;
NOTE: The "<>" operator is interpreted as "MAX".
60            y = 4 max 3;
61            z = . ne 100;
62            put _all_;
63            run;

x=4 y=4 z=1 _ERROR_=0 _N_=1
BruceBrad
Lapis Lazuli | Level 10

Yes, they've put that warning in the log because in other languages (including SAS SQL) it means 'not equals'.

 

Makes me think it might be AI written. Taking wrong information from closely related documents is the sort of thing that LLMs do. 

ChrisHemedinger
Community Manager

The video that appears to be the "source" is 5 years old, but the article is new. I agree it must be AI generated but why make this? I don't know.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
quickbluefish
Barite | Level 11

With pearls of wisdom like:

While SAS excels at handling vast datasets, its true analytical power is often unleashed through precise control and conditional logic.

...who can resist?  The sad thing is that since not anyone in their right mind would read an article even 1/10th that long whose sole topic was the concept of "not equal to" in a high level language, the only thing that will actually ingest it is other LLMs.  Slop begets slop.  

Amir
PROC Star

Hi _all_,

 

Reading all the posts about what the "<>" operator means, it did bring about memories for me where I did use it to mean not-equal-to in data step code.

 

Checking the documentation, I did find a page about operators with a section on MIN and MAX Operators that includes a table where the 2nd foot note says 'In a WHERE expression, the symbol representation <> is interpreted as “not equal to”.'

 

So, for example, the following code:

 

data want1;
  set sashelp.class;
  
  where age <> 15;
run;

 

yields the following log:

 

 73         data want1;
 74           set sashelp.class;
 75         
 76           where age <> 15;
 NOTE: The "<>" operator is interpreted as "not equals".
 77         run;
 
 NOTE: There were 15 observations read from the data set SASHELP.CLASS.
       WHERE age not = 15;
 NOTE: The data set WORK.WANT1 has 15 observations and 5 variables.

 

The "NOTE:" about the "<>" operator clarifies how it is being interpreted; I don't recall it ever misinterpreting my intention, but ymmv. The 2nd "NOTE:" helpfully spells out "WHERE age not = 15", as per usual SAS behaviour.

 

Comparing character data is no different, e.g.:

 

data want2;
  set sashelp.class;
  
  where name <>: 'J';
run;

 

 has the following log:

 

 71         data want2;
 72           set sashelp.class;
 73         
 74           where name <>: 'J';
 NOTE: The "<>" operator is interpreted as "not equals".
 75         run;
 
 NOTE: There were 12 observations read from the data set SASHELP.CLASS.
       WHERE name not =: 'J';
 NOTE: The data set WORK.WANT2 has 12 observations and 5 variables.

 

Lastly, both meanings can appear in the same data step:

 

data want3;
  set sashelp.class;
  
  where name <>: 'J';
  
  weight2 = weight <> 100;
run;

 

gives:

 

 71         data want3;
 72           set sashelp.class;
 73         
 74           where name <>: 'J';
 NOTE: The "<>" operator is interpreted as "not equals".
 75         
 76           weight2 = weight <> 100;
 NOTE: The "<>" operator is interpreted as "MAX".
 77         run;
 
 NOTE: There were 12 observations read from the data set SASHELP.CLASS.
       WHERE name not =: 'J';
 NOTE: The data set WORK.WANT3 has 12 observations and 6 variables.

 

So, in short, I wasn't just dreaming! 😆

 

 

Thanks & kind regards,

Amir.

Tom
Super User Tom
Super User

That is because the WHERE is not run "IN" the data step, put as a filter on the data before it makes it to the data step.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 8 replies
  • 303 views
  • 1 like
  • 8 in conversation