Tabstat

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)countco
Sumsumsu
Minimum (smallest) observed valueminmi
Maximum (largest) observed valuemaxma
Range between minimum and maximumranger
Standard deviationsd
Variancevariancev
Skewnessskewnesssk
Kurtosiskurtosisk
Median (same as p50)medianmed

Function

Basic command
tabstat varname
Useful options
tabstat varname, stat(x)
tabstat varname, stat(x) by(groupvar)
Explanations
varnameInsert 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

Dataset
StataData1.dta
Variable namegpa
Variable labelGrade point average (Age 15, Year 1985)
Value labelsN/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

Dataset
StataData1.dta
Variable namegpa
Variable labelGrade point average (Age 15, Year 1985)
Value labelsN/A
Variable namecognitive
Variable labelCognitive test score (Age 15, Year 1985)
Value labelsN/A

You can use also use tabstat for multiple variables:

tabstat gpa cognitive, stat(n me med mi ma r sd v sk k)