Is there an easy way to look up a value label?
To illustrate, imagine I have a variable 'value' containing integer
values 1 2 or 8 for numerous cases.
I define value labels
. lab def valuecats 1"one" 2"two" 8"a few"
. lab val values valuecats
then tabulate it and save result in matricees
. tab values, matcell(F) matrow(V)
Now I want to extract the information to form my own table.
I can access the value V[3,1] which (in this case) will be 9. However
this number is now isolated from the original variable and label
mapping. Is there any simple(ish) lookup function I can use to map from
a value to a value label? Presumably there must be as Stata is able to
do this but is it accessible to us mortals?
P.S. I am aware I could use the 'uselabel' command to obtain a dataset
with these mappings but I want to be able to do this without destroying
the original data.
Thanks.
Richard J. Atkins
Department of Epidemiology and Population Health
London School of Hygiene and Tropical Medicine
Keppel Street, London WC1E 7HT
E-mail: [email protected]
Homepage: http://www.lshtm.ac.uk/ncdeu/staff/ratkins.html
Tel: 020 7927 2968
*
* 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/