The following code was suggested in a posting earlier this month:
>set seed =300.
>compute random =uniform(333).
>sort cases by n.hosp random.
I just looked at it and said, that CAN'T work: since the seed is set back
to 300 for each case, all the random values will be the same.
But it does work. Below is SPSS draft output, with SET SEED *within* the
transformation program, just to make sure, and the random value is
different for each case.
What's up? I thought that SET was an executable statement -- that it could
be governed by DO IF, that you could reset the same value several times in
a transformation program. Is SET SEED somehow special? If so, what are the
rules for how it works?
NUMERIC REC_NUM (F4).
LOOP REC_NUM = 1 TO 10.
. END CASE.
END INPUT PROGRAM.
NUMERIC RAND_VAL (F6.2).
COMPUTE RAND_VAL = UNIFORM(1000).
Number of cases read: 10 Number of cases listed: 10