I have this old habit of typing
. fre <varname>
to get a quick overview of a (categorical) variable (some will know
where this habit comes from). Of course, Stata responds (in red):
unrecognized command: fre
r(199);
But not anymore.
Thanks to Kit Baum, a package called -fre- is available from the SSC
Archive. To install the package, type
. ssc install fre
Stata 9 is required.
-fre- displays a table of the frequency distribution of the specified
variable (or several tables if more than one variable is specified).
Some of the features of -fre- are:
o Labels and values are printed by default. Labels are printed in full length.
o Missing values are included in the bottom part of the table by
default and two percentage columns are displayed, one based on all
observations and one based on the non-missing ("valid") observations.
o If a variable has many categories ("levels"), only the smallest and
largest 10 are displayed (along with missing values). This ensures
that the table will fit on screen. Option -all- enforces displaying
all categories.
o There is an -include- option to tabulate categories that have zero
frequency. This is useful, for example, for producing codebooks.
-include- without argument uses the label definitions to determine the
unobserved categories. Alternatively, you may provide a list of
categories in parentheses, i.e. type -include(<numlist>)-.
o The frequency tables may be written to file, either tab-delimited
or LaTeX-formatted. This, again, is useful for producing codebooks.
ben
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/