Previous Page | Next Page

Functions and CALL Routines

INT Function



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

Syntax
Arguments
Details
Comparisons
Examples
See Also

Syntax

INT(argument)


Arguments

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.


Examples

The following SAS statements produce these results.

SAS Statements Results
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


See Also

Functions:

CEIL Function

FLOOR Function

INTZ Function

Previous Page | Next Page | Top of Page