SPSS has VECTOR but it requires variables to be contiguous.
DO REPEAT is also useful but Rich's COUNT suggestion is probably the easiest
solution for your specific request).
It the future when posting SAS to SPSS requests please illustrate with sample input data and output so to minimize possible confusion. I know minimal SAS, but what else could such a sequence be doing ;-)
In many/most other cases it is unlikely to be so transparent.
DO REPEAT v=m1 m2 m3 m6 m9 m10 m14.
COMPUTE countselfm=SUM( ANY(v,1,2),countselfm).
COMPUTE countotherm=SUM( ANY(v,3,4),countotherm).
END REPEAT.
If M1..M14 are contiguous you could use VECTOR/LOOP mix.
VECTOR v=M1 TO M14.
LOOP #=1 TO 7.
COMPUTE countselfm=SUM( ANY(v(#),1,2),countselfm).
COMPUTE countotherm=SUM( ANY(v(#),3,4),countotherm).
END LOOP.
nato123 wrote
I am trying to use an array in SPSS but am unsure how to translate the SAS code to SPSS. Can SPSS do arrays?
What I am trying to do is (how it looks is SAS):
arraymktmemos{7} m1, m2, m3, m6, m9, m10, m14; do i=1 to 7;
if mktmemos {i} in (1,2) then countselfm=countselfm+1;
if mktmemos{i} in (3,4) then countotherm=countotherm+1;
etc. etc.
....
end;
Thanks!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"