REMOVE Function
discards elements from a matrix
- REMOVE( matrix, indices)
The inputs to the REMOVE function are as follows:
- matrix
- is a numeric or character matrix or literal.
- indices
- refers to a matrix containing the indices of
elements that are removed from matrix.
The REMOVE function returns as a row vector elements of the
first argument, with elements corresponding to the indices
in the second argument discarded and the gaps removed.
The first argument is indexed in row-major order, as
in subscripting, and the indices must be in the range
1 to the number of elements in the first argument.
Noninteger indices are truncated to their integer part.
You can repeat the indices, and you can give them in any order.
If all elements are removed, the result is
a null matrix (zero rows and zero columns).
Thus, the following statement removes the third element, producing the
result shown:
a=remove({ 5 6, 7 8} , 3);
A
5 6 8
The following statement causes all but the fourth element to
be removed, giving the result shown:
a=remove({ 5 6 7 8} , { 3 2 3 1} );
A
8
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.