Is there any way in spss to assign one value to multiple variables at
once in a single statements?
Something along these lines (pseudocode):
if(x<10) num1=num2=num3=num4=1.
Goal is that all variables num* have the value 1 when x is smaller
than 10.
Kind regards,
Filip Van Droogenbroeck
do if x lt 10.
do repeat num= num1 to num4.
compute num=1.
end repeat.
*this is where you might put what to put in num otherwise.
end if.
Art Kendall
Social Research Consultants.
>Hi everybody,
>
>Is there any way in spss to assign one value to multiple variables at
>once in a single statements?
The one provision that I know of for multiple assignments
is useful for initializing variables. I've used it especially often
after creating a new VECTOR ...
RECODE var1, var10 to var11(ELSE= 0).
>
>Something along these lines (pseudocode):
>
>if(x<10) num1=num2=num3=num4=1.
>
>Goal is that all variables num* have the value 1 when x is smaller
>than 10.
... but, so far as I know, the RECODE is always unconditional -- It
cannot depend on an IF or DO IF.
--
Rich Ulrich
do if (v50x10=1).
recode v50x01 v50x02 v50x03 v50x04 v50x05 v50x06 v50x07 v50x08 v50x09
(1=8) (else = copy).
end if.
this works, apparently the recode command can be conditioned in
spss19.
kind regards,
Filip Van Droogenbroeck
Recode can be governed by conditionals such as DO IF as far back as at
least V15 and probably much earlier.
Regards,
Jon Peck