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 (November 2001)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 19 Nov 2001 17:23:45 +0100
Reply-To:   Markus Quandt <Markus.Quandt@UNI-KOELN.DE>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Markus Quandt <Markus.Quandt@UNI-KOELN.DE>
Organization:   Universitaet zu Koeln
Subject:   Re: Very Strange Behavior
Comments:   To: "David C. Howell" <David.Howell@UVM.EDU>
Content-Type:   text/plain; charset=us-ascii

Hi, without having thought too deeply about it: I remember a similar situation where my conclusion was that the REPEAT command treats the variables IN THEIR SEQUENCE IN THE DATASET and NOT in alphabetical order (as one too easily expects when used to other programming languages where you have real arrays and such). So, if you run your loop the first time, SPSS *creates* the variables in this order: X1 Y1 X2 Y2 and so on, because the variables are created by the two COMPUTE statements nested in the loop, NOT by the REPEAT statement itself. If you run the same syntax the second time, all your X# and Y# variables do already exist. BUT X1 TO X5 is not read as: "X1 X2 X3 X4 X5", instead SPSS uses "X1 Y1 X2 Y2 X3 Y3 X4 Y4 X5".

So how to overcome this? Create your variables beforehand; don't let REPEAT do it. E.g., use

NUMERIC X1 TO X5. NUMERIC Y1 TO Y5.

I hope this works, as I didn't check it in detail - but you should get the idea...

Regards, MQ

"David C. Howell" wrote: > > I have a very strange problem that I cannot seem to sort out.

... > > ****************************************************** > do repeat x = x1 to x5/ y = y1 to y5. > compute x = equala. > compute y = satisfa. > end repeat print. > execute. > ****************************************************** > > But NOW, if I don't change a single thing, and don't delete the > new variables from the data file, but execute that same piece > of code again, things go very wrong. Now I get x1 = equala, y1 > = equala , x2 = equala, y2 = equala, .. Everything is equal to > equala except for y5 (the last one) which is equal to satisfa. > (This same pattern holds if I generate more variables--only the > last is different.) > > If I delete the newly created variables from my data set and > start over, it works the first time but fails after that.

-- ________________________________________________________________ Markus Quandt Zentralarchiv fuer Empirische Sozialforschung (ZA) Institut fuer Angewandte Sozialforschung (IfAS) Postanschrift: Institut fuer Angewandte Sozialforschung Universitaet zu Koeln Greinstr. 2 50939 Koeln Tel. +49-221/470-4232 ### Fax. +49-221/470-5169


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