Written by:
Ylva B Almquist
Quick facts
Number of variables
One
Scales of variable(s)
Continuous or categorical (ordinal)
Information
A nice alternative to summarize is tabstat.
Per default, you will only get the mean value, but you can additionally order the following descriptive statistics (just to give some examples):
Count of nonmissing obs. (same as count) | n | |
Count of nonmissing obs. (same as n) | count | co |
| Sum | sum | su |
| Minimum (smallest) observed value | min | mi |
| Maximum (largest) observed value | max | ma |
| Range between minimum and maximum | range | r |
| Standard deviation | sd | |
| Variance | variance | v |
| Skewness | skewness | sk |
| Kurtosis | kurtosis | k |
Median (same as p50) | median | med |
Function
| Basic command |
tabstat varname |
| Useful options |
tabstat varname, stat(x) tabstat varname, stat(x) by(groupvar) |
| Explanations | |
varname | Insert the name of the variable you want to use. |
stat(x) | Replace “x” by specifying the statistics you want to show. |
by(groupvar) | Specify a group variable. |
More information
help tabstat |
Practical example 1
| Variable name | gpa |
| Variable label | Grade point average (Age 15, Year 1985) |
| Value labels | N/A |
You can use tabstat for a single variable and specify as many statistics as you like:
tabstat gpa, stat(n me med mi ma r sd v sk k) |
And here is an example where sex is included as a group variable:
tabstat gpa, stat(n me med mi ma r sd v sk k) by(sex) |
Practical example 2
| Variable name | gpa |
| Variable label | Grade point average (Age 15, Year 1985) |
| Value labels | N/A |
| Variable name | cognitive |
| Variable label | Cognitive test score (Age 15, Year 1985) |
| Value labels | N/A |
You can use also use tabstat for multiple variables:
tabstat gpa cognitive, stat(n me med mi ma r sd v sk k) |