📄 table.hlp
字号:
{smcl}
{* 01feb2005}{...}
{cmd:help table}{right:dialog: {bf:{dialog table}}}
{hline}
{title:Title}
{p2colset 5 18 20 2}{...}
{p2col:{hi:[R] table} {hline 2}}Tables of summary statistics{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 14 2}
{cmd:table}
{it:rowvar}
[{it:colvar}
[{it:supercolvar}]]
{ifin}
{weight}
[{cmd:,} {it:options}]
{synoptset 21 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Main}
{synopt:{opth c:ontents(table##clist:clist)}}contents of table cells; select up to 5
statistics; default is {cmd:contents(freq)}{p_end}
{synopt:{opth "by(varlist:superrowvarlist)"}}superrow variables
{p_end}
{syntab:Options}
{synopt:{opt cw}}perform casewise deletion{p_end}
{synopt:{opt cell:width(#)}}cell width{p_end}
{synopt:{opt csep:width(#)}}column separation width{p_end}
{synopt:{opt stubw:idth(#)}}stub width{p_end}
{synopt:{opt scsep:width(#)}}supercolumn separation width{p_end}
{synopt:{opt cen:ter}}center-align table cells; default is right-align{p_end}
{synopt:{opt l:eft}}left-align table cells; default is right-align{p_end}
{synopt:{opt row}}add row totals{p_end}
{synopt:{opt col}}add column totals{p_end}
{synopt:{opt sc:ol}}add supercolumn totals{p_end}
{synopt:{cmdab:f:ormat(%}{it:{help fmt}}{cmd:)}}display format for numbers in cells;
default is {cmd:format(%9.0g)}{p_end}
{synopt:{opt con:cise}}suppress rows with all missing entries{p_end}
{synopt:{opt m:issing}}show missing statistics with period{p_end}
{synopt:{opt replace}}replace current data with table statistics{p_end}
{synopt:{opt n:ame(string)}}name new variables with prefix {it:string}{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
{opt by} may be used with {opt table}; see {helpb by}.{p_end}
{p 4 6 2}
{opt fweight}s, {opt aweight}s, {opt iweight}s, and {opt pweight}s are
allowed; see {help weight}.{p_end}
{p 4 6 2}
{opt sd} (standard deviation) is not allowed with {opt pweight}s.{p_end}
{synoptset 25 tabbed}{...}
{marker clist}{...}
{syntab:where elements of {it:clist} may be}
{synopt:{opt freq}}frequency{p_end}
{synopt:{opt m:ean} {varname}}mean of {it:varname}{p_end}
{synopt:{opt sd} {it:varname}}standard deviation{p_end}
{synopt:{opt sum} {it:varname}}sum{p_end}
{synopt:{opt rawsum} {it:varname}}sums ignoring optionally specified
weight{p_end}
{synopt:{opt count} {it:varname}}count of nonmissing observations{p_end}
{synopt:{opt n} {it:varname}}same as {opt count}{p_end}
{synopt:{opt max} {it:varname}}maximum{p_end}
{synopt:{opt min} {it:varname}}minimum{p_end}
{synopt:{opt med:ian} {it:varname}}median{p_end}
{synopt:{opt p1} {it:varname}}1st percentile{p_end}
{synopt:{opt p2} {it:varname}}2nd percentile{p_end}
{synopt:{opt ...}}3rd-49th percentile{p_end}
{synopt:{opt p50} {it:varname}}50th percentile ({opt median}){p_end}
{synopt:{opt ...}}51st-97th percentile{p_end}
{synopt:{opt p98} {it:varname}}98th percentile{p_end}
{synopt:{opt p99} {it:varname}}99th percentile{p_end}
{synopt:{opt iqr} {it:varname}}interquartile range{p_end}
{p2colreset}{...}
{title:Description}
{pstd}
{opt table} calculates and displays tables of statistics.
{title:Options}
{dlgtab:Main}
{phang}
{opth "contents(table##clist:clist)"} specifies the contents of the table's
cells; if not specified, {cmd:contents(freq)} is used by default.
{cmd:contents(freq)} produces a table of frequencies.
{cmd:contents(mean mpg)} produces a table of the means of the variable
{opt mpg}. {cmd:contents(freq mean mpg sd mpg)} produces a table of
frequencies together with the mean and standard deviation of variable
{opt mpg}. Up to five statistics may be specified.
{phang}
{opth "by(varlist:superrowvarlist)"} specifies that numeric or string variables be
treated as superrows. Up to four variables may be specified in {it:superrowvarlist}.
Note that the {opt by()} option may be specified with the {opt by} prefix.
{dlgtab:Options}
{phang}
{opt cw} specifies casewise deletion. If {opt cw} is not specified, all
observations possible are used to calculate each of the specified statistics.
{opt cw} is relevant only when you request a table containing statistics on
multiple variables. For instance, {cmd:contents(mean mpg mean weight)} would
produce a table reporting the means of the variables {opt mpg} and
{opt weight}. Consider an observation in which {opt mpg} is known but
{opt weight} is missing. By default, that observation will be used in the
calculation of the mean of {opt mpg}. If you specify {opt cw}, the
observation will be excluded in the calculation of the means of both {opt mpg}
and {opt weight}.
{phang}
{opt cellwidth(#)} specifies the width of the cell in units of digit widths;
10 means the space occupied by 10 digits, which is {cmd:0123456789}. The
default {opt cellwidth()} is not a fixed number, but a number chosen by
{opt table} to spread the table out while presenting a reasonable number of
columns across the page.
{phang}
{opt csepwidth(#)} specifies the separation between columns
in units of digit widths. The default is not a fixed number, but a number
chosen by {opt table} according to what it thinks looks best.
{phang}
{opt 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 a number chosen by {opt table} according to what it thinks
looks best.
{phang}
{opt scsepwidth(#)} specifies the separation between
supercolumns in units of digit widths. The default is not a fixed number, but
a number chosen by {opt table} to present the results best.
{phang}
{opt 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. {cmd:center format(%9.2f)} is
popular.
{phang}
{opt 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.
{phang}
{opt row} specifies that a row be added to the table reflecting the total
across the rows.
{phang}
{opt col} specifies that a column be added to the table reflecting the total
across columns.
{phang}
{opt scol} specifies that a supercolumn be added to the table reflecting the
total across supercolumns.
{phang}
{cmd:format(%}{it:{help fmt}}{cmd:)} specifies the display format for
presenting numbers in the table's cells. {cmd:format(%9.0g)} is the default;
{cmd:format(%9.2f)} and {cmd:format(%9.2fc)} are popular alternatives. The
width of the format you specify does not matter, except that {cmd:%}{it:fmt}
must be valid. The width of the cells is chosen by {opt table} to present
the results best. Option {opt cellwidth()} allows you to override
{opt table}'s choice.
{phang}
{opt concise} specifies that rows with all missing entries not be displayed.
{phang}
{opt missing} specifies that missing statistics be shown in the table as
periods (Stata's missing value indicator). The default is that missing
entries be left blank.
{phang}
{opt replace} specifies the data in memory be replaced with data
containing one observation per cell (row, column, supercolumn, and superrow)
and with variables containing the statistics designated in {opt contents()}.
{pmore}
This option is rarely specified. If you do not specify this option,
the data in memory remain unchanged.
{pmore}
If you do specify this option, the first statistic will be named {opt table1},
the second {opt table2}, and so on. For instance, if
{cmd:contents(mean mpg sd mpg)} was specified, the means of mpg would be in
variable {opt table1} and the standard deviations in {opt table2}.
{phang}
{opt name(string)} is relevant only if you specify {opt replace}.
{opt name()} allows changing the default stub name {opt replace} uses to name
new variables associated with the statistics. If you specify
{cmd:name(stat)}, the first statistic will be placed in {opt stat1}, the
second in {opt stat2}, and so on.
{title:Examples}
{phang}{cmd:. table rep78}{p_end}
{phang}{cmd:. table rep78, contents(n mpg)}{p_end}
{phang}{cmd:. table rep78, c(n mpg mean mpg sd mpg median mpg)}{p_end}
{phang}{cmd:. table rep78, c(n mpg mean mpg sd mpg median mpg) format(%9.2f)}
{phang}{cmd:. table rep78 foreign, c(mean mpg)}{p_end}
{phang}{cmd:. table rep78 foreign, c(mean mpg) f(%9.2f) center}{p_end}
{phang}{cmd:. table foreign rep78, c(mean mpg n mpg) f(%9.2f) center}{p_end}
{phang}{cmd:. table foreign rep78, c(mean mpg n mpg) f(%9.2f) center row col}
{phang}{cmd:. table workplace smokes race, c(mean prob)}{p_end}
{phang}{cmd:. table workplace smokes race, c(mean prob) f(%9.4f)}{p_end}
{phang}{cmd:. table workplace smokes race, c(mean prob) f(%9.4f) sc col}
{phang}{cmd:. table workplace smokes race, by(sex) c(mean prob) f(%9.3f)}
{title:Also see}
{psee}
Manual: {bf:[R] table}
{psee}
Online:
{helpb adjust},
{helpb collapse},
{helpb tabdisp},
{helpb tabstat},
{help tabulate oneway},
{help tabulate twoway}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -