@node CTABLES Summary Functions for Individual Cells
@subsubsection Summary Functions for Individual Cells
-This section lists the summary functions that can be applied to
-individual cells in @code{CTABLES}. Only one such summary function,
+This section lists the summary functions that consider only an
+individual cell in @code{CTABLES}. Only one such summary function,
@code{COUNT}, may be applied to both categorical and scale variables:
@table @asis
AT_DATA([ctables.sps],
[[GET 'nhtsa.sav'.
SET TVAR=NAME.
+
+* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
+ CTABLES later, to make the results easier to verify.
SPLIT FILE BY REGION.
-FREQUENCIES qn19a /STATISTICS=ALL /FORMAT NOTABLE.
+FREQUENCIES
+ qn19a
+ /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
+ /FORMAT NOTABLE /MISSING=INCLUDE.
SPLIT FILE OFF.
+
CTABLES
/VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
- /TABLE region BY qn19a[COUNT, MAXIMUM, MEAN, MINIMUM, MISSING, MODE]
+ /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN]
+ /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
+ /SLABELS POSITION=ROW.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+ Statistics
+╭────────────────┬────────╮
+│REGION │ QN19A │
+├────────────────┼────────┤
+│NE N Valid │ 936│
+│ Missing│ 473│
+│ ╶─────────┼────────┤
+│ Mean │ 19.33│
+│ ╶─────────┼────────┤
+│ S.E. Mean│ .14│
+│ ╶─────────┼────────┤
+│ Median │ 18.00│
+│ ╶─────────┼────────┤
+│ Mode │ 18.00│
+│ ╶─────────┼────────┤
+│ Std Dev │ 4.41│
+│ ╶─────────┼────────┤
+│ Variance │ 19.41│
+│ ╶─────────┼────────┤
+│ Range │ 59.00│
+│ ╶─────────┼────────┤
+│ Minimum │ .00│
+│ ╶─────────┼────────┤
+│ Maximum │ 59.00│
+│ ╶─────────┼────────┤
+│ Sum │18092.00│
+├────────────────┼────────┤
+│MW N Valid │ 1019│
+│ Missing│ 635│
+│ ╶─────────┼────────┤
+│ Mean │ 19.83│
+│ ╶─────────┼────────┤
+│ S.E. Mean│ .16│
+│ ╶─────────┼────────┤
+│ Median │ 19.00│
+│ ╶─────────┼────────┤
+│ Mode │ 18.00│
+│ ╶─────────┼────────┤
+│ Std Dev │ 5.15│
+│ ╶─────────┼────────┤
+│ Variance │ 26.47│
+│ ╶─────────┼────────┤
+│ Range │ 71.00│
+│ ╶─────────┼────────┤
+│ Minimum │ 4.00│
+│ ╶─────────┼────────┤
+│ Maximum │ 75.00│
+│ ╶─────────┼────────┤
+│ Sum │20206.00│
+├────────────────┼────────┤
+│S N Valid │ 1276│
+│ Missing│ 1114│
+│ ╶─────────┼────────┤
+│ Mean │ 20.29│
+│ ╶─────────┼────────┤
+│ S.E. Mean│ .18│
+│ ╶─────────┼────────┤
+│ Median │ 19.00│
+│ ╶─────────┼────────┤
+│ Mode │ 18.00│
+│ ╶─────────┼────────┤
+│ Std Dev │ 6.44│
+│ ╶─────────┼────────┤
+│ Variance │ 41.43│
+│ ╶─────────┼────────┤
+│ Range │ 75.00│
+│ ╶─────────┼────────┤
+│ Minimum │ 4.00│
+│ ╶─────────┼────────┤
+│ Maximum │ 79.00│
+│ ╶─────────┼────────┤
+│ Sum │25886.00│
+├────────────────┼────────┤
+│W N Valid │ 950│
+│ Missing│ 596│
+│ ╶─────────┼────────┤
+│ Mean │ 19.87│
+│ ╶─────────┼────────┤
+│ S.E. Mean│ .17│
+│ ╶─────────┼────────┤
+│ Median │ 19.00│
+│ ╶─────────┼────────┤
+│ Mode │ 18.00│
+│ ╶─────────┼────────┤
+│ Std Dev │ 5.25│
+│ ╶─────────┼────────┤
+│ Variance │ 27.59│
+│ ╶─────────┼────────┤
+│ Range │ 61.00│
+│ ╶─────────┼────────┤
+│ Minimum │ 4.00│
+│ ╶─────────┼────────┤
+│ Maximum │ 65.00│
+│ ╶─────────┼────────┤
+│ Sum │18877.00│
+╰────────────────┴────────╯
+
+ Custom Tables
+╭───────────────────────────┬────────╮
+│ │ QN19A │
+├───────────────────────────┼────────┤
+│REGION NE Valid N │ 936│
+│ Missing │ 473.00│
+│ Mean │ 19.33│
+│ Std Error of Mean│ .14│
+│ Median │ 18.00│
+│ Mode │ 18.00│
+│ Std Deviation │ 4.41│
+│ Variance │ 19.41│
+│ Range │ 59.00│
+│ Minimum │ .00│
+│ Maximum │ 59.00│
+│ Sum │18092.00│
+│ Count │ 1409│
+│ Total N │ 1409│
+│ ╶────────────────────┼────────┤
+│ MW Valid N │ 1019│
+│ Missing │ 635.00│
+│ Mean │ 19.83│
+│ Std Error of Mean│ .16│
+│ Median │ 19.00│
+│ Mode │ 18.00│
+│ Std Deviation │ 5.15│
+│ Variance │ 26.47│
+│ Range │ 71.00│
+│ Minimum │ 4.00│
+│ Maximum │ 75.00│
+│ Sum │20206.00│
+│ Count │ 1654│
+│ Total N │ 1654│
+│ ╶────────────────────┼────────┤
+│ S Valid N │ 1276│
+│ Missing │ 1114.00│
+│ Mean │ 20.29│
+│ Std Error of Mean│ .18│
+│ Median │ 19.00│
+│ Mode │ 18.00│
+│ Std Deviation │ 6.44│
+│ Variance │ 41.43│
+│ Range │ 75.00│
+│ Minimum │ 4.00│
+│ Maximum │ 79.00│
+│ Sum │25886.00│
+│ Count │ 2390│
+│ Total N │ 2390│
+│ ╶────────────────────┼────────┤
+│ W Valid N │ 950│
+│ Missing │ 596.00│
+│ Mean │ 19.87│
+│ Std Error of Mean│ .17│
+│ Median │ 19.00│
+│ Mode │ 18.00│
+│ Std Deviation │ 5.25│
+│ Variance │ 27.59│
+│ Range │ 61.00│
+│ Minimum │ 4.00│
+│ Maximum │ 65.00│
+│ Sum │18877.00│
+│ Count │ 1546│
+│ Total N │ 1546│
+╰───────────────────────────┴────────╯
+])
+AT_CLEANUP
+
+
+AT_SETUP([CTABLES scale summary functions - assertion failure])
+AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
+AT_DATA([ctables.sps],
+[[GET 'nhtsa.sav'.
+CTABLES
+ /VLABELS VARIABLE=qn19a DISPLAY=NONE
+ /TABLE region BY qn19a
/CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
/SLABELS POSITION=ROW.
]])