Hello @theflunkee,
I would apply the ROUND function to the difference so as to obtain a clean result:
TimeBetter=round(time_mlead1-time_m, 1e-9);
Small differences between relatively large numbers are particularly prone to (relative) rounding errors due to numeric representation issues. Let's take the second record of your sample data as an example, using Windows SAS 9.4M5:
301 data _null_;
302 time_mlead1='09:30:00.002551't;
303 time_m='09:30:00.002524't;
304 TimeBetter=round(time_mlead1-time_m, 1e-9);
305 TimeBroken=time_mlead1-time_m;
306 put (TimeB:)(=best16. /);
307 run;
TimeBetter=0.000027
TimeBroken=0.00002699999459
Even with the standard format BEST16. the rounding error in TimeBroken becomes obvious and of course the condition TimeBroken=0.000027 does not hold, whereas TimeBetter=0.000027 is true.
The relative error in TimeBroken is approx. 2.0E-5 percent, which is more than five billion times larger than the unavoidable relative numeric representation error in TimeBetter (using the ROUND function) of approx. 3.7E-15 percent.
None of your 20 example records, except the two trivial cases with time_mlead1=time_m, would produce a perfect result without cleaning the rounding error.
... View more