Bug fixes.
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet tested:
4 dnl - Preprocessing to distinguish categorical from scale.
5 dnl - Parsing (positive and negative)
6 dnl - String variables and values
7 dnl - Testing details of missing value handling in summaries.
8 dnl - test CLABELS ROWLABELS=LAYER.
9 dnl - Test VLABELS.
10 dnl - Test WEIGHT and adjustment weights.
11 dnl - EMPTY=INCLUDE For string ranges.
12 dnl - Summary functions:
13 dnl   * Separate summary functions for totals and subtotals.
14 dnl   * )CILEVEL in summary label specification
15 dnl Category sorting:
16 dnl   * VALUE
17 dnl   * LABEL
18 dnl   * ascending/descending
19 dnl - CATEGORIES:
20 dnl   * String values
21 dnl   * Date values
22 dnl   * THRU (numeric ranges)
23 dnl   * THRU (string ranges)
24 dnl   * OTHERNM
25 dnl - FORMAT:
26 dnl   * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
27 dnl   * EMPTY.
28 dnl   * MISSING.
29 dnl - HIDESMALLCOUNTS.
30 dnl - Date/time variables and values
31 dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
32 dnl - TITLES: )DATE, )TIME, )TABLE.
33 dnl - Test PCOMPUTE:
34 dnl   * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
35 dnl   * MISSING, OTHERNM
36 dnl   * strings and string ranges
37 dnl   * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
38 dnl   * dates
39 dnl - PPROPERTIES:
40 dnl   * )LABEL[N].
41 dnl - Summary functions:
42 dnl   * U-prefix for unweighted summaries.
43 dnl   * areaPCT.SUM and UareaPCT.SUM functions.
44 dnl - SPLIT FILE with SEPARATE splits
45 dnl - Definition of columns/rows when labels are rotated from one axis to another.
46 dnl
47 dnl Not for v1:
48 dnl - Multiple response sets
49 dnl - MRSETS subcommand.
50 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
51 dnl - SIGTEST
52 dnl - COMPARETEST
53 dnl - Summary functions:
54 dnl   * .LCL and .UCL suffixes.
55 dnl   * .SE suffixes.
56 dnl - CATEGORIES:
57 dnl   * Data-dependent sorting.
58 dnl
59 dnl
60 dnl Bug:
61 dnl     CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a.
62 dnl produces a bad median:
63 dnl                     Custom Tables
64 dnl +--------------------------+-----------------------+
65 dnl |                          |      S3a. GENDER:     |
66 dnl |                          +-----------+-----------+
67 dnl |                          |    Male   |   Female  |
68 dnl |                          +----+------+----+------+
69 dnl |                          |Mean|Median|Mean|Median|
70 dnl +--------------------------+----+------+----+------+
71 dnl |D1. AGE: What is your age?|  46|   999|  50|   999|
72 dnl +--------------------------+----+------+----+------+
73
74
75
76 AT_SETUP([CTABLES parsing])
77 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
78 AT_DATA([ctables.sps],
79 [[GET 'nhtsa.sav'.
80 CTABLES
81     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
82     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
83     /FORMAT UNITS=CM EMPTY="(-)"
84     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
85     /VLABELS VARIABLES=qn17 DISPLAY=NAME
86     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
87     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
88     /VLABELS VARIABLES=qn20 DISPLAY=NONE
89     /MRSETS COUNTDUPLICATES=NO
90     /MRSETS COUNTDUPLICATES=YES
91     /SMISSING VARIABLE
92     /SMISSING LISTWISE
93     /WEIGHT VARIABLE=qns3a
94     /HIDESMALLCOUNTS
95     /HIDESMALLCOUNTS COUNT=10
96     /TABLE qnsa1
97     /SLABELS POSITION=COLUMN VISIBLE=YES
98     /SLABELS VISIBLE=NO POSITION=ROW
99     /SLABELS POSITION=LAYER
100     /CLABELS AUTO
101     /CLABELS ROWLABELS=OPPOSITE
102     /CRITERIA CILEVEL=50
103     /CATEGORIES VARIABLES=qn1 qn17
104                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
105                 POSITION=BEFORE EMPTY=INCLUDE.
106 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
107 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
108 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
109 ]])
110 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
111          Custom Tables
112 Count
113 ╭───────────────────┬────┬────╮
114 │                   │ RDD│CELL│
115 ├───────────────────┼────┼────┤
116 │Sa1. SAMPLE SOURCE:│5392│1607│
117 ╰───────────────────┴────┴────╯
118
119        Custom Tables
120 RDD
121 ╭───────────────────┬─────╮
122 │                   │Count│
123 ├───────────────────┼─────┤
124 │Sa1. SAMPLE SOURCE:│ 5392│
125 ╰───────────────────┴─────╯
126
127           Custom Tables
128 ╭────────────────────────┬─────╮
129 │                        │Count│
130 ├────────────────────────┼─────┤
131 │Sa1. SAMPLE SOURCE: RDD │ 5392│
132 │                    CELL│ 1607│
133 ╰────────────────────────┴─────╯
134
135           Custom Tables
136 ╭────────────────────────┬─────╮
137 │                        │Count│
138 ├────────────────────────┼─────┤
139 │Sa1. SAMPLE SOURCE: RDD │ 5392│
140 │                    CELL│ 1607│
141 ╰────────────────────────┴─────╯
142 ])
143 AT_CLEANUP
144
145 AT_SETUP([CTABLES parsing - negative])
146 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
147 AT_DATA([ctables.sps],
148 [[GET 'nhtsa.sav'.
149 CTABLES.
150 CTABLES /FORMAT MINCOLWIDTH='foo'.
151 CTABLES /TABLE qn1 [**].
152 CTABLES /TABLE qn1 [NOTAFUNCTION].
153 CTABLES /TABLE (qn1.
154 CTABLES /TABLE **.
155 CTABLES /TABLE NOTAVAR.
156 STRING string(A8).
157 CTABLES /TABLE string[S].
158 CTABLES /TABLE qn1 [PTILE 101].
159 CTABLES /TABLE qn1 [MEAN F0.1].
160 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
161 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
162 CTABLES /TABLE qn1 [MEAN TOTALS].
163 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
164 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
165 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
166 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
167 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
168 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
169 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
170 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
171 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
172 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
173 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
174 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
175 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
176 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
177 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
178 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
179 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
180 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
181 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
182 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
183 CTABLES /PCOMPUTE &k=EXPR([LO **]).
184 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
185 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
186 CTABLES /PCOMPUTE &k=EXPR([1**]).
187 CTABLES /PCOMPUTE &k=EXPR((1x)).
188 CTABLES /PCOMPUTE **k.
189 CTABLES /PCOMPUTE &1.
190 CTABLES /PCOMPUTE &k**.
191 CTABLES /PCOMPUTE &k=**.
192 CTABLES /PCOMPUTE &k=EXPR**.
193 CTABLES /PCOMPUTE &k=EXPR(1x).
194 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
195 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
196 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
197 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
198 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
199 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
200 CTABLES /FORMAT EMPTY=**.
201 CTABLES /FORMAT MISSING=**.
202 CTABLES /FORMAT **.
203 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
204 CTABLES /VLABELS **.
205 CTABLES /VLABELS VARIABLES=NOTAVAR.
206 CTABLES /VLABELS VARIABLES=qn1 **.
207 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
208 CTABLES /MRSETS **.
209 CTABLES /MRSETS COUNTDUPLICATES=**.
210 CTABLES /SMISSING **.
211 CTABLES /WEIGHT **.
212 CTABLES /WEIGHT VARIABLE=NOTAVAR.
213 CTABLES /HIDESMALLCOUNTS COUNT=1.
214 CTABLES /QUUX.
215 CTABLES /HIDESMALLCOUNTS COUNT=2.
216 CTABLES /TABLE qn1**.
217 CTABLES /TABLE qn1 /SLABELS POSITION=**.
218 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
219 CTABLES /TABLE qn1 /SLABELS **.
220 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
221 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
222 CTABLES /TABLE qn1 /CLABELS **.
223 CTABLES /TABLE qn1 /CRITERIA **.
224 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
225 CTABLES /TABLE qn1 /TITLES **.
226 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
227 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
228 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
229 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
230 CTABLES /TABLE qn1 /SIGTEST **.
231 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
232 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
233 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
234 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
235 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
236 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
237 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
238 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
239 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
240 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
241 CTABLES /TABLE qn1 /COMPARETEST **.
242 CTABLES /TABLE qn1 / **.
243 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
244 CTABLES /TABLE qn20 > qnd1.
245 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
246 NUMERIC datetime (DATETIME17.0).
247 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
248 ]])
249 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
250 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
251
252 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
253 negative number for MINCOLWIDTH.
254
255 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
256 identifier.
257
258 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
259 summary function name.
260
261 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
262
263 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
264 identifier.
265
266 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
267
268 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
269 scale variable.
270    10 | CTABLES /TABLE string[S].
271       |                ^~~~~~~~~
272
273 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
274 between 0 and 100 for PTILE.
275
276 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
277 requires a width between 1 and 40.
278
279 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
280 format NEGPAREN requires width 2 or greater.
281
282 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
283 format NEGPAREN requires width greater than decimals.
284
285 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
286 scale variables.
287    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
288       |                     ^~~~
289
290 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
291    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
292       |                ^~~
293
294 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
295
296 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
297 scale variables.
298    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
299       |                     ^~~~
300
301 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
302    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
303       |                ^~~
304
305 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
306
307 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
308
309 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
310
311 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
312
313 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
314
315 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
316
317 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
318 identifier.
319
320 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
321    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
322       |                                               ^~
323
324 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
325 between 0 and 100 for PTILE.
326
327 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
328 `@:}@'.
329
330 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
331 `@{:@'.
332
333 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
334 or EXCLUDE.
335
336 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
337 NO.
338
339 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
340
341 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
342 or AFTER.
343
344 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
345 or EXCLUDE.
346
347 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
348 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
349
350 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
351 LABEL, POSITION, or EMPTY.
352
353 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
354 integer for SUBTOTAL.
355
356 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
357
358 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
359
360 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
361
362 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
363
364 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
365
366 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
367
368 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
369
370 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
371
372 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
373
374 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
375
376 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
377
378 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
379
380 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
381 the previous definition.
382    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
383       |                               ^~~~~~~~~~~~~~~~~~~
384
385 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
386    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
387       |          ^~~~~~~~~~~~~~~~~~~
388
389 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
390 `/'.
391
392 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
393 Expecting summary function name.
394
395 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
396 between 0 and 100 for PTILE.
397
398 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
399
400 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
401 NO.
402
403 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
404 FORMAT, or HIDESOURCECATS.
405
406 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
407
408 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
409
410 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
411 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
412
413 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
414 MAXCOLWIDTH.
415
416 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
417 VARIABLES.
418
419 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
420
421 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
422 DISPLAY.
423
424 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
425 DEFAULT, NAME, LABEL, BOTH, or NONE.
426
427 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
428 COUNTDUPLICATES.
429
430 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
431 NO.
432
433 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
434 VARIABLE or LISTWISE.
435
436 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
437 VARIABLE.
438
439 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
440
441 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
442 greater for HIDESMALLCOUNTS COUNT.
443
444 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
445 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
446 HIDESMALLCOUNTS, or TABLE.
447
448 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
449 `/'.
450
451 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
452
453 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
454 ROW, or LAYER.
455
456 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
457 NO.
458
459 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
460 POSITION or VISIBLE.
461
462 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
463 OPPOSITE or LAYER.
464
465 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
466 OPPOSITE or LAYER.
467
468 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
469 ROWLABELS, or COLLABELS.
470
471 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
472 CILEVEL.
473
474 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
475 in @<:@0,100@:}@ for CILEVEL.
476
477 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
478 CAPTION, CORNER, or TITLE.
479
480 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
481 CHISQUARE.
482
483 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
484 in @<:@0,1@:}@ for ALPHA.
485
486 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
487 NO.
488
489 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
490 ALLVISIBLE or SUBTOTALS.
491
492 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
493 ALPHA, INCLUDEMRSETS, or CATEGORIES.
494
495 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
496 MEAN.
497
498 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
499 in (0,1) for ALPHA.
500
501 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
502 for ALPHA.
503
504 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
505 BONFERRONI, BH, or NONE.
506
507 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
508 NO.
509
510 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
511 or TESTEDCATS.
512
513 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
514 ALLVISIBLE or SUBTOTALS.
515
516 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
517 NO.
518
519 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
520 SIMPLE.
521
522 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
523 NO.
524
525 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
526 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
527 SHOWSIG.
528
529 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
530 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
531
532 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
533 specified.
534
535 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
536    97 | CTABLES /TABLE qn20 > qnd1.
537       |                ^~~~~~~~~~~
538
539 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
540    97 | CTABLES /TABLE qn20 > qnd1.
541       |                ^~~~
542
543 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
544    97 | CTABLES /TABLE qn20 > qnd1.
545       |                       ^~~~
546
547 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
548 categorical variables at the innermost nesting level.
549    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
550       |                ^~~~~~~~~~~~~~~~~~~~
551
552 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
553 summary.
554    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
555       |                ^~~
556
557 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
558 specification as format DATETIME: Day (123) must be between 1 and 31..
559   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
560       |                                                    ^~~~~
561 ]])
562 AT_CLEANUP
563
564 AT_SETUP([CTABLES parsing - more negative])
565 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
566 AT_DATA([ctables.sps],
567 [[GET 'nhtsa.sav'.
568 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
569 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
570 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
571
572 STRING string(A8).
573 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
574 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
575
576 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
577
578 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
579 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
580 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
581 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
582
583 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
584 CTABLES /PCOMPUTE &x=EXPR([**]).
585 CTABLES /PCOMPUTE &x=EXPR(**).
586
587 CTABLES /TABLE.
588
589 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
590 ]])
591 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
592 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
593 category not included in the category list.
594     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
595 VARIABLES=qn1 [&pc].
596       |
597 ^~~
598
599 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
600     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
601 VARIABLES=qn1 [&pc].
602       |                            ^~~~~~~~
603
604 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
605 list of categories here.
606     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
607 VARIABLES=qn1 [&pc].
608       |
609 ^~~~
610
611 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
612 category not included in the category list.
613     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
614 [&pc].
615       |
616 ^~~
617
618 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
619     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
620 [&pc].
621       |                            ^~~~~
622
623 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
624 variable's CATEGORIES specification.
625
626 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
627 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
628 subtotals by position, e.g. SUBTOTAL[1].
629     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
630 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
631       |
632 ^~~~~~~~~~~~~~~~~~~~~~~~
633
634 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
635 position.
636     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
637 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
638       |                            ^~~~~~~~
639
640 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
641 applied only to string variables, but this subcommand tries to apply it to
642 numeric variable QN1.
643     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
644       |                                               ^~~~~~~~
645
646 ctables.sps:8.53: error: CTABLES: This category specification may be applied
647 only to numeric variables, but this subcommand tries to apply it to string
648 variable string.
649     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
650       |                                                     ^
651
652 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
653 based on a summary function.
654
655 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
656 moved to be categorical, but qnd1 is a scale variable.
657
658 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
659 moved to have the same width, but QN1 has width 0 and string has width 8.
660
661 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
662 moved to have the same value labels, but QN1 and QNSA1 have different value
663 labels.
664
665 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
666 moved to have the same category specifications, but QN105BA and QN105BB have
667 different category specifications.
668
669 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
670 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
671 this warning, insert parentheses.
672    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
673       |                           ^~~~~~~
674
675 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
676 `/'.
677
678 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
679
680 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
681
682 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
683 variable must be specified.
684
685 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
686
687 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
688 summary.
689    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
690       |                ^~~~~
691
692 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
693 summary.
694    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
695       |                                 ^~~~~
696
697 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
698 summary.
699    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
700       |                                                  ^~~~~
701 ]])
702 AT_CLEANUP
703
704 AT_SETUP([CTABLES one categorical variable])
705 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
706 AT_DATA([ctables.sps],
707 [[GET 'nhtsa.sav'.
708 CTABLES /TABLE qn1.
709 CTABLES /TABLE BY qn1.
710 CTABLES /TABLE BY BY qn1.
711 ]])
712 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
713                                   Custom Tables
714 ╭────────────────────────────────────────────────────────────────────────┬─────╮
715 │                                                                        │Count│
716 ├────────────────────────────────────────────────────────────────────────┼─────┤
717 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
718 │motor vehicle?                                     Several days a week  │ 1274│
719 │                                                   Once a week or less  │  361│
720 │                                                   Only certain times a │  130│
721 │                                                   year                 │     │
722 │                                                   Never                │  540│
723 ╰────────────────────────────────────────────────────────────────────────┴─────╯
724
725                                   Custom Tables
726 ╭──────────────────────────────────────────────────────────────────────────────╮
727 │        1. How often do you usually drive a car or other motor vehicle?       │
728 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
729 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
730 │Every day│       week       │       less       │          year          │Never│
731 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
732 │  Count  │       Count      │       Count      │          Count         │Count│
733 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
734 │     4667│              1274│               361│                     130│  540│
735 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
736
737 Custom Tables
738 Every day
739 ╭─────╮
740 │Count│
741 ├─────┤
742 │ 4667│
743 ╰─────╯
744 ])
745 AT_CLEANUP
746
747 AT_SETUP([CTABLES one scale variable])
748 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
749 AT_DATA([ctables.sps],
750 [[GET 'nhtsa.sav'.
751 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
752 CTABLES /TABLE BY qnd1.
753 CTABLES /TABLE BY BY qnd1.
754 ]])
755 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
756                                   Custom Tables
757 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
758 │                      │     │       │       │    │     Std    │       │       │
759 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
760 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
761 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
762 │age?                  │     │       │       │    │            │       │       │
763 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
764
765         Custom Tables
766 ╭──────────────────────────╮
767 │D1. AGE: What is your age?│
768 ├──────────────────────────┤
769 │           Mean           │
770 ├──────────────────────────┤
771 │                        48│
772 ╰──────────────────────────╯
773
774 Custom Tables
775 D1. AGE: What is your age?
776 ╭────╮
777 │Mean│
778 ├────┤
779 │  48│
780 ╰────╯
781 ])
782 AT_CLEANUP
783
784 AT_SETUP([CTABLES simple stacking])
785 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
786 AT_DATA([ctables.sps],
787 [[GET 'nhtsa.sav'.
788 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
789 ]])
790 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
791                                   Custom Tables
792 ╭───────────────────────────────────────────────────────────────┬──────────────╮
793 │                                                               │ S3a. GENDER: │
794 │                                                               ├──────┬───────┤
795 │                                                               │ Male │ Female│
796 │                                                               ├──────┼───────┤
797 │                                                               │Column│ Column│
798 │                                                               │   %  │   %   │
799 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
800 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
801 │too much to drink to drive safely will A. Get      certain     │      │       │
802 │stopped by the police?                             Very likely │   21%│    22%│
803 │                                                   Somewhat    │   38%│    42%│
804 │                                                   likely      │      │       │
805 │                                                   Somewhat    │   21%│    18%│
806 │                                                   unlikely    │      │       │
807 │                                                   Very        │   10%│     8%│
808 │                                                   unlikely    │      │       │
809 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
810 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
811 │too much to drink to drive safely will B. Have an  certain     │      │       │
812 │accident?                                          Very likely │   36%│    45%│
813 │                                                   Somewhat    │   39%│    32%│
814 │                                                   likely      │      │       │
815 │                                                   Somewhat    │    9%│     4%│
816 │                                                   unlikely    │      │       │
817 │                                                   Very        │    3%│     2%│
818 │                                                   unlikely    │      │       │
819 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
820 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
821 │too much to drink to drive safely will C. Be       certain     │      │       │
822 │convicted for drunk driving?                       Very likely │   32%│    28%│
823 │                                                   Somewhat    │   27%│    32%│
824 │                                                   likely      │      │       │
825 │                                                   Somewhat    │   15%│    15%│
826 │                                                   unlikely    │      │       │
827 │                                                   Very        │    9%│     9%│
828 │                                                   unlikely    │      │       │
829 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
830 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
831 │too much to drink to drive safely will D. Be       certain     │      │       │
832 │arrested for drunk driving?                        Very likely │   26%│    27%│
833 │                                                   Somewhat    │   32%│    35%│
834 │                                                   likely      │      │       │
835 │                                                   Somewhat    │   17%│    15%│
836 │                                                   unlikely    │      │       │
837 │                                                   Very        │    9%│     7%│
838 │                                                   unlikely    │      │       │
839 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
840 ])
841 AT_CLEANUP
842
843 AT_SETUP([CTABLES show or hide empty categories])
844 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
845 AT_DATA([ctables.sps],
846 [[GET 'nhtsa.sav'.
847 IF (qn105ba = 2) qn105ba = 1.
848 IF (qns3a = 1) qns3a = 2.
849 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
850 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
851     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
852 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
853     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
854 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
855     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
856 ]])
857 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
858                                   Custom Tables
859 ╭──────────────────────────────────────────────────────────────┬───────────────╮
860 │                                                              │  S3a. GENDER: │
861 │                                                              ├───────┬───────┤
862 │                                                              │  Male │ Female│
863 │                                                              ├───────┼───────┤
864 │                                                              │ Column│ Column│
865 │                                                              │   %   │   %   │
866 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
867 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
868 │too much to drink to drive safely will A. Get      certain    │       │       │
869 │stopped by the police?                             Very likely│      .│     0%│
870 │                                                   Somewhat   │      .│    40%│
871 │                                                   likely     │       │       │
872 │                                                   Somewhat   │      .│    19%│
873 │                                                   unlikely   │       │       │
874 │                                                   Very       │      .│     9%│
875 │                                                   unlikely   │       │       │
876 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
877
878                                   Custom Tables
879 ╭──────────────────────────────────────────────────────────────┬───────────────╮
880 │                                                              │  S3a. GENDER: │
881 │                                                              ├───────┬───────┤
882 │                                                              │  Male │ Female│
883 │                                                              ├───────┼───────┤
884 │                                                              │ Column│ Column│
885 │                                                              │   %   │   %   │
886 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
887 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
888 │too much to drink to drive safely will A. Get      certain    │       │       │
889 │stopped by the police?                             Somewhat   │      .│    40%│
890 │                                                   likely     │       │       │
891 │                                                   Somewhat   │      .│    19%│
892 │                                                   unlikely   │       │       │
893 │                                                   Very       │      .│     9%│
894 │                                                   unlikely   │       │       │
895 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
896
897                                   Custom Tables
898 ╭────────────────────────────────────────────────────────────────────┬─────────╮
899 │                                                                    │   S3a.  │
900 │                                                                    │ GENDER: │
901 │                                                                    ├─────────┤
902 │                                                                    │  Female │
903 │                                                                    ├─────────┤
904 │                                                                    │ Column %│
905 ├────────────────────────────────────────────────────────────────────┼─────────┤
906 │105b. How likely is it that drivers who have had too    Almost      │      32%│
907 │much to drink to drive safely will A. Get stopped by    certain     │         │
908 │the police?                                             Very likely │       0%│
909 │                                                        Somewhat    │      40%│
910 │                                                        likely      │         │
911 │                                                        Somewhat    │      19%│
912 │                                                        unlikely    │         │
913 │                                                        Very        │       9%│
914 │                                                        unlikely    │         │
915 ╰────────────────────────────────────────────────────────────────────┴─────────╯
916
917                                   Custom Tables
918 ╭────────────────────────────────────────────────────────────────────┬─────────╮
919 │                                                                    │   S3a.  │
920 │                                                                    │ GENDER: │
921 │                                                                    ├─────────┤
922 │                                                                    │  Female │
923 │                                                                    ├─────────┤
924 │                                                                    │ Column %│
925 ├────────────────────────────────────────────────────────────────────┼─────────┤
926 │105b. How likely is it that drivers who have had too    Almost      │      32%│
927 │much to drink to drive safely will A. Get stopped by    certain     │         │
928 │the police?                                             Somewhat    │      40%│
929 │                                                        likely      │         │
930 │                                                        Somewhat    │      19%│
931 │                                                        unlikely    │         │
932 │                                                        Very        │       9%│
933 │                                                        unlikely    │         │
934 ╰────────────────────────────────────────────────────────────────────┴─────────╯
935 ])
936 AT_CLEANUP
937
938 AT_SETUP([CTABLES simple nesting])
939 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
940 AT_DATA([ctables.sps],
941 [[GET 'nhtsa.sav'.
942 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
943   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
944 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
945   /CATEGORIES VARIABLES=qns3a TOTAL=YES
946   /CLABELS ROW=OPPOSITE.
947 ]])
948 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
949                                   Custom Tables
950 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
951 │                                                                 │     │ Table│
952 │                                                                 │Count│   %  │
953 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
954 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
955 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
956 │drive safely will A. Get stopped by                        Total │  700│   10%│
957 │the police?                           ╶──────────────────────────┼─────┼──────┤
958 │                                       Very       S3a.     Male  │  660│   10%│
959 │                                       likely     GENDER:  Female│  842│   12%│
960 │                                                           Total │ 1502│   22%│
961 │                                      ╶──────────────────────────┼─────┼──────┤
962 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
963 │                                       likely     GENDER:  Female│ 1589│   23%│
964 │                                                           Total │ 2763│   40%│
965 │                                      ╶──────────────────────────┼─────┼──────┤
966 │                                       Somewhat   S3a.     Male  │  640│    9%│
967 │                                       unlikely   GENDER:  Female│  667│   10%│
968 │                                                           Total │ 1307│   19%│
969 │                                      ╶──────────────────────────┼─────┼──────┤
970 │                                       Very       S3a.     Male  │  311│    5%│
971 │                                       unlikely   GENDER:  Female│  298│    4%│
972 │                                                           Total │  609│    9%│
973 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
974 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
975 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
976 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
977 │                                      ╶──────────────────────────┼─────┼──────┤
978 │                                       Very       S3a.     Male  │ 1104│   16%│
979 │                                       likely     GENDER:  Female│ 1715│   25%│
980 │                                                           Total │ 2819│   41%│
981 │                                      ╶──────────────────────────┼─────┼──────┤
982 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
983 │                                       likely     GENDER:  Female│ 1214│   18%│
984 │                                                           Total │ 2417│   35%│
985 │                                      ╶──────────────────────────┼─────┼──────┤
986 │                                       Somewhat   S3a.     Male  │  262│    4%│
987 │                                       unlikely   GENDER:  Female│  168│    2%│
988 │                                                           Total │  430│    6%│
989 │                                      ╶──────────────────────────┼─────┼──────┤
990 │                                       Very       S3a.     Male  │   81│    1%│
991 │                                       unlikely   GENDER:  Female│   59│    1%│
992 │                                                           Total │  140│    2%│
993 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
994 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
995 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
996 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
997 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
998 │                                       Very       S3a.     Male  │  988│   14%│
999 │                                       likely     GENDER:  Female│ 1049│   15%│
1000 │                                                           Total │ 2037│   30%│
1001 │                                      ╶──────────────────────────┼─────┼──────┤
1002 │                                       Somewhat   S3a.     Male  │  822│   12%│
1003 │                                       likely     GENDER:  Female│ 1210│   18%│
1004 │                                                           Total │ 2032│   30%│
1005 │                                      ╶──────────────────────────┼─────┼──────┤
1006 │                                       Somewhat   S3a.     Male  │  446│    7%│
1007 │                                       unlikely   GENDER:  Female│  548│    8%│
1008 │                                                           Total │  994│   15%│
1009 │                                      ╶──────────────────────────┼─────┼──────┤
1010 │                                       Very       S3a.     Male  │  268│    4%│
1011 │                                       unlikely   GENDER:  Female│  354│    5%│
1012 │                                                           Total │  622│    9%│
1013 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1014 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1015 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1016 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1017 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1018 │                                       Very       S3a.     Male  │  805│   12%│
1019 │                                       likely     GENDER:  Female│ 1029│   15%│
1020 │                                                           Total │ 1834│   27%│
1021 │                                      ╶──────────────────────────┼─────┼──────┤
1022 │                                       Somewhat   S3a.     Male  │  975│   14%│
1023 │                                       likely     GENDER:  Female│ 1332│   19%│
1024 │                                                           Total │ 2307│   34%│
1025 │                                      ╶──────────────────────────┼─────┼──────┤
1026 │                                       Somewhat   S3a.     Male  │  535│    8%│
1027 │                                       unlikely   GENDER:  Female│  560│    8%│
1028 │                                                           Total │ 1095│   16%│
1029 │                                      ╶──────────────────────────┼─────┼──────┤
1030 │                                       Very       S3a.     Male  │  270│    4%│
1031 │                                       unlikely   GENDER:  Female│  279│    4%│
1032 │                                                           Total │  549│    8%│
1033 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1034
1035                                   Custom Tables
1036 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1037 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1038 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1039 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1040 │                                 │        │ Table│         │         │        │
1041 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1042 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1043 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1044 │GENDER:        is it that drivers│        │      │         │         │        │
1045 │               who have had too  │        │      │         │         │        │
1046 │               much to drink to  │        │      │         │         │        │
1047 │               drive safely will │        │      │         │         │        │
1048 │               A. Get stopped by │        │      │         │         │        │
1049 │               the police?       │        │      │         │         │        │
1050 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1051 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1052 │               is it that drivers│        │      │         │         │        │
1053 │               who have had too  │        │      │         │         │        │
1054 │               much to drink to  │        │      │         │         │        │
1055 │               drive safely will │        │      │         │         │        │
1056 │               A. Get stopped by │        │      │         │         │        │
1057 │               the police?       │        │      │         │         │        │
1058 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1059 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1060 │               is it that drivers│        │      │         │         │        │
1061 │               who have had too  │        │      │         │         │        │
1062 │               much to drink to  │        │      │         │         │        │
1063 │               drive safely will │        │      │         │         │        │
1064 │               A. Get stopped by │        │      │         │         │        │
1065 │               the police?       │        │      │         │         │        │
1066 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1067 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1068 │GENDER:        is it that drivers│        │      │         │         │        │
1069 │               who have had too  │        │      │         │         │        │
1070 │               much to drink to  │        │      │         │         │        │
1071 │               drive safely will │        │      │         │         │        │
1072 │               B. Have an        │        │      │         │         │        │
1073 │               accident?         │        │      │         │         │        │
1074 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1075 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1076 │               is it that drivers│        │      │         │         │        │
1077 │               who have had too  │        │      │         │         │        │
1078 │               much to drink to  │        │      │         │         │        │
1079 │               drive safely will │        │      │         │         │        │
1080 │               B. Have an        │        │      │         │         │        │
1081 │               accident?         │        │      │         │         │        │
1082 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1083 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1084 │               is it that drivers│        │      │         │         │        │
1085 │               who have had too  │        │      │         │         │        │
1086 │               much to drink to  │        │      │         │         │        │
1087 │               drive safely will │        │      │         │         │        │
1088 │               B. Have an        │        │      │         │         │        │
1089 │               accident?         │        │      │         │         │        │
1090 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1091 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1092 │GENDER:        is it that drivers│        │      │         │         │        │
1093 │               who have had too  │        │      │         │         │        │
1094 │               much to drink to  │        │      │         │         │        │
1095 │               drive safely will │        │      │         │         │        │
1096 │               C. Be convicted   │        │      │         │         │        │
1097 │               for drunk driving?│        │      │         │         │        │
1098 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1099 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1100 │               is it that drivers│        │      │         │         │        │
1101 │               who have had too  │        │      │         │         │        │
1102 │               much to drink to  │        │      │         │         │        │
1103 │               drive safely will │        │      │         │         │        │
1104 │               C. Be convicted   │        │      │         │         │        │
1105 │               for drunk driving?│        │      │         │         │        │
1106 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1107 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1108 │               is it that drivers│        │      │         │         │        │
1109 │               who have had too  │        │      │         │         │        │
1110 │               much to drink to  │        │      │         │         │        │
1111 │               drive safely will │        │      │         │         │        │
1112 │               C. Be convicted   │        │      │         │         │        │
1113 │               for drunk driving?│        │      │         │         │        │
1114 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1115 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1116 │GENDER:        is it that drivers│        │      │         │         │        │
1117 │               who have had too  │        │      │         │         │        │
1118 │               much to drink to  │        │      │         │         │        │
1119 │               drive safely will │        │      │         │         │        │
1120 │               D. Be arrested for│        │      │         │         │        │
1121 │               drunk driving?    │        │      │         │         │        │
1122 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1123 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1124 │               is it that drivers│        │      │         │         │        │
1125 │               who have had too  │        │      │         │         │        │
1126 │               much to drink to  │        │      │         │         │        │
1127 │               drive safely will │        │      │         │         │        │
1128 │               D. Be arrested for│        │      │         │         │        │
1129 │               drunk driving?    │        │      │         │         │        │
1130 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1131 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1132 │               is it that drivers│        │      │         │         │        │
1133 │               who have had too  │        │      │         │         │        │
1134 │               much to drink to  │        │      │         │         │        │
1135 │               drive safely will │        │      │         │         │        │
1136 │               D. Be arrested for│        │      │         │         │        │
1137 │               drunk driving?    │        │      │         │         │        │
1138 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1139 ])
1140 AT_CLEANUP
1141
1142 AT_SETUP([CTABLES nesting and scale variables])
1143 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1144 AT_DATA([ctables.sps],
1145 [[GET 'nhtsa.sav'.
1146 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1147 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1148 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1149   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1150 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1151 ]])
1152 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1153                                   Custom Tables
1154 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1155 │                                                                 │S3a. GENDER:│
1156 │                                                                 ├─────┬──────┤
1157 │                                                                 │ Male│Female│
1158 │                                                                 ├─────┼──────┤
1159 │                                                                 │ Mean│ Mean │
1160 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1161 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1162 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1163 │                                                  week           │     │      │
1164 │                                                  Once a week or │   44│    54│
1165 │                                                  less           │     │      │
1166 │                                                  Only certain   │   34│    41│
1167 │                                                  times a year   │     │      │
1168 │                                                  Never          │   39│    55│
1169 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1170
1171                                   Custom Tables
1172 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1173 │                                                         │Minimum│Maximum│Mean│
1174 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1175 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1176 │What is  GENDER:         months, has there been a        │       │       │    │
1177 │your                     time when you felt you          │       │       │    │
1178 │age?                     should cut down on your      No │     16│     86│  46│
1179 │                         drinking?                       │       │       │    │
1180 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1181 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1182 │                         months, has there been a        │       │       │    │
1183 │                         time when you felt you          │       │       │    │
1184 │                         should cut down on your      No │     16│     86│  48│
1185 │                         drinking?                       │       │       │    │
1186 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1187 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1188 │What is  GENDER:         months, has there been a        │       │       │    │
1189 │your                     time when people criticized  No │     16│     86│  46│
1190 │age?                     your drinking?                  │       │       │    │
1191 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1192 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1193 │                         months, has there been a        │       │       │    │
1194 │                         time when people criticized  No │     16│     86│  48│
1195 │                         your drinking?                  │       │       │    │
1196 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1197
1198                                   Custom Tables
1199 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1200 │                             │S1. Including yourself, how many members of this│
1201 │                             │         household are age 16 or older?         │
1202 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1203 │                             │      │      │      │      │      │      │ 6 or │
1204 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1205 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1206 │                             │Column│Column│Column│Column│Column│Column│Column│
1207 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1208 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1209 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1210 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1211 │SOURCE:     likely           │      │      │      │      │      │      │      │
1212 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1213 │            that     likely  │      │      │      │      │      │      │      │
1214 │            drivers          │      │      │      │      │      │      │      │
1215 │            who have         │      │      │      │      │      │      │      │
1216 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1217 │            much to  likely  │      │      │      │      │      │      │      │
1218 │            drink to         │      │      │      │      │      │      │      │
1219 │            drive            │      │      │      │      │      │      │      │
1220 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1221 │            will A.  unlikely│      │      │      │      │      │      │      │
1222 │            Get              │      │      │      │      │      │      │      │
1223 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1224 │            by the   unlikely│      │      │      │      │      │      │      │
1225 │            police?          │      │      │      │      │      │      │      │
1226 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1227
1228                                   Custom Tables
1229 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1230 │                                                              │    │    Std   │
1231 │                                                              │Mean│ Deviation│
1232 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1233 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1234 │group           typical month did you have one or more        │    │          │
1235 │                alcoholic beverages to drink?                 │    │          │
1236 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1237 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1238 │                typical month did you have one or more        │    │          │
1239 │                alcoholic beverages to drink?                 │    │          │
1240 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1241 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1242 │                typical month did you have one or more        │    │          │
1243 │                alcoholic beverages to drink?                 │    │          │
1244 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1245 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1246 │                typical month did you have one or more        │    │          │
1247 │                alcoholic beverages to drink?                 │    │          │
1248 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1249 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1250 │                typical month did you have one or more        │    │          │
1251 │                alcoholic beverages to drink?                 │    │          │
1252 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1253 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1254 │       older    typical month did you have one or more        │    │          │
1255 │                alcoholic beverages to drink?                 │    │          │
1256 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1257 ])
1258 AT_CLEANUP
1259
1260
1261 AT_SETUP([CTABLES SLABELS])
1262 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1263 AT_DATA([ctables.sps],
1264 [[GET 'nhtsa.sav'.
1265 CTABLES /TABLE qn1 [COUNT COLPCT].
1266 CTABLES /TABLE qn1 [COUNT COLPCT]
1267     /SLABELS POSITION=ROW.
1268 CTABLES /TABLE qn1 [COUNT COLPCT]
1269     /SLABELS POSITION=ROW VISIBLE=NO.
1270 ]])
1271 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1272                                   Custom Tables
1273 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1274 │                                                                │     │ Column│
1275 │                                                                │Count│   %   │
1276 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1277 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1278 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1279 │                                             Once a week or less│  361│   5.2%│
1280 │                                             Only certain times │  130│   1.9%│
1281 │                                             a year             │     │       │
1282 │                                             Never              │  540│   7.7%│
1283 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1284
1285                                   Custom Tables
1286 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1287 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1288 │other motor vehicle?                                             Column │66.9%│
1289 │                                                                 %      │     │
1290 │                                            ╶───────────────────────────┼─────┤
1291 │                                             Several days a week Count  │ 1274│
1292 │                                                                 Column │18.3%│
1293 │                                                                 %      │     │
1294 │                                            ╶───────────────────────────┼─────┤
1295 │                                             Once a week or less Count  │  361│
1296 │                                                                 Column │ 5.2%│
1297 │                                                                 %      │     │
1298 │                                            ╶───────────────────────────┼─────┤
1299 │                                             Only certain times  Count  │  130│
1300 │                                             a year              Column │ 1.9%│
1301 │                                                                 %      │     │
1302 │                                            ╶───────────────────────────┼─────┤
1303 │                                             Never               Count  │  540│
1304 │                                                                 Column │ 7.7%│
1305 │                                                                 %      │     │
1306 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1307
1308                                   Custom Tables
1309 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1310 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1311 │motor vehicle?                                                          │66.9%│
1312 │                                                   Several days a week  │ 1274│
1313 │                                                                        │18.3%│
1314 │                                                   Once a week or less  │  361│
1315 │                                                                        │ 5.2%│
1316 │                                                   Only certain times a │  130│
1317 │                                                   year                 │ 1.9%│
1318 │                                                   Never                │  540│
1319 │                                                                        │ 7.7%│
1320 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1321 ])
1322 AT_CLEANUP
1323
1324 AT_SETUP([CTABLES simple totals])
1325 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1326 AT_DATA([ctables.sps],
1327 [[GET 'nhtsa.sav'.
1328 CTABLES /TABLE=qn17
1329     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1330 DESCRIPTIVES qn18/STATISTICS=MEAN.
1331 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1332     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1333 ]])
1334 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1335                                   Custom Tables
1336 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1337 │                                                                        │Count│
1338 ├────────────────────────────────────────────────────────────────────────┼─────┤
1339 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1340 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1341 │                                                      Light beer        │  620│
1342 │                                                      Wine              │ 1418│
1343 │                                                      Wine coolers      │  137│
1344 │                                                      Hard liquor or    │  888│
1345 │                                                      mixed drinks      │     │
1346 │                                                      Flavored malt     │   83│
1347 │                                                      drinks            │     │
1348 │                                                      Number responding │ 4221│
1349 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1350
1351                              Descriptive Statistics
1352 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1353 │                                                                    │  N │Mean│
1354 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1355 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1356 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1357 │Valid N (listwise)                                                  │6999│    │
1358 │Missing N (listwise)                                                │2781│    │
1359 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1360
1361                                   Custom Tables
1362 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1363 │                                                      │    │     │ Valid│Total│
1364 │                                                      │Mean│Count│   N  │  N  │
1365 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1366 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1367 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1368 │                you usually drink per sitting?        │    │     │      │     │
1369 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1370 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1371 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1372 │                you usually drink per sitting?        │    │     │      │     │
1373 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1374 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1375 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1376 │                you usually drink per sitting?        │    │     │      │     │
1377 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1378 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1379 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1380 │                you usually drink per sitting?        │    │     │      │     │
1381 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1382 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1383 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1384 │                you usually drink per sitting?        │    │     │      │     │
1385 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1386 ])
1387 AT_CLEANUP
1388
1389 AT_SETUP([CTABLES subtotals])
1390 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1391 AT_DATA([ctables.sps],
1392 [[GET 'nhtsa.sav'.
1393 CTABLES /TABLE=qn105ba BY qns1
1394     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1395 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1396     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1397 CTABLES /TABLE=qn105ba BY qns1
1398     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1399     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1400 ]])
1401 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1402                                                       Custom Tables
1403 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1404 │                                                         │ S1. Including yourself, how many members of this household │
1405 │                                                         │                    are age 16 or older?                    │
1406 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1407 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1408 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1409 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1410 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1411 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1412 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1413 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1414 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1415 │                                              likely     │       │       │         │       │        │      │          │
1416 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1417 │                                              unlikely   │       │       │         │       │        │      │          │
1418 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1419 │                                              unlikely   │       │       │         │       │        │      │          │
1420 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1421
1422                                                       Custom Tables
1423 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1424 │                                                        │  S1. Including yourself, how many members of this household │
1425 │                                                        │                     are age 16 or older?                    │
1426 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1427 │                                                        │        │        │        │        │       │        │  6 or  │
1428 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1429 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1430 │                                                        │        │        │        │        │ Column│        │        │
1431 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1432 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1433 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1434 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1435 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1436 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1437 │                                             likely     │        │        │        │        │       │        │        │
1438 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1439 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1440 │                                             unlikely   │        │        │        │        │       │        │        │
1441 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1442 │                                             unlikely   │        │        │        │        │       │        │        │
1443 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1444 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1445
1446                                                       Custom Tables
1447 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1448 │                                                         │ S1. Including yourself, how many members of this household │
1449 │                                                         │                    are age 16 or older?                    │
1450 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1451 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1452 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1453 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1454 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1455 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1456 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1457 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1458 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1459 │                                              likely     │       │       │         │       │        │      │          │
1460 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1461 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1462 │                                              unlikely   │       │       │         │       │        │      │          │
1463 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1464 │                                              unlikely   │       │       │         │       │        │      │          │
1465 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1466 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1467 ])
1468 AT_CLEANUP
1469
1470 AT_SETUP([CTABLES PCOMPUTE])
1471 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1472 AT_DATA([ctables.sps],
1473 [[GET 'nhtsa.sav'.
1474 CTABLES
1475     /PCOMPUTE &x=EXPR([3] + [4])
1476     /PCOMPUTE &y=EXPR([4] + [5])
1477     /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
1478     /PPROPERTIES &y LABEL='4+5'
1479     /TABLE=qn105ba BY qns1
1480     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
1481 ]])
1482 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1483                                                       Custom Tables
1484 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1485 │                                                        │  S1. Including yourself, how many members of this household │
1486 │                                                        │                     are age 16 or older?                    │
1487 │                                                        ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
1488 │                                                        │   1   │   2   │ Subtotal │   5   │   3+4  │  4+5 │ Subtotal │
1489 │                                                        ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1490 │                                                        │ Count │ Count │   Count  │ Count │  Count │ Count│   Count  │
1491 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1492 │105b. How likely is it that drivers who have Almost     │    147│    246│       393│     11│   81.00│    30│        92│
1493 │had too much to drink to drive safely will   certain    │       │       │          │       │        │      │          │
1494 │A. Get stopped by the police?                Very likely│    384│    552│       936│     14│  171.00│    65│       185│
1495 │                                             Somewhat   │    590│   1249│      1839│     20│  265.00│    92│       285│
1496 │                                             likely     │       │       │          │       │        │      │          │
1497 │                                             Somewhat   │    278│    647│       925│      6│  116.00│    38│       122│
1498 │                                             unlikely   │       │       │          │       │        │      │          │
1499 │                                             Very       │    141│    290│       431│      4│   59.00│    22│        63│
1500 │                                             unlikely   │       │       │          │       │        │      │          │
1501 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
1502 ])
1503 AT_CLEANUP
1504
1505 AT_SETUP([CTABLES CLABELS])
1506 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1507 AT_DATA([ctables.sps],
1508 [[GET 'nhtsa.sav'.
1509 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1510 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1511 ]])
1512 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1513                                                       Custom Tables
1514 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1515 │       │                                                 S3a. GENDER:                                                 │
1516 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1517 │       │                         Male                         │                         Female                        │
1518 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1519 │       │  15 or  │ 16 to │ 26 to│ 36 to│ 46 to│ 56 to │ 66 or │   15 or  │ 16 to│ 26 to │ 36 to│ 46 to│ 56 to│  66 or │
1520 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1521 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1522 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1523 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1524 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1525 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1526 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1527
1528                 Custom Tables
1529 ╭──────────────────────────────┬────────────╮
1530 │                              │S3a. GENDER:│
1531 │                              ├────────────┤
1532 │                              │    Count   │
1533 ├──────────────────────────────┼────────────┤
1534 │Age group 15 or younger Male  │           0│
1535 │                        Female│           0│
1536 │         ╶────────────────────┼────────────┤
1537 │          16 to 25      Male  │         594│
1538 │                        Female│         505│
1539 │         ╶────────────────────┼────────────┤
1540 │          26 to 35      Male  │         476│
1541 │                        Female│         491│
1542 │         ╶────────────────────┼────────────┤
1543 │          36 to 45      Male  │         489│
1544 │                        Female│         548│
1545 │         ╶────────────────────┼────────────┤
1546 │          46 to 55      Male  │         526│
1547 │                        Female│         649│
1548 │         ╶────────────────────┼────────────┤
1549 │          56 to 65      Male  │         516│
1550 │                        Female│         731│
1551 │         ╶────────────────────┼────────────┤
1552 │          66 or older   Male  │         531│
1553 │                        Female│         943│
1554 ╰──────────────────────────────┴────────────╯
1555 ])
1556 AT_CLEANUP
1557
1558 AT_SETUP([CTABLES missing values])
1559 AT_DATA([ctables.sps],
1560 [[DATA LIST LIST NOTABLE/x y.
1561 BEGIN DATA.
1562 1 1
1563 1 2
1564 1 3
1565 1 4
1566 1 5
1567 1 .
1568 2 1
1569 2 2
1570 2 3
1571 2 4
1572 2 5
1573 2 .
1574 3 1
1575 3 2
1576 3 3
1577 3 4
1578 3 5
1579 3 .
1580 4 1
1581 4 2
1582 4 3
1583 4 4
1584 4 5
1585 4 .
1586 5 1
1587 5 2
1588 5 3
1589 5 4
1590 5 5
1591 5 .
1592 . 1
1593 . 2
1594 . 3
1595 . 4
1596 . 5
1597 . .
1598 END DATA.
1599 MISSING VALUES x (1, 2) y (2, 3).
1600 VARIABLE LEVEL ALL (NOMINAL).
1601
1602 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1603                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1604     /CATEGORIES VARIABLES=ALL TOTAL=YES.
1605 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1606                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1607     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1608 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1609                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1610     /CATEGORIES VARIABLES=ALL TOTAL=YES
1611     /SLABELS POSITION=ROW.
1612 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1613                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1614     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1615     /SLABELS POSITION=ROW.
1616 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1617                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1618     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
1619     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
1620     /SLABELS POSITION=ROW.
1621 ]])
1622 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1623                                Custom Tables
1624 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1625 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1626 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1627 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1628 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1629 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1630 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
1631 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1632 dnl Note that Column Total N % doesn't add up to 100 because missing
1633 dnl values are included in the total but not shown as a category and this
1634 dnl is expected behavior.
1635
1636                                Custom Tables
1637 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1638 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1639 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1640 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1641 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1642 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1643 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1644 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1645 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
1646 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1647 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1648 dnl values are included in the total but not shown as a category and this
1649 dnl is expected behavior.
1650
1651                      Custom Tables
1652 ╭────────────────────────┬───────────────────────────╮
1653 │                        │             y             │
1654 │                        ├──────┬──────┬──────┬──────┤
1655 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
1656 ├────────────────────────┼──────┼──────┼──────┼──────┤
1657 │x 3.00  Count           │     1│     1│     1│     3│
1658 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1659 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1660 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1661 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1662 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1663 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1664 │        Valid N         │      │      │      │     3│
1665 │        Total N         │      │      │      │     6│
1666 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1667 │  4.00  Count           │     1│     1│     1│     3│
1668 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1669 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1670 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1671 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1672 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1673 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1674 │        Valid N         │      │      │      │     3│
1675 │        Total N         │      │      │      │     6│
1676 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1677 │  5.00  Count           │     1│     1│     1│     3│
1678 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1679 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1680 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1681 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1682 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1683 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1684 │        Valid N         │      │      │      │     3│
1685 │        Total N         │      │      │      │     6│
1686 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1687 │  Total Count           │     3│     3│     3│     9│
1688 │        Column %        │100.0%│100.0%│100.0%│     .│
1689 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
1690 │        Column Total N %│100.0%│100.0%│100.0%│     .│
1691 │        Row %           │     .│     .│     .│     .│
1692 │        Row Valid N %   │     .│     .│     .│     .│
1693 │        Row Total N %   │     .│     .│     .│     .│
1694 │        Valid N         │     3│     3│     3│     9│
1695 │        Total N         │     6│     6│     6│    36│
1696 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1697
1698                             Custom Tables
1699 ╭────────────────────────┬─────────────────────────────────────────╮
1700 │                        │                    y                    │
1701 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
1702 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1703 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1704 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
1705 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1706 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
1707 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1708 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1709 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1710 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1711 │        Valid N         │      │      │      │      │      │     0│
1712 │        Total N         │      │      │      │      │      │     6│
1713 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1714 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
1715 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1716 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
1717 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1718 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1719 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1720 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1721 │        Valid N         │      │      │      │      │      │     0│
1722 │        Total N         │      │      │      │      │      │     6│
1723 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1724 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
1725 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1726 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1727 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1728 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1729 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1730 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1731 │        Valid N         │      │      │      │      │      │     3│
1732 │        Total N         │      │      │      │      │      │     6│
1733 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1734 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
1735 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1736 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1737 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1738 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1739 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1740 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1741 │        Valid N         │      │      │      │      │      │     3│
1742 │        Total N         │      │      │      │      │      │     6│
1743 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1744 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
1745 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1746 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1747 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1748 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1749 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1750 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1751 │        Valid N         │      │      │      │      │      │     3│
1752 │        Total N         │      │      │      │      │      │     6│
1753 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1754 │  Total Count           │     5│     5│     5│     5│     5│    25│
1755 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
1756 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
1757 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
1758 │        Row %           │     .│     .│     .│     .│     .│     .│
1759 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1760 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
1761 │        Valid N         │     3│     0│     0│     3│     3│     9│
1762 │        Total N         │     6│     6│     6│     6│     6│    36│
1763 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
1764
1765                         Custom Tables
1766 ╭────────────────────────┬──────────────────────────────────╮
1767 │                        │                 y                │
1768 │                        ├──────┬──────┬──────┬──────┬──────┤
1769 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1770 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
1771 │x 1.00  Count           │     1│     1│     1│     1│     4│
1772 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1773 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
1774 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1775 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1776 │        Row Valid N %   │     .│     .│     .│     .│     .│
1777 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1778 │        Valid N         │      │      │      │      │     0│
1779 │        Total N         │      │      │      │      │     6│
1780 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1781 │  2.00  Count           │     1│     1│     1│     1│     4│
1782 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1783 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
1784 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1785 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1786 │        Row Valid N %   │     .│     .│     .│     .│     .│
1787 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1788 │        Valid N         │      │      │      │      │     0│
1789 │        Total N         │      │      │      │      │     6│
1790 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1791 │  3.00  Count           │     1│     1│     1│     1│     4│
1792 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1793 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
1794 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1795 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1796 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
1797 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1798 │        Valid N         │      │      │      │      │     3│
1799 │        Total N         │      │      │      │      │     6│
1800 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1801 │  4.00  Count           │     1│     1│     1│     1│     4│
1802 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1803 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
1804 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1805 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1806 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
1807 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1808 │        Valid N         │      │      │      │      │     3│
1809 │        Total N         │      │      │      │      │     6│
1810 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1811 │  Total Count           │     4│     4│     4│     4│    16│
1812 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
1813 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
1814 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
1815 │        Row %           │     .│     .│     .│     .│     .│
1816 │        Row Valid N %   │     .│     .│     .│     .│     .│
1817 │        Row Total N %   │     .│     .│     .│     .│     .│
1818 │        Valid N         │     2│     0│     2│     2│     6│
1819 │        Total N         │     5│     5│     5│     5│    30│
1820 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
1821 ])
1822 AT_CLEANUP
1823
1824 AT_SETUP([CTABLES SMISSING=LISTWISE])
1825 AT_KEYWORDS([SMISSING LISTWISE])
1826 AT_DATA([ctables.sps],
1827 [[DATA LIST LIST NOTABLE/x y z.
1828 BEGIN DATA.
1829 1  . 40
1830 1 10 50
1831 1 20 60
1832 1  .  .
1833 1 30  .
1834 END DATA.
1835 VARIABLE LEVEL x (NOMINAL).
1836
1837 CTABLES /TABLE (y + z) > x.
1838 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
1839
1840 * The following doesn't come out as listwise because the tables are
1841 separate, not linked by an > operator.
1842 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
1843 ]])
1844 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1845   Custom Tables
1846 ╭────────┬─────╮
1847 │        │ Mean│
1848 ├────────┼─────┤
1849 │y x 1.00│20.00│
1850 ├────────┼─────┤
1851 │z x 1.00│50.00│
1852 ╰────────┴─────╯
1853
1854   Custom Tables
1855 ╭────────┬─────╮
1856 │        │ Mean│
1857 ├────────┼─────┤
1858 │y x 1.00│15.00│
1859 ├────────┼─────┤
1860 │z x 1.00│55.00│
1861 ╰────────┴─────╯
1862
1863   Custom Tables
1864 ╭────────┬─────╮
1865 │        │ Mean│
1866 ├────────┼─────┤
1867 │y x 1.00│20.00│
1868 ├────────┼─────┤
1869 │z x 1.00│50.00│
1870 ╰────────┴─────╯
1871 ])
1872 AT_CLEANUP