more pcompute
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet tested:
4 dnl - Preprocessing to distinguish categorical from scale.
5 dnl - Testing details of missing value handling in summaries.
6 dnl - Test WEIGHT and adjustment weights.
7 dnl - Summary functions:
8 dnl   * Separate summary functions for totals and subtotals.
9 dnl   * )CILEVEL in summary label specification
10 dnl - CATEGORIES:
11 dnl   * Date values
12 dnl   * THRU (numeric ranges)
13 dnl   * OTHERNM
14 dnl - Date/time variables and values
15 dnl - Test PCOMPUTE:
16 dnl   * MISSING, OTHERNM
17 dnl   * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
18 dnl   * dates
19 dnl - Summary functions:
20 dnl   * U-prefix for unweighted summaries.
21 dnl   * areaPCT.SUM and UareaPCT.SUM functions.
22 dnl - SPLIT FILE with SEPARATE splits
23 dnl - Definition of columns/rows when labels are rotated from one axis to another.
24 dnl
25 dnl Not for v1:
26 dnl - Multiple response sets
27 dnl - MRSETS subcommand.
28 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
29 dnl - SIGTEST
30 dnl - COMPARETEST
31 dnl - Summary functions:
32 dnl   * .LCL and .UCL suffixes.
33 dnl   * .SE suffixes.
34 dnl - CATEGORIES:
35 dnl   * Data-dependent sorting.
36
37 AT_SETUP([CTABLES parsing])
38 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
39 AT_DATA([ctables.sps],
40 [[GET 'nhtsa.sav'.
41 CTABLES
42     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
43     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
44     /FORMAT UNITS=CM EMPTY="(-)"
45     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
46     /VLABELS VARIABLES=qn17 DISPLAY=NAME
47     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
48     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
49     /VLABELS VARIABLES=qn20 DISPLAY=NONE
50     /MRSETS COUNTDUPLICATES=NO
51     /MRSETS COUNTDUPLICATES=YES
52     /SMISSING VARIABLE
53     /SMISSING LISTWISE
54     /WEIGHT VARIABLE=qns3a
55     /HIDESMALLCOUNTS
56     /HIDESMALLCOUNTS COUNT=10
57     /TABLE qnsa1
58     /SLABELS POSITION=COLUMN VISIBLE=YES
59     /SLABELS VISIBLE=NO POSITION=ROW
60     /SLABELS POSITION=LAYER
61     /CLABELS AUTO
62     /CLABELS ROWLABELS=OPPOSITE
63     /CRITERIA CILEVEL=50
64     /CATEGORIES VARIABLES=qn1 qn17
65                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
66                 POSITION=BEFORE EMPTY=INCLUDE.
67 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
68 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
69 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
70 ]])
71 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
72          Custom Tables
73 Count
74 ╭───────────────────┬────┬────╮
75 │                   │ RDD│CELL│
76 ├───────────────────┼────┼────┤
77 │Sa1. SAMPLE SOURCE:│5392│1607│
78 ╰───────────────────┴────┴────╯
79
80        Custom Tables
81 RDD
82 ╭───────────────────┬─────╮
83 │                   │Count│
84 ├───────────────────┼─────┤
85 │Sa1. SAMPLE SOURCE:│ 5392│
86 ╰───────────────────┴─────╯
87
88           Custom Tables
89 ╭────────────────────────┬─────╮
90 │                        │Count│
91 ├────────────────────────┼─────┤
92 │Sa1. SAMPLE SOURCE: RDD │ 5392│
93 │                    CELL│ 1607│
94 ╰────────────────────────┴─────╯
95
96           Custom Tables
97 ╭────────────────────────┬─────╮
98 │                        │Count│
99 ├────────────────────────┼─────┤
100 │Sa1. SAMPLE SOURCE: RDD │ 5392│
101 │                    CELL│ 1607│
102 ╰────────────────────────┴─────╯
103 ])
104 AT_CLEANUP
105
106 AT_SETUP([CTABLES parsing - negative])
107 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
108 AT_DATA([ctables.sps],
109 [[GET 'nhtsa.sav'.
110 CTABLES.
111 CTABLES /FORMAT MINCOLWIDTH='foo'.
112 CTABLES /TABLE qn1 [**].
113 CTABLES /TABLE qn1 [NOTAFUNCTION].
114 CTABLES /TABLE (qn1.
115 CTABLES /TABLE **.
116 CTABLES /TABLE NOTAVAR.
117 STRING string(A8).
118 CTABLES /TABLE string[S].
119 CTABLES /TABLE qn1 [PTILE 101].
120 CTABLES /TABLE qn1 [MEAN F0.1].
121 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
122 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
123 CTABLES /TABLE qn1 [MEAN TOTALS].
124 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
127 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
128 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
129 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
130 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
131 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
132 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
133 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
134 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
135 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
136 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
137 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
138 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
142 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
143 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
144 CTABLES /PCOMPUTE &k=EXPR([LO **]).
145 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
146 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
147 CTABLES /PCOMPUTE &k=EXPR([1**]).
148 CTABLES /PCOMPUTE &k=EXPR((1x)).
149 CTABLES /PCOMPUTE **k.
150 CTABLES /PCOMPUTE &1.
151 CTABLES /PCOMPUTE &k**.
152 CTABLES /PCOMPUTE &k=**.
153 CTABLES /PCOMPUTE &k=EXPR**.
154 CTABLES /PCOMPUTE &k=EXPR(1x).
155 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
156 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
157 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
158 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
159 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
160 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
161 CTABLES /FORMAT EMPTY=**.
162 CTABLES /FORMAT MISSING=**.
163 CTABLES /FORMAT **.
164 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
165 CTABLES /VLABELS **.
166 CTABLES /VLABELS VARIABLES=NOTAVAR.
167 CTABLES /VLABELS VARIABLES=qn1 **.
168 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
169 CTABLES /MRSETS **.
170 CTABLES /MRSETS COUNTDUPLICATES=**.
171 CTABLES /SMISSING **.
172 CTABLES /WEIGHT **.
173 CTABLES /WEIGHT VARIABLE=NOTAVAR.
174 CTABLES /HIDESMALLCOUNTS COUNT=1.
175 CTABLES /QUUX.
176 CTABLES /HIDESMALLCOUNTS COUNT=2.
177 CTABLES /TABLE qn1**.
178 CTABLES /TABLE qn1 /SLABELS POSITION=**.
179 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
180 CTABLES /TABLE qn1 /SLABELS **.
181 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
182 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
183 CTABLES /TABLE qn1 /CLABELS **.
184 CTABLES /TABLE qn1 /CRITERIA **.
185 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
186 CTABLES /TABLE qn1 /TITLES **.
187 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
188 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
189 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
190 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
191 CTABLES /TABLE qn1 /SIGTEST **.
192 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
193 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
194 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
195 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
196 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
197 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
198 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
199 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
200 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
201 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
202 CTABLES /TABLE qn1 /COMPARETEST **.
203 CTABLES /TABLE qn1 / **.
204 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
205 CTABLES /TABLE qn20 > qnd1.
206 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
207 NUMERIC datetime (DATETIME17.0).
208 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
209 ]])
210 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
211 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
212
213 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
214 negative number for MINCOLWIDTH.
215
216 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
217 identifier.
218
219 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
220 summary function name.
221
222 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
223
224 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
225 identifier.
226
227 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
228
229 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
230 scale variable.
231    10 | CTABLES /TABLE string[S].
232       |                ^~~~~~~~~
233
234 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
235 between 0 and 100 for PTILE.
236
237 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
238 requires a width between 1 and 40.
239
240 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
241 format NEGPAREN requires width 2 or greater.
242
243 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
244 format NEGPAREN requires width greater than decimals.
245
246 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
247 scale variables.
248    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
249       |                     ^~~~
250
251 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
252    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
253       |                ^~~
254
255 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
256
257 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
258 scale variables.
259    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
260       |                     ^~~~
261
262 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
263    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
264       |                ^~~
265
266 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
267
268 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
269
270 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
271
272 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
273
274 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
275
276 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
277
278 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
279 identifier.
280
281 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
282    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
283       |                                               ^~
284
285 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
286 between 0 and 100 for PTILE.
287
288 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
289 `@:}@'.
290
291 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
292 `@{:@'.
293
294 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
295 or EXCLUDE.
296
297 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
298 NO.
299
300 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
301
302 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
303 or AFTER.
304
305 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
306 or EXCLUDE.
307
308 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
309 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
310
311 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
312 LABEL, POSITION, or EMPTY.
313
314 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
315 integer for SUBTOTAL.
316
317 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
318
319 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
320
321 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
322
323 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
324
325 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
326
327 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
328
329 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
330
331 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
332
333 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
334
335 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
336
337 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
338
339 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
340
341 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
342 the previous definition.
343    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
344       |                               ^~~~~~~~~~~~~~~~~~~
345
346 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
347    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
348       |          ^~~~~~~~~~~~~~~~~~~
349
350 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
351 `/'.
352
353 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
354 Expecting summary function name.
355
356 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
357 between 0 and 100 for PTILE.
358
359 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
360
361 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
362 NO.
363
364 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
365 FORMAT, or HIDESOURCECATS.
366
367 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
368
369 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
370
371 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
372 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
373
374 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
375 MAXCOLWIDTH.
376
377 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
378 VARIABLES.
379
380 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
381
382 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
383 DISPLAY.
384
385 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
386 DEFAULT, NAME, LABEL, BOTH, or NONE.
387
388 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
389 COUNTDUPLICATES.
390
391 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
392 NO.
393
394 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
395 VARIABLE or LISTWISE.
396
397 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
398 VARIABLE.
399
400 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
401
402 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
403 greater for HIDESMALLCOUNTS COUNT.
404
405 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
406 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
407 HIDESMALLCOUNTS, or TABLE.
408
409 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
410 `/'.
411
412 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
413
414 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
415 ROW, or LAYER.
416
417 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
418 NO.
419
420 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
421 POSITION or VISIBLE.
422
423 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
424 OPPOSITE or LAYER.
425
426 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
427 OPPOSITE or LAYER.
428
429 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
430 ROWLABELS, or COLLABELS.
431
432 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
433 CILEVEL.
434
435 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
436 in @<:@0,100@:}@ for CILEVEL.
437
438 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
439 CAPTION, CORNER, or TITLE.
440
441 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
442 CHISQUARE.
443
444 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
445 in @<:@0,1@:}@ for ALPHA.
446
447 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
448 NO.
449
450 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
451 ALLVISIBLE or SUBTOTALS.
452
453 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
454 ALPHA, INCLUDEMRSETS, or CATEGORIES.
455
456 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
457 MEAN.
458
459 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
460 in (0,1) for ALPHA.
461
462 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
463 for ALPHA.
464
465 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
466 BONFERRONI, BH, or NONE.
467
468 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
469 NO.
470
471 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
472 or TESTEDCATS.
473
474 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
475 ALLVISIBLE or SUBTOTALS.
476
477 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
478 NO.
479
480 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
481 SIMPLE.
482
483 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
484 NO.
485
486 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
487 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
488 SHOWSIG.
489
490 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
491 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
492
493 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
494 specified.
495
496 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
497    97 | CTABLES /TABLE qn20 > qnd1.
498       |                ^~~~~~~~~~~
499
500 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
501    97 | CTABLES /TABLE qn20 > qnd1.
502       |                ^~~~
503
504 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
505    97 | CTABLES /TABLE qn20 > qnd1.
506       |                       ^~~~
507
508 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
509 categorical variables at the innermost nesting level.
510    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
511       |                ^~~~~~~~~~~~~~~~~~~~
512
513 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
514 summary.
515    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
516       |                ^~~
517
518 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
519 specification as format DATETIME: Day (123) must be between 1 and 31..
520   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
521       |                                                    ^~~~~
522 ]])
523 AT_CLEANUP
524
525 AT_SETUP([CTABLES parsing - more negative])
526 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
527 AT_DATA([ctables.sps],
528 [[GET 'nhtsa.sav'.
529 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
530 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
531 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
532
533 STRING string(A8).
534 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
535 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
536
537 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
538
539 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
540 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
541 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
542 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
543
544 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
545 CTABLES /PCOMPUTE &x=EXPR([**]).
546 CTABLES /PCOMPUTE &x=EXPR(**).
547
548 CTABLES /TABLE.
549
550 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
551 ]])
552 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
553 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
554 category not included in the category list.
555     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
556 VARIABLES=qn1 [&pc].
557       |
558 ^~~
559
560 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
561     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
562 VARIABLES=qn1 [&pc].
563       |                            ^~~~~~~~
564
565 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
566 list of categories here.
567     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
568 VARIABLES=qn1 [&pc].
569       |
570 ^~~~
571
572 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
573 category not included in the category list.
574     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
575 [&pc].
576       |
577 ^~~
578
579 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
580     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
581 [&pc].
582       |                            ^~~~~
583
584 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
585 variable's CATEGORIES specification.
586
587 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
588 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
589 subtotals by position, e.g. SUBTOTAL[1].
590     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
591 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
592       |
593 ^~~~~~~~~~~~~~~~~~~~~~~~
594
595 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
596 position.
597     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
598 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
599       |                            ^~~~~~~~
600
601 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
602 applied only to string variables, but this subcommand tries to apply it to
603 numeric variable QN1.
604     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
605       |                                               ^~~~~~~~
606
607 ctables.sps:8.53: error: CTABLES: This category specification may be applied
608 only to numeric variables, but this subcommand tries to apply it to string
609 variable string.
610     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
611       |                                                     ^
612
613 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
614 based on a summary function.
615
616 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
617 moved to be categorical, but qnd1 is a scale variable.
618
619 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
620 moved to have the same width, but QN1 has width 0 and string has width 8.
621
622 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
623 moved to have the same value labels, but QN1 and QNSA1 have different value
624 labels.
625
626 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
627 moved to have the same category specifications, but QN105BA and QN105BB have
628 different category specifications.
629
630 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
631 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
632 this warning, insert parentheses.
633    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
634       |                           ^~~~~~~
635
636 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
637 `/'.
638
639 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
640
641 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
642
643 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
644 variable must be specified.
645
646 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
647
648 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
649 summary.
650    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
651       |                                                  ^~~~~
652
653 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
654 summary.
655    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
656       |                ^~~~~
657
658 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
659 summary.
660    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
661       |                                 ^~~~~
662
663 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
664 has a summary even if the syntax does not explicitly specify one.
665    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
666       |                                 ^~~~~
667 ]])
668 AT_CLEANUP
669
670 AT_SETUP([CTABLES one categorical variable])
671 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
672 AT_DATA([ctables.sps],
673 [[GET 'nhtsa.sav'.
674 CTABLES /TABLE qn1.
675 CTABLES /TABLE BY qn1.
676 CTABLES /TABLE BY BY qn1.
677 ]])
678 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
679                                   Custom Tables
680 ╭────────────────────────────────────────────────────────────────────────┬─────╮
681 │                                                                        │Count│
682 ├────────────────────────────────────────────────────────────────────────┼─────┤
683 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
684 │motor vehicle?                                     Several days a week  │ 1274│
685 │                                                   Once a week or less  │  361│
686 │                                                   Only certain times a │  130│
687 │                                                   year                 │     │
688 │                                                   Never                │  540│
689 ╰────────────────────────────────────────────────────────────────────────┴─────╯
690
691                                   Custom Tables
692 ╭──────────────────────────────────────────────────────────────────────────────╮
693 │        1. How often do you usually drive a car or other motor vehicle?       │
694 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
695 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
696 │Every day│       week       │       less       │          year          │Never│
697 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
698 │  Count  │       Count      │       Count      │          Count         │Count│
699 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
700 │     4667│              1274│               361│                     130│  540│
701 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
702
703 Custom Tables
704 Every day
705 ╭─────╮
706 │Count│
707 ├─────┤
708 │ 4667│
709 ╰─────╯
710 ])
711 AT_CLEANUP
712
713 AT_SETUP([CTABLES one string variable])
714 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
715 AT_DATA([ctables.sps],
716 [[GET 'nhtsa.sav'.
717 STRING licensed(A8).
718 MISSING VALUES licensed('DontKnow', 'Refused').
719 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
720 CTABLES /TABLE licensed.
721 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
722 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
723 * Notice that the string matching is case-sensitive.
724 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
725 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
726 CTABLES
727     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
728     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
729     /TABLE licensed
730     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
731 CTABLES
732     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
733     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
734     /TABLE licensed
735     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
736 ]])
737 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
738     Custom Tables
739 ╭────────────┬─────╮
740 │            │Count│
741 ├────────────┼─────┤
742 │licensed No │  572│
743 │         Yes│ 6379│
744 ╰────────────┴─────╯
745
746           Custom Tables
747 ╭─────────────────┬─────┬───────╮
748 │                 │Count│Valid N│
749 ├─────────────────┼─────┼───────┤
750 │licensed DontKnow│    4│       │
751 │         No      │  572│       │
752 │         Refused │   44│       │
753 │         Yes     │ 6379│       │
754 │         Total   │ 6999│   6951│
755 ╰─────────────────┴─────┴───────╯
756
757      Custom Tables
758 ╭──────────────┬─────╮
759 │              │Count│
760 ├──────────────┼─────┤
761 │licensed Yes  │ 6379│
762 │         No   │  572│
763 │         Total│ 6951│
764 ╰──────────────┴─────╯
765
766      Custom Tables
767 ╭──────────────┬─────╮
768 │              │Count│
769 ├──────────────┼─────┤
770 │licensed Yes  │ 6379│
771 │         no   │    0│
772 │         Total│ 6379│
773 ╰──────────────┴─────╯
774
775       Custom Tables
776 ╭────────────────┬─────╮
777 │                │Count│
778 ├────────────────┼─────┤
779 │licensed No     │  572│
780 │         Refused│   44│
781 │         Yes    │ 6379│
782 │         Total  │ 6995│
783 ╰────────────────┴─────╯
784
785       Custom Tables
786 ╭────────────────┬─────╮
787 │                │Count│
788 ├────────────────┼─────┤
789 │licensed Yes    │ 6379│
790 │         Not Yes│  620│
791 ╰────────────────┴─────╯
792
793       Custom Tables
794 ╭────────────────┬─────╮
795 │                │Count│
796 ├────────────────┼─────┤
797 │licensed Yes    │ 6379│
798 │         Not Yes│  620│
799 ╰────────────────┴─────╯
800 ])
801 AT_CLEANUP
802
803 AT_SETUP([CTABLES one scale variable])
804 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
805 AT_DATA([ctables.sps],
806 [[GET 'nhtsa.sav'.
807 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
808 CTABLES /TABLE BY qnd1.
809 CTABLES /TABLE BY BY qnd1.
810 ]])
811 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
812                                   Custom Tables
813 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
814 │                      │     │       │       │    │     Std    │       │       │
815 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
816 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
817 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
818 │age?                  │     │       │       │    │            │       │       │
819 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
820
821         Custom Tables
822 ╭──────────────────────────╮
823 │D1. AGE: What is your age?│
824 ├──────────────────────────┤
825 │           Mean           │
826 ├──────────────────────────┤
827 │                        48│
828 ╰──────────────────────────╯
829
830 Custom Tables
831 D1. AGE: What is your age?
832 ╭────╮
833 │Mean│
834 ├────┤
835 │  48│
836 ╰────╯
837 ])
838 AT_CLEANUP
839
840 AT_SETUP([CTABLES simple stacking])
841 AT_KEYWORDS([stack stacked])
842 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
843 AT_DATA([ctables.sps],
844 [[GET 'nhtsa.sav'.
845 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
846 ]])
847 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
848                                   Custom Tables
849 ╭───────────────────────────────────────────────────────────────┬──────────────╮
850 │                                                               │ S3a. GENDER: │
851 │                                                               ├──────┬───────┤
852 │                                                               │ Male │ Female│
853 │                                                               ├──────┼───────┤
854 │                                                               │Column│ Column│
855 │                                                               │   %  │   %   │
856 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
857 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
858 │too much to drink to drive safely will A. Get      certain     │      │       │
859 │stopped by the police?                             Very likely │   21%│    22%│
860 │                                                   Somewhat    │   38%│    42%│
861 │                                                   likely      │      │       │
862 │                                                   Somewhat    │   21%│    18%│
863 │                                                   unlikely    │      │       │
864 │                                                   Very        │   10%│     8%│
865 │                                                   unlikely    │      │       │
866 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
867 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
868 │too much to drink to drive safely will B. Have an  certain     │      │       │
869 │accident?                                          Very likely │   36%│    45%│
870 │                                                   Somewhat    │   39%│    32%│
871 │                                                   likely      │      │       │
872 │                                                   Somewhat    │    9%│     4%│
873 │                                                   unlikely    │      │       │
874 │                                                   Very        │    3%│     2%│
875 │                                                   unlikely    │      │       │
876 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
877 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
878 │too much to drink to drive safely will C. Be       certain     │      │       │
879 │convicted for drunk driving?                       Very likely │   32%│    28%│
880 │                                                   Somewhat    │   27%│    32%│
881 │                                                   likely      │      │       │
882 │                                                   Somewhat    │   15%│    15%│
883 │                                                   unlikely    │      │       │
884 │                                                   Very        │    9%│     9%│
885 │                                                   unlikely    │      │       │
886 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
887 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
888 │too much to drink to drive safely will D. Be       certain     │      │       │
889 │arrested for drunk driving?                        Very likely │   26%│    27%│
890 │                                                   Somewhat    │   32%│    35%│
891 │                                                   likely      │      │       │
892 │                                                   Somewhat    │   17%│    15%│
893 │                                                   unlikely    │      │       │
894 │                                                   Very        │    9%│     7%│
895 │                                                   unlikely    │      │       │
896 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
897 ])
898 AT_CLEANUP
899
900 AT_SETUP([CTABLES show or hide empty categories])
901 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
902 AT_DATA([ctables.sps],
903 [[GET 'nhtsa.sav'.
904 IF (qn105ba = 2) qn105ba = 1.
905 IF (qns3a = 1) qns3a = 2.
906 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
907 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
908     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
909 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
910     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
911 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
912     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
913 ]])
914 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
915                                   Custom Tables
916 ╭──────────────────────────────────────────────────────────────┬───────────────╮
917 │                                                              │  S3a. GENDER: │
918 │                                                              ├───────┬───────┤
919 │                                                              │  Male │ Female│
920 │                                                              ├───────┼───────┤
921 │                                                              │ Column│ Column│
922 │                                                              │   %   │   %   │
923 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
924 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
925 │too much to drink to drive safely will A. Get      certain    │       │       │
926 │stopped by the police?                             Very likely│      .│     0%│
927 │                                                   Somewhat   │      .│    40%│
928 │                                                   likely     │       │       │
929 │                                                   Somewhat   │      .│    19%│
930 │                                                   unlikely   │       │       │
931 │                                                   Very       │      .│     9%│
932 │                                                   unlikely   │       │       │
933 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
934
935                                   Custom Tables
936 ╭──────────────────────────────────────────────────────────────┬───────────────╮
937 │                                                              │  S3a. GENDER: │
938 │                                                              ├───────┬───────┤
939 │                                                              │  Male │ Female│
940 │                                                              ├───────┼───────┤
941 │                                                              │ Column│ Column│
942 │                                                              │   %   │   %   │
943 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
944 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
945 │too much to drink to drive safely will A. Get      certain    │       │       │
946 │stopped by the police?                             Somewhat   │      .│    40%│
947 │                                                   likely     │       │       │
948 │                                                   Somewhat   │      .│    19%│
949 │                                                   unlikely   │       │       │
950 │                                                   Very       │      .│     9%│
951 │                                                   unlikely   │       │       │
952 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
953
954                                   Custom Tables
955 ╭────────────────────────────────────────────────────────────────────┬─────────╮
956 │                                                                    │   S3a.  │
957 │                                                                    │ GENDER: │
958 │                                                                    ├─────────┤
959 │                                                                    │  Female │
960 │                                                                    ├─────────┤
961 │                                                                    │ Column %│
962 ├────────────────────────────────────────────────────────────────────┼─────────┤
963 │105b. How likely is it that drivers who have had too    Almost      │      32%│
964 │much to drink to drive safely will A. Get stopped by    certain     │         │
965 │the police?                                             Very likely │       0%│
966 │                                                        Somewhat    │      40%│
967 │                                                        likely      │         │
968 │                                                        Somewhat    │      19%│
969 │                                                        unlikely    │         │
970 │                                                        Very        │       9%│
971 │                                                        unlikely    │         │
972 ╰────────────────────────────────────────────────────────────────────┴─────────╯
973
974                                   Custom Tables
975 ╭────────────────────────────────────────────────────────────────────┬─────────╮
976 │                                                                    │   S3a.  │
977 │                                                                    │ GENDER: │
978 │                                                                    ├─────────┤
979 │                                                                    │  Female │
980 │                                                                    ├─────────┤
981 │                                                                    │ Column %│
982 ├────────────────────────────────────────────────────────────────────┼─────────┤
983 │105b. How likely is it that drivers who have had too    Almost      │      32%│
984 │much to drink to drive safely will A. Get stopped by    certain     │         │
985 │the police?                                             Somewhat    │      40%│
986 │                                                        likely      │         │
987 │                                                        Somewhat    │      19%│
988 │                                                        unlikely    │         │
989 │                                                        Very        │       9%│
990 │                                                        unlikely    │         │
991 ╰────────────────────────────────────────────────────────────────────┴─────────╯
992 ])
993 AT_CLEANUP
994
995 AT_SETUP([CTABLES sorting categories])
996 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
997 AT_DATA([ctables.sps],
998 [[GET 'nhtsa.sav'.
999 IF (QND5A=6) QND5A=-1.
1000 IF (QND5A=5) QND5A=-2.
1001 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1002         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1003         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1004         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1005 ]])
1006 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1007                                   Custom Tables
1008 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1009 │                                                                        │Count│
1010 ├────────────────────────────────────────────────────────────────────────┼─────┤
1011 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1012 │background?                                     -1.00                   │   78│
1013 │                                                Cuban                   │   20│
1014 │                                                Mexican                 │  311│
1015 │                                                Spanish                 │   48│
1016 │                                                South American          │   34│
1017 │                                                Central American        │    0│
1018 │                                                Puerto Rican, OR        │    0│
1019 │                                                Something else          │   68│
1020 │                                                Multiple - cannot choose│    7│
1021 │                                                one                     │     │
1022 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1023
1024                                   Custom Tables
1025 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1026 │                                                                        │Count│
1027 ├────────────────────────────────────────────────────────────────────────┼─────┤
1028 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1029 │background?                                     one                     │     │
1030 │                                                Something else          │   68│
1031 │                                                Puerto Rican, OR        │    0│
1032 │                                                Central American        │    0│
1033 │                                                South American          │   34│
1034 │                                                Spanish                 │   48│
1035 │                                                Mexican                 │  311│
1036 │                                                Cuban                   │   20│
1037 │                                                -1.00                   │   78│
1038 │                                                -2.00                   │   52│
1039 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1040
1041                                   Custom Tables
1042 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1043 │                                                                        │Count│
1044 ├────────────────────────────────────────────────────────────────────────┼─────┤
1045 │D5a. What would you say is your primary ethnic  Central American        │    0│
1046 │background?                                     Cuban                   │   20│
1047 │                                                Mexican                 │  311│
1048 │                                                Multiple - cannot choose│    7│
1049 │                                                one                     │     │
1050 │                                                Puerto Rican, OR        │    0│
1051 │                                                Something else          │   68│
1052 │                                                South American          │   34│
1053 │                                                Spanish                 │   48│
1054 │                                                -2.00                   │   52│
1055 │                                                -1.00                   │   78│
1056 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1057
1058                                   Custom Tables
1059 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1060 │                                                                        │Count│
1061 ├────────────────────────────────────────────────────────────────────────┼─────┤
1062 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1063 │background?                                     South American          │   34│
1064 │                                                Something else          │   68│
1065 │                                                Puerto Rican, OR        │    0│
1066 │                                                Multiple - cannot choose│    7│
1067 │                                                one                     │     │
1068 │                                                Mexican                 │  311│
1069 │                                                Cuban                   │   20│
1070 │                                                Central American        │    0│
1071 │                                                -1.00                   │   78│
1072 │                                                -2.00                   │   52│
1073 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1074 ])
1075 AT_CLEANUP
1076
1077 AT_SETUP([CTABLES simple nesting])
1078 AT_KEYWORDS([nest nested])
1079 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1080 AT_DATA([ctables.sps],
1081 [[GET 'nhtsa.sav'.
1082 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1083   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1084 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1085   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1086   /CLABELS ROW=OPPOSITE.
1087 ]])
1088 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1089                                   Custom Tables
1090 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1091 │                                                                 │     │ Table│
1092 │                                                                 │Count│   %  │
1093 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1094 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1095 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1096 │drive safely will A. Get stopped by                        Total │  700│   10%│
1097 │the police?                           ╶──────────────────────────┼─────┼──────┤
1098 │                                       Very       S3a.     Male  │  660│   10%│
1099 │                                       likely     GENDER:  Female│  842│   12%│
1100 │                                                           Total │ 1502│   22%│
1101 │                                      ╶──────────────────────────┼─────┼──────┤
1102 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1103 │                                       likely     GENDER:  Female│ 1589│   23%│
1104 │                                                           Total │ 2763│   40%│
1105 │                                      ╶──────────────────────────┼─────┼──────┤
1106 │                                       Somewhat   S3a.     Male  │  640│    9%│
1107 │                                       unlikely   GENDER:  Female│  667│   10%│
1108 │                                                           Total │ 1307│   19%│
1109 │                                      ╶──────────────────────────┼─────┼──────┤
1110 │                                       Very       S3a.     Male  │  311│    5%│
1111 │                                       unlikely   GENDER:  Female│  298│    4%│
1112 │                                                           Total │  609│    9%│
1113 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1114 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1115 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1116 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1117 │                                      ╶──────────────────────────┼─────┼──────┤
1118 │                                       Very       S3a.     Male  │ 1104│   16%│
1119 │                                       likely     GENDER:  Female│ 1715│   25%│
1120 │                                                           Total │ 2819│   41%│
1121 │                                      ╶──────────────────────────┼─────┼──────┤
1122 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1123 │                                       likely     GENDER:  Female│ 1214│   18%│
1124 │                                                           Total │ 2417│   35%│
1125 │                                      ╶──────────────────────────┼─────┼──────┤
1126 │                                       Somewhat   S3a.     Male  │  262│    4%│
1127 │                                       unlikely   GENDER:  Female│  168│    2%│
1128 │                                                           Total │  430│    6%│
1129 │                                      ╶──────────────────────────┼─────┼──────┤
1130 │                                       Very       S3a.     Male  │   81│    1%│
1131 │                                       unlikely   GENDER:  Female│   59│    1%│
1132 │                                                           Total │  140│    2%│
1133 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1134 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1135 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1136 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1137 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1138 │                                       Very       S3a.     Male  │  988│   14%│
1139 │                                       likely     GENDER:  Female│ 1049│   15%│
1140 │                                                           Total │ 2037│   30%│
1141 │                                      ╶──────────────────────────┼─────┼──────┤
1142 │                                       Somewhat   S3a.     Male  │  822│   12%│
1143 │                                       likely     GENDER:  Female│ 1210│   18%│
1144 │                                                           Total │ 2032│   30%│
1145 │                                      ╶──────────────────────────┼─────┼──────┤
1146 │                                       Somewhat   S3a.     Male  │  446│    7%│
1147 │                                       unlikely   GENDER:  Female│  548│    8%│
1148 │                                                           Total │  994│   15%│
1149 │                                      ╶──────────────────────────┼─────┼──────┤
1150 │                                       Very       S3a.     Male  │  268│    4%│
1151 │                                       unlikely   GENDER:  Female│  354│    5%│
1152 │                                                           Total │  622│    9%│
1153 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1154 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1155 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1156 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1157 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1158 │                                       Very       S3a.     Male  │  805│   12%│
1159 │                                       likely     GENDER:  Female│ 1029│   15%│
1160 │                                                           Total │ 1834│   27%│
1161 │                                      ╶──────────────────────────┼─────┼──────┤
1162 │                                       Somewhat   S3a.     Male  │  975│   14%│
1163 │                                       likely     GENDER:  Female│ 1332│   19%│
1164 │                                                           Total │ 2307│   34%│
1165 │                                      ╶──────────────────────────┼─────┼──────┤
1166 │                                       Somewhat   S3a.     Male  │  535│    8%│
1167 │                                       unlikely   GENDER:  Female│  560│    8%│
1168 │                                                           Total │ 1095│   16%│
1169 │                                      ╶──────────────────────────┼─────┼──────┤
1170 │                                       Very       S3a.     Male  │  270│    4%│
1171 │                                       unlikely   GENDER:  Female│  279│    4%│
1172 │                                                           Total │  549│    8%│
1173 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1174
1175                                   Custom Tables
1176 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1177 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1178 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1179 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1180 │                                 │        │ Table│         │         │        │
1181 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1182 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1183 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1184 │GENDER:        is it that drivers│        │      │         │         │        │
1185 │               who have had too  │        │      │         │         │        │
1186 │               much to drink to  │        │      │         │         │        │
1187 │               drive safely will │        │      │         │         │        │
1188 │               A. Get stopped by │        │      │         │         │        │
1189 │               the police?       │        │      │         │         │        │
1190 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1191 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1192 │               is it that drivers│        │      │         │         │        │
1193 │               who have had too  │        │      │         │         │        │
1194 │               much to drink to  │        │      │         │         │        │
1195 │               drive safely will │        │      │         │         │        │
1196 │               A. Get stopped by │        │      │         │         │        │
1197 │               the police?       │        │      │         │         │        │
1198 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1199 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1200 │               is it that drivers│        │      │         │         │        │
1201 │               who have had too  │        │      │         │         │        │
1202 │               much to drink to  │        │      │         │         │        │
1203 │               drive safely will │        │      │         │         │        │
1204 │               A. Get stopped by │        │      │         │         │        │
1205 │               the police?       │        │      │         │         │        │
1206 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1207 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1208 │GENDER:        is it that drivers│        │      │         │         │        │
1209 │               who have had too  │        │      │         │         │        │
1210 │               much to drink to  │        │      │         │         │        │
1211 │               drive safely will │        │      │         │         │        │
1212 │               B. Have an        │        │      │         │         │        │
1213 │               accident?         │        │      │         │         │        │
1214 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1215 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1216 │               is it that drivers│        │      │         │         │        │
1217 │               who have had too  │        │      │         │         │        │
1218 │               much to drink to  │        │      │         │         │        │
1219 │               drive safely will │        │      │         │         │        │
1220 │               B. Have an        │        │      │         │         │        │
1221 │               accident?         │        │      │         │         │        │
1222 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1223 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1224 │               is it that drivers│        │      │         │         │        │
1225 │               who have had too  │        │      │         │         │        │
1226 │               much to drink to  │        │      │         │         │        │
1227 │               drive safely will │        │      │         │         │        │
1228 │               B. Have an        │        │      │         │         │        │
1229 │               accident?         │        │      │         │         │        │
1230 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1231 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1232 │GENDER:        is it that drivers│        │      │         │         │        │
1233 │               who have had too  │        │      │         │         │        │
1234 │               much to drink to  │        │      │         │         │        │
1235 │               drive safely will │        │      │         │         │        │
1236 │               C. Be convicted   │        │      │         │         │        │
1237 │               for drunk driving?│        │      │         │         │        │
1238 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1239 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1240 │               is it that drivers│        │      │         │         │        │
1241 │               who have had too  │        │      │         │         │        │
1242 │               much to drink to  │        │      │         │         │        │
1243 │               drive safely will │        │      │         │         │        │
1244 │               C. Be convicted   │        │      │         │         │        │
1245 │               for drunk driving?│        │      │         │         │        │
1246 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1247 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1248 │               is it that drivers│        │      │         │         │        │
1249 │               who have had too  │        │      │         │         │        │
1250 │               much to drink to  │        │      │         │         │        │
1251 │               drive safely will │        │      │         │         │        │
1252 │               C. Be convicted   │        │      │         │         │        │
1253 │               for drunk driving?│        │      │         │         │        │
1254 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1255 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1256 │GENDER:        is it that drivers│        │      │         │         │        │
1257 │               who have had too  │        │      │         │         │        │
1258 │               much to drink to  │        │      │         │         │        │
1259 │               drive safely will │        │      │         │         │        │
1260 │               D. Be arrested for│        │      │         │         │        │
1261 │               drunk driving?    │        │      │         │         │        │
1262 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1263 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1264 │               is it that drivers│        │      │         │         │        │
1265 │               who have had too  │        │      │         │         │        │
1266 │               much to drink to  │        │      │         │         │        │
1267 │               drive safely will │        │      │         │         │        │
1268 │               D. Be arrested for│        │      │         │         │        │
1269 │               drunk driving?    │        │      │         │         │        │
1270 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1271 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1272 │               is it that drivers│        │      │         │         │        │
1273 │               who have had too  │        │      │         │         │        │
1274 │               much to drink to  │        │      │         │         │        │
1275 │               drive safely will │        │      │         │         │        │
1276 │               D. Be arrested for│        │      │         │         │        │
1277 │               drunk driving?    │        │      │         │         │        │
1278 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1279 ])
1280 AT_CLEANUP
1281
1282 AT_SETUP([CTABLES nesting and scale variables])
1283 AT_KEYWORDS([nest nested])
1284 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1285 AT_DATA([ctables.sps],
1286 [[GET 'nhtsa.sav'.
1287 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1288 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1289 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1290   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1291 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1292 ]])
1293 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1294                                   Custom Tables
1295 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1296 │                                                                 │S3a. GENDER:│
1297 │                                                                 ├─────┬──────┤
1298 │                                                                 │ Male│Female│
1299 │                                                                 ├─────┼──────┤
1300 │                                                                 │ Mean│ Mean │
1301 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1302 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1303 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1304 │                                                  week           │     │      │
1305 │                                                  Once a week or │   44│    54│
1306 │                                                  less           │     │      │
1307 │                                                  Only certain   │   34│    41│
1308 │                                                  times a year   │     │      │
1309 │                                                  Never          │   39│    55│
1310 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1311
1312                                   Custom Tables
1313 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1314 │                                                         │Minimum│Maximum│Mean│
1315 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1316 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1317 │What is  GENDER:         months, has there been a        │       │       │    │
1318 │your                     time when you felt you          │       │       │    │
1319 │age?                     should cut down on your      No │     16│     86│  46│
1320 │                         drinking?                       │       │       │    │
1321 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1322 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1323 │                         months, has there been a        │       │       │    │
1324 │                         time when you felt you          │       │       │    │
1325 │                         should cut down on your      No │     16│     86│  48│
1326 │                         drinking?                       │       │       │    │
1327 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1328 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1329 │What is  GENDER:         months, has there been a        │       │       │    │
1330 │your                     time when people criticized  No │     16│     86│  46│
1331 │age?                     your drinking?                  │       │       │    │
1332 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1333 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1334 │                         months, has there been a        │       │       │    │
1335 │                         time when people criticized  No │     16│     86│  48│
1336 │                         your drinking?                  │       │       │    │
1337 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1338
1339                                   Custom Tables
1340 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1341 │                             │S1. Including yourself, how many members of this│
1342 │                             │         household are age 16 or older?         │
1343 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1344 │                             │      │      │      │      │      │      │ 6 or │
1345 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1346 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1347 │                             │Column│Column│Column│Column│Column│Column│Column│
1348 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1349 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1350 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1351 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1352 │SOURCE:     likely           │      │      │      │      │      │      │      │
1353 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1354 │            that     likely  │      │      │      │      │      │      │      │
1355 │            drivers          │      │      │      │      │      │      │      │
1356 │            who have         │      │      │      │      │      │      │      │
1357 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1358 │            much to  likely  │      │      │      │      │      │      │      │
1359 │            drink to         │      │      │      │      │      │      │      │
1360 │            drive            │      │      │      │      │      │      │      │
1361 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1362 │            will A.  unlikely│      │      │      │      │      │      │      │
1363 │            Get              │      │      │      │      │      │      │      │
1364 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1365 │            by the   unlikely│      │      │      │      │      │      │      │
1366 │            police?          │      │      │      │      │      │      │      │
1367 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1368
1369                                   Custom Tables
1370 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1371 │                                                              │    │    Std   │
1372 │                                                              │Mean│ Deviation│
1373 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1374 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1375 │group           typical month did you have one or more        │    │          │
1376 │                alcoholic beverages to drink?                 │    │          │
1377 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1378 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1379 │                typical month did you have one or more        │    │          │
1380 │                alcoholic beverages to drink?                 │    │          │
1381 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1382 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1383 │                typical month did you have one or more        │    │          │
1384 │                alcoholic beverages to drink?                 │    │          │
1385 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1386 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1387 │                typical month did you have one or more        │    │          │
1388 │                alcoholic beverages to drink?                 │    │          │
1389 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1390 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1391 │                typical month did you have one or more        │    │          │
1392 │                alcoholic beverages to drink?                 │    │          │
1393 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1394 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1395 │       older    typical month did you have one or more        │    │          │
1396 │                alcoholic beverages to drink?                 │    │          │
1397 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1398 ])
1399 AT_CLEANUP
1400
1401
1402 AT_SETUP([CTABLES SLABELS])
1403 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1404 AT_DATA([ctables.sps],
1405 [[GET 'nhtsa.sav'.
1406 CTABLES /TABLE qn1 [COUNT COLPCT].
1407 CTABLES /TABLE qn1 [COUNT COLPCT]
1408     /SLABELS POSITION=ROW.
1409 CTABLES /TABLE qn1 [COUNT COLPCT]
1410     /SLABELS POSITION=ROW VISIBLE=NO.
1411 ]])
1412 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1413                                   Custom Tables
1414 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1415 │                                                                │     │ Column│
1416 │                                                                │Count│   %   │
1417 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1418 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1419 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1420 │                                             Once a week or less│  361│   5.2%│
1421 │                                             Only certain times │  130│   1.9%│
1422 │                                             a year             │     │       │
1423 │                                             Never              │  540│   7.7%│
1424 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1425
1426                                   Custom Tables
1427 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1428 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1429 │other motor vehicle?                                             Column │66.9%│
1430 │                                                                 %      │     │
1431 │                                            ╶───────────────────────────┼─────┤
1432 │                                             Several days a week Count  │ 1274│
1433 │                                                                 Column │18.3%│
1434 │                                                                 %      │     │
1435 │                                            ╶───────────────────────────┼─────┤
1436 │                                             Once a week or less Count  │  361│
1437 │                                                                 Column │ 5.2%│
1438 │                                                                 %      │     │
1439 │                                            ╶───────────────────────────┼─────┤
1440 │                                             Only certain times  Count  │  130│
1441 │                                             a year              Column │ 1.9%│
1442 │                                                                 %      │     │
1443 │                                            ╶───────────────────────────┼─────┤
1444 │                                             Never               Count  │  540│
1445 │                                                                 Column │ 7.7%│
1446 │                                                                 %      │     │
1447 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1448
1449                                   Custom Tables
1450 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1451 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1452 │motor vehicle?                                                          │66.9%│
1453 │                                                   Several days a week  │ 1274│
1454 │                                                                        │18.3%│
1455 │                                                   Once a week or less  │  361│
1456 │                                                                        │ 5.2%│
1457 │                                                   Only certain times a │  130│
1458 │                                                   year                 │ 1.9%│
1459 │                                                   Never                │  540│
1460 │                                                                        │ 7.7%│
1461 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1462 ])
1463 AT_CLEANUP
1464
1465 AT_SETUP([CTABLES simple totals])
1466 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1467 AT_DATA([ctables.sps],
1468 [[GET 'nhtsa.sav'.
1469 CTABLES /TABLE=qn17
1470     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1471 DESCRIPTIVES qn18/STATISTICS=MEAN.
1472 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1473     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1474 ]])
1475 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1476                                   Custom Tables
1477 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1478 │                                                                        │Count│
1479 ├────────────────────────────────────────────────────────────────────────┼─────┤
1480 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1481 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1482 │                                                      Light beer        │  620│
1483 │                                                      Wine              │ 1418│
1484 │                                                      Wine coolers      │  137│
1485 │                                                      Hard liquor or    │  888│
1486 │                                                      mixed drinks      │     │
1487 │                                                      Flavored malt     │   83│
1488 │                                                      drinks            │     │
1489 │                                                      Number responding │ 4221│
1490 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1491
1492                              Descriptive Statistics
1493 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1494 │                                                                    │  N │Mean│
1495 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1496 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1497 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1498 │Valid N (listwise)                                                  │6999│    │
1499 │Missing N (listwise)                                                │2781│    │
1500 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1501
1502                                   Custom Tables
1503 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1504 │                                                      │    │     │ Valid│Total│
1505 │                                                      │Mean│Count│   N  │  N  │
1506 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1507 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1508 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1509 │                you usually drink per sitting?        │    │     │      │     │
1510 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1511 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1512 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1513 │                you usually drink per sitting?        │    │     │      │     │
1514 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1515 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1516 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1517 │                you usually drink per sitting?        │    │     │      │     │
1518 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1519 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1520 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1521 │                you usually drink per sitting?        │    │     │      │     │
1522 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1523 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1524 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1525 │                you usually drink per sitting?        │    │     │      │     │
1526 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1527 ])
1528 AT_CLEANUP
1529
1530 AT_SETUP([CTABLES subtotals])
1531 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1532 AT_DATA([ctables.sps],
1533 [[GET 'nhtsa.sav'.
1534 CTABLES /TABLE=qn105ba BY qns1
1535     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1536 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1537     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1538 CTABLES /TABLE=qn105ba BY qns1
1539     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1540     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1541 ]])
1542 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1543                                                       Custom Tables
1544 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1545 │                                                         │ S1. Including yourself, how many members of this household │
1546 │                                                         │                    are age 16 or older?                    │
1547 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1548 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1549 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1550 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1551 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1552 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1553 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1554 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1555 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1556 │                                              likely     │       │       │         │       │        │      │          │
1557 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1558 │                                              unlikely   │       │       │         │       │        │      │          │
1559 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1560 │                                              unlikely   │       │       │         │       │        │      │          │
1561 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1562
1563                                                       Custom Tables
1564 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1565 │                                                        │  S1. Including yourself, how many members of this household │
1566 │                                                        │                     are age 16 or older?                    │
1567 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1568 │                                                        │        │        │        │        │       │        │  6 or  │
1569 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1570 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1571 │                                                        │        │        │        │        │ Column│        │        │
1572 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1573 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1574 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1575 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1576 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1577 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1578 │                                             likely     │        │        │        │        │       │        │        │
1579 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1580 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1581 │                                             unlikely   │        │        │        │        │       │        │        │
1582 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1583 │                                             unlikely   │        │        │        │        │       │        │        │
1584 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1585 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1586
1587                                                       Custom Tables
1588 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1589 │                                                         │ S1. Including yourself, how many members of this household │
1590 │                                                         │                    are age 16 or older?                    │
1591 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1592 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1593 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1594 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1595 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1596 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1597 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1598 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1599 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1600 │                                              likely     │       │       │         │       │        │      │          │
1601 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1602 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1603 │                                              unlikely   │       │       │         │       │        │      │          │
1604 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1605 │                                              unlikely   │       │       │         │       │        │      │          │
1606 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1607 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1608 ])
1609 AT_CLEANUP
1610
1611 AT_SETUP([CTABLES PCOMPUTE])
1612 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1613 AT_DATA([ctables.sps],
1614 [[GET 'nhtsa.sav'.
1615 CTABLES
1616     /PCOMPUTE &x=EXPR([3] + [4])
1617     /PCOMPUTE &y=EXPR([4] + [5])
1618     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1619     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1620     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1621     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1622
1623 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1624 CTABLES
1625     /PCOMPUTE &x=EXPR([3] + [4])
1626     /PCOMPUTE &y=EXPR([4] + [5])
1627     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1628     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1629     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1630     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1631 ]])
1632 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1633                                                                 Custom Tables
1634 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1635 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1636 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1637 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1638 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1639 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1640 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1641 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1642 │105b. How  Almost  │  147│30.3%│  246│50.7%│  393│81.0%│   62│12.8%│   19│3.9%│   11│2.3%│ 81.00│16.7%│   30│6.2%│   92│19.0%│  485│100.0%│
1643 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1644 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1645 │drivers    Very    │  384│34.3%│  552│49.2%│  936│83.5%│  120│10.7%│   51│4.5%│   14│1.2%│171.00│15.3%│   65│5.8%│  185│16.5%│ 1121│100.0%│
1646 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1647 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1648 │much to    Somewhat│  590│27.8%│ 1249│58.8%│ 1839│86.6%│  193│ 9.1%│   72│3.4%│   20│ .9%│265.00│12.5%│   92│4.3%│  285│13.4%│ 2124│100.0%│
1649 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1650 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1651 │safely     Somewhat│  278│26.6%│  647│61.8%│  925│88.3%│   84│ 8.0%│   32│3.1%│    6│ .6%│116.00│11.1%│   38│3.6%│  122│11.7%│ 1047│100.0%│
1652 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1653 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1654 │stopped by Very    │  141│28.5%│  290│58.7%│  431│87.2%│   41│ 8.3%│   18│3.6%│    4│ .8%│ 59.00│11.9%│   22│4.5%│   63│12.8%│  494│100.0%│
1655 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1656 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1657 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1658
1659                                                                 Custom Tables
1660 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1661 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1662 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1663 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1664 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1665 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1666 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1667 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1668 │105b. How likely is it that    Almost    │  147│30.3%│  246│50.7%│  393│81.0%│   62│12.8%│ 81.00│16.7%│   30│6.2%│   92│19.0%│  485│100.0%│
1669 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1670 │to drink to drive safely will  Very      │  384│34.3%│  552│49.2%│  936│83.5%│  120│10.7%│171.00│15.3%│   65│5.8%│  185│16.5%│ 1121│100.0%│
1671 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1672 │                               Somewhat  │  590│27.8%│ 1249│58.8%│ 1839│86.6%│  193│ 9.1%│265.00│12.5%│   92│4.3%│  285│13.4%│ 2124│100.0%│
1673 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1674 │                               Somewhat  │  278│26.6%│  647│61.8%│  925│88.3%│   84│ 8.0%│116.00│11.1%│   38│3.6%│  122│11.7%│ 1047│100.0%│
1675 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1676 │                               Very      │  141│28.5%│  290│58.7%│  431│87.2%│   41│ 8.3%│ 59.00│11.9%│   22│4.5%│   63│12.8%│  494│100.0%│
1677 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1678 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1679 ])
1680 AT_CLEANUP
1681
1682 AT_SETUP([CTABLES CLABELS])
1683 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1684 AT_DATA([ctables.sps],
1685 [[GET 'nhtsa.sav'.
1686 CTABLES /TABLE AgeGroup BY qns3a.
1687 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1688 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1689 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1690 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1691 ]])
1692 pwd
1693 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1694              Custom Tables
1695 ╭───────────────────────┬────────────╮
1696 │                       │S3a. GENDER:│
1697 │                       ├─────┬──────┤
1698 │                       │ Male│Female│
1699 │                       ├─────┼──────┤
1700 │                       │Count│ Count│
1701 ├───────────────────────┼─────┼──────┤
1702 │Age group 15 or younger│    0│     0│
1703 │          16 to 25     │  594│   505│
1704 │          26 to 35     │  476│   491│
1705 │          36 to 45     │  489│   548│
1706 │          46 to 55     │  526│   649│
1707 │          56 to 65     │  516│   731│
1708 │          66 or older  │  531│   943│
1709 ╰───────────────────────┴─────┴──────╯
1710
1711                                                       Custom Tables
1712 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1713 │       │                                                 S3a. GENDER:                                                 │
1714 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1715 │       │                         Male                         │                         Female                        │
1716 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1717 │       │  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 │
1718 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1719 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1720 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1721 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1722 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1723 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1724 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1725
1726                 Custom Tables
1727 ╭──────────────────────────────┬────────────╮
1728 │                              │S3a. GENDER:│
1729 │                              ├────────────┤
1730 │                              │    Count   │
1731 ├──────────────────────────────┼────────────┤
1732 │Age group 15 or younger Male  │           0│
1733 │                        Female│           0│
1734 │         ╶────────────────────┼────────────┤
1735 │          16 to 25      Male  │         594│
1736 │                        Female│         505│
1737 │         ╶────────────────────┼────────────┤
1738 │          26 to 35      Male  │         476│
1739 │                        Female│         491│
1740 │         ╶────────────────────┼────────────┤
1741 │          36 to 45      Male  │         489│
1742 │                        Female│         548│
1743 │         ╶────────────────────┼────────────┤
1744 │          46 to 55      Male  │         526│
1745 │                        Female│         649│
1746 │         ╶────────────────────┼────────────┤
1747 │          56 to 65      Male  │         516│
1748 │                        Female│         731│
1749 │         ╶────────────────────┼────────────┤
1750 │          66 or older   Male  │         531│
1751 │                        Female│         943│
1752 ╰──────────────────────────────┴────────────╯
1753
1754       Custom Tables
1755 15 or younger
1756 ╭─────────┬────────────╮
1757 │         │S3a. GENDER:│
1758 │         ├─────┬──────┤
1759 │         │ Male│Female│
1760 │         ├─────┼──────┤
1761 │         │Count│ Count│
1762 ├─────────┼─────┼──────┤
1763 │Age group│    0│     0│
1764 ╰─────────┴─────┴──────╯
1765
1766       Custom Tables
1767 16 to 25
1768 ╭─────────┬────────────╮
1769 │         │S3a. GENDER:│
1770 │         ├─────┬──────┤
1771 │         │ Male│Female│
1772 │         ├─────┼──────┤
1773 │         │Count│ Count│
1774 ├─────────┼─────┼──────┤
1775 │Age group│  594│   505│
1776 ╰─────────┴─────┴──────╯
1777
1778       Custom Tables
1779 26 to 35
1780 ╭─────────┬────────────╮
1781 │         │S3a. GENDER:│
1782 │         ├─────┬──────┤
1783 │         │ Male│Female│
1784 │         ├─────┼──────┤
1785 │         │Count│ Count│
1786 ├─────────┼─────┼──────┤
1787 │Age group│  476│   491│
1788 ╰─────────┴─────┴──────╯
1789
1790       Custom Tables
1791 36 to 45
1792 ╭─────────┬────────────╮
1793 │         │S3a. GENDER:│
1794 │         ├─────┬──────┤
1795 │         │ Male│Female│
1796 │         ├─────┼──────┤
1797 │         │Count│ Count│
1798 ├─────────┼─────┼──────┤
1799 │Age group│  489│   548│
1800 ╰─────────┴─────┴──────╯
1801
1802       Custom Tables
1803 46 to 55
1804 ╭─────────┬────────────╮
1805 │         │S3a. GENDER:│
1806 │         ├─────┬──────┤
1807 │         │ Male│Female│
1808 │         ├─────┼──────┤
1809 │         │Count│ Count│
1810 ├─────────┼─────┼──────┤
1811 │Age group│  526│   649│
1812 ╰─────────┴─────┴──────╯
1813
1814       Custom Tables
1815 56 to 65
1816 ╭─────────┬────────────╮
1817 │         │S3a. GENDER:│
1818 │         ├─────┬──────┤
1819 │         │ Male│Female│
1820 │         ├─────┼──────┤
1821 │         │Count│ Count│
1822 ├─────────┼─────┼──────┤
1823 │Age group│  516│   731│
1824 ╰─────────┴─────┴──────╯
1825
1826       Custom Tables
1827 66 or older
1828 ╭─────────┬────────────╮
1829 │         │S3a. GENDER:│
1830 │         ├─────┬──────┤
1831 │         │ Male│Female│
1832 │         ├─────┼──────┤
1833 │         │Count│ Count│
1834 ├─────────┼─────┼──────┤
1835 │Age group│  531│   943│
1836 ╰─────────┴─────┴──────╯
1837
1838              Custom Tables
1839 Male
1840 ╭───────────────────────┬────────────╮
1841 │                       │S3a. GENDER:│
1842 │                       ├────────────┤
1843 │                       │    Count   │
1844 ├───────────────────────┼────────────┤
1845 │Age group 15 or younger│           0│
1846 │          16 to 25     │         594│
1847 │          26 to 35     │         476│
1848 │          36 to 45     │         489│
1849 │          46 to 55     │         526│
1850 │          56 to 65     │         516│
1851 │          66 or older  │         531│
1852 ╰───────────────────────┴────────────╯
1853
1854              Custom Tables
1855 Female
1856 ╭───────────────────────┬────────────╮
1857 │                       │S3a. GENDER:│
1858 │                       ├────────────┤
1859 │                       │    Count   │
1860 ├───────────────────────┼────────────┤
1861 │Age group 15 or younger│           0│
1862 │          16 to 25     │         505│
1863 │          26 to 35     │         491│
1864 │          36 to 45     │         548│
1865 │          46 to 55     │         649│
1866 │          56 to 65     │         731│
1867 │          66 or older  │         943│
1868 ╰───────────────────────┴────────────╯
1869 ])
1870 AT_CLEANUP
1871
1872 AT_SETUP([CTABLES missing values])
1873 AT_DATA([ctables.sps],
1874 [[DATA LIST LIST NOTABLE/x y.
1875 BEGIN DATA.
1876 1 1
1877 1 2
1878 1 3
1879 1 4
1880 1 5
1881 1 .
1882 2 1
1883 2 2
1884 2 3
1885 2 4
1886 2 5
1887 2 .
1888 3 1
1889 3 2
1890 3 3
1891 3 4
1892 3 5
1893 3 .
1894 4 1
1895 4 2
1896 4 3
1897 4 4
1898 4 5
1899 4 .
1900 5 1
1901 5 2
1902 5 3
1903 5 4
1904 5 5
1905 5 .
1906 . 1
1907 . 2
1908 . 3
1909 . 4
1910 . 5
1911 . .
1912 END DATA.
1913 MISSING VALUES x (1, 2) y (2, 3).
1914 VARIABLE LEVEL ALL (NOMINAL).
1915
1916 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1917                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1918     /CATEGORIES VARIABLES=ALL TOTAL=YES.
1919 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1920                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1921     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1922 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1923                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1924     /CATEGORIES VARIABLES=ALL TOTAL=YES
1925     /SLABELS POSITION=ROW.
1926 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1927                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1928     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1929     /SLABELS POSITION=ROW.
1930 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1931                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1932     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
1933     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
1934     /SLABELS POSITION=ROW.
1935 ]])
1936 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1937                                Custom Tables
1938 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1939 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1940 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1941 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1942 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1943 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1944 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
1945 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1946 dnl Note that Column Total N % doesn't add up to 100 because missing
1947 dnl values are included in the total but not shown as a category and this
1948 dnl is expected behavior.
1949
1950                                Custom Tables
1951 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1952 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1953 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1954 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1955 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1956 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1957 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1958 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1959 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
1960 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1961 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1962 dnl values are included in the total but not shown as a category and this
1963 dnl is expected behavior.
1964
1965                      Custom Tables
1966 ╭────────────────────────┬───────────────────────────╮
1967 │                        │             y             │
1968 │                        ├──────┬──────┬──────┬──────┤
1969 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
1970 ├────────────────────────┼──────┼──────┼──────┼──────┤
1971 │x 3.00  Count           │     1│     1│     1│     3│
1972 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1973 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1974 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1975 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1976 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1977 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1978 │        Valid N         │      │      │      │     3│
1979 │        Total N         │      │      │      │     6│
1980 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1981 │  4.00  Count           │     1│     1│     1│     3│
1982 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1983 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1984 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1985 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1986 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1987 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1988 │        Valid N         │      │      │      │     3│
1989 │        Total N         │      │      │      │     6│
1990 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1991 │  5.00  Count           │     1│     1│     1│     3│
1992 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1993 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1994 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1995 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1996 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1997 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1998 │        Valid N         │      │      │      │     3│
1999 │        Total N         │      │      │      │     6│
2000 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2001 │  Total Count           │     3│     3│     3│     9│
2002 │        Column %        │100.0%│100.0%│100.0%│     .│
2003 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2004 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2005 │        Row %           │     .│     .│     .│     .│
2006 │        Row Valid N %   │     .│     .│     .│     .│
2007 │        Row Total N %   │     .│     .│     .│     .│
2008 │        Valid N         │     3│     3│     3│     9│
2009 │        Total N         │     6│     6│     6│    36│
2010 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2011
2012                             Custom Tables
2013 ╭────────────────────────┬─────────────────────────────────────────╮
2014 │                        │                    y                    │
2015 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2016 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2017 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2018 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2019 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2020 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2021 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2022 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2023 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2024 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2025 │        Valid N         │      │      │      │      │      │     0│
2026 │        Total N         │      │      │      │      │      │     6│
2027 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2028 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2029 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2030 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2031 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2032 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2033 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2034 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2035 │        Valid N         │      │      │      │      │      │     0│
2036 │        Total N         │      │      │      │      │      │     6│
2037 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2038 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2039 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2040 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2041 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2042 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2043 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2044 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2045 │        Valid N         │      │      │      │      │      │     3│
2046 │        Total N         │      │      │      │      │      │     6│
2047 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2048 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2049 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2050 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2051 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2052 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2053 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2054 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2055 │        Valid N         │      │      │      │      │      │     3│
2056 │        Total N         │      │      │      │      │      │     6│
2057 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2058 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2059 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2060 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2061 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2062 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2063 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2064 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2065 │        Valid N         │      │      │      │      │      │     3│
2066 │        Total N         │      │      │      │      │      │     6│
2067 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2068 │  Total Count           │     5│     5│     5│     5│     5│    25│
2069 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2070 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2071 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2072 │        Row %           │     .│     .│     .│     .│     .│     .│
2073 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2074 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2075 │        Valid N         │     3│     0│     0│     3│     3│     9│
2076 │        Total N         │     6│     6│     6│     6│     6│    36│
2077 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2078
2079                         Custom Tables
2080 ╭────────────────────────┬──────────────────────────────────╮
2081 │                        │                 y                │
2082 │                        ├──────┬──────┬──────┬──────┬──────┤
2083 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2084 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2085 │x 1.00  Count           │     1│     1│     1│     1│     4│
2086 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2087 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2088 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2089 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2090 │        Row Valid N %   │     .│     .│     .│     .│     .│
2091 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2092 │        Valid N         │      │      │      │      │     0│
2093 │        Total N         │      │      │      │      │     6│
2094 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2095 │  2.00  Count           │     1│     1│     1│     1│     4│
2096 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2097 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2098 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2099 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2100 │        Row Valid N %   │     .│     .│     .│     .│     .│
2101 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2102 │        Valid N         │      │      │      │      │     0│
2103 │        Total N         │      │      │      │      │     6│
2104 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2105 │  3.00  Count           │     1│     1│     1│     1│     4│
2106 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2107 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2108 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2109 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2110 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2111 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2112 │        Valid N         │      │      │      │      │     3│
2113 │        Total N         │      │      │      │      │     6│
2114 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2115 │  4.00  Count           │     1│     1│     1│     1│     4│
2116 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2117 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2118 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2119 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2120 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2121 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2122 │        Valid N         │      │      │      │      │     3│
2123 │        Total N         │      │      │      │      │     6│
2124 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2125 │  Total Count           │     4│     4│     4│     4│    16│
2126 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2127 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2128 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2129 │        Row %           │     .│     .│     .│     .│     .│
2130 │        Row Valid N %   │     .│     .│     .│     .│     .│
2131 │        Row Total N %   │     .│     .│     .│     .│     .│
2132 │        Valid N         │     2│     0│     2│     2│     6│
2133 │        Total N         │     5│     5│     5│     5│    30│
2134 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2135 ])
2136 AT_CLEANUP
2137
2138 AT_SETUP([CTABLES SMISSING=LISTWISE])
2139 AT_KEYWORDS([SMISSING LISTWISE])
2140 AT_DATA([ctables.sps],
2141 [[DATA LIST LIST NOTABLE/x y z.
2142 BEGIN DATA.
2143 1  . 40
2144 1 10 50
2145 1 20 60
2146 1  .  .
2147 1 30  .
2148 END DATA.
2149 VARIABLE LEVEL x (NOMINAL).
2150
2151 CTABLES /TABLE (y + z) > x.
2152 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2153
2154 * The following doesn't come out as listwise because the tables are
2155 separate, not linked by an > operator.
2156 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2157 ]])
2158 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2159   Custom Tables
2160 ╭────────┬─────╮
2161 │        │ Mean│
2162 ├────────┼─────┤
2163 │y x 1.00│20.00│
2164 ├────────┼─────┤
2165 │z x 1.00│50.00│
2166 ╰────────┴─────╯
2167
2168   Custom Tables
2169 ╭────────┬─────╮
2170 │        │ Mean│
2171 ├────────┼─────┤
2172 │y x 1.00│15.00│
2173 ├────────┼─────┤
2174 │z x 1.00│55.00│
2175 ╰────────┴─────╯
2176
2177   Custom Tables
2178 ╭────────┬─────╮
2179 │        │ Mean│
2180 ├────────┼─────┤
2181 │y x 1.00│20.00│
2182 ├────────┼─────┤
2183 │z x 1.00│50.00│
2184 ╰────────┴─────╯
2185 ])
2186 AT_CLEANUP
2187
2188 AT_SETUP([CTABLES VLABELS - variables on different axes])
2189 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2190 AT_DATA([ctables.sps],
2191 [[GET 'nhtsa.sav'.
2192 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2193 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2194 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2195 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2196 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2197 ]])
2198 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2199                                  Custom Tables
2200 ╭────────────────────────────────────────────────────────────────┬────────────╮
2201 │                                                                │S3a. GENDER:│
2202 │                                                                ├─────┬──────┤
2203 │                                                                │ Male│Female│
2204 │                                                                ├─────┼──────┤
2205 │                                                                │Count│ Count│
2206 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2207 │D5a. What would you say is your primary    Cuban                │   13│     7│
2208 │ethnic background?                         Mexican              │  175│   136│
2209 │                                           Spanish              │   20│    28│
2210 │                                           South American       │   21│    13│
2211 │                                           Central American     │   27│    25│
2212 │                                           Puerto Rican, OR     │   37│    41│
2213 │                                           Something else       │   35│    33│
2214 │                                           Multiple - cannot    │    2│     5│
2215 │                                           choose one           │     │      │
2216 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2217
2218                   Custom Tables
2219 ╭──────────────────────────────────┬────────────╮
2220 │                                  │    QNS3A   │
2221 │                                  ├─────┬──────┤
2222 │                                  │ Male│Female│
2223 │                                  ├─────┼──────┤
2224 │                                  │Count│ Count│
2225 ├──────────────────────────────────┼─────┼──────┤
2226 │QND5A Cuban                       │   13│     7│
2227 │      Mexican                     │  175│   136│
2228 │      Spanish                     │   20│    28│
2229 │      South American              │   21│    13│
2230 │      Central American            │   27│    25│
2231 │      Puerto Rican, OR            │   37│    41│
2232 │      Something else              │   35│    33│
2233 │      Multiple - cannot choose one│    2│     5│
2234 ╰──────────────────────────────────┴─────┴──────╯
2235
2236                                  Custom Tables
2237 ╭────────────────────────────────────────────────────────────────┬────────────╮
2238 │                                                                │S3a. GENDER:│
2239 │                                                                ├─────┬──────┤
2240 │                                                                │ Male│Female│
2241 │                                                                ├─────┼──────┤
2242 │                                                                │Count│ Count│
2243 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2244 │D5a. What would you say is your primary    Cuban                │   13│     7│
2245 │ethnic background?                         Mexican              │  175│   136│
2246 │                                           Spanish              │   20│    28│
2247 │                                           South American       │   21│    13│
2248 │                                           Central American     │   27│    25│
2249 │                                           Puerto Rican, OR     │   37│    41│
2250 │                                           Something else       │   35│    33│
2251 │                                           Multiple - cannot    │    2│     5│
2252 │                                           choose one           │     │      │
2253 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2254
2255                                  Custom Tables
2256 ╭────────────────────────────────────────────────────────────┬────────────────╮
2257 │                                                            │   QNS3A S3a.   │
2258 │                                                            │     GENDER:    │
2259 │                                                            ├───────┬────────┤
2260 │                                                            │  Male │ Female │
2261 │                                                            ├───────┼────────┤
2262 │                                                            │ Count │  Count │
2263 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2264 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2265 │primary ethnic background?               Mexican            │    175│     136│
2266 │                                         Spanish            │     20│      28│
2267 │                                         South American     │     21│      13│
2268 │                                         Central American   │     27│      25│
2269 │                                         Puerto Rican, OR   │     37│      41│
2270 │                                         Something else     │     35│      33│
2271 │                                         Multiple - cannot  │      2│       5│
2272 │                                         choose one         │       │        │
2273 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2274
2275                Custom Tables
2276 ╭────────────────────────────┬─────┬──────╮
2277 │                            │ Male│Female│
2278 │                            ├─────┼──────┤
2279 │                            │Count│ Count│
2280 ├────────────────────────────┼─────┼──────┤
2281 │Cuban                       │   13│     7│
2282 │Mexican                     │  175│   136│
2283 │Spanish                     │   20│    28│
2284 │South American              │   21│    13│
2285 │Central American            │   27│    25│
2286 │Puerto Rican, OR            │   37│    41│
2287 │Something else              │   35│    33│
2288 │Multiple - cannot choose one│    2│     5│
2289 ╰────────────────────────────┴─────┴──────╯
2290 ])
2291 AT_CLEANUP
2292
2293 AT_SETUP([CTABLES VLABELS - stacked variables])
2294 AT_KEYWORDS([stack stacking])
2295 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2296 AT_DATA([ctables.sps],
2297 [[GET 'nhtsa.sav'.
2298 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2299 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2300 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2301 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2302 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2303 ]])
2304 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2305                                  Custom Tables
2306 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2307 │                                                                       │Count│
2308 ├───────────────────────────────────────────────────────────────────────┼─────┤
2309 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2310 │background?                                     Mexican                │  311│
2311 │                                                Spanish                │   48│
2312 │                                                South American         │   34│
2313 │                                                Central American       │   52│
2314 │                                                Puerto Rican, OR       │   78│
2315 │                                                Something else         │   68│
2316 │                                                Multiple - cannot      │    7│
2317 │                                                choose one             │     │
2318 ├───────────────────────────────────────────────────────────────────────┼─────┤
2319 │QNS3A                                           Male                   │ 3132│
2320 │                                                Female                 │ 3867│
2321 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2322
2323                   Custom Tables
2324 ╭─────────────────────────────────────────┬─────╮
2325 │                                         │Count│
2326 ├─────────────────────────────────────────┼─────┤
2327 │QND5A        Cuban                       │   20│
2328 │             Mexican                     │  311│
2329 │             Spanish                     │   48│
2330 │             South American              │   34│
2331 │             Central American            │   52│
2332 │             Puerto Rican, OR            │   78│
2333 │             Something else              │   68│
2334 │             Multiple - cannot choose one│    7│
2335 ├─────────────────────────────────────────┼─────┤
2336 │S3a. GENDER: Male                        │ 3132│
2337 │             Female                      │ 3867│
2338 ╰─────────────────────────────────────────┴─────╯
2339
2340                                  Custom Tables
2341 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2342 │                                                                       │Count│
2343 ├───────────────────────────────────────────────────────────────────────┼─────┤
2344 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2345 │background?                                     Mexican                │  311│
2346 │                                                Spanish                │   48│
2347 │                                                South American         │   34│
2348 │                                                Central American       │   52│
2349 │                                                Puerto Rican, OR       │   78│
2350 │                                                Something else         │   68│
2351 │                                                Multiple - cannot      │    7│
2352 │                                                choose one             │     │
2353 ├───────────────────────────────────────────────────────────────────────┼─────┤
2354 │Male                                                                   │ 3132│
2355 ├───────────────────────────────────────────────────────────────────────┼─────┤
2356 │Female                                                                 │ 3867│
2357 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2358
2359             Custom Tables
2360 ╭─────────────────────────────┬─────╮
2361 │                             │Count│
2362 ├─────────────────────────────┼─────┤
2363 │Cuban                        │   20│
2364 ├─────────────────────────────┼─────┤
2365 │Mexican                      │  311│
2366 ├─────────────────────────────┼─────┤
2367 │Spanish                      │   48│
2368 ├─────────────────────────────┼─────┤
2369 │South American               │   34│
2370 ├─────────────────────────────┼─────┤
2371 │Central American             │   52│
2372 ├─────────────────────────────┼─────┤
2373 │Puerto Rican, OR             │   78│
2374 ├─────────────────────────────┼─────┤
2375 │Something else               │   68│
2376 ├─────────────────────────────┼─────┤
2377 │Multiple - cannot choose one │    7│
2378 ├─────────────────────────────┼─────┤
2379 │S3a. GENDER:     Male        │ 3132│
2380 │                 Female      │ 3867│
2381 ╰─────────────────────────────┴─────╯
2382
2383             Custom Tables
2384 ╭────────────────────────────┬─────╮
2385 │                            │Count│
2386 ├────────────────────────────┼─────┤
2387 │Cuban                       │   20│
2388 │Mexican                     │  311│
2389 │Spanish                     │   48│
2390 │South American              │   34│
2391 │Central American            │   52│
2392 │Puerto Rican, OR            │   78│
2393 │Something else              │   68│
2394 │Multiple - cannot choose one│    7│
2395 │Male                        │ 3132│
2396 │Female                      │ 3867│
2397 ╰────────────────────────────┴─────╯
2398 ])
2399 AT_CLEANUP
2400
2401 AT_SETUP([CTABLES VLABELS - nested variables])
2402 AT_KEYWORDS([nest nesting])
2403 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2404 AT_DATA([ctables.sps],
2405 [[GET 'nhtsa.sav'.
2406 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2407 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2408 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2409 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2410 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2411 ]])
2412 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2413                                  Custom Tables
2414 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2415 │                                                                       │Count│
2416 ├───────────────────────────────────────────────────────────────────────┼─────┤
2417 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2418 │primary ethnic background?                                       Female│    7│
2419 │                                     ╶─────────────────────────────────┼─────┤
2420 │                                      Mexican              QNS3A Male  │  175│
2421 │                                                                 Female│  136│
2422 │                                     ╶─────────────────────────────────┼─────┤
2423 │                                      Spanish              QNS3A Male  │   20│
2424 │                                                                 Female│   28│
2425 │                                     ╶─────────────────────────────────┼─────┤
2426 │                                      South American       QNS3A Male  │   21│
2427 │                                                                 Female│   13│
2428 │                                     ╶─────────────────────────────────┼─────┤
2429 │                                      Central American     QNS3A Male  │   27│
2430 │                                                                 Female│   25│
2431 │                                     ╶─────────────────────────────────┼─────┤
2432 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2433 │                                                                 Female│   41│
2434 │                                     ╶─────────────────────────────────┼─────┤
2435 │                                      Something else       QNS3A Male  │   35│
2436 │                                                                 Female│   33│
2437 │                                     ╶─────────────────────────────────┼─────┤
2438 │                                      Multiple - cannot    QNS3A Male  │    2│
2439 │                                      choose one                 Female│    5│
2440 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2441
2442                          Custom Tables
2443 ╭──────────────────────────────────────────────────────┬─────╮
2444 │                                                      │Count│
2445 ├──────────────────────────────────────────────────────┼─────┤
2446 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2447 │                                                Female│    7│
2448 │     ╶────────────────────────────────────────────────┼─────┤
2449 │      Mexican                      S3a. GENDER: Male  │  175│
2450 │                                                Female│  136│
2451 │     ╶────────────────────────────────────────────────┼─────┤
2452 │      Spanish                      S3a. GENDER: Male  │   20│
2453 │                                                Female│   28│
2454 │     ╶────────────────────────────────────────────────┼─────┤
2455 │      South American               S3a. GENDER: Male  │   21│
2456 │                                                Female│   13│
2457 │     ╶────────────────────────────────────────────────┼─────┤
2458 │      Central American             S3a. GENDER: Male  │   27│
2459 │                                                Female│   25│
2460 │     ╶────────────────────────────────────────────────┼─────┤
2461 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2462 │                                                Female│   41│
2463 │     ╶────────────────────────────────────────────────┼─────┤
2464 │      Something else               S3a. GENDER: Male  │   35│
2465 │                                                Female│   33│
2466 │     ╶────────────────────────────────────────────────┼─────┤
2467 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2468 │                                                Female│    5│
2469 ╰──────────────────────────────────────────────────────┴─────╯
2470
2471                                  Custom Tables
2472 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2473 │                                                                       │Count│
2474 ├───────────────────────────────────────────────────────────────────────┼─────┤
2475 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2476 │ethnic background?                                               Female│    7│
2477 │                                          ╶────────────────────────────┼─────┤
2478 │                                           Mexican               Male  │  175│
2479 │                                                                 Female│  136│
2480 │                                          ╶────────────────────────────┼─────┤
2481 │                                           Spanish               Male  │   20│
2482 │                                                                 Female│   28│
2483 │                                          ╶────────────────────────────┼─────┤
2484 │                                           South American        Male  │   21│
2485 │                                                                 Female│   13│
2486 │                                          ╶────────────────────────────┼─────┤
2487 │                                           Central American      Male  │   27│
2488 │                                                                 Female│   25│
2489 │                                          ╶────────────────────────────┼─────┤
2490 │                                           Puerto Rican, OR      Male  │   37│
2491 │                                                                 Female│   41│
2492 │                                          ╶────────────────────────────┼─────┤
2493 │                                           Something else        Male  │   35│
2494 │                                                                 Female│   33│
2495 │                                          ╶────────────────────────────┼─────┤
2496 │                                           Multiple - cannot     Male  │    2│
2497 │                                           choose one            Female│    5│
2498 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2499
2500                       Custom Tables
2501 ╭────────────────────────────────────────────────┬─────╮
2502 │                                                │Count│
2503 ├────────────────────────────────────────────────┼─────┤
2504 │Cuban                        S3a. GENDER: Male  │   13│
2505 │                                          Female│    7│
2506 ├────────────────────────────────────────────────┼─────┤
2507 │Mexican                      S3a. GENDER: Male  │  175│
2508 │                                          Female│  136│
2509 ├────────────────────────────────────────────────┼─────┤
2510 │Spanish                      S3a. GENDER: Male  │   20│
2511 │                                          Female│   28│
2512 ├────────────────────────────────────────────────┼─────┤
2513 │South American               S3a. GENDER: Male  │   21│
2514 │                                          Female│   13│
2515 ├────────────────────────────────────────────────┼─────┤
2516 │Central American             S3a. GENDER: Male  │   27│
2517 │                                          Female│   25│
2518 ├────────────────────────────────────────────────┼─────┤
2519 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2520 │                                          Female│   41│
2521 ├────────────────────────────────────────────────┼─────┤
2522 │Something else               S3a. GENDER: Male  │   35│
2523 │                                          Female│   33│
2524 ├────────────────────────────────────────────────┼─────┤
2525 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2526 │                                          Female│    5│
2527 ╰────────────────────────────────────────────────┴─────╯
2528
2529                Custom Tables
2530 ╭───────────────────────────────────┬─────╮
2531 │                                   │Count│
2532 ├───────────────────────────────────┼─────┤
2533 │Cuban                        Male  │   13│
2534 │                             Female│    7│
2535 ├───────────────────────────────────┼─────┤
2536 │Mexican                      Male  │  175│
2537 │                             Female│  136│
2538 ├───────────────────────────────────┼─────┤
2539 │Spanish                      Male  │   20│
2540 │                             Female│   28│
2541 ├───────────────────────────────────┼─────┤
2542 │South American               Male  │   21│
2543 │                             Female│   13│
2544 ├───────────────────────────────────┼─────┤
2545 │Central American             Male  │   27│
2546 │                             Female│   25│
2547 ├───────────────────────────────────┼─────┤
2548 │Puerto Rican, OR             Male  │   37│
2549 │                             Female│   41│
2550 ├───────────────────────────────────┼─────┤
2551 │Something else               Male  │   35│
2552 │                             Female│   33│
2553 ├───────────────────────────────────┼─────┤
2554 │Multiple - cannot choose one Male  │    2│
2555 │                             Female│    5│
2556 ╰───────────────────────────────────┴─────╯
2557 ])
2558 AT_CLEANUP
2559
2560 AT_SETUP([CTABLES FORMAT EMPTY])
2561 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2562 AT_DATA([ctables.sps],
2563 [[GET 'nhtsa.sav'.
2564 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2565 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2566 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2567 ]])
2568 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2569                                  Custom Tables
2570 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2571 │                                             │   D5. ETHNICITY: Are you of   │
2572 │                                             │  Hispanic or Latino origin or │
2573 │                                             │            descent?           │
2574 │                                             ├───────────────┬───────────────┤
2575 │                                             │      Yes      │       No      │
2576 │                                             ├───────────────┼───────────────┤
2577 │                                             │     Count     │     Count     │
2578 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2579 │D5a. What would you say is   Cuban           │             20│              0│
2580 │your primary ethnic          Mexican         │            311│              0│
2581 │background?                  Spanish         │             48│              0│
2582 │                             South American  │             34│              0│
2583 │                             Central American│             52│              0│
2584 │                             Puerto Rican, OR│             78│              0│
2585 │                             Something else  │             68│              0│
2586 │                             Multiple -      │              7│              0│
2587 │                             cannot choose   │               │               │
2588 │                             one             │               │               │
2589 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2590
2591                                  Custom Tables
2592 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2593 │                                             │   D5. ETHNICITY: Are you of   │
2594 │                                             │  Hispanic or Latino origin or │
2595 │                                             │            descent?           │
2596 │                                             ├───────────────┬───────────────┤
2597 │                                             │      Yes      │       No      │
2598 │                                             ├───────────────┼───────────────┤
2599 │                                             │     Count     │     Count     │
2600 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2601 │D5a. What would you say is   Cuban           │             20│               │
2602 │your primary ethnic          Mexican         │            311│               │
2603 │background?                  Spanish         │             48│               │
2604 │                             South American  │             34│               │
2605 │                             Central American│             52│               │
2606 │                             Puerto Rican, OR│             78│               │
2607 │                             Something else  │             68│               │
2608 │                             Multiple -      │              7│               │
2609 │                             cannot choose   │               │               │
2610 │                             one             │               │               │
2611 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2612
2613                                  Custom Tables
2614 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2615 │                                             │   D5. ETHNICITY: Are you of   │
2616 │                                             │  Hispanic or Latino origin or │
2617 │                                             │            descent?           │
2618 │                                             ├───────────────┬───────────────┤
2619 │                                             │      Yes      │       No      │
2620 │                                             ├───────────────┼───────────────┤
2621 │                                             │     Count     │     Count     │
2622 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2623 │D5a. What would you say is   Cuban           │             20│n/a            │
2624 │your primary ethnic          Mexican         │            311│n/a            │
2625 │background?                  Spanish         │             48│n/a            │
2626 │                             South American  │             34│n/a            │
2627 │                             Central American│             52│n/a            │
2628 │                             Puerto Rican, OR│             78│n/a            │
2629 │                             Something else  │             68│n/a            │
2630 │                             Multiple -      │              7│n/a            │
2631 │                             cannot choose   │               │               │
2632 │                             one             │               │               │
2633 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2634 ])
2635 AT_CLEANUP
2636
2637 AT_SETUP([CTABLES FORMAT MISSING])
2638 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2639 AT_DATA([ctables.sps],
2640 [[GET 'nhtsa.sav'.
2641 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2642 ]])
2643 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2644                                  Custom Tables
2645 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2646 │                                             │   D5. ETHNICITY: Are you of   │
2647 │                                             │  Hispanic or Latino origin or │
2648 │                                             │            descent?           │
2649 │                                             ├───────────────┬───────────────┤
2650 │                                             │      Yes      │       No      │
2651 │                                             ├───────────────┼───────────────┤
2652 │                                             │    Column %   │    Column %   │
2653 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2654 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2655 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2656 │background?                  Spanish         │           7.8%│(no data)      │
2657 │                             South American  │           5.5%│(no data)      │
2658 │                             Central American│           8.4%│(no data)      │
2659 │                             Puerto Rican, OR│          12.6%│(no data)      │
2660 │                             Something else  │          11.0%│(no data)      │
2661 │                             Multiple -      │           1.1%│(no data)      │
2662 │                             cannot choose   │               │               │
2663 │                             one             │               │               │
2664 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2665 ])
2666 AT_CLEANUP
2667
2668 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2669 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2670 AT_DATA([ctables.sps],
2671 [[GET 'nhtsa.sav'.
2672 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2673 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2674 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2675 ]])
2676 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2677                                  Custom Tables
2678 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2679 │                                                              │Count│Column %│
2680 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2681 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2682 │occasion?                                        1            │  491│   34.9%│
2683 │                                                 2            │  462│   32.9%│
2684 │                                                 3            │  229│   16.3%│
2685 │                                                 4            │   82│    5.8%│
2686 │                                                 5            │   56│    4.0%│
2687 │                                                 6            │   32│    2.3%│
2688 │                                                 7            │    9│     .6%│
2689 │                                                 8            │    8│     .6%│
2690 │                                                 9            │    4│     .3%│
2691 │                                                 10           │    6│     .4%│
2692 │                                                 11           │    2│     .1%│
2693 │                                                 12           │    5│     .4%│
2694 │                                                 14           │    1│     .1%│
2695 │                                                 15           │    1│     .1%│
2696 │                                                 18           │    1│     .1%│
2697 │                                                 20           │    4│     .3%│
2698 │                                                 25           │    1│     .1%│
2699 │                                                 30           │    3│     .2%│
2700 │                                                 60           │    1│     .1%│
2701 │                                                 99+          │    0│     .0%│
2702 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2703
2704                                  Custom Tables
2705 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2706 │                                                              │Count│Column %│
2707 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2708 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2709 │occasion?                                        1            │  491│   34.9%│
2710 │                                                 2            │  462│   32.9%│
2711 │                                                 3            │  229│   16.3%│
2712 │                                                 4            │   82│    5.8%│
2713 │                                                 5            │   56│    4.0%│
2714 │                                                 6            │   32│    2.3%│
2715 │                                                 7            │    9│     .6%│
2716 │                                                 8            │    8│     .6%│
2717 │                                                 9            │<5   │     .3%│
2718 │                                                 10           │    6│     .4%│
2719 │                                                 11           │<5   │     .1%│
2720 │                                                 12           │    5│     .4%│
2721 │                                                 14           │<5   │     .1%│
2722 │                                                 15           │<5   │     .1%│
2723 │                                                 18           │<5   │     .1%│
2724 │                                                 20           │<5   │     .3%│
2725 │                                                 25           │<5   │     .1%│
2726 │                                                 30           │<5   │     .2%│
2727 │                                                 60           │<5   │     .1%│
2728 │                                                 99+          │<5   │     .0%│
2729 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2730
2731                                  Custom Tables
2732 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2733 │                                                              │Count│Column %│
2734 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2735 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2736 │occasion?                                        1            │  491│   34.9%│
2737 │                                                 2            │  462│   32.9%│
2738 │                                                 3            │  229│   16.3%│
2739 │                                                 4            │   82│    5.8%│
2740 │                                                 5            │   56│    4.0%│
2741 │                                                 6            │   32│    2.3%│
2742 │                                                 7            │<10  │     .6%│
2743 │                                                 8            │<10  │     .6%│
2744 │                                                 9            │<10  │     .3%│
2745 │                                                 10           │<10  │     .4%│
2746 │                                                 11           │<10  │     .1%│
2747 │                                                 12           │<10  │     .4%│
2748 │                                                 14           │<10  │     .1%│
2749 │                                                 15           │<10  │     .1%│
2750 │                                                 18           │<10  │     .1%│
2751 │                                                 20           │<10  │     .3%│
2752 │                                                 25           │<10  │     .1%│
2753 │                                                 30           │<10  │     .2%│
2754 │                                                 60           │<10  │     .1%│
2755 │                                                 99+          │<10  │     .0%│
2756 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2757 ])
2758 AT_CLEANUP
2759
2760 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2761 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2762 AT_DATA([ctables.sps],
2763 [[GET 'nhtsa.sav'.
2764 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2765 ]])
2766 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2767  Custom Tables
2768 ╭────────────╮
2769 │S3a. GENDER:│
2770 ├─────┬──────┤
2771 │ Male│Female│
2772 ├─────┼──────┤
2773 │Count│ Count│
2774 ├─────┼──────┤
2775 │ 3132│  3867│
2776 ╰─────┴──────╯
2777 ])
2778 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2779 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2780 maximumColumnWidth="192"
2781 minimumColumnWidth="96"
2782 ])
2783 AT_CLEANUP
2784
2785 AT_SETUP([CTABLES special formats])
2786 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2787 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2788 AT_DATA([ctables.sps],
2789 [[GET 'nhtsa.sav'.
2790 COMPUTE x = qnd3 - 4.
2791 CTABLES /TABLE x[MINIMUM NEGPAREN8.1, MINIMUM NEQUAL8.1, MINIMUM PAREN8.1, MINIMUM PCTPAREN8.1, MAXIMUM NEGPAREN8.1, MAXIMUM NEQUAL8.1, MAXIMUM PAREN8.1, MAXIMUM PCTPAREN8.1].
2792 ]])
2793 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2794                            Custom Tables
2795 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2796 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2797 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2798 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
2799 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2800 ])
2801 AT_CLEANUP
2802
2803 AT_SETUP([CTABLES TITLES])
2804 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2805 AT_DATA([ctables.sps],
2806 [[GET 'nhtsa.sav'.
2807 CTABLES
2808     /VLABELS VARIABLES=qn1 DISPLAY=NONE
2809     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
2810     /TITLES TITLE='How often do you drive?'
2811             CAPTION='Generated )TIME on )DATE'
2812             CORNER=')TABLE'.
2813 ]])
2814 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
2815 s&../../..&MM/DD/YY&'], [0], [dnl
2816                             How often do you drive?
2817 ╭───────────────────────────────────┬─────────────────────────────────────────╮
2818 │                                   │               S3a. GENDER:              │
2819 │                                   ├────────────────────┬────────────────────┤
2820 │                                   │        Male        │       Female       │
2821 │                                   ├────────────────────┼────────────────────┤
2822 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
2823 │                                   │ you of Hispanic or │ you of Hispanic or │
2824 │                                   │  Latino origin or  │  Latino origin or  │
2825 │( ( 1. How often do you usually    │      descent?      │      descent?      │
2826 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
2827 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
2828 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
2829 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
2830 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
2831 │Every day                          │      218│      2066│      166│      2175│
2832 │Several days a week                │       44│       391│       45│       782│
2833 │Once a week or less                │       16│       109│       12│       223│
2834 │Only certain times a year          │       15│        41│       11│        61│
2835 │Never                              │       39│       150│       56│       278│
2836 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
2837 Generated HH:MM:SS on MM/DD/YY
2838 ])
2839 AT_CLEANUP
2840
2841 AT_SETUP([CTABLES area definitions])
2842 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2843 AT_DATA([ctables.sps],
2844 [[GET 'nhtsa.sav'.
2845 CTABLES
2846     /VLABELS VARIABLES=ALL DISPLAY=NAME
2847     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLE.ID, LAYER.ID, SUBTABLE.ID]
2848     /SLABELS POSITION=ROW
2849     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROW.ID, LAYERROW.ID]
2850     /SLABELS POSITION=ROW
2851     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COL.ID, LAYERCOL.ID]
2852     /SLABELS POSITION=ROW.
2853 ]])
2854 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
2855                     Custom Tables
2856 Male
2857 ╭─────────────────────────────┬─────────────┬──────╮
2858 │                             │    QND7A    │ QN64B│
2859 │                             ├──────┬──────┼───┬──┤
2860 │                             │  Yes │  No  │   │  │
2861 │                             ├──────┼──────┤   │  │
2862 │                             │ QN86 │ QN86 │   │  │
2863 │                             ├───┬──┼───┬──┤   │  │
2864 │                             │Yes│No│Yes│No│Yes│No│
2865 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
2866 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
2867 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
2868 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
2869 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
2870 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
2871 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
2872 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
2873 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
2874 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
2875 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
2876 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
2877 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
2878 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
2879 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
2880 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
2881 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
2882
2883                     Custom Tables
2884 Female
2885 ╭─────────────────────────────┬─────────────┬──────╮
2886 │                             │    QND7A    │ QN64B│
2887 │                             ├──────┬──────┼───┬──┤
2888 │                             │  Yes │  No  │   │  │
2889 │                             ├──────┼──────┤   │  │
2890 │                             │ QN86 │ QN86 │   │  │
2891 │                             ├───┬──┼───┬──┤   │  │
2892 │                             │Yes│No│Yes│No│Yes│No│
2893 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
2894 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
2895 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
2896 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
2897 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
2898 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
2899 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
2900 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
2901 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
2902 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
2903 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
2904 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
2905 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
2906 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
2907 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
2908 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
2909 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
2910
2911                     Custom Tables
2912 Male
2913 ╭──────────────────────────────┬─────────────┬──────╮
2914 │                              │    QND7A    │ QN64B│
2915 │                              ├──────┬──────┼───┬──┤
2916 │                              │  Yes │  No  │   │  │
2917 │                              ├──────┼──────┤   │  │
2918 │                              │ QN86 │ QN86 │   │  │
2919 │                              ├───┬──┼───┬──┤   │  │
2920 │                              │Yes│No│Yes│No│Yes│No│
2921 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
2922 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
2923 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
2924 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
2925 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
2926 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
2927 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
2928 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
2929 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
2930 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
2931 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
2932 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
2933 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
2934
2935                     Custom Tables
2936 Female
2937 ╭──────────────────────────────┬─────────────┬──────╮
2938 │                              │    QND7A    │ QN64B│
2939 │                              ├──────┬──────┼───┬──┤
2940 │                              │  Yes │  No  │   │  │
2941 │                              ├──────┼──────┤   │  │
2942 │                              │ QN86 │ QN86 │   │  │
2943 │                              ├───┬──┼───┬──┤   │  │
2944 │                              │Yes│No│Yes│No│Yes│No│
2945 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
2946 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
2947 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
2948 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
2949 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
2950 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
2951 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
2952 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
2953 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
2954 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
2955 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
2956 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
2957 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
2958
2959                       Custom Tables
2960 Male
2961 ╭─────────────────────────────────┬─────────────┬──────╮
2962 │                                 │    QND7A    │ QN64B│
2963 │                                 ├──────┬──────┼───┬──┤
2964 │                                 │  Yes │  No  │   │  │
2965 │                                 ├──────┼──────┤   │  │
2966 │                                 │ QN86 │ QN86 │   │  │
2967 │                                 ├───┬──┼───┬──┤   │  │
2968 │                                 │Yes│No│Yes│No│Yes│No│
2969 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
2970 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
2971 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
2972 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
2973 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
2974 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
2975 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
2976 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
2977 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
2978 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
2979 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
2980 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
2981 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
2982
2983                       Custom Tables
2984 Female
2985 ╭─────────────────────────────────┬─────────────┬──────╮
2986 │                                 │    QND7A    │ QN64B│
2987 │                                 ├──────┬──────┼───┬──┤
2988 │                                 │  Yes │  No  │   │  │
2989 │                                 ├──────┼──────┤   │  │
2990 │                                 │ QN86 │ QN86 │   │  │
2991 │                                 ├───┬──┼───┬──┤   │  │
2992 │                                 │Yes│No│Yes│No│Yes│No│
2993 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
2994 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
2995 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
2996 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
2997 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
2998 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
2999 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3000 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3001 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3002 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3003 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3004 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3005 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3006 ])
3007 AT_CLEANUP
3008
3009 AT_SETUP([CTABLES categorical summary functions])
3010 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3011 AT_DATA([ctables.sps],
3012 [[GET 'nhtsa.sav'.
3013 CTABLES
3014     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
3015     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
3016     /SLABELS POSITION=ROW.
3017 ]])
3018 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3019                                                       Custom Tables
3020 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
3021 │                 │                     D5a. What would you say is your primary ethnic background?                     │
3022 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
3023 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
3024 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
3025 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
3026 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3027 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
3028 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
3029 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
3030 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3031 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3032 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
3033 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3034 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3035 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
3036 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
3037 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3038 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
3039 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
3040 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
3041 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3042 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3043 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
3044 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3045 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3046 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
3047 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
3048 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3049 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
3050 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
3051 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
3052 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3053 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3054 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
3055 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3056 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3057 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
3058 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
3059 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3060 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
3061 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
3062 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
3063 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3064 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3065 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
3066 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3067 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3068 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
3069 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
3070 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
3071 ])
3072 AT_CLEANUP
3073
3074
3075 AT_SETUP([CTABLES scale summary functions])
3076 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3077 AT_DATA([ctables.sps],
3078 [[GET 'nhtsa.sav'.
3079 SET TVAR=NAME.
3080
3081 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
3082   CTABLES later, to make the results easier to verify.
3083 SPLIT FILE BY REGION.
3084 FREQUENCIES
3085     qn19a
3086     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
3087     /FORMAT NOTABLE /MISSING=INCLUDE.
3088 SPLIT FILE OFF.
3089
3090 CTABLES
3091     /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
3092     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, COLPCT.SUM]
3093     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
3094     /SLABELS POSITION=ROW.
3095 ]])
3096 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3097          Statistics
3098 ╭────────────────┬────────╮
3099 │REGION          │  QN19A │
3100 ├────────────────┼────────┤
3101 │NE     N Valid  │     936│
3102 │         Missing│     473│
3103 │      ╶─────────┼────────┤
3104 │       Mean     │   19.33│
3105 │      ╶─────────┼────────┤
3106 │       S.E. Mean│     .14│
3107 │      ╶─────────┼────────┤
3108 │       Median   │   18.00│
3109 │      ╶─────────┼────────┤
3110 │       Mode     │   18.00│
3111 │      ╶─────────┼────────┤
3112 │       Std Dev  │    4.41│
3113 │      ╶─────────┼────────┤
3114 │       Variance │   19.41│
3115 │      ╶─────────┼────────┤
3116 │       Range    │   59.00│
3117 │      ╶─────────┼────────┤
3118 │       Minimum  │     .00│
3119 │      ╶─────────┼────────┤
3120 │       Maximum  │   59.00│
3121 │      ╶─────────┼────────┤
3122 │       Sum      │18092.00│
3123 ├────────────────┼────────┤
3124 │MW     N Valid  │    1019│
3125 │         Missing│     635│
3126 │      ╶─────────┼────────┤
3127 │       Mean     │   19.83│
3128 │      ╶─────────┼────────┤
3129 │       S.E. Mean│     .16│
3130 │      ╶─────────┼────────┤
3131 │       Median   │   19.00│
3132 │      ╶─────────┼────────┤
3133 │       Mode     │   18.00│
3134 │      ╶─────────┼────────┤
3135 │       Std Dev  │    5.15│
3136 │      ╶─────────┼────────┤
3137 │       Variance │   26.47│
3138 │      ╶─────────┼────────┤
3139 │       Range    │   71.00│
3140 │      ╶─────────┼────────┤
3141 │       Minimum  │    4.00│
3142 │      ╶─────────┼────────┤
3143 │       Maximum  │   75.00│
3144 │      ╶─────────┼────────┤
3145 │       Sum      │20206.00│
3146 ├────────────────┼────────┤
3147 │S      N Valid  │    1276│
3148 │         Missing│    1114│
3149 │      ╶─────────┼────────┤
3150 │       Mean     │   20.29│
3151 │      ╶─────────┼────────┤
3152 │       S.E. Mean│     .18│
3153 │      ╶─────────┼────────┤
3154 │       Median   │   19.00│
3155 │      ╶─────────┼────────┤
3156 │       Mode     │   18.00│
3157 │      ╶─────────┼────────┤
3158 │       Std Dev  │    6.44│
3159 │      ╶─────────┼────────┤
3160 │       Variance │   41.43│
3161 │      ╶─────────┼────────┤
3162 │       Range    │   75.00│
3163 │      ╶─────────┼────────┤
3164 │       Minimum  │    4.00│
3165 │      ╶─────────┼────────┤
3166 │       Maximum  │   79.00│
3167 │      ╶─────────┼────────┤
3168 │       Sum      │25886.00│
3169 ├────────────────┼────────┤
3170 │W      N Valid  │     950│
3171 │         Missing│     596│
3172 │      ╶─────────┼────────┤
3173 │       Mean     │   19.87│
3174 │      ╶─────────┼────────┤
3175 │       S.E. Mean│     .17│
3176 │      ╶─────────┼────────┤
3177 │       Median   │   19.00│
3178 │      ╶─────────┼────────┤
3179 │       Mode     │   18.00│
3180 │      ╶─────────┼────────┤
3181 │       Std Dev  │    5.25│
3182 │      ╶─────────┼────────┤
3183 │       Variance │   27.59│
3184 │      ╶─────────┼────────┤
3185 │       Range    │   61.00│
3186 │      ╶─────────┼────────┤
3187 │       Minimum  │    4.00│
3188 │      ╶─────────┼────────┤
3189 │       Maximum  │   65.00│
3190 │      ╶─────────┼────────┤
3191 │       Sum      │18877.00│
3192 ╰────────────────┴────────╯
3193
3194              Custom Tables
3195 ╭───────────────────────────┬────────╮
3196 │                           │  QN19A │
3197 ├───────────────────────────┼────────┤
3198 │REGION NE Valid N          │     936│
3199 │          Missing          │  473.00│
3200 │          Mean             │   19.33│
3201 │          Std Error of Mean│     .14│
3202 │          Median           │   18.00│
3203 │          Mode             │   18.00│
3204 │          Std Deviation    │    4.41│
3205 │          Variance         │   19.41│
3206 │          Range            │   59.00│
3207 │          Minimum          │     .00│
3208 │          Maximum          │   59.00│
3209 │          Sum              │18092.00│
3210 │          Count            │    1409│
3211 │          Total N          │    1409│
3212 │          Column Sum %     │   21.8%│
3213 │      ╶────────────────────┼────────┤
3214 │       MW Valid N          │    1019│
3215 │          Missing          │  635.00│
3216 │          Mean             │   19.83│
3217 │          Std Error of Mean│     .16│
3218 │          Median           │   19.00│
3219 │          Mode             │   18.00│
3220 │          Std Deviation    │    5.15│
3221 │          Variance         │   26.47│
3222 │          Range            │   71.00│
3223 │          Minimum          │    4.00│
3224 │          Maximum          │   75.00│
3225 │          Sum              │20206.00│
3226 │          Count            │    1654│
3227 │          Total N          │    1654│
3228 │          Column Sum %     │   24.3%│
3229 │      ╶────────────────────┼────────┤
3230 │       S  Valid N          │    1276│
3231 │          Missing          │ 1114.00│
3232 │          Mean             │   20.29│
3233 │          Std Error of Mean│     .18│
3234 │          Median           │   19.00│
3235 │          Mode             │   18.00│
3236 │          Std Deviation    │    6.44│
3237 │          Variance         │   41.43│
3238 │          Range            │   75.00│
3239 │          Minimum          │    4.00│
3240 │          Maximum          │   79.00│
3241 │          Sum              │25886.00│
3242 │          Count            │    2390│
3243 │          Total N          │    2390│
3244 │          Column Sum %     │   31.2%│
3245 │      ╶────────────────────┼────────┤
3246 │       W  Valid N          │     950│
3247 │          Missing          │  596.00│
3248 │          Mean             │   19.87│
3249 │          Std Error of Mean│     .17│
3250 │          Median           │   19.00│
3251 │          Mode             │   18.00│
3252 │          Std Deviation    │    5.25│
3253 │          Variance         │   27.59│
3254 │          Range            │   61.00│
3255 │          Minimum          │    4.00│
3256 │          Maximum          │   65.00│
3257 │          Sum              │18877.00│
3258 │          Count            │    1546│
3259 │          Total N          │    1546│
3260 │          Column Sum %     │   22.7%│
3261 ╰───────────────────────────┴────────╯
3262 ])
3263 AT_CLEANUP
3264
3265
3266 AT_SETUP([CTABLES hidden scale VLABELS])
3267 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3268 AT_DATA([ctables.sps],
3269 [[GET 'nhtsa.sav'.
3270 CTABLES
3271     /TABLE region BY qn19a + qn35
3272     /SLABELS POSITION=ROW.
3273 CTABLES
3274     /VLABELS VARIABLE=qn19a DISPLAY=NONE
3275     /TABLE region BY qn19a + qn35
3276     /SLABELS POSITION=ROW.
3277 CTABLES
3278     /VLABELS VARIABLE=qn35 DISPLAY=NONE
3279     /TABLE region BY qn19a + qn35
3280     /SLABELS POSITION=ROW.
3281
3282 * This one in particular caused a crash because no categories were
3283   created on the column axis, so passing in 0 for the index was still
3284   too big for that number of categories.  It was fixed by creating a
3285   name-only category for each variable despite the "NONE" request,
3286   then hiding the entire dimension's labels if all its labels were
3287   set to "NONE".
3288 CTABLES
3289     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
3290     /TABLE region BY qn19a + qn35
3291     /SLABELS POSITION=ROW.
3292 ]])
3293 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3294                                  Custom Tables
3295 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
3296 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
3297 │              │   when you first starting  │   many times have you driven a  │
3298 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
3299 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
3300 │              │      sips of alcohol.      │            beverages?           │
3301 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
3302 │Region NE Mean│                       19.33│                                2│
3303 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3304 │       MW Mean│                       19.83│                                2│
3305 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3306 │       S  Mean│                       20.29│                                2│
3307 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3308 │       W  Mean│                       19.87│                                2│
3309 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
3310
3311                                  Custom Tables
3312 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
3313 │              │     │  35. In the past thirty days, how many times have you  │
3314 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
3315 │              │QN19A│                  alcoholic beverages?                  │
3316 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
3317 │Region NE Mean│19.33│                                                       2│
3318 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3319 │       MW Mean│19.83│                                                       2│
3320 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3321 │       S  Mean│20.29│                                                       2│
3322 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3323 │       W  Mean│19.87│                                                       2│
3324 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
3325
3326                                  Custom Tables
3327 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
3328 │              │   19a. About how old were you when you first starting   │    │
3329 │              │  drinking alcohol, not counting small tastes or sips of │    │
3330 │              │                         alcohol.                        │qn35│
3331 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
3332 │Region NE Mean│                                                    19.33│   2│
3333 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3334 │       MW Mean│                                                    19.83│   2│
3335 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3336 │       S  Mean│                                                    20.29│   2│
3337 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3338 │       W  Mean│                                                    19.87│   2│
3339 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
3340
3341       Custom Tables
3342 ╭──────────────┬───────╮
3343 │Region NE Mean│19.33 2│
3344 │      ╶───────┼───────┤
3345 │       MW Mean│19.83 2│
3346 │      ╶───────┼───────┤
3347 │       S  Mean│20.29 2│
3348 │      ╶───────┼───────┤
3349 │       W  Mean│19.87 2│
3350 ╰──────────────┴───────╯
3351 ])
3352 AT_CLEANUP
3353