Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: your mail


From   Edwin Leuven <[email protected]>
To   [email protected]
Subject   st: Re: your mail
Date   Wed, 11 Feb 2004 14:18:51 +0100 (CET)

On Wed, 11 Feb 2004, Simon Moore wrote:
> I have data in a variable coded something along the lines of 1(very
> happy), 2(happy), 3(not so happy) and 4(miserable).  All I want to do
> is switch this around so that 1 becomes 4, 2 becomes 3 and so on.  I
> realise that I could use recode but was wondering if there is a
> remarkably simple solution that I cannot find.

i guess the most simple way is to let someone else do it for you

if this is not an option you could also do *in your particular case*

replace var = 5 - var

yet, this isn't a big gain compared to

recode var (1=4) (2=3) (3=2) (4=1)

where the recode has the advantage of being more transparent

so my advice: stick to recode
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index