Re: st: RE: help with encode

If that really is the situation you're in -- all encoded values are
2's and 3's -- then why not simply linearly transform the encoded
variables to the values that you want? That is, type:

replace gender = gender - 2
(Subtract 1 if you had 1's and 2's as mentioned in your original post.)

However, I suspect something else is going on. My expectation is that
you have more than just two string values ("m" and "f") in your
series. Can you provide to the list the output of -table female-? I
suspect that if you try Nick's -tab ...- command shown below, you
would also find unexpected values.

However, these are all conjectures. You would likely resolve your
situation much more quickly (and waste fewer people's time on the list
in the process) if you followed the guidance clearly laid out in the
Statalist FAQ:

3.3 Stata references in your question

Say exactly what you typed and exactly what Stata typed (or did) in
response. N.B. exactly!

Why not at least show us what actually happened? In this case, copy
and paste from the results window the *exact* -encode- command and
resulting Stata output. Then copy and past whatever command led you
to conclude that you were getting 2's and 3's, and the *exact* and
*complete* output from that command. (In consideration to Statalist
readers, please don't provide us with a lengthy -list- output. Use -
table- instead, as suggested above.)

Hope this helps,
Mike
On Jul 24, 2009, at 4:09 AM, Miranda Kim wrote:

I tried this but couldn't make it work, as it then automatically
encodes the variables with 2's and 3's...

Nick Cox wrote:

In addition to other answers the direct answer to the second
question is