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;
proc sql; select mod(11169568236203649, 30269) from dummy;
Oracle SQL script and the result.
select mod(11169568236203649, 30269) from dual;
R script and the result.
11169568236203649 %% 30269
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.)