/CLABELS ROWLABELS=OPPOSITE.
]])
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│
-╰────────────────┴────────╯
+ Statistics
+╭─────────┬───────────────────────────────────╮
+│ │ REGION │
+│ ├────────┬────────┬────────┬────────┤
+│ │ NE │ MW │ S │ W │
+│ ├────────┼────────┼────────┼────────┤
+│ │ QN19A │ QN19A │ QN19A │ QN19A │
+├─────────┼────────┼────────┼────────┼────────┤
+│N Valid │ 936│ 1019│ 1276│ 950│
+│ Missing│ 473│ 635│ 1114│ 596│
+├─────────┼────────┼────────┼────────┼────────┤
+│Mean │ 19.33│ 19.83│ 20.29│ 19.87│
+├─────────┼────────┼────────┼────────┼────────┤
+│S.E. Mean│ .14│ .16│ .18│ .17│
+├─────────┼────────┼────────┼────────┼────────┤
+│Median │ 18.00│ 19.00│ 19.00│ 19.00│
+├─────────┼────────┼────────┼────────┼────────┤
+│Mode │ 18.00│ 18.00│ 18.00│ 18.00│
+├─────────┼────────┼────────┼────────┼────────┤
+│Std Dev │ 4.41│ 5.15│ 6.44│ 5.25│
+├─────────┼────────┼────────┼────────┼────────┤
+│Variance │ 19.41│ 26.47│ 41.43│ 27.59│
+├─────────┼────────┼────────┼────────┼────────┤
+│Range │ 59.00│ 71.00│ 75.00│ 61.00│
+├─────────┼────────┼────────┼────────┼────────┤
+│Minimum │ .00│ 4.00│ 4.00│ 4.00│
+├─────────┼────────┼────────┼────────┼────────┤
+│Maximum │ 59.00│ 75.00│ 79.00│ 65.00│
+├─────────┼────────┼────────┼────────┼────────┤
+│Sum │18092.00│20206.00│25886.00│18877.00│
+╰─────────┴────────┴────────┴────────┴────────╯
Custom Tables
╭────────────────────────┬────────┬────────┬────────┬────────╮
])
AT_CLEANUP
+AT_SETUP([CTABLES scale summary functions - weighting])
+weight=1
+c=10
+for a in 1 2 9; do
+ for b in 3 4 9; do
+ for n in 1 2 3 4 5 6 7 8 9 10; do
+ if test $c -lt 15; then
+ cval=.
+ else
+ cval=$c
+ fi
+ printf "$weight $a $b $cval\n"
+ weight=$(expr \( $weight + 3 \) % 7 + 2)
+ c=$(expr \( $c + 13 \) % 29 + 7)
+ done
+ done
+done > ctables.txt
+
+AT_DATA([ctables.sps],
+[[DATA LIST LIST NOTABLE FILE='ctables.txt'
+ /w (F5.0) a b c (f2.0).
+VAR LEVEL w c (SCALE) a b (NOMINAL).
+MISSING VALUES a b (9).
+
+* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
+ CTABLES later, to make the results easier to verify.
+SPLIT FILE BY a b.
+FREQUENCIES
+ c
+ /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
+ /FORMAT NOTABLE /MISSING=INCLUDE.
+SPLIT FILE OFF.
+
+CTABLES
+ /TABLE c[VALIDN, MISSING, MEAN F8.2, SEMEAN F8.2, MEDIAN F8.2, MODE, STDDEV F8.2, VARIANCE F8.2, RANGE F8.2, MINIMUM, MAXIMUM, SUM F8.2, COUNT, TOTALN, LAYERROWPCT.SUM] BY a>b
+ /SLABELS POSITION=ROW
+ /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
+]])
+AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
+ Statistics
+╭─────────┬──────────────────────────────────────────────────────────────╮
+│ │ a │
+│ ├────────────────────┬────────────────────┬────────────────────┤
+│ │ 1 │ 2 │ 9 │
+│ ├────────────────────┼────────────────────┼────────────────────┤
+│ │ b │ b │ b │
+│ ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
+│ │ 3 │ 4 │ 9 │ 3 │ 4 │ 9 │ 3 │ 4 │ 9 │
+│ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│ │ c │ c │ c │ c │ c │ c │ c │ c │ c │
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│N Valid │ 7│ 6│ 8│ 7│ 7│ 8│ 7│ 7│ 8│
+│ Missing│ 3│ 4│ 2│ 3│ 3│ 2│ 3│ 3│ 2│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Mean │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│S.E. Mean│ 2.44│ 2.14│ 2.58│ 2.44│ 2.18│ 2.43│ 2.36│ 2.18│ 2.47│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Median │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Mode │ .│ .│ .│ .│ .│ .│ .│ .│ .│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Std Dev │ 6.47│ 5.24│ 7.31│ 6.47│ 5.77│ 6.88│ 6.24│ 5.77│ 6.98│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Range │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Minimum │ 16│ 18│ 15│ 16│ 18│ 15│ 16│ 18│ 15│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Maximum │ 34│ 31│ 35│ 34│ 33│ 35│ 34│ 33│ 35│
+├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│Sum │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
+╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
+
+ Custom Tables
+╭───────────────────┬──────────────────────────────────────────────────────────────╮
+│ │ a │
+│ ├────────────────────┬────────────────────┬────────────────────┤
+│ │ 1 │ 2 │ 9 │
+│ ├────────────────────┼────────────────────┼────────────────────┤
+│ │ b │ b │ b │
+│ ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
+│ │ 3 │ 4 │ 9 │ 3 │ 4 │ 9 │ 3 │ 4 │ 9 │
+├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
+│c Valid N │ 7│ 6│ 8│ 7│ 7│ 8│ 7│ 7│ 8│
+│ Missing │ 3│ 4│ 2│ 3│ 3│ 2│ 3│ 3│ 2│
+│ Mean │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
+│ Std Error of Mean│ 2.44│ 2.14│ 2.58│ 2.44│ 2.18│ 2.43│ 2.36│ 2.18│ 2.47│
+│ Median │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
+│ Mode │ 16│ 18│ 15│ 16│ 18│ 15│ 16│ 18│ 15│
+│ Std Deviation │ 6.47│ 5.24│ 7.31│ 6.47│ 5.77│ 6.88│ 6.24│ 5.77│ 6.98│
+│ Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
+│ Range │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
+│ Minimum │ 16│ 18│ 15│ 16│ 18│ 15│ 16│ 18│ 15│
+│ Maximum │ 34│ 31│ 35│ 34│ 33│ 35│ 34│ 33│ 35│
+│ Sum │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
+│ Count │ 10│ 10│ 10│ 10│ 10│ 10│ 10│ 10│ 10│
+│ Total N │ 10│ 10│ 10│ 10│ 10│ 10│ 10│ 10│ 10│
+│ Layer Row Sum % │ xxxx%│ xxxx%│ xxxx%│ xxxx%│ xxxx%│ xxxx%│ xxx8%│ xxxx%│ xxxx%│
+╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
+])
+AT_CLEANUP
AT_SETUP([CTABLES hidden scale VLABELS])
AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])