Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: merging variables with labels
From
"Ben Hoen" <[email protected]>
To
<[email protected]>
Subject
st: merging variables with labels
Date
Wed, 12 Jan 2011 20:24:28 -0500
I have two variables (e.g. x and y) with value labels (e.g. xlab and ylab).
Both x and y were created via .encode (they were derived from string
variables) so they overlap in their underlying values but the value labels
are unique between x and y and within x and y.
I would like to create a new variable z which would take on the value labels
of x (xlab) for some cases and y (ylab) for other cases based on an
expression. I do not care what the underlying values are, only that the
value labels are correctly assigned?
Suggestions?
Somewhat relatedly, is there a quick way on the command line to display the
underlying value of a variable if one only has the label? I imagine
something like: .display y if ylab="something"
Ben
Ben Hoen
Principal Research Associate
Lawrence Berkeley National Laboratory
Office: 845-758-1896
Cell: 718-812-7589
[email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/