asdocx with tab3way

  Introduction to tab3way

tab3way is a community-contributed package written by Philip Ryan. tab3way cross-tabulates 3 variables and displays any combination of cell frequencies, cell  percents, row percents and column, percents. “Missing” categories may be specified. tab3way optionally provides row, column and supercolumn, totals by temporarily augmenting observations in the existing data set and making a new category (labelled “TOTAL”) for each variable to accommodate these totals.

Users of asdocx have requested the addition of support for tab3way. Beginning with version 2.2.5, asdocx will now support it, allowing users to export its output table to Word, Excel, LaTeX, or HTML.

How to use asdocx  How tab3way works with asdocx

A slightly modified version of the program is available on the asdocx website, which is automatically downloaded when a user first uses it with asdocx. The modification is done to extract only the output matrix from the program and send it to asdocx, no other changes are made1. To use it with asdocx, simply add “asdocx” as a prefix. Here are some examples of how to use it with asdocx.

  Example of using tab3way with asdocx

  * Load example dataset
 sysuse auto, clear
 * Create a variable with 4 categories of the price
egen price_cat = cut(price), group(4)

 * asdocx with tab3way
asdocx tab3way price_cat rep78 foreign, allp allt usemiss replace save(Tabulations.xlsx)
Table: Tabulation of frequencies
Car origin and Repair record 1978
Domestic Foreign
price_cat 1 2 3 4 5 1 2 3 4 5
0 4 7 1 1 1 1 2
30.76 53.84 7.69 7.69 25 25 50
50 25.92 11.11 50 33.33 11.11 22.22
1 2 8 2 1 1 2 1
15.38 61.53 15.38 7.692 25 50 25
100 29.63 22.22 50 33.33 22.22 11.111
2 2 5 4 1 2 4
18.18 45.45 36.36 14.28 28.57 57.14
25 18.51 44.44 33.33 22.22 44.44
3 2 7 2 4 2
18.18 63.63 18.18 66.66 33.33
25 25.92 22.22 44.44 22.22

 tab3way options

The tab3way command comes in with a variety of options to customize the output of your three-way tabulations. Here are the available options:

Option Purpose
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. The denominator for the row percentage is the total N over all categories of the supercolvar within a specific rowvar/colvar combination.
colpct displays column percentages. The denominator for the column percentage is the total N over all categories of the rowvar within a specific supercolvar/colvar combination.
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.
scoltot displays supercolumn totals.
alltot displays row, column and supercolumn totals.
usemiss shows missing values as a separate category, similar to tabulate.., missing. (missing is an option for tab3way 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.

See also

  • tabmany – Table of multiple coded answers
  • mrtab – One- and two-way tables of multiple responses
  • fre – One-way frequency tables
  • missings – Various utilities for managing missing values
  • tabulate, tab1, tab2
  • tabcount – Tabulate upto 7 variables

Order asdocx

Yearly license of asdocx is available at $9.99. Its life-time license is available at $49.99. With the asdocx membership, you get :

  • Life-time license to use
  • All future updates
  • All premium templates / plugins.


Order asdocx



Ryan, P. (2002). TAB3WAY: Stata module to handle three-way tables with percentages.