syntax help creating variables

syntax help creating variables

Post by Reinha » Thu, 03 Jul 2003 23:07:09



Hello!

Is there any possibility to create an uncertain amount of variables?
With the TO command it is easy to create a fix number of variables
(example: Compute x1 to x20.) I want something like Compute x1 to xn,
where n has to be calculated. Is there any possibility to do that?

The purpose is, that I want to create dummy variables for outliers of
a regression. Until now I do this with following code:

Compute outlier=0.

IF (zre_2>2) outlier = 1 .
CREATE var2=CSUM(outlier).
Compute var3=outlier*var2.

DO REPEAT dummy = dummy1 TO dummy20  /#i=1 TO 20.
DO IF (var3 eq  #i) .
COMPUTE dummy=1.
else.
compute dummy=0.
end if.
END REPEAT.

EXECUTE.

With this code I have to know, that there are 20 outliers. I want a
code that detects automatically all outliers and creates as many dummy
variables as necessary.

Thanks for every help.