LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2004)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 16 Aug 2004 13:54:04 -0400
Reply-To:   Richard Ristow <wrristow@mindspring.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Richard Ristow <wrristow@mindspring.com>
Subject:   Random: A strange bug that isn't
Content-Type:   text/plain; charset="us-ascii"; format=flowed

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?

NEW FILE. INPUT PROGRAM. NUMERIC REC_NUM (F4). LOOP REC_NUM = 1 TO 10. . END CASE. END LOOP. END FILE. END INPUT PROGRAM. SET SEED=100.

NUMERIC RAND_VAL (F6.2). COMPUTE RAND_VAL = UNIFORM(1000). SET SEED=100. LIST.

List REC_NUM RAND_VAL

1 496.26 2 8.87 3 982.43 4 939.86 5 160.26 6 927.73 7 297.92 8 169.17 9 979.40 10 656.66

Number of cases read: 10 Number of cases listed: 10


Back to: Top of message | Previous page | Main SPSSX-L page