-------------------------------------------------------------------------------
help for tabsort
-------------------------------------------------------------------------------

One- and two-way tables with sorted rows and/or columns

tabsort varlist [weight] [if exp] [in range] [, norsort nocsort reverse sort(measure) summarize(summvar) tabulate_options ]

by ...: may be used with tabsort; see help by.

Description

tabsort tabulates varlist, containing either one or two variables, such that the order of rows (and of columns where present) is by default by frequency of occurrence (most frequent first), or optionally by means or standard deviations of a summarized variable (highest value first).

Remarks

String variables that contain only one or more spaces " " are tabulated with marginal |, except that very long values will be shown truncated, as occurs to any very long string value.

String values that are empty "" are tabulated as missing.

In Stata 8, tabulate with the sort option provides an official alternative for one-way tables of counts only.

Options

norsort suppresses sorting of rows by frequency.

nocsort suppresses sorting of columns by frequency.

reverse reverses the sort order, so that lowest values come first.

sort(measure) indicates the measure by which rows and/or columns are sorted. The default is f or freq, indicating frequencies. c or count is acceptable as a synonym. Alternatively, with summarize() m (or mean) or s (or sd) may be specified.

summarize(summvar) indicates a variable to be summarized within each cell of the table.

tabulate_options are other options for tabulate.

Examples

. tabsort rep78

. format price %1.0f . tabsort rep78 foreign, su(price) so(mean) . format price %8.0g

Author

Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

Acknowledgements

Edmond Ng and Lee Sieswerda alerted me to bugs.

Also see

On-line: tabulate, tabsum; groups (if installed)