help for tabm

Tabulation of multiple variables

tabm
varlist
[weight]
[if exp]
[in range]
[,
missing
oneway
replace
transpose
valuelabel(lblname)
varnames
tabulate_options]

by ... : may be used with tabm:
see help by.

fweights, aweights and iweights are allowed with
tabm; see help weights.

Description

tabm tabulates varlist, containing two or more comparable
variables.
By default a combined two-way table is shown of variables in varlist by
values in varlist. Either all variables should be numeric, or all
variables should be string: the type of the first variable named is
taken to indicate the user's intentions. By default also, variables are
listed in the rows of the table and values in the columns. Optionally,
two-way tables may be transposed.

Optionally, a one-way table may be shown of values in varlist pooled
across all variables.

Remarks

For further discussion of handling multiple responses in Stata,
see Cox and Kohler (2003) and Jann (2005).

Options

missing specifies that observations with missing values are to be
included.

oneway specifies display of a one-way table.

replace specifies that the tabulated data overwrite the data in
question. The new variables will be _stack, indexing variables,
_values, the distinct values of varlist, and (if weights are
specified) _weight, the weights. replace may not be specified
with by:.

transpose transposes rows and columns as compared with the
default. This option may be needed if there are too many values to show
as columns.

valuelabel(lblname) specifies a value label name to be
used in tabulation. The default is that any value label associated with
the first numeric variable in varlist will be used. This option
will be ignored in tabulation of string variables.

varnames insists on variable names being shown to indicate varlist
on the rows or columns of the table. The default is to show variable labels
whenever defined.

tabulate_options are options allowed with tabulate for two-way or
one-way tables.

Examples

. clear

. set obs 100

. forval j = 1/7 {

. gen y`j' = floor(10 * runiform()^`j')

. }

. tabm y*

. tabm y*, transpose

. tabm y*, oneway

Author

Nicholas J. Cox, Durham University, U.K.

n.j.cox@durham.ac.uk

Acknowledgments

Lee Sieswerda suggested making tabm byable and
helped in testing. Svend Juul gave a careful analysis of how missing
values were not being supported properly. Questions from Chris Martin
led to identification of a bug affecting valuelabel() and the
introduction of varnames as an option.

References

Cox, N.J. and Kohler, U. 2003.
On structure and shape: the case of multiple responses.
Stata Journal 3: 81-99.

Jann, B. 2005. Tabulation of multiple responses.
Stata Journal 5: 92-122.

Also see

On-line: help for tabulate; mrtab (if installed)