MOD( m, n) is one of the most commonly used functions. It returns the remainder of m divided by n and the result is deterministic. We would expect it to be calculated correctly by any data analysis software packages.
However, we have found an issue in SAS mod function.The calculation we tested is mod(11169568236203649, 30269). SAS returns different results than Oracle and R do. SAS returns 11731. Both Oracle and R return 11732.
SAS script (SAS Version 9.2) and the result.
data test; val=mod(11169568236203649, 30269) ; run;
11731
or
proc sql; select mod(11169568236203649, 30269) from dummy;
11731
Oracle SQL script and the result.
select mod(11169568236203649, 30269) from dual;
11732
R script and the result.
11169568236203649 %% 30269
11732
We have verified that 11732 is the correct answer using two independent approaches. You may try the above scripts on your own computer and let me know what you find out. ( I explain my approaches to verify that 11732 is the correct answer of mod(11169568236203649,30269) and why I bother to calculate mod(x, 30269) in other posts on this blog.)
2 comments:
When I run your code on SAS 9.2 TS 2M3 I get 11732.
I also get the same answer on SAS 9.3.
Which OS are you on?
Thank you for testing this. I am using Windows SAS 9.2.2.3. What OS are you using?
Post a Comment