round(x [, ndec]), x REAL or a structure with REAL components, ndec an integer |

round(x) rounds the elements of the REAL variable x to the nearest integer, producing a vector, matrix, or array with the same shape as x. round(x,n) where n is an integer is equivalent to 10^(-n)*round(x*10^n). If n > 0, this rounds to n decimal places. If n < 0, this rounds to the nearest multiple of 10^abs(n). round(x,0) is equivalent to round(x). If x is a structure, so is round(x) or round(x,n). If xi is the i-th component of x, the i-th component of round(x) or round(x,n) is round(xi) or round(xi,n). Example: round(3141.593,2) is 3141.59 and round(3141.593,-2) is 3100, the nearest multiple of 100 = 10^2. round(x, p) can also be used when x is a CHARACTER variable and p, if present, is a quoted string or CHARACTER scalar or REAL scalar. The result is a CHARACTER variable of the same shape as x describing the transformation. For example, both round(vector("X1","X2"),3) and round(vector("X1","X2"),"3") return vector("round(X1,3)","round(X2,3)"). Any element of x that is "" or starts with '@', '(', '[', '{', '<', '/' or '\' is not modified. This can be useful for creating labels for a transformed variable. See also topics floor(), ceiling(), 'structures', 'labels'.

Gary Oehlert 2003-01-15