Language Reference |
REMOVE Function |
The REMOVE function discards elements from a matrix. The arguments to the REMOVE function are as follows:
is a numeric or character matrix or literal.
specifies the indices of elements of matrix to remove.
The REMOVE function returns (as a row vector) a subset of the elements of the first argument. Elements that correspond to indices in the second argument are removed. The elements of the first argument are enumerated in row-major order, and the indices must be in the range 1 to , where matrix is an matrix. Nonintegral indices are truncated to their integer part. You can repeat the indices and give them in any order. If all elements are removed, the result is a null matrix (zero rows and zero columns).
The following statement removes the third element, which creates a row vector with three elements:
x = {5 6, 7 8}; a = remove(x, 3); /* remove element 3 */ print a;
The following statement causes all but the fourth element to be removed:
r = {3 2 3 1}; b = remove(x, r); /* equivalent to removing elements 1:3 */ print b;
The output shown in Figure 23.210 shows that repeated indices are ignored.
Copyright © SAS Institute, Inc. All Rights Reserved.