1

I am new to SPSS and I am trying to generate average values to empty cells (basically fill in missing info by the average answer the user has given) and I cannot get my example code to work (or understand the example well).

COMPUTE QOL_puutt = Nmiss(ass, bass, grass, gas).

This part I understand

Do repeat A  = ass1 ass2  ass3. If ((Missing (A)) & QOL_puutt <= 4) A
= RND(Mean (ass1, ass2, ass3)).  End repeat.

Here something goes wrong. I understood that ass1,ass2,ass3 would refer to cells (column ass row 3)??? Here are the error codes

Error # 4285 in column 15. Text: ass1 Incorrect variable name: either the name is more than 64 characters, or it is not defined by a previous command. Execution of this command stops.

Error # 4285 in column 15. Text: ass2 Incorrect variable name: either the name is more than 64 characters, or it is not defined by a previous command. Execution of this command stops.

Error # 4285 in column 15. Text: ass3 Incorrect variable name: either the name is more than 64 characters, or it is not defined by a previous command. Execution of this command stops

1 Answer 1

1

Its a little hard to tell what the code is due to the wrapping, but you can simplify it like this do repeatA = ass1 ass2 ass3. if missing(A) A = mean(ass, bass, grass, gas). end repeat.

If all the values are missing, mean will return sysmis automatically. If you want to require a certain number of nonmissing values, say, 2, you could write the statement as if missing(A) A = mean.2(ass, bass, grass, gas).

HTH, Jon Peck

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.