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
ROUNDE ( argument <, rounding-unit >)
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.
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 .
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.
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.
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
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