syntax to recode

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

syntax to recode

Johnny Amora
The scale variable X which ranged from 0 to 5 will be recoded into Y with five categories as follows: A = lowest thru below 1.5; B = 1.5 thru below 2.5; C=2.5 thru below 3.5; D=3.5 thru below 4.5; and E= 4.5 to highest.

  The syntax I wrote is:

  STRING Y (a15).
  RECODE X (lowest thru below 1.5 ="A") (1.5 thru below 2.5="B") (2.5 thru below 3.5="C") (3.5 thru below 4.5="D") (4.5 thru highest="E") INTO Y.
  Execute.

  This syntax does not work because of the word "below".  What to use in place of "below" ?  Your comments/suggestions to improve the syntax are appreciated.

  Thank you.


Johnny T. Amora
Center for Learning and Performance Assessment
De La Salle-College of Saint Benilde
Manila, Philippines

---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: syntax to recode

Peck, Jon
There is no "below" keyword in RECODE.  Each input value or interval is checked in order, and the first one that includes the value is used.  Intervals are always closed ended.

So to achieve what you want here, you just need to list the intervals in the reverse order.
4.5 thru highest
then
3.5 thru 4.5
etc.

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Johnny Amora
Sent: Saturday, May 03, 2008 7:48 AM
To: [hidden email]
Subject: [SPSSX-L] syntax to recode

The scale variable X which ranged from 0 to 5 will be recoded into Y with five categories as follows: A = lowest thru below 1.5; B = 1.5 thru below 2.5; C=2.5 thru below 3.5; D=3.5 thru below 4.5; and E= 4.5 to highest.

  The syntax I wrote is:

  STRING Y (a15).
  RECODE X (lowest thru below 1.5 ="A") (1.5 thru below 2.5="B") (2.5 thru below 3.5="C") (3.5 thru below 4.5="D") (4.5 thru highest="E") INTO Y.
  Execute.

  This syntax does not work because of the word "below".  What to use in place of "below" ?  Your comments/suggestions to improve the syntax are appreciated.

  Thank you.


Johnny T. Amora
Center for Learning and Performance Assessment
De La Salle-College of Saint Benilde
Manila, Philippines

---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD