Tuesday, 7 December 2010

Nesting in CTABLE and sorted results

example 1:
CTABLES /TABLE SEX > HAPMAR [COLPCT] BY CHILDCAT.

example 2:
CTABLES /TABLE SEX > HAPMAR BY CHILDCAT.
OR
CTABLES /TABLE (HAPPY + HAPMAR) > SEX.

choose one of the above depending on how you want the variable SEX
to be displayed the first example brings it out as the outer most variable,
while the 2nd one puts it as the inner most.


The following will give sorted result (Descending) based on
the variable CAR1 by age group
of respondent:

CTABLES
/TABLE CAR1 BY AGECAT
/CATEGORIES VARIABLES=AGECAT TOTAL=YES
/CATEGORIES VARIABLES=CAR1 ORDER=D KEY=COUNT.


(Source SPSS help file)

*In addition to the above, I want to add column percents
and Ns to the tables!!