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 <Michael.Lacy@colostate.edu>
To   statalist@hsphsun2.harvard.edu
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?

Thanks,

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






*
* 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/




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