FW: [SPSSX-L] Efficient Syntax

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FW: [SPSSX-L] Efficient Syntax

Melissa Ives
Not tested, but this format creates a 0/1 dichotomy if the condition is true.
Compute award=(any("GP",awartyp1 to awartyp8)).

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Sam Ballard
Sent: Wednesday, November 19, 2008 10:52 AM
To: [hidden email]
Subject: [SPSSX-L] Efficient Syntax

Dear List,

I'm trying to create a new variable based on eight STRING variables. My syntax is below that works. Is there a more efficient way to write the syntax to create the variable? Something that doesn't repeat the IF statement over and over again?

COMPUTE AWARD = 0.
IF (AWARTYP1 = 'GP') AWARD =1.
IF (AWARTYP2 = 'GP') AWARD =1.
IF (AWARTYP3 = 'GP') AWARD =1.
IF (AWARTYP4 = 'GP') AWARD =1.
IF (AWARTYP5 = 'GP') AWARD =1.
IF (AWARTYP6 = 'GP') AWARD =1.
IF (AWARTYP7 = 'GP') AWARD =1.
IF (AWARTYP8 = 'GP') AWARD =1.
Execute.


Thanks in Advance,
Sam
SDCCD

=====================
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

PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.

=====================
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