ROUNDE Function


ROUNDE Function

Rounds the first argument to the nearest multiple of the second argument, and returns an even multiple when the first argument is halfway between the two nearest multiples

Category: Truncation

Syntax

ROUNDE ( argument <, rounding-unit >)

Arguments

argument

  • is a numeric constant, variable, or expression to be rounded.

rounding-unit

  • is a positive, numeric constant, variable, or expression that specifies the rounding unit.

Details

The ROUNDE function rounds the first argument to the nearest multiple of the second argument. If you omit the second argument, ROUNDE uses a default value of 1 for rounding-unit .

Comparisons

The ROUNDE function is the same as the ROUND function except that when the first argument is halfway between the two nearest multiples of the second argument, ROUNDE returns an even multiple. ROUND returns the multiple with the larger absolute value.

Examples

The following example compares the results that are returned by the ROUNDE function with the results that are returned by the ROUND function.

 options pageno=1 nodate linesize=80 pagesize=60;  data results;     do x=0 to 4 by .25;        Rounde=rounde(x);        Round=round(x);        output;     end;  run;  proc print data=results noobs;  run; 

The following output shows the results.

Output 4.45: Results That are Returned by the ROUNDE and ROUND Functions
start example
 The SAS System                            1    x        Rounde      Round  0.00          0          0  0.25          0          0  0.50          0          1  0.75          1          1  1.00          1          1  1.25          1          1  1.50          2          2  1.75          2          2  2.00          2          2  2.25          2          2  2.50          2          3  2.75          3          3  3.00          3          3  3.25          3          3  3.50          4          4  3.75          4          4  4.00          4          4 
end example
 

See Also

Function:

  • 'CEIL Function' on page 431

  • 'CEILZ Function' on page 433

  • 'FLOOR Function' on page 544

  • 'FLOORZ Function' on page 546

  • 'INT Function' on page 597

  • 'INTZ Function' on page 609

  • 'ROUND Function' on page 789

  • 'ROUNDZ Function' on page 797




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