27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CTABLES 395<br />

• The SUBTOTAL keyword is used within a category list to request subtotals for a variable.<br />

The position of a subtotal within the list determines where it will appear in the table and the<br />

categories to which it applies. By default, a subtotal applies to all values that precede it up<br />

to the next subtotal. If POSITION=BEFORE is specified (see Totals on p. 397), subtotals apply<br />

to the categories that follow them in the list. Hierarchical and overlapping subtotals are<br />

not supported. You can specify a label for a subtotal by placing it in quotes immediately following<br />

the SUBTOTAL keyword and an equals sign, as illustrated in the following example.<br />

Example<br />

CTABLES /TABLE AGECAT<br />

/CATEGORIES VARIABLES=AGECAT [1, 2, 3, SUBTOTAL=’Subtotal < 45’,<br />

4, 5, 6, SUBTOTAL=’Subtotal 45+’].<br />

Age<br />

category<br />

Less than 25<br />

25 to 34<br />

35 to 44<br />

Subtotal < 45<br />

45 to 54<br />

55 to 64<br />

65 or older<br />

Subtotal 45+<br />

Implicit Category Specification<br />

Count<br />

242<br />

627<br />

679<br />

1548<br />

481<br />

320<br />

479<br />

1280<br />

The implicit list allows you to sort the categories and to show or hide user-missing values<br />

without having to enumerate the values. It also provides for data-dependent sorting. If you<br />

do not supply an explicit value list, you can use the following keywords:<br />

ORDER The sorting order. You can select A (the default) for ascending order, or D for<br />

descending order.<br />

KEY The sort key. You can select VALUE (the default) to sort by the values, or LABEL to<br />

sort by the value labels. When values are sorted by label, any unlabeled values<br />

appear after the labeled values in the table. You can also specify a summary function<br />

for data-dependent sorting.<br />

MISSING Whether user-missing values are included. You can specify EXCLUDE (the default)<br />

or INCLUDE. System-missing values are never included.<br />

Data-Dependent Sorting. The following conventions and limitations apply to sorting using a<br />

summary function as the key:<br />

• The sort function must be a summary function supported in CTABLES. The PTILE, MODE,<br />

and MEDIAN functions cannot be used.<br />

• The sort function must be used in the table. The exception to this is COUNT. You can sort<br />

by COUNT even if counts do not appear in the table.<br />

• Data-dependent sorting is not available if category labels are repositioned using the<br />

CLABELS subcommand.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!