BookmarkSubscribeRSS Feed
yogita_patel
Calcite | Level 5

Hello, I was wondering what is difference between (. ne chg) and (chg ne .). as i am getting different results while i use this condition vise versa.

3 REPLIES 3
ballardw
Super User

You would have to provide example data and exact complete code to determine why you get different results.

Possibly including the LOG where you get the different results.

 

The most likely cause I would think of is incorrect use of "ne ." with a character variable.

The MISSING function is there for a reason: Not missing(chg) would be a better approach and doesn't care if the variable CHG is character or numeric.

Rick_SAS
SAS Super FREQ

There should be no difference between those two logical expressions, so the issue must be related to either data or the way that you are using the expressions.

 

Here is an example of using each of the two expressions. You can see that they give the same logical result (0 or 1) for the inputs in this example:

data Have;
input chg @@;
MissFist   = (. ne chg);
MissSecond = (chg ne .);
datalines;
-1 0 . 1 2 .A 
;

proc print; run;

Please post your example where you claim to obtain different results.

yabwon
Onyx | Level 15

No data, no answer. 

Without data... just an opinion. My opinion is: in SAS these are equivalent logical conditions which results the same.

 

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