spss

SPSS Custom Tables Nesting


I'm trying to nest nominal variables, but I keep getting the error that a scale variable may not be crossed or nested with another scale variable.

Here's the code I'm trying to use:

CTABLES
  /VLABELS VARIABLES=Status PD DISPLAY=DEFAULT
  /TABLE Status [C][COLPCT.VALIDN 'Percent' PCT40.0, COUNT 'Frequencies' F40.0] BY PD [C][COLPCT.VALIDN 'Percent' PCT40.0, COUNT 'Frequencies' F40.0]
  /CLABELS COLLABELS=OPPOSITE
  /CATEGORIES VARIABLES=Status [1, 2, 3, 4, SUBTOTAL='Percent n', OTHERNM, MISSING] EMPTY=INCLUDE
     TOTAL=YES LABEL='Total responses n' POSITION=AFTER
  /CATEGORIES VARIABLES=PD [1, 0 SUBTOTAL='Percent n', OTHERNM, MISSING] EMPTY=INCLUDE
    TOTAL=YES LABEL='Total responses n' POSITION=AFTER
  /CRITERIA CILEVEL=95

I tried going through the custom tables creation wizard and roughly came up with this code, which works.

CTABLES
  /VLABELS VARIABLES=Status PD DISPLAY=DEFAULT
  /TABLE Status [C][COLPCT.COUNT PCT40.0, COUNT F40.0] BY PD
  /CATEGORIES VARIABLES=Status ORDER=A KEY=VALUE EMPTY=INCLUDE MISSING=EXCLUDE
  /CATEGORIES VARIABLES=PD ORDER=A KEY=VALUE EMPTY=EXCLUDE
  /CRITERIA CILEVEL=95

I can't figure out which difference between what I have and the code it generated that's causing the issue.


Solution

  • I got it to work like this:

    CTABLES
    /VLABELS VARIABLES=Status PD DISPLAY=DEFAULT
    /TABLE Status [C][COLPCT.VALIDN 'Percent' PCT40.0] BY PD
    /CATEGORIES VARIABLES=Status [1, 2, 3, 4, SUBTOTAL='Percent n', OTHERNM, MISSING] EMPTY=INCLUDE
      TOTAL=YES LABEL='Total responses n' POSITION=AFTER
    /CATEGORIES VARIABLES=PD [1, 0] EMPTY=INCLUDE
     TOTAL=NO POSITION=AFTER
    /CRITERIA CILEVEL=95
    

    I think taking out the "CLABELS COLLABELS=OPPOSITE" line did it