Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Fri, 28 Sep 2012 17:12:50 +0100 |

Everyone's happy now. Please note that my assertion that "[t]his replacement lies outside -recode-'s rules" was quite wrong. Nick On Fri, Sep 28, 2012 at 5:02 PM, Erik Aadland <erikaadland@hotmail.com> wrote: > Nick, Daniel, Martyn. > I figured out that I did wrong. > In my code, I had a space between the minus sign and the value in one of my brackets. > e.g. recode year (1990 = -156) (1991= - 144) > When I had this space, I got the following error message: > unknown el - in rule > r(198); > > Without the space between the minus sign and the value, recode appears to work. > Sorry about this inconvenience. > Regards, > Erik. > > ---------------------------------------- >> From: statams48@gmail.com >> Date: Fri, 28 Sep 2012 16:42:58 +0100 >> Subject: Re: st: how recode a positive value on a variable to a particular negative value >> To: statalist@hsphsun2.harvard.edu >> >> Erik, >> It works for me: >> . list >> >> +------+ >> | year | >> |------| >> 1. | 1990 | >> 2. | 1991 | >> 3. | 1990 | >> 4. | 1992 | >> 5. | 1993 | >> +------+ >> >> . recode year (1990 = -156) (1991= -144) (1992 = -100) >> (year: 4 changes made) >> >> . list >> >> +------+ >> | year | >> |------| >> 1. | -156 | >> 2. | -144 | >> 3. | -156 | >> 4. | -100 | >> 5. | 1993 | >> +------+ >> What error message do you get? >> >> Martyn >> >> On 28 September 2012 16:26, Erik Aadland <erikaadland@hotmail.com> wrote: >> > Dear Statalist. >> > 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/

**References**:**st: how recode a positive value on a variable to a particular negative value***From:*Erik Aadland <erikaadland@hotmail.com>

**Re: st: how recode a positive value on a variable to a particular negative value***From:*Martyn Sherriff <statams48@gmail.com>

**RE: st: how recode a positive value on a variable to a particular negative value***From:*Erik Aadland <erikaadland@hotmail.com>

- Prev by Date:
**RE: st: how recode a positive value on a variable to a particular negative value** - Next by Date:
**st: question regd wmpstata** - Previous by thread:
**RE: st: how recode a positive value on a variable to a particular negative value** - Next by thread:
**Re: st: how recode a positive value on a variable to a particular negative value** - Index(es):