2
votes

I am new to SPSS, the world of statistics and new to this forum. I am doing research in conjunction with my Masters Degree and running into a bit of a problem and looking for some help. Yes, I could hire a consultant, but view this part of the learning process, and would like to see if I cannot master this - with your help of course.....

I am looking to add: q1 and q51 q2 and q52 q3 and q53 etc.... through to q50 and q100

The new variable names currently are TOTAL1 to TOTAL50, but could be anything. Q1 to q100 exist and are consecutive TOTAL1 to TOTAL 50 exists and are consecutive

I have tried:

do repeat x = q1 to q50 
         /y = q51 to q100 
         /z = TOTAL1 to TOTAL50. 
COMPUTE z = x + y.
end repeat . 
EXECUTE.

But getting the following in the output:

Error # 4502 in column 11. Text: = An equals sign appears in a variable or value list where it is not expected. It will be ignored. Execution of this command stops.

Error # 4508 in column 15. Text: + Unrecognized text appears on the DO REPEAT command. It will be ignored. EXECUTE. do repeat x = q1 to q50 / y = q51 to q100 / z = TOTAL1 to TOTAL50 COMPUTE z = x + y end repeat .

Error # 4502 in column 11. Text: = An equals sign appears in a variable or value list where it is not expected. It will be ignored. Execution of this command stops.

Error # 4508 in column 15. Text: + Unrecognized text appears on the DO REPEAT command. It will be ignored. EXECUTE.

Is this the best way of doing this? Can anyone spot a syntax error?

I am using SPSS v. 20.

1
You don't seem to have a full stop, acting as a terminator after the DO REPEAT and before COMPUTE, which is required. Could that be it? But otherwise your logic in the use of DO REPEAt is correct. - Jignesh Sutar
Cross posted on the NABBLE list serve as well. You might as well give that as an answer @JigneshSutar. - Andy W
Thanks everyone for your responses. Being a newbie, I confused the Output file and the Journal, and it was not until yesterday a light bulb went off, and I realized I could get out the Journal and get the command from there that succeeded. The DO REPEAT was from syntax, but it seems that when I clicked run, I used the green triangle from the menu bar (Run Selected) rather than run all. Seems that DO REPEAT had problems creating the new variables, but once they were created could COMPUTE. Seth - Seth Chancy

1 Answers

0
votes

Try this

do repeat x = q1 to q50 
         /y = q51 to q100 
         /z = TOTAL1 to TOTAL50. 
- COMPUTE z = x + y.  /*i just added a minus sign before the compute./
end repeat . 
EXECUTE.