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 (March 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 2 Mar 2005 14:44:15 -0500
Reply-To:     Richard Ristow <>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <>
Subject:      Re: Restructuring data
Comments: To: Russell Deighton <>
In-Reply-To:  <>
Content-Type: text/plain; charset="us-ascii"; format=flowed

Dear Russell,

At 12:05 PM 3/2/2005, you wrote:

>(can I email you directly, or should I send follow-ups to the listserv >address?)

Off-list E-mail, like this, is fine. I'm copying my reply to the list, so anyone else interested can see the progress on the problem. And so any solution is shared, and saved. (One purpose of the list is to help readers with problems they haven't hit yet.)

>(By the way, nothing happens until I say execute (then I get the error >message), but you said I shouldn't use execute).

It's better not to use EXECUTE; it forces an extra pass of the data, and that would normally take place anyway when you run a procedure or SAVE. When you're debugging transformation code, though, you sometimes need one to force the data pass and see what's working. That's the function it's serving, in your case. If you see "Transformations pending" in the lower-left margin of the data-editor window, a data pass is pending. If you're testing the transformation, or need to see the result in the data editor, then either use EXECUTE or select menu Transformations/Run Pending Transformations. (That's the same thing.)

>I've come a lot further now, but I'm still not quite there. In fact I >have 57 quadruplets instead of triplets and the first of them starts >at v3, going on up to v230, but the principle is the same. However, >with my current solution, I still get the same error message, although >with a little test example I got your syntax to work. (They're photos >which subjects responded to, and the color, response, and reaction >time are recorded, and the photos can be numbered from 1 to 64). >Anyway, here's the syntax: > >VECTOR v=v3 TO v230. >VECTOR order=order1 TO order64. >VECTOR color=color1 TO color64. >VECTOR respns=respns1 TO respns64. >VECTOR rt=rt1 TO rt64. >LOOP #cnt= 3 TO 227 BY 4. >. compute order(v(#cnt)) = (#cnt+1)/4. >. compute color(v(#cnt)) = v(#cnt +1). >. compute respns(v(#cnt)) = v(#cnt +2). >. compute rt(v(#cnt)) = v(#cnt +3). >END LOOP.

I think your problem is in the LOOP command. You have

LOOP #cnt= 3 TO 227 BY 4.

On the first pass, then, #cnt is 3. You want v(#cnt) to be v3, the 'order' variable in the first of your quadruplets. But it isn't. You have

VECTOR v=v3 TO v230.

So v3 is the first element of the vector, and that's v(1), not v(3). v(3) is variable v5.

Now, v5 is the 'response' variable in the first quadruplet. There's no reason for it to be an integer in the range 1-64. If it isn't, using it as an index, as in "order(v(#cnt))" will be invalid, and generate the error.

Try this revision:

LOOP #cnt= 1 TO 227 BY 4. . compute order(v(#cnt)) = (#cnt+3)/4. . compute color(v(#cnt)) = v(#cnt +1). . compute respns(v(#cnt)) = v(#cnt +2). . compute rt(v(#cnt)) = v(#cnt +3). END LOOP.

Notice that I've also changed . compute order(v(#cnt)) = (#cnt+1)/4. to . compute order(v(#cnt)) = (#cnt+3)/4. The form I suggested before would also work, but I admit it's more code: . compute order(v(#cnt)) = 1 + TRUNC(#cnt/4).

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