Frequency Tables

The tabulate command

Frequency tables display the values of a variable, weighted with the number of occurrences of each single value. In addition, percentages are displayed.

tabulate f1

will display a frequency table including percentages and cumulative percentages. Note that if you want to use probability weights with your data, tabulate can be used with the svy prefix.

The tabulate command cannot be used to create tables for several variables. Rather

(CAUTION!)   tab f1 f2

will display a cross tabulation of the two variables. To create several frequency tables tab1 can be deployed:

tab1 f17 f18 f20 f25

However, tab1 cannot be used with svy.

Options

tab1 f17 f18 f20 f25, plot

will display frequency counts only plus simple bar charts (made of asterisks).

tab1 f17 f18 f20 f25, m

(with "m" being an abbreviation for "missing") will include values defined as missing in the table.

tab1 f17 f18 f20 f25, nol sort

(with "nol" for "nolabel") will display the table with the numerical codes instead of the value labels. At the same time, the table will be sorted by frequency, in descending order.


The fre command

Procedure fre first has to be downloaded and installed. To achieve this, type

ssc install fre

Now,

fre income

will produce a frequency table which displays the 20 lowest and the 20 highest values, plus missing values. Therefore, fre is a good idea if you suspect (or know) that the variable to be investigated has many values. Note, however, that you can add option all in order to produce the full table. Other options are available, among which the possibility to have the table written in tex format.

The fre command can handle more than one variable.

© W. Ludwig-Mayerhofer, Stata Guide | Last update: 23 Apr 2017