Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Tabulate with codes *and* value labels?

From   Mike Lacy <>
Subject   st: Tabulate with codes *and* value labels?
Date   Fri, 08 Sep 2006 07:44:53 -0600

I often find I would like a simple oneway tabulation that shows both the numeric codes and the labels for a variable, not just or the other. This is quite useful before and after a recode, for example. I'm thinking of something like the following mocked-up trivial example, in which 0 and 1 as well as "foreign" and "domestic" show up in the tabulation:

Car type | Freq. Percent
Domestic 0 | 52 70.27
Foreign 1 | 22 29.73
Total | 74 100.00

For some time I was convinced an answer to this question must lie somewhere in the archives, but I must not have hit the right combination of keywords if it is. Since I gather there is no built-in solution, could someone at least sketch how to make a program to obtain the value label associated with a given variable, and display that info. in a nice way?


Mike Lacy
Fort Collins CO USA
(970) 491-6721 office

* For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index