This is a specific case of the general maxim: Avoid testing floating-point values for equality
A more robust check for equality of floating-point numbers x and y is
abs(x - x) < tol
where tol is a small number such as 1e-6.
If testing floating-point numbers is something you do a lot, you could incorporate the logic into a macro, as follows:
/* gernate some data where there are small difference betwen numbers */
data A;
call streaminit(12345);
do x1 = -5 to 5;
x2 = x1 + rand("Normal",0,1e-6);
x3 = x2 + rand("Normal",0,1e-6);
output;
end;
run;
%macro FloatEq(a,b,tol=1e-6);
(abs(&a - &b) < &tol)
%mend;
proc print data=A;
where ^%FloatEq(x1,x3) OR ^%FloatEq(x2,x3);
format _all_ 12.9;
run;