carelessness score syntax for spss (need help)

I would appreciate if you help.
I want to write a syntax to calculate a "carelessness score" that would work for any questionnaire and I am not very good at statistics or spss syntaxes.
I could not find anything online about the topic or any syntax file that would do this task for me.
Idea in my mind is something like this: if a case responded to question sets of two (which are highly correlated) differently (non correlating way), this may show that he may have randomly or carelessly responded these questions. I decided to calculate a total score of carelessness for each case (in the data set) by adding correlation X difference of every two questions (correlation for that question couple calculated for the whole sample multiplied by the difference of that cases response to these two questions). alternatively a syntax which uses lets say 10 percent of the mostly correlated variables may also work well.
syntax would look like the following (for a sample questionnaire of total 30 items) (care.A is carelessness score of a single pair of questions; care.T is the total score of carelessness):
care.T = 0
from x = 0 to 28
x = x+1
from y = 1 to 29
y = y + 1
care.A = (ABS ( variable(x) - variable(y) ) X ( correlation variable(x) variable(y) )
care.T = care.T + care.A
write (add to sav file) care.T

Thanks for your time.
Dr. Mehmet Akif Ersoy
Ege University Faculty of Medicine
Department of Psychiatry
Izmir Turkey