|
From the syntax manual
"If DO REPEAT is used to create new variables, the order in which they are
created depends on how the transformation commands are specified. Variables
created by specifying the TO keyword are not necessarily consecutive in the
working data file."
There is an example under PRINT that shows the situation you have
encountered. It says, "if you plan to use the TO keyword to refer to [x1 to
x5] later, you should use two separate DO REPEAT utilities; otherwise, [x1
to x5] will include for of the five [y] variables.
-----Original Message-----
From: David C. Howell [mailto:David.Howell@UVM.EDU]
Sent: Monday, November 19, 2001 9:46 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: [SPSSX-L] Very Strange Behavior
I have a very strange problem that I cannot seem to sort out. The syntax and
output below have been stripped down to the bare essentials. I simplified my
code to a minimum to focus on where the error lies. This is part of a much
larger task, and looks silly on its own, but this is the part that fails me.
If I execute the following 5 lines of code I get exactly what I want. x1 =
equala, y1 = satisfa, x2 = equala, y2 = satisfa, etc.
******************************************************
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.
From the print command's output shown below, you can see what is happening,
but WHY is it happening? When I run the syntax a second time, with the
first set of output variables sill in the file, x1 is set to equala, y1 is
set to satisfa, but then y1 is reset to equala.
Any ideas would be very welcome.
*************************************************************
From the first time it is run.
2029 +COMPUTE X1 = EQUALA
2030 +COMPUTE Y1 = SATISFA
2031 +COMPUTE X2 = EQUALA
2032 +COMPUTE Y2 = SATISFA
2033 +COMPUTE X3 = EQUALA
2034 +COMPUTE Y3 = SATISFA
2035 +COMPUTE X4 = EQUALA
2036 +COMPUTE Y4 = SATISFA
2037 +COMPUTE X5 = EQUALA
2038 +COMPUTE Y5 = SATISFA
Here we run it a second time
2047 +COMPUTE X1 = EQUALA
2048 +COMPUTE Y1 = SATISFA
2049 +COMPUTE Y1 = EQUALA ???????????
2050 +COMPUTE X2 = SATISFA
2051 +COMPUTE X2 = EQUALA ???????????
2052 +COMPUTE Y2 = SATISFA
2053 +COMPUTE Y2 = EQUALA ???????????
2054 +COMPUTE X3 = SATISFA
2055 +COMPUTE X3 = EQUALA
2056 +COMPUTE Y3 = SATISFA
2057 +COMPUTE Y3 = EQUALA
2058 +COMPUTE X4 = SATISFA
2059 +COMPUTE X4 = EQUALA
2060 +COMPUTE Y4 = SATISFA
2061 +COMPUTE Y4 = EQUALA
2062 +COMPUTE X5 = SATISFA
2063 +COMPUTE X5 = EQUALA
2064 +COMPUTE Y5 = SATISFA
*******************************************
**************************************************************************
David C. Howell Phone: (802) 656-2670
Dept of Psychology Fax: (802) 656-8783
University of Vermont email: David.Howell@uvm.edu
Burlington, VT 05405
http://www.uvm.edu/~dhowell/StatPages/StatHomePage.html
<http://www.uvm.edu/~dhowell/StatPages/StatHomePage.html>
http://www.uvm.edu/~dhowell/gradstat/index.html
<http://www.uvm.edu/~dhowell/gradstat/index.html>
[text/html]
|