Stata 15 help for tabdisp

[P] tabdisp -- Display tables

Syntax

tabdisp rowvar [colvar [supercolvar]] [if] [in], cellvar(varnames) [by(superrowvars) format(%fmt) center left concise missing totals dotz cellwidth(#) csepwidth(#) scsepwidth(#) stubwidth(#)]

by is allowed; see [D] by.

rowvar, colvar, and supercolvar may be numeric or string variables.

Description

tabdisp displays data in a table. tabdisp calculates no statistics and is intended for use by programmers.

For the corresponding command that calculates statistics and displays them in a table, see [R] table.

Although tabdisp is intended for programming applications, it can be used interactively for listing data.

Options

cellvar(varnames) is required; it specifies the numeric or string variables containing the values to be displayed in the table's cells. Up to five variable names may be specified.

by(superrowvars) specifies numeric or string variables to be treated as superrows. Up to four variables may be specified.

format(%fmt) specifies the display format for presenting numbers in the table's cells. format(%9.0g) is the default; format(%9.2f) is a popular alternative. The width of the format you specify does not matter, except that %fmt must be valid. The width of the cells is chosen by tabdisp to be what it thinks looks best. The cellwidth() option allows you to override tabdisp's choice.

center specifies that results be centered in the table's cells. The default is to right-align results. For centering to work well, you typically need to specify a display format as well. center format(%9.2f) is popular.

left specifies that column labels be left-aligned. The default is to right-align column labels to distinguish them from supercolumn labels, which are left-aligned. If you specify left, both column and supercolumn labels are left-aligned.

concise specifies that rows with all missing entries not be displayed.

missing specifies that, in cells containing missing values, the missing value (., .a, .b, ..., or .z) be displayed. The default is that cells with missing values are left blank.

totals specifies that observations where rowvar, colvar, supercolvar, or superrowvars contain the system missing value (.) be interpreted as containing the corresponding totals of cellvar(), and that the table be labeled accordingly. If dotz option is also specified, observations where the stub variables contain .z will be thus interpreted.

dotz specifies that the roles of missing values . and .z be interchanged in labeling the stubs of the table. By default, if any of rowvar, colvar, supercolvar, and superrowvars contains missing (., .a, .b, ..., or .z), then "." is placed last in the ordering. dotz specifies that .z be placed last. Also, if option totals is specified, .z values rather than "." values will be labeled "Total".

cellwidth(#) specifies the width of the cell in units of digit widths; 10 means the space occupied by 10 digits, which is 0123456789. The default cellwidth() is not a fixed number but rather a number chosen by tabdisp to spread the table out while presenting a reasonable number of columns across the page.

csepwidth(#) specifies the separation between columns in units of digit widths. The default is not a fixed number but rather a number chosen by tabdisp according to what it thinks looks best.

scsepwidth(#) specifies the separation between supercolumns in units of digit widths. The default is not a fixed number but rather a number chosen by tabdisp according to what it thinks looks best.

stubwidth(#) specifies the width, in units of digit widths, to be allocated to the left stub of the table. The default is not a fixed number but rather a number chosen by tabdisp according to what it thinks looks best.

Examples

--------------------------------------------------------------------------- Setup . webuse tabdxmpl1

List the data . list

List the data using tabdisp . tabdisp a b, cell(c)

Drop observation 6 . drop in 6

List the data using tabdisp . tabdisp a b, cell(c)

--------------------------------------------------------------------------- Setup . sysuse auto2, clear

List some of the data . list make mpg weight displ rep78 in 1/10

List some of the data using tabdisp . tabdisp make, cell(mpg weight displ rep78)

Make dataset of means of mpg by categories of foreign and rep78 . collapse (mean) mpg, by(foreign rep78)

List the data . list

List the data using tabdisp . tabdisp foreign rep78, cell(mpg)

Drop observations having a missing value for rep78 . drop if rep78 >= .

List the data using tabdisp with a format of %9.2f and centering results in the cells . tabdisp foreign rep78, cell(mpg) format(%9.2f) center

--------------------------------------------------------------------------- Setup . webuse tabdxmpl3, clear

List the data, which consists of all string variables, using tabdisp . tabdisp agecat sex party, c(reaction) center

--------------------------------------------------------------------------- Setup . webuse tabdxmpl4

List the data . list

List the data using tabdisp . tabdisp sex response, cell(pop)

List the data using tabdisp, requesting that missing values be displayed . tabdisp sex response, cell(pop) missing

--------------------------------------------------------------------------- Setup . webuse tabdxmpl5

List the data . list

List the data using tabdisp . tabdisp sex response, cell(pop)

List the data using tabdisp, labeling the system missing values as totals . tabdisp sex response, cell(pop) total ---------------------------------------------------------------------------


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index