Language Reference

MOD Function

computes the modulo (remainder)

MOD( value, divisor)

The inputs to the MOD function are as follows:
value
is a numeric matrix or literal giving the dividend.

divisor
is a numeric matrix or literal giving the divisor.

The MOD function is the scalar function returning the remainder of the division of elements of the first argument by elements of the second argument.

If either operand is a scalar, the MOD function performs the operation for each element of the matrix with the scalar value. If either operand is a row or column vector, then the operation is performed using that vector on each of the rows or columns of the matrix.

Unlike the MOD function in Base SAS, the IML MOD function does not perform any numerical "fuzzing" to return an exact zero when the result would otherwise be very small. Thus the results of the IML MOD function is more similar to the MODZ function in Base SAS.

An example of a valid statement follows:

  
    c = { -7 14 20 -81 23 }; 
    b=mod(c,4); 
    print b; 
  
                         B 
  
        -3         2         0        -1         3
 

Previous Page | Next Page | Top of Page