Frequency table

Quick facts

Number of variables
One

Scales of variable(s)
Categorical

Information

A frequency table is a simple but very useful description of one variable and gives us both the frequency and various types of percentages of individuals with the different values.

Note
This function is used primarily for categorical variables (i.e. nominal/ordinal) but can be used for any type of variable; the main concern is that the table becomes too lengthy if there are many categories/values in the variable.

Types of statistic

The following information is included in the frequency table:

Freq.Frequency
PercentPercent
Cum.Cumulative percent
Note
Frequency tables do not automatically include information about missingness (but it is available as an option).

Function

Basic command
tab varname
Useful options
tab varname, m
tab varname, nol
tab varname, sort
Explanations
varnameInsert the name of the variable you want to use.
mTreat missing values like other values.
nolDisplay numeric codes rather than value labels.
sortDisplay the table in descending order of frequency.
Short names
tabtabulate
mmissing
nolnolabel
Note
Options can be used simultaneously, e.g:
tab varname, m nol sort
Note
You can make frequency tables for multiple variables at the same time, by using the command tab1.
For example: tab1 varname1 varname2 varname3
Note
You can make a frequency table of one variable, stratified by another variable, with the command bysort. For example: bysort varname2: varname1
More information
help tabulate oneway

Practical example

Dataset
StataData1.dta
Variable nameeduc
Variable labelEducational level (Age 40, Year 2010)
Value labels1=Compulsory
2=Upper secondary
3=University
tab educ

This is the simplest form of a frequency table. It shows the frequencies, the percentage distribution, and the cumulative percentages.

In this particular example, we see the distribution of educational level. Here, we are mostly interested in the column called Percent. It shows that 19.2% of the sample have compulsory education, 44.2% have upper secondary education, and 36.6% have university education. This then actually tells us something about the mode/type value; it is the most common value – which in this case is upper secondary education.

tab educ, m

The table above includes missing values. We can see that 8.2% of the original sample has missing values for this variable. 

tab educ, nol

The table above omits the value labels, and instead shows the actual values.

tab educ, sort

And here, in the table above, we can see the categories sorted from the most common one (upper secondary) to the least common one (compulsory).