Statalist The Stata Listserver


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

Re: st: RE: tabulate - displaying value labels and numeric codes


From   "Daniel Stegmueller" <d.stegmueller@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: tabulate - displaying value labels and numeric codes
Date   Thu, 15 Mar 2007 14:43:32 +0100

Svend, Maarten and Ben:
nice, as always!

I do, however, prefer a solution where I don't need to alter the data,
so I will give -tabl- a try...

Daniel




2007/3/15, Svend Juul <SJ@soci.au.dk>:
Daniel Stegmueller wrote:
> I invoke the following sequence of commands quite regularly: - tab x-
> followed by -tab x, nolabel-  in orer to see value labels and their
> numeric counterparts.
>
> Is there a quick way(i.e. has anybody written an ado...) to display
> both simultaneously (without using -codebook- of course...)

Then Maarten wrote:
The easiest way is to add the numeric values to the value labels, which
can be easily done with the -numlabel- command. In the example below I
do that for all variables: -label dir- stores all names of value labels
in r(names) and -numlabel- adds the numeric values to the labels.

*--------- begin example -------
sysuse nlsw88, replace
tab race
label dir
numlabel `r(names)', add
tab race
*--------- end example ---------
-----------------------------------------------------------------

It can be made simpler. The single command:
   numlabel , add
adds numbers to all value labels.

Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: sj@soci.au.dk
__________________________________________

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

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