Functions and CALL Routines |
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.
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 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.
Results That are Returned by the ROUNDE and ROUND Functions
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
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.