Internet Guide to Stata |
Print article |
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 this command cannot be used to create tables for several variables. Rather
(CAUTION!) tab f1 f2
will display a cross tabulation of the two variables. However, there are other solutions.
To create several frequency tables use the "tab1" command:
tab1 f17 f18 f20 f25
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.
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: 21 Aug 2012