INT Function


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

Category: Truncation

Syntax

INT ( argument )

Arguments

argument

  • is numeric.

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' on page 431

  • 'FLOOR Function' on page 544

  • 'INTZ Function' on page 609




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net