Bookmark and Share

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]

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


From   Erik Aadland <erikaadland@hotmail.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 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: 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.
> > 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index