Functions and CALL Routines 
Category:  Truncation 
Syntax  
Arguments  
Details  
Comparisons  
Examples  
Example 1: Comparing Results from the ROUNDZ and ROUND Functions  
Example 2: Sample Output from the ROUNDZ Function  
See Also 
Syntax 
ROUNDZ (argument <,roundingunit>) 
is a numeric constant, variable, or expression to be rounded.
is a positive, numeric constant, variable, or expression that specifies the rounding unit.
Details 
The ROUNDZ function rounds the first argument to the nearest multiple of the second argument. If you omit the second argument, ROUNDZ uses a default value of 1 for roundingunit.
Comparisons 
The ROUNDZ function is the same as the ROUND function except that:
ROUNDZ returns an even multiple when the first argument is exactly halfway between the two nearest multiples of the second argument. ROUND returns the multiple with the larger absolute value when the first argument is approximately halfway between the two nearest multiples.
When the rounding unit is less than one and not the reciprocal of an integer, the result that is returned by ROUNDZ might not agree exactly with the result from decimal arithmetic. ROUNDZ does not fuzz the result. ROUND performs extra computations, called fuzzing, to try to make the result agree with decimal arithmetic.
Examples 
The following example compares the results that are returned by the ROUNDZ and the ROUND function.
options pageno=1 nodate linesize=60 pagesize=60; data test; do i=10 to 17; Value=2.5  10**(i); Roundz=roundz(value); Round=round(value); output; end; do i=16 to 12 by 1; value=2.5 + 10**(i); roundz=roundz(value); round=round(value); output; end; run; proc print data=test noobs; format value 19.16; run;
The following output shows the results.
Results That Are Returned by the ROUNDZ and ROUND Functions
The SAS System 1 i Value Roundz Round 10 2.4999999999000000 2 2 11 2.4999999999900000 2 2 12 2.4999999999990000 2 3 13 2.4999999999999000 2 3 14 2.4999999999999900 2 3 15 2.4999999999999900 2 3 16 2.5000000000000000 2 3 17 2.5000000000000000 2 3 16 2.5000000000000000 2 3 15 2.5000000000000000 3 3 14 2.5000000000000100 3 3 13 2.5000000000001000 3 3 12 2.5000000000010000 3 3
These examples show the results that are returned by ROUNDZ.
See Also 

Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.