|
Size: 1982
Comment:
|
← Revision 5 as of 2026-04-10 21:28:52 ⇥
Size: 998
Comment: Reorg
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| The '''`summarize`''' command computes summary statistics. | '''`-summarize-`''' computes summary statistics. See [[Stata/AggregatingData|here]] for other similar commands. |
| Line 13: | Line 15: |
| Try: |
|
| Line 15: | Line 19: |
| summarize foo bar baz if foo==1 summarize foo bar baz in 1/10 by foo: summarize foo bar baz |
|
| Line 20: | Line 21: |
| Add the '''`detail`''' option for even more statistics. | The command takes `if` and `in` filters and is `by`-able. |
| Line 22: | Line 23: |
| ---- | A number of useful statistics are returned as scalars: * `r(N)` * `r(min)` * `r(max)` * `r(sum)` * `r(sum_w)` * `r(mean)` * `r(Var)` * `r(sd)` |
| Line 24: | Line 33: |
| The '''`meanonly`''' option is useful for programming and for working with very large datasets. Printed output is suppressed | |
| Line 25: | Line 35: |
== Stored Results == `summarize` stores the following statistics: ||'''Name''' ||'''Statistic''' ||'''Requires `detail` option?'''|| ||`r(N)` ||count || || ||`r(mean)` ||mean || || ||`r(skewness)`||skewness ||yes || ||`r(min)` ||minimum || || ||`r(max)` ||maximum || || ||`r(sum_w)` ||sum of weights || || ||`r(p1)` ||1st percentile ||yes || ||`r(p5)` ||5th percentile ||yes || ||`r(p10)` ||10th percentile ||yes || ||`r(p25)` ||25th percentile ||yes || ||`r(p50)` ||50th percentile ||yes || ||`r(p75)` ||75th percentile ||yes || ||`r(p90)` ||90th percentile ||yes || ||`r(p95)` ||95th percentile ||yes || ||`r(p99)` ||99th percentile ||yes || ||`r(Var)` ||variance || || ||`r(kurtosis)`||kurtosis ||yes || ||`r(sum)` ||sum || || ||`r(sd)` ||standard deviation|| || |
The '''`detail`''' option calculates even more statistics. Note that it is incompatible with `meanonly`. The additional scalars are: * `r(skewness)` * `r(kurtosis)` * Nth percentiles as `r(pN)` * For example, `r(p50)` is the 50th percentile a.k.a. the median. |
| Line 57: | Line 47: |
| [[https://www.stata.com/manuals/rsummarize.pdf|Stata manual for summarize]] | [[https://www.stata.com/manuals/rsummarize.pdf|Stata manual for -summarize-]] |
Stata Summarize
-summarize- computes summary statistics.
See here for other similar commands.
Contents
Usage
Try:
summarize foo bar baz
The command takes if and in filters and is by-able.
A number of useful statistics are returned as scalars:
r(N)
r(min)
r(max)
r(sum)
r(sum_w)
r(mean)
r(Var)
r(sd)
The meanonly option is useful for programming and for working with very large datasets. Printed output is suppressed
The detail option calculates even more statistics. Note that it is incompatible with meanonly. The additional scalars are:
r(skewness)
r(kurtosis)
Nth percentiles as r(pN)
For example, r(p50) is the 50th percentile a.k.a. the median.
