-------------------------------------------------------------------------------
help for tab2way                                              v1.01  2002-08-28
-------------------------------------------------------------------------------

Cross-tabulation of 2 variables with display of percentages

tab2way rowvar colvar [weight] [if exp] [in range] [, cellpct rowpct colpct allpct rowtot coltot alltot format(%fmt) {freq|nofreq} usemiss]

by varlist: may be used with tab2way to stratify tables. See help by.

fweights are allowed. See help weights.

Description

tab2way cross-tabulates 2 variables and displays any combination of cell frequencies, cell percents, row percents and column percents. "Missing" categories may be specified. tab2way optionally provides row and column totals by temporarily augmenting observations in the existing data set and making a new category (labelled "TOTAL") for each variable to accommodate these totals. tab2way is a front end for tabdisp, although not all of the latter's options are implemented here.

Options

freq|nofreq displays|does not display cell frequencies. freq is the default.

cellpct displays cell percentages. The denominator of the cell percentage is the total N over the entire table.

rowpct displays row percentages.

colpct displays column percentages.

allpct displays cell frequencies and cell, row and column percentages. Specifying none of cellpct, rowpct, colpct or allpct provides just frequencies (default).

rowtot displays row totals.

coltot displays column totals.

alltot displays row and column totals.

usemiss shows missing values as a separate category, similar to tabulate.., missing. (missing is an option for tab2way insofar as it is passed to tabdisp, where it has a different role.)

format(%fmt) specifies the display format for presenting percentages in the table's cells (the frequencies, if specified, are always displayed as integers). The default is %8.2f, which gives 2 decimal places.

In addition, any of the following options allowed by tabdisp may be specified: center, missing, cellwidth(#), csepwidth(#), scsepwidth(#), stubwidth(#).

Examples

. use auto . egen price_cat = cut(price), group(4) . tab2way price_cat rep78, rowpct colp format(%5.3f) . bysort foreign: tab2way price_cat rep78, allp allt usemiss

Author

Philip Ryan Department of Public Health University of Adelaide South Australia email: philip.ryan@adelaide.edu.au

Also see

On-line: help for tabdisp, table, tabulate