Language Reference |
sorts a matrix by specified columns
The SORT call is used to sort a matrix, rearranging its rows according to the columns and order determined by the by and descend inputs. Because the sort is done in place, very little additional memory space is required. The SORT call is not as fast as the SORTNDX call for matrices with large rows. After a matrix has been sorted, the unique combinations of values in the by columns can be obtained from the UNIQUEBY function.
For example, the following statements produce the matrix , as shown:
m = { 1 1 0, 2 2 0, 1 1 1, 2 2 2}; call sort( m, {1 3}, {3} );
M 1 1 1 1 1 0 2 2 2 2 2 0
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.