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   Erik Aadland <[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:02:32 +0000

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: [email protected]
> 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: [email protected]
>
> 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 <[email protected]> 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.
> > Regards,
> > Erik.
> > *
> > * 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