I agree with Christian Sauer in that if you have CTABLES
this can probably be done the easiest with that command (I do not have that license though). But other possible ways are:
FREQUENCIES
forVar1 TO Var4
, specifying the sum for the columns. This table will come out in wide format, but you can edit it and transpose the columns and rows to get it in the format you want.- Use multiple response categories.
- Reshape the data using
VARSTOCASES
soVar1 TO Var4
are now in one column. Then useCROSSTABS
to get the table.
Examples of all three of these below. All three need to be edited post hoc to get the final table you want, but they are all pretty close.
data list free / Var1 to Var4 (4F1.0).
begin data
1 0 1 0
1 1 0 0
0 0 0 1
end data.
*Then Transpose the rows/columns and edit the table.
FREQ VAR Var1 TO Var4 /FORMAT = NOTABLE /STATISTICS = SUM.
*Use multiple respone categories.
MULT RESPONSE GROUPS=$Var (Var1 Var2 Var3 Var4 (1))
/FREQUENCIES=$Var .
*Reshape and then use crosstabs.
VARSTOCASES /MAKE Var From Var1 to Var4 /INDEX Lab (Var).
CROSSTABS TABLE Lab BY Var.