CTABLES sort categories from multiple nested variables

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CTABLES sort categories from multiple nested variables

Jignesh Sutar
This post was updated on .
I’m trying to produce a CTABLE which has numerous variables nested within each other cross tabbed by (sum of a) scale variables but want the categories of all the nested variables to be ordered from outer level to inner level.

So for example if I have (V1>V2>V3)[c], at first, I want categories of V1 to be ordered descending and then categories of V2 ordered within categories of V1 and categories of V3 ordered within each cell of V1>V2.

Do demonstrate this, see below code.

What seems to be the convention is that CTABLES orders V1,V2,V3 individually at a total level, independent of within the nested categories. There seem to be some comments on this in the CSR which I think is eluding to that this is being default behaviour but I wonder if there are ways to overcome this?

It seems sensible to produce table outputs to this format so there ought to be an option to allow for this type of behaviour.




get file="C:\Program Files\IBM\SPSS\Statistics\22\Samples\English\Employee data.sav".


ctables
 /table (jobcat)[c] by salbegin[s][sum comma8.0]
 /categories variables=jobcat total=yes position=before key=sum(salbegin) order=d
 /titles title = "Table1: un-ordered".

ctables /vlabels variables=gender minority jobcat display=none
 /table (gender>minority>jobcat)[c] by salbegin[s][sum comma8.0]
 /categories variables=jobcat total=yes position=before
 /categories variables=all empty=exclude
 /titles title = "Table2: un-ordered".

ctables /vlabels variables=gender minority jobcat display=none
 /table (gender>minority>jobcat)[c] by salbegin[s][sum comma8.0]
 /categories variables=gender total=no position=before key=sum(salbegin) order=d
 /categories variables=jobcat total=yes position=before key=sum(salbegin) order=d
 /categories variables=all empty=exclude
 /titles title = "Table3: Ordered".

spssinc modify tables subtype="custom table" select="Total" dimension= rows level = -1 process = all /styles textstyle=bold.
spssinc modify tables subtype="custom table" select="Total" dimension= rows level = -2 process = all /styles textstyle=bold.