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