INT Function

Returns the integer value, fuzzed to avoid unexpected floating-point results.

Category: Truncation

Syntax

INT(argument)

Required Argument

argument

specifies a numeric constant, variable, or expression.

Details

The INT function returns the integer portion of the argument (truncates the decimal portion). If the argument's value is within 1E-12 of an integer, the function results in that integer. If the value of argument is positive, the INT function has the same result as the FLOOR function. If the value of argument is negative, the INT function has the same result as the CEIL function.

Comparisons

Unlike the INTZ function, the INT function fuzzes the result. If the argument is within 1E-12 of an integer, the INT function fuzzes the result to be equal to that integer. The INTZ function does not fuzz the result. Therefore, with the INTZ function you might get unexpected results.

Example

The following SAS statements produce these results.
SAS Statement
Result
var1=2.1;
x=int(var1);
put x;
 
2
var2=-2.4;
y=int(var2);
put y;
 
-2
a=int(1+1.e-11);
put a;
 
1
b=int(-1.6);
put b;
 
-1