Efficient Syntax

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

Efficient Syntax

Sam Ballard
Dear List,

I want to create a new variable based on a series of variables, 1 through
7. I tried using the keyword TO in a IF statement, but this won't work
(see below). Does anyone know an efficient way to do this (without
repeating the code seven times)?

String Assess (A2).
If (TESTTYPE.1 to TESTTYPE.7~=" ") Assess=0.
EXECUTE .


Thanks,
Sam

=====================
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: Efficient Syntax

Marks, Jim
Does this do what you want?

DATA LIST free /id (f8.0) testtype.1 to testtype.7 (7a5).
BEGIN DATA
1 'a' 'b' 'c' 'd' 'e' 'f' 'g'
2 ' ' 'b' 'c' 'd' 'e' 'f' 'g'
END DATA.

String Assess (A2).
If ANY(' ',TESTTYPE.1 to TESTTYPE.7) Assess='0'.
EXECUTE .


Jim Marks
Director, Market Research
x1616

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Sam Ballard
Sent: Tuesday, February 24, 2009 2:04 PM
To: [hidden email]
Subject: Efficient Syntax

Dear List,

I want to create a new variable based on a series of variables, 1
through
7. I tried using the keyword TO in a IF statement, but this won't work
(see below). Does anyone know an efficient way to do this (without
repeating the code seven times)?

String Assess (A2).
If (TESTTYPE.1 to TESTTYPE.7~=" ") Assess=0.
EXECUTE .


Thanks,
Sam

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