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