Functions and CALL Routines |
Returns the integer value, fuzzed to avoid unexpected floating-point
results.
-
argument
-
specifies a numeric constant, variable,
or expression.
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.
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.
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
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.