Beware of the "<>"!
There are some languages in which "<>" means "does not equal", but SAS is not one of them!
In the SAS language, the "<>" is interpreted as "MAX", so any statement using this operator is basically saying "take the highest value from this pair". So for example, the conditional statement "if a <> b" would resolve to "true" whenever either variable was greater than 0.
So the following code will not work quite as expected :
data _null_; a = 2; b = 2; if a <> b then put "A is NOT Equal to B"; else put "A is Equal to B"; run;
On running this code the following info will be written to the log :
12 13 data _null_; 14 a = 2; 15 b = 2; 16 17 if a <> b then NOTE: The "<>" operator is interpreted as "MAX". 18 put "A is NOT Equal to B"; 19 else 20 put "A is Equal to B"; 21 22 run; A is NOT Equal to B NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
As you can see, the data step has written the statement "A is NOT Equal to B", which is obviously incorrect. However, if you look a little harder you will notice the rather helpful "NOTE: The "<>" operator is interpreted as "MAX"." message which informs you of exactly what has happened.