|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: label after recode
On Mar 20, 2008, at 4:17 AM, Christopher Intemann wrote:
in order to fit the distribution of wildtypes/genotypes in my
population, I want to change the order of the values coded in
z1_gene_x. I'm using the recode command:
<snip>
. recode z1_gene_x 1=2 2=1
(z1_gene_x: 4692 changes made)
<snip>
It seems like recode actually does what it is supposed to.
However, it does not change the label, what is somehow confusing.
According to the manual, recode supports the label option, but not
for just keeping the label...
-recode- won't automatically remap the original value labels based on
your transformation. What it will permit you to do is to define a
new value label simultaneously. Thus, for example, you could do
recode z1_gene_x (1=2 G) (2=1 T), gen(foo)
which would generate a new variable called foo containing the recoded
variable, together with a value label called foo which maps 1 to "T"
and 2 to "G". The -label- option merely lets you alter the name of
the value label that is created.
Note that this approach requires that you create a new variable
(i.e., with the -generate- option). The advantage is that you are
able to recode the variable and create the new value label all in a
single command, and that by bundling the two operations together
syntatically, you are less likely to make an error (i.e., to map a
value to the wrong label).
-- Phil
*
* 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/