📄 tabstat.hlp
字号:
{smcl}
{* 18mar2005}{...}
{cmd:help tabstat}{right:dialog: {bf:{dialog tabstat}}}
{hline}
{title:Title}
{p2colset 5 20 22 2}{...}
{p2col:{hi:[R] tabstat} {hline 2}}Display table of summary statistics{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 16 2}
{cmd:tabstat}
{varlist}
{ifin}
{weight}
[{cmd:,} {it:options}]
{synoptset 27 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Main}
{synopt:{opth by(varname)}}
group statistics by variable
{p_end}
{synopt:{cmdab:s:tatistics:(}{it:{help tabstat##statname:statname}} [{it:...}]{cmd:)}}
report specified statistics
{p_end}
{syntab:Options}
{synopt:{opt case:wise}}
perform casewise deletion of observations
{p_end}
{synopt:{opt not:otal}}
do not report overall statistics; use with {opt by()}
{p_end}
{synopt:{opt m:issing}}
report statistics for missing values of {opt by()} variable
{p_end}
{synopt:{opt nosep:arator}}
do not use separator line between {opt by()} categories
{p_end}
{synopt:{opt la:belwidth(#)}}
width for {opt by()} variable labels; default is {cmd:labelwidth(16)}
{p_end}
{synopt:{opt va:rwidth(#)}}
variable width; default is {cmd:varwidth(12)}
{p_end}
{synopt:{cmdab:c:olumns(}{opt v:ariables}{cmd:)}}
display variables in table columns; the default
{p_end}
{synopt:{cmdab:c:olumns(}{opt s:tatistics}{cmd:)}}
display statistics in table columns
{p_end}
{synopt:{opt lo:ngstub}}
make left table stub wider
{p_end}
{synopt:{opt f:ormat}[{cmd:(%}{it:{help format:fmt}}{cmd:)}]}
display format for statistics; default format is {cmd:%9.0g}
{p_end}
{synopt:{opt save}}
save summary statistics in {opt r()}
{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
{opt by} may be used with {opt tabstat}; see {helpb by}.
{p_end}
{p 4 6 2}
{opt aweight}s and {opt fweight}s are allowed; see {help weight}.
{p_end}
{title:Description}
{pstd}
{opt tabstat} displays summary statistics for a series of numeric variables
in a single table, possibly broken down on (conditioned by) another variable.
{pstd}
Without the {opt by()} option, {opt tabstat} is a useful alternative to
{helpb summarize} because it allows you to specify the list of statistics to be
displayed.
{pstd}
With the {opt by()} option, {opt tabstat} resembles {opt tabulate} used with
its {opt summarize()} option in that both report statistics of {varlist}
for the different values of {varname}. {opt tabstat} allows
more flexibility in terms of the statistics presented and the format of the
table.
{pstd}
{opt tabstat} is sensitive to {help log:linesize}; it widens the table, if
possible, and wraps, if necessary.
{title:Options}
{dlgtab:Main}
{phang}
{opth by(varname)} specifies that the statistics be
displayed separately for each unique value of {it:varname}; {it:varname}
may be numeric or string. For instance, {cmd:tabstat height} would present
the overall mean of height. {cmd:tabstat height, by(sex)} would present
the mean height of males, and of females, and the overall mean height.
Do not confuse the {opt by()} option with the {helpb by} prefix; both may
be specified.
{phang}
{cmd:statistics(}{it:{help tabstat##statname:statname}} [{it:...}]{cmd:)}
specifies the statistics to be displayed; the default is equivalent to
specifying {cmd:statistics(mean)}. ({opt stats()} is a synonym for
{opt statistics()}.) Multiple statistics may be specified
and are separated by white space, such as {cmd:statistics(mean sd)}.
Available statistics are
{marker statname}{...}
{synoptset 17}{...}
{synopt:{space 4}{it:statname}}definition{p_end}
{space 4}{synoptline}
{synopt:{space 4}{opt me:an}} mean{p_end}
{synopt:{space 4}{opt co:unt}} count of nonmissing observations{p_end}
{synopt:{space 4}{opt n}} same as {cmd:count}{p_end}
{synopt:{space 4}{opt su:m}} sum{p_end}
{synopt:{space 4}{opt ma:x}} maximum{p_end}
{synopt:{space 4}{opt mi:n}} minimum{p_end}
{synopt:{space 4}{opt r:ange}} range = max - min{p_end}
{synopt:{space 4}{opt sd}} standard deviation{p_end}
{synopt:{space 4}{opt v:ariance}} variance{p_end}
{synopt:{space 4}{opt cv}} coefficient of variation ({cmd:sd/mean}){p_end}
{synopt:{space 4}{opt sem:ean}} standard error of mean ({cmd:sd/sqrt(n)}){p_end}
{synopt:{space 4}{opt sk:ewness}} skewness{p_end}
{synopt:{space 4}{opt k:urtosis}} kurtosis{p_end}
{synopt:{space 4}{opt p1}} 1st percentile{p_end}
{synopt:{space 4}{opt p5}} 5th percentile{p_end}
{synopt:{space 4}{opt p10}} 10th percentile{p_end}
{synopt:{space 4}{opt p25}} 25th percentile{p_end}
{synopt:{space 4}{opt med:ian}} median (same as {opt p50}){p_end}
{synopt:{space 4}{opt p50}} 50th percentile (same as {opt median}){p_end}
{synopt:{space 4}{opt p75}} 75th percentile{p_end}
{synopt:{space 4}{opt p90}} 90th percentile{p_end}
{synopt:{space 4}{opt p95}} 95th percentile{p_end}
{synopt:{space 4}{opt p99}} 99th percentile{p_end}
{synopt:{space 4}{opt r:ange}}range = {opt max} - {opt min}{p_end}
{synopt:{space 4}{opt iqr}} interquartile range = {opt p75} - {opt p25}{p_end}
{synopt:{space 4}{opt q}} equivalent to specifying {cmd:p25 p50 p75}{p_end}
{space 4}{synoptline}
{p2colreset}{...}
{dlgtab:Options}
{phang}
{opt casewise} specifies casewise deletion of observations. Statistics
are to be computed for the sample that is not missing for any of the
variables in {varlist}. The default is to use all the nonmissing values
for each variable.
{phang}
{opt nototal} is for use with {opt by()}; it specifies that the overall
statistics not be reported.
{phang}
{opt missing} specifies that missing values of the {opt by()}
variable be treated just like any other value and that statistics should be
displayed for them. The default is not to report the statistics for the
{cmd:by()==}{it:missing} group. If the {opt by()} variable is a string
variable, {cmd:by()==""} is considered to mean missing.
{phang}
{opt noseparator} specifies that a separator line between the {opt by()}
categories not be displayed.
{phang}
{opt labelwidth(#)} specifies the maximum width to be used within the stub to
display the labels of the {opt by()} variable. The default is
{cmd:labelwidth(16)}. 8 {ul:<} {it:#} {ul:<} 32.
{phang}
{opt varwidth(#)} specifies the maximum width to be used within the stub to
display the names of variables. The default is
{cmd:varwidth(12)}. {opt varwidth()} is effective only with
{cmd:column(statistics)}. Setting {opt varwidth()} implies {opt longstub}.
8 {ul:<} {it:#} {ul:<} 16.
{phang}
{cmd:columns(variables}|{cmd:statistics)} specifies whether to display
variables or statistics in the columns of the table.
{cmd:column(variables)} is the default when more than one variable is
specified.
{phang}
{opt longstub} specifies that the left stub of the table be made wider
so that it can include names of the statistics or variables in addition to
the categories of {opth by(varname)}. The default is to describe the
contents of the statistics or variables in a header. {opt longstub} is
ignored if {opt by(varname)} is not specified.
{phang}
{opt format} and {cmd:format(%}{it:{help format:fmt}}{cmd:)} specify how the
statistics are to be formatted. The default is to use a {cmd:%9.0g}
format.
{pmore}
{opt format} specifies that each variable's statistics be formatted
with the variable's display format; see {helpb format}.
{pmore}
{cmd:format(%}{it:fmt}{cmd:)} specifies the format to be used for all
statistics. The maximum width of the specified format should not exceed 9
characters.
{phang}
{opt save} specifies that the summary statistics be returned in
{opt r()}. The overall (unconditional) statistics are returned in matrix
{cmd:r(StatTotal)} (rows are statistics, columns are variables). The conditional
statistics are returned in the matrices {cmd:r(Stat1)}, {cmd:r(Stat2)}, ..., and
the names of the corresponding variables are returned in the macros
{cmd:r(name1)}, {cmd:r(name2)}, ....
{title:Examples}
{phang}{cmd:. tabstat item1 item2 item3, stats(mean range)}{p_end}
{phang}{cmd:. tabstat item1 item2 item3, by(education)}{p_end}
{phang}{cmd:. tabstat item1 item2 item3, by(education) f(%7.2f) long}
{phang}{cmd:. tabstat pric weig trun disp, by(foreign) stats(min mean max) col(stat)}
{title:Also see}
{psee}
Manual: {bf:[R] tabstat}
{psee}
Online:
{helpb collapse},
{helpb summarize},
{helpb table},
{help tabulate summarize}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -