TABSORT procedure

Sorts tables so their margins are in ascending or descending order (R.W. Payne).


Options

PRINT = strings
Controls output (tables, histograms); default * i.e. none

DIRECTION = string
Direction of sorting (ascending, descending); default asce

METHOD = string
Method to use to construct a marginal table for the sorting of a factor when there is no one-way table classified by the factor in the TABLE list (totals, means, minima, maxima, variances, medians); default tota

FACTORS = pointer
Specifies or saves a list of classifying factors of the tables in the TABLE list

NEWFACTORS = pointer
Specifies or saves a list of classifying factors of the new tables, corresponding to those in the FACTORS pointer


Parameters

TABLE = tables
Tables to be sorted

NEWTABLE= tables
Allows the new sorted tables to be saved

TITLE = texts
Title to be used when displaying each table

FIELDWIDTH = scalars
Field width for printing each table

DECIMALS = scalars
Decimal places for each table


Description

This procedure sorts tables so that their margins are in a specified order. With a multi-way table, for example, this may help in interpreting an interaction from an analysis of variance. With a one-way table, it allows the cells to be displayed in ascending order, as in a Pareto chart.

   The original tables are supplied by the TABLE parameter. If you want to specify your own ordering, the FACTORS and NEWFACTORS options can be set to pre-defined pointers of factors indicating the ways in which each dimension of the tables is to be sorted: FACTORS contains factors from the classifying sets of the original tables, and NEWFACTORS contains the corresponding factors for the new tables (with the levels in the new order).

   Alternatively, you can let TABSORT defining the ordering. For each factor classifying the original tables, the ordering is obtained using a one-way table for that factor. This may be available amongst the list of original tables (specified by the TABLE parameter). If not, TABSORT finds the first table in the list with the factor in its classifying set, and constructs a marginal table for the factor using the MARGIN directive; the MARGIN option then defines how the margin is formed (using means, medians and so on). Having obtained a suitable one-way table, TABSORT forms a new factor whose levels are in the order that will arrange the entries of the table in either ascending or descending order according to the setting of the DIRECTION option (default ascending). The FACTORS and NEWFACTORS options can be used to save pointers containing the factors and reordered factors for future use. Note also, that even if you do not want to use the factors in future, you can use the pointers to specify identifiers for the new factors to be used when the tables are printed.

   The PRINT option controls the output produced by TABSORT. The setting tables prints the tables. The setting histograms, causes any one-way tables to be plotted by the DHISTOGRAM directive, and any two-way tables to be plotted by D3HISTOGRAM. The TITLE parameter allows you to supply a title to be used in the display of each table. The FIELDWIDTH parameter specifies field widths, and the DECIMALS parameter specified numbers of decimal places. The NEWTABLE parameter can be used to save the sorted tables.

 

Options: PRINT, DIRECTION, METHOD, FACTORS, NEWFACTORS.

Parameters: TABLE, NEWTABLE, TITLE, FIELDWIDTH, DECIMALS.


Method

TABSORT uses FACSORT to sort the factors and COMBINE to reorder the table.