Advanced tables and statistics > Other tabulation facilities > Sorting tables
 
Sorting tables
Sometimes you want rows to be arranged according to the size of the counts or values in the cells, the largest in the first row, the second largest in the second row, and so on.
Keywords
You can place any of these keywords on the tab statement of the table which is to be sorted. Alternatively you can put the keywords on the a, flt or sectbeg statement, in which case all tables at that level are sorted (tables which are not to be sorted would then need the keyword nosort on the tab statement).
csort
Column-wise sort; that is, largest column first, smallest column last.
maxsortedcols=n
maxsortedrows=n
Prints only the first n columns or rows of the sorted table.
nosort
Do not sort this table.
pcsort
Sort on percentages in the direction defined by sort or csort.
rsort
Row-wise sort. This is the same as sort.
sort
Row-wise sort; that is, largest row first, smallest row last.
sortcol
Selects the column on which to sort when sorting is row-wise. The default is to sort on the figures in the base column.
See
Sorting rows
Sorting columns
Sorting percentages
Sorting at different levels
Text-only elements in sorted tables
Totals, statistics and manipulated elements in sorted tables
See also
Other tabulation facilities