Temporary & IF Statements

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

Temporary & IF Statements

zstatman
Didn't this construct work at one time or another?

Temp.
Select If(ChapterMemberRecode = 2).
Compute loyalcx=5.
IF  ((q8br=1 or q8br=2) or (q10r=1 or q10r=2) or (q12r=1 or q12r=2))
loyalcx=4.
IF  ((q8br=1 or q8br=2 or q8br=3 or q8br=4) and ((q10r=3 or q10r=4) or
(q12r=3 or q12r=4 or q12r=5))) loyalcx=3.
IF  ((q8br=4 or q8br=5) and (q10r=4 or q10r=5) and (q12r=4 or q12r=5))
loyalcx=2.
IF  ((q8br=4 or q8br=5) and (q10r=5) and (q12r=5)) loyalcx=1.
EXECUTE .

I just ran it in V17 then reran to check in V15 (all patches, etc in both
versions) and for both it shows up in the viewer without error but doesn't
actually do anything, the new variable's data column is blank.

Opinions welcomed

Tks

WMB
Statistical Services

============
mailto: [hidden email]
http:\\home.earthlink.net\~info.statman
============

=====================
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============
Reply | Threaded
Open this post in threaded view
|

Re: Temporary & IF Statements

Melissa Ives
I believe you want this to be a DO IF.
TEMPORARY only works on the next data pass and would not work with this kind of compute.
Melissa

DO IF (ChapterMemberRecode = 2).
  Compute loyalcx=5.
  IF  ((q8br=1 or q8br=2) or (q10r=1 or q10r=2) or (q12r=1 or q12r=2)) loyalcx=4.
  IF  ((q8br=1 or q8br=2 or q8br=3 or q8br=4) and ((q10r=3 or q10r=4)
        or (q12r=3 or q12r=4 or q12r=5))) loyalcx=3.
  IF  ((q8br=4 or q8br=5) and (q10r=4 or q10r=5) and (q12r=4 or q12r=5)) loyalcx=2.
  IF  ((q8br=4 or q8br=5) and (q10r=5) and (q12r=5)) loyalcx=1.
END IF

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Statmanz
Sent: Thursday, April 09, 2009 6:52 AM
To: [hidden email]
Subject: [SPSSX-L] Temporary & IF Statements

Didn't this construct work at one time or another?

Temp.
Select If(ChapterMemberRecode = 2).
Compute loyalcx=5.
IF  ((q8br=1 or q8br=2) or (q10r=1 or q10r=2) or (q12r=1 or q12r=2)) loyalcx=4.
IF  ((q8br=1 or q8br=2 or q8br=3 or q8br=4) and ((q10r=3 or q10r=4) or
(q12r=3 or q12r=4 or q12r=5))) loyalcx=3.
IF  ((q8br=4 or q8br=5) and (q10r=4 or q10r=5) and (q12r=4 or q12r=5)) loyalcx=2.
IF  ((q8br=4 or q8br=5) and (q10r=5) and (q12r=5)) loyalcx=1.
EXECUTE .

I just ran it in V17 then reran to check in V15 (all patches, etc in both
versions) and for both it shows up in the viewer without error but doesn't actually do anything, the new variable's data column is blank.

Opinions welcomed

Tks

WMB
Statistical Services

============
mailto: [hidden email]
http:\\home.earthlink.net\~info.statman
============

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