Bookmark and Share

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]

Re: st: how recode a positive value on a variable to a particular negative value


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: how recode a positive value on a variable to a particular negative value
Date   Fri, 28 Sep 2012 16:44:15 +0100

Good. but Daniel's question remains; I did not try to reproduce your
non-result.

No one need care, but I dislike -recode-. I have to rediscover the
rules each time. I find it faster to use -replace-. But I am happy if
anyone else regards it with affection as a trusty workhorse they call
upon repeatedly.

Nick

On Fri, Sep 28, 2012 at 4:39 PM, Erik Aadland <[email protected]> wrote:
> Thank you so much, Nick.
> The variable will not be used to measure years.
> Kind regards,
> Erik.
>
> ----------------------------------------
>> Date: Fri, 28 Sep 2012 16:36:16 +0100
>> Subject: Re: st: how recode a positive value on a variable to a particular negative value
>> From: [email protected]
>> To: [email protected]
>>
>> I believe you. The intent of -recode- is quite explicit: to recode
>> categorical variables. This replacement lies outside -recode-'s rules.
>>
>> That aside, you just need (it seems)
>>
>> replace year = -156 if year == 1990
>> replace year = -144 if year == 1991
>>
>> How far this -year- variable is still telling you about years is your
>> own call (unless the example is just invented).
>>
>> Nick
>>
>> On Fri, Sep 28, 2012 at 4:26 PM, Erik Aadland <[email protected]> wrote:
>>
>> > I am trying to recode positive values on a specific variable into particular negative values.
>> > e.g:
>> > recode year (1990 = -156) (1991= -144)
>> > and so on.
>> > However, recode does not allow a negative value it seems.
>> > Any input on this problem would be very appreciated.
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>> * http://www.ats.ucla.edu/stat/stata/
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index