| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Tabulate with codes *and* value labels?
Jeroen Weesie's 200 program -tabl- does that. I use it all the time.
. tab eth
Ethnic origin | Freq. Percent Cum.
----------------------------------+-----------------------------------
White, not of hispanic origin | 130,508 90.93 90.93
Black, not of hispanic origin | 5,854 4.08 95.01
Asian or Pacific Islander | 1,418 0.99 96.00
American Indian or Alaskan Native | 1,380 0.96 96.96
Hispanic | 3,751 2.61 99.57
Other | 614 0.43 100.00
----------------------------------+-----------------------------------
Total | 143,525 100.00
. tabl eth
ethorig (Ethnic origin) code | Freq Percent
--------------------------------------------+--------------------
White, not of hispanic origin 1 | 130508 90.93
Black, not of hispanic origin 2 | 5854 4.08
Asian or Pacific Islander 3 | 1418 0.99
American Indian or Alaskan Native 4 | 1380 0.96
Hispanic 5 | 3751 2.61
Other 7 | 614 0.43
--------------------------------------------+--------------------
<missing value> . | 1319
--------------------------------------------+--------------------
Total | 144844 100.00
.
At 08:44 AM 9/8/2006, you wrote
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/
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel +1 316 263 2125
[email protected]
*
* 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/