{smcl}
{hline}
help for {cmd:tab2way} {right:v1.01  2002-08-28}
{hline}

{title:Cross-tabulation of 2 variables with display of percentages}

{p 1 28 3}{cmd:tab2way} {it:rowvar colvar} [{it:weight}]
[{cmd:if} {it:exp}] [{cmd:in} {it:range}]
[{cmd:,} {cmdab:cellp:ct} {cmdab:rowp:ct}
{cmdab:colp:ct} {cmdab:allp:ct}
{cmdab:rowt:ot} {cmdab:colt:ot} {cmdab:allt:ot}
{cmdab:f:ormat}{cmd:(%}{it:fmt}{cmd:)}
{c -(}{cmd:freq}|{cmd:nofreq}{c )-} {cmd:usemiss}]
{p_end}

{p 1 13 3}{cmd:by} {it:varlist}{cmd::} may be used with {cmd:tab2way} to
stratify tables. See help {help by:by}.
{p_end}

{space 1}{cmd:fweight}s are allowed. See help {help weights:weights}.


{title:Description}

{p 0 8 3}{cmd:tab2way} cross-tabulates 2 variables and displays any
 combination of cell frequencies, cell percents, row percents and
column percents. "Missing" categories may be specified.
{p_end}
{p 8 8 3}{cmd: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.
{p_end}
{p 8 8 3}{cmd:tab2way} is a front end for {help tabdisp:tabdisp}, although
 not all of the latter's options are implemented here.
{p_end}


{title:Options}

{p 0 12 3}{cmd:freq}|{cmd:nofreq}{space 1}{it:displays}|{it:does not display}
 cell frequencies. {cmd:freq} is the default.
{p_end}

{p 0 12 3}{cmd:cellpct}{space 5}displays cell percentages. The denominator of
 the cell percentage is the total N over the entire table.
{p_end}

{p 0 12 3}{cmd:rowpct}{space 6}displays row percentages.
{p_end}

{p 0 12 3}{cmd:colpct}{space 6}displays column percentages.
{p_end}

{p 0 12 3}{cmd:allpct}{space 6}displays cell frequencies and cell, row
 and column percentages. Specifying none of {cmd:cellpct}, {cmd:rowpct},
 {cmd:colpct} or {cmd:allpct} provides just frequencies (default).
{p_end}

{cmd:rowtot}      displays row totals.

{cmd:coltot}      displays column totals.

{cmd:alltot}      displays row and column totals.

{p 0 12 3}{cmd:usemiss}{space 5}shows missing values as a separate category,
 similar to {cmd:tabulate.., missing}. ({cmd:missing} is an option for
 {cmd:tab2way} insofar as it is passed to {help tabdisp:tabdisp}, where it
 has a different role.)
{p_end}

{p 0 13 3}{cmd:format(%}{it:fmt}{cmd:)} 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.
{p_end}

{p 0 0 3}In addition, any of the following options allowed by
{help tabdisp:tabdisp} may be specified: {cmd: center}, {cmd:missing},
 {cmd:cellwidth(}{it:#}{cmd:)}, {cmd:csepwidth(}{it:#}{cmd:)},
 {cmd:scsepwidth(}{it:#}{cmd:)}, {cmd:stubwidth(}{it:#}{cmd:)}.
{p_end}


{title:Examples}
{input}
    . 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
{txt}

{title:Author}

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


{title:Also see}

{p 0 10 3}On-line:  help for {help tabdisp:tabdisp}, {help table:table},
 {help tabulate:tabulate}
{p_end}

