rotation works and is tested
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet tested:
4 dnl - Summary functions:
5 dnl   * Separate summary functions for totals and subtotals.
6 dnl   * U-prefix for unweighted summaries.
7 dnl   * areaPCT.SUM and UareaPCT.SUM functions.
8 dnl   * WEIGHT and adjustment weights.
9 dnl   * details of missing value handling in summaries.
10 dnl
11 dnl Not for v1:
12 dnl - Multiple response sets
13 dnl - MRSETS subcommand.
14 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
15 dnl - SIGTEST
16 dnl - COMPARETEST
17 dnl - Summary functions:
18 dnl   * .LCL and .UCL suffixes.
19 dnl   * .SE suffixes.
20 dnl - Summary functions:
21 dnl   * )CILEVEL in summary label specification
22 dnl - CATEGORIES:
23 dnl   * Data-dependent sorting.
24
25 AT_SETUP([CTABLES parsing])
26 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
27 AT_DATA([ctables.sps],
28 [[GET 'nhtsa.sav'.
29 CTABLES
30     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
31     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
32     /FORMAT UNITS=CM EMPTY="(-)"
33     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
34     /VLABELS VARIABLES=qn17 DISPLAY=NAME
35     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
36     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
37     /VLABELS VARIABLES=qn20 DISPLAY=NONE
38     /MRSETS COUNTDUPLICATES=NO
39     /MRSETS COUNTDUPLICATES=YES
40     /SMISSING VARIABLE
41     /SMISSING LISTWISE
42     /WEIGHT VARIABLE=qns3a
43     /HIDESMALLCOUNTS
44     /HIDESMALLCOUNTS COUNT=10
45     /TABLE qnsa1
46     /SLABELS POSITION=COLUMN VISIBLE=YES
47     /SLABELS VISIBLE=NO POSITION=ROW
48     /SLABELS POSITION=LAYER
49     /CLABELS AUTO
50     /CLABELS ROWLABELS=OPPOSITE
51     /CRITERIA CILEVEL=50
52     /CATEGORIES VARIABLES=qn1 qn17
53                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
54                 POSITION=BEFORE EMPTY=INCLUDE.
55 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
56 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
57 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
58 ]])
59 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
60          Custom Tables
61 Count
62 ╭───────────────────┬────┬────╮
63 │                   │ RDD│CELL│
64 ├───────────────────┼────┼────┤
65 │Sa1. SAMPLE SOURCE:│5392│1607│
66 ╰───────────────────┴────┴────╯
67
68        Custom Tables
69 RDD
70 ╭───────────────────┬─────╮
71 │                   │Count│
72 ├───────────────────┼─────┤
73 │Sa1. SAMPLE SOURCE:│ 5392│
74 ╰───────────────────┴─────╯
75
76           Custom Tables
77 ╭────────────────────────┬─────╮
78 │                        │Count│
79 ├────────────────────────┼─────┤
80 │Sa1. SAMPLE SOURCE: RDD │ 5392│
81 │                    CELL│ 1607│
82 ╰────────────────────────┴─────╯
83
84           Custom Tables
85 ╭────────────────────────┬─────╮
86 │                        │Count│
87 ├────────────────────────┼─────┤
88 │Sa1. SAMPLE SOURCE: RDD │ 5392│
89 │                    CELL│ 1607│
90 ╰────────────────────────┴─────╯
91 ])
92 AT_CLEANUP
93
94 AT_SETUP([CTABLES parsing - negative])
95 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
96 AT_DATA([ctables.sps],
97 [[GET 'nhtsa.sav'.
98 CTABLES.
99 CTABLES /FORMAT MINCOLWIDTH='foo'.
100 CTABLES /TABLE qn1 [**].
101 CTABLES /TABLE qn1 [NOTAFUNCTION].
102 CTABLES /TABLE (qn1.
103 CTABLES /TABLE **.
104 CTABLES /TABLE NOTAVAR.
105 STRING string(A8).
106 CTABLES /TABLE string[S].
107 CTABLES /TABLE qn1 [PTILE 101].
108 CTABLES /TABLE qn1 [MEAN F0.1].
109 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
110 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
111 CTABLES /TABLE qn1 [MEAN TOTALS].
112 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
113 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
114 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
115 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
116 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
117 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
118 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
119 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
120 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
121 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
122 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
123 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
124 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
127 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
128 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
129 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
130 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
131 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
132 CTABLES /PCOMPUTE &k=EXPR([LO **]).
133 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
134 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
135 CTABLES /PCOMPUTE &k=EXPR([1**]).
136 CTABLES /PCOMPUTE &k=EXPR((1x)).
137 CTABLES /PCOMPUTE **k.
138 CTABLES /PCOMPUTE &1.
139 CTABLES /PCOMPUTE &k**.
140 CTABLES /PCOMPUTE &k=**.
141 CTABLES /PCOMPUTE &k=EXPR**.
142 CTABLES /PCOMPUTE &k=EXPR(1x).
143 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
144 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
145 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
146 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
147 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
148 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
149 CTABLES /FORMAT EMPTY=**.
150 CTABLES /FORMAT MISSING=**.
151 CTABLES /FORMAT **.
152 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
153 CTABLES /VLABELS **.
154 CTABLES /VLABELS VARIABLES=NOTAVAR.
155 CTABLES /VLABELS VARIABLES=qn1 **.
156 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
157 CTABLES /MRSETS **.
158 CTABLES /MRSETS COUNTDUPLICATES=**.
159 CTABLES /SMISSING **.
160 CTABLES /WEIGHT **.
161 CTABLES /WEIGHT VARIABLE=NOTAVAR.
162 CTABLES /HIDESMALLCOUNTS COUNT=1.
163 CTABLES /QUUX.
164 CTABLES /HIDESMALLCOUNTS COUNT=2.
165 CTABLES /TABLE qn1**.
166 CTABLES /TABLE qn1 /SLABELS POSITION=**.
167 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
168 CTABLES /TABLE qn1 /SLABELS **.
169 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
170 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
171 CTABLES /TABLE qn1 /CLABELS **.
172 CTABLES /TABLE qn1 /CRITERIA **.
173 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
174 CTABLES /TABLE qn1 /TITLES **.
175 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
176 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
177 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
178 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
179 CTABLES /TABLE qn1 /SIGTEST **.
180 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
181 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
182 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
183 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
184 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
185 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
186 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
187 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
188 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
189 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
190 CTABLES /TABLE qn1 /COMPARETEST **.
191 CTABLES /TABLE qn1 / **.
192 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
193 CTABLES /TABLE qn20 > qnd1.
194 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
195 NUMERIC datetime (DATETIME17.0).
196 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
197 ]])
198 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
199 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
200
201 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
202 negative number for MINCOLWIDTH.
203
204 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
205 identifier.
206
207 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
208 summary function name.
209
210 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
211
212 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
213 identifier.
214
215 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
216
217 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
218 scale variable.
219    10 | CTABLES /TABLE string[S].
220       |                ^~~~~~~~~
221
222 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
223 between 0 and 100 for PTILE.
224
225 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
226 requires a width between 1 and 40.
227
228 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
229 format NEGPAREN requires width 2 or greater.
230
231 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
232 format NEGPAREN requires width greater than decimals.
233
234 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
235 scale variables.
236    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
237       |                     ^~~~
238
239 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
240    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
241       |                ^~~
242
243 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
244
245 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
246 scale variables.
247    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
248       |                     ^~~~
249
250 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
251    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
252       |                ^~~
253
254 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
255
256 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
257
258 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
259
260 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
261
262 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
263
264 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
265
266 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
267 identifier.
268
269 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
270    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
271       |                                               ^~
272
273 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
274 between 0 and 100 for PTILE.
275
276 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
277 `@:}@'.
278
279 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
280 `@{:@'.
281
282 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
283 or EXCLUDE.
284
285 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
286 NO.
287
288 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
289
290 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
291 or AFTER.
292
293 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
294 or EXCLUDE.
295
296 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
297 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
298
299 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
300 LABEL, POSITION, or EMPTY.
301
302 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
303 integer for SUBTOTAL.
304
305 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
306
307 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
308
309 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
310
311 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
312
313 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
314
315 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
316
317 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
318
319 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
320
321 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
322
323 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
324
325 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
326
327 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
328
329 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
330 the previous definition.
331    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
332       |                               ^~~~~~~~~~~~~~~~~~~
333
334 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
335    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
336       |          ^~~~~~~~~~~~~~~~~~~
337
338 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
339 `/'.
340
341 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
342 Expecting summary function name.
343
344 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
345 between 0 and 100 for PTILE.
346
347 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
348
349 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
350 NO.
351
352 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
353 FORMAT, or HIDESOURCECATS.
354
355 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
356
357 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
358
359 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
360 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
361
362 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
363 MAXCOLWIDTH.
364
365 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
366 VARIABLES.
367
368 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
369
370 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
371 DISPLAY.
372
373 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
374 DEFAULT, NAME, LABEL, BOTH, or NONE.
375
376 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
377 COUNTDUPLICATES.
378
379 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
380 NO.
381
382 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
383 VARIABLE or LISTWISE.
384
385 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
386 VARIABLE.
387
388 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
389
390 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
391 greater for HIDESMALLCOUNTS COUNT.
392
393 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
394 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
395 HIDESMALLCOUNTS, or TABLE.
396
397 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
398 `/'.
399
400 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
401
402 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
403 ROW, or LAYER.
404
405 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
406 NO.
407
408 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
409 POSITION or VISIBLE.
410
411 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
412 OPPOSITE or LAYER.
413
414 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
415 OPPOSITE or LAYER.
416
417 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
418 ROWLABELS, or COLLABELS.
419
420 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
421 CILEVEL.
422
423 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
424 in @<:@0,100@:}@ for CILEVEL.
425
426 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
427 CAPTION, CORNER, or TITLE.
428
429 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
430 CHISQUARE.
431
432 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
433 in @<:@0,1@:}@ for ALPHA.
434
435 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
436 NO.
437
438 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
439 ALLVISIBLE or SUBTOTALS.
440
441 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
442 ALPHA, INCLUDEMRSETS, or CATEGORIES.
443
444 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
445 MEAN.
446
447 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
448 in (0,1) for ALPHA.
449
450 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
451 for ALPHA.
452
453 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
454 BONFERRONI, BH, or NONE.
455
456 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
457 NO.
458
459 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
460 or TESTEDCATS.
461
462 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
463 ALLVISIBLE or SUBTOTALS.
464
465 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
466 NO.
467
468 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
469 SIMPLE.
470
471 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
472 NO.
473
474 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
475 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
476 SHOWSIG.
477
478 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
479 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
480
481 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
482 specified.
483
484 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
485    97 | CTABLES /TABLE qn20 > qnd1.
486       |                ^~~~~~~~~~~
487
488 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
489    97 | CTABLES /TABLE qn20 > qnd1.
490       |                ^~~~
491
492 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
493    97 | CTABLES /TABLE qn20 > qnd1.
494       |                       ^~~~
495
496 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
497 categorical variables at the innermost nesting level.
498    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
499       |                ^~~~~~~~~~~~~~~~~~~~
500
501 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
502 summary.
503    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
504       |                ^~~
505
506 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
507 specification as format DATETIME: Day (123) must be between 1 and 31..
508   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
509       |                                                    ^~~~~
510 ]])
511 AT_CLEANUP
512
513 AT_SETUP([CTABLES parsing - more negative])
514 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
515 AT_DATA([ctables.sps],
516 [[GET 'nhtsa.sav'.
517 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
518 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
519 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
520
521 STRING string(A8).
522 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
523 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
524
525 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
526
527 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
528 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
529 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
530 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
531
532 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
533 CTABLES /PCOMPUTE &x=EXPR([**]).
534 CTABLES /PCOMPUTE &x=EXPR(**).
535
536 CTABLES /TABLE.
537
538 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
539 ]])
540 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
541 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
542 category not included in the category list.
543     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
544 VARIABLES=qn1 [&pc].
545       |
546 ^~~
547
548 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
549     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
550 VARIABLES=qn1 [&pc].
551       |                            ^~~~~~~~
552
553 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
554 list of categories here.
555     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
556 VARIABLES=qn1 [&pc].
557       |
558 ^~~~
559
560 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
561 category not included in the category list.
562     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
563 [&pc].
564       |
565 ^~~
566
567 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
568     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
569 [&pc].
570       |                            ^~~~~
571
572 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
573 variable's CATEGORIES specification.
574
575 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
576 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
577 subtotals by position, e.g. SUBTOTAL[1].
578     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
579 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
580       |
581 ^~~~~~~~~~~~~~~~~~~~~~~~
582
583 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
584 position.
585     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
586 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
587       |                            ^~~~~~~~
588
589 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
590 applied only to string variables, but this subcommand tries to apply it to
591 numeric variable QN1.
592     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
593       |                                               ^~~~~~~~
594
595 ctables.sps:8.53: error: CTABLES: This category specification may be applied
596 only to numeric variables, but this subcommand tries to apply it to string
597 variable string.
598     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
599       |                                                     ^
600
601 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
602 based on a summary function.
603
604 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
605 moved to be categorical, but qnd1 is a scale variable.
606
607 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
608 moved to have the same width, but QN1 has width 0 and string has width 8.
609
610 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
611 moved to have the same value labels, but QN1 and QNSA1 have different value
612 labels.
613
614 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
615 moved to have the same category specifications, but QN105BA and QN105BB have
616 different category specifications.
617
618 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
619 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
620 this warning, insert parentheses.
621    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
622       |                           ^~~~~~~
623
624 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
625 `/'.
626
627 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
628
629 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
630
631 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
632 variable must be specified.
633
634 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
635
636 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
637 summary.
638    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
639       |                                                  ^~~~~
640
641 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
642 summary.
643    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
644       |                ^~~~~
645
646 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
647 summary.
648    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
649       |                                 ^~~~~
650
651 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
652 has a summary even if the syntax does not explicitly specify one.
653    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
654       |                                 ^~~~~
655 ]])
656 AT_CLEANUP
657
658 AT_SETUP([CTABLES one categorical variable])
659 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
660 AT_DATA([ctables.sps],
661 [[GET 'nhtsa.sav'.
662 CTABLES /TABLE qn1.
663 CTABLES /TABLE BY qn1.
664 CTABLES /TABLE BY BY qn1.
665 ]])
666 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
667                                   Custom Tables
668 ╭────────────────────────────────────────────────────────────────────────┬─────╮
669 │                                                                        │Count│
670 ├────────────────────────────────────────────────────────────────────────┼─────┤
671 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
672 │motor vehicle?                                     Several days a week  │ 1274│
673 │                                                   Once a week or less  │  361│
674 │                                                   Only certain times a │  130│
675 │                                                   year                 │     │
676 │                                                   Never                │  540│
677 ╰────────────────────────────────────────────────────────────────────────┴─────╯
678
679                                   Custom Tables
680 ╭──────────────────────────────────────────────────────────────────────────────╮
681 │        1. How often do you usually drive a car or other motor vehicle?       │
682 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
683 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
684 │Every day│       week       │       less       │          year          │Never│
685 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
686 │  Count  │       Count      │       Count      │          Count         │Count│
687 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
688 │     4667│              1274│               361│                     130│  540│
689 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
690
691 Custom Tables
692 Every day
693 ╭─────╮
694 │Count│
695 ├─────┤
696 │ 4667│
697 ╰─────╯
698 ])
699 AT_CLEANUP
700
701 AT_SETUP([CTABLES one string variable])
702 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
703 AT_DATA([ctables.sps],
704 [[GET 'nhtsa.sav'.
705 STRING licensed(A8).
706 MISSING VALUES licensed('DontKnow', 'Refused').
707 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
708 CTABLES /TABLE licensed.
709 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
710 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
711 * Notice that the string matching is case-sensitive.
712 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
713 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
714 CTABLES
715     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
716     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
717     /TABLE licensed
718     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
719 CTABLES
720     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
721     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
722     /TABLE licensed
723     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
724 ]])
725 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
726     Custom Tables
727 ╭────────────┬─────╮
728 │            │Count│
729 ├────────────┼─────┤
730 │licensed No │  572│
731 │         Yes│ 6379│
732 ╰────────────┴─────╯
733
734           Custom Tables
735 ╭─────────────────┬─────┬───────╮
736 │                 │Count│Valid N│
737 ├─────────────────┼─────┼───────┤
738 │licensed DontKnow│    4│       │
739 │         No      │  572│       │
740 │         Refused │   44│       │
741 │         Yes     │ 6379│       │
742 │         Total   │ 6999│   6951│
743 ╰─────────────────┴─────┴───────╯
744
745      Custom Tables
746 ╭──────────────┬─────╮
747 │              │Count│
748 ├──────────────┼─────┤
749 │licensed Yes  │ 6379│
750 │         No   │  572│
751 │         Total│ 6951│
752 ╰──────────────┴─────╯
753
754      Custom Tables
755 ╭──────────────┬─────╮
756 │              │Count│
757 ├──────────────┼─────┤
758 │licensed Yes  │ 6379│
759 │         no   │    0│
760 │         Total│ 6379│
761 ╰──────────────┴─────╯
762
763       Custom Tables
764 ╭────────────────┬─────╮
765 │                │Count│
766 ├────────────────┼─────┤
767 │licensed No     │  572│
768 │         Refused│   44│
769 │         Yes    │ 6379│
770 │         Total  │ 6995│
771 ╰────────────────┴─────╯
772
773       Custom Tables
774 ╭────────────────┬─────╮
775 │                │Count│
776 ├────────────────┼─────┤
777 │licensed Yes    │ 6379│
778 │         Not Yes│  620│
779 ╰────────────────┴─────╯
780
781       Custom Tables
782 ╭────────────────┬─────╮
783 │                │Count│
784 ├────────────────┼─────┤
785 │licensed Yes    │ 6379│
786 │         Not Yes│  620│
787 ╰────────────────┴─────╯
788 ])
789 AT_CLEANUP
790
791 AT_SETUP([CTABLES one scale variable])
792 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
793 AT_DATA([ctables.sps],
794 [[GET 'nhtsa.sav'.
795 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
796 CTABLES /TABLE BY qnd1.
797 CTABLES /TABLE BY BY qnd1.
798 ]])
799 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
800                                   Custom Tables
801 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
802 │                      │     │       │       │    │     Std    │       │       │
803 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
804 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
805 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
806 │age?                  │     │       │       │    │            │       │       │
807 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
808
809         Custom Tables
810 ╭──────────────────────────╮
811 │D1. AGE: What is your age?│
812 ├──────────────────────────┤
813 │           Mean           │
814 ├──────────────────────────┤
815 │                        48│
816 ╰──────────────────────────╯
817
818 Custom Tables
819 D1. AGE: What is your age?
820 ╭────╮
821 │Mean│
822 ├────┤
823 │  48│
824 ╰────╯
825 ])
826 AT_CLEANUP
827
828 AT_SETUP([CTABLES simple stacking])
829 AT_KEYWORDS([stack stacked])
830 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
831 AT_DATA([ctables.sps],
832 [[GET 'nhtsa.sav'.
833 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
834 ]])
835 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
836                                   Custom Tables
837 ╭───────────────────────────────────────────────────────────────┬──────────────╮
838 │                                                               │ S3a. GENDER: │
839 │                                                               ├──────┬───────┤
840 │                                                               │ Male │ Female│
841 │                                                               ├──────┼───────┤
842 │                                                               │Column│ Column│
843 │                                                               │   %  │   %   │
844 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
845 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
846 │too much to drink to drive safely will A. Get      certain     │      │       │
847 │stopped by the police?                             Very likely │   21%│    22%│
848 │                                                   Somewhat    │   38%│    42%│
849 │                                                   likely      │      │       │
850 │                                                   Somewhat    │   21%│    18%│
851 │                                                   unlikely    │      │       │
852 │                                                   Very        │   10%│     8%│
853 │                                                   unlikely    │      │       │
854 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
855 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
856 │too much to drink to drive safely will B. Have an  certain     │      │       │
857 │accident?                                          Very likely │   36%│    45%│
858 │                                                   Somewhat    │   39%│    32%│
859 │                                                   likely      │      │       │
860 │                                                   Somewhat    │    9%│     4%│
861 │                                                   unlikely    │      │       │
862 │                                                   Very        │    3%│     2%│
863 │                                                   unlikely    │      │       │
864 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
865 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
866 │too much to drink to drive safely will C. Be       certain     │      │       │
867 │convicted for drunk driving?                       Very likely │   32%│    28%│
868 │                                                   Somewhat    │   27%│    32%│
869 │                                                   likely      │      │       │
870 │                                                   Somewhat    │   15%│    15%│
871 │                                                   unlikely    │      │       │
872 │                                                   Very        │    9%│     9%│
873 │                                                   unlikely    │      │       │
874 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
875 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
876 │too much to drink to drive safely will D. Be       certain     │      │       │
877 │arrested for drunk driving?                        Very likely │   26%│    27%│
878 │                                                   Somewhat    │   32%│    35%│
879 │                                                   likely      │      │       │
880 │                                                   Somewhat    │   17%│    15%│
881 │                                                   unlikely    │      │       │
882 │                                                   Very        │    9%│     7%│
883 │                                                   unlikely    │      │       │
884 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
885 ])
886 AT_CLEANUP
887
888 AT_SETUP([CTABLES show or hide empty categories])
889 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
890 AT_DATA([ctables.sps],
891 [[GET 'nhtsa.sav'.
892 IF (qn105ba = 2) qn105ba = 1.
893 IF (qns3a = 1) qns3a = 2.
894 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
895 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
896     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
897 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
898     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
899 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
900     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
901 ]])
902 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
903                                   Custom Tables
904 ╭──────────────────────────────────────────────────────────────┬───────────────╮
905 │                                                              │  S3a. GENDER: │
906 │                                                              ├───────┬───────┤
907 │                                                              │  Male │ Female│
908 │                                                              ├───────┼───────┤
909 │                                                              │ Column│ Column│
910 │                                                              │   %   │   %   │
911 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
912 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
913 │too much to drink to drive safely will A. Get      certain    │       │       │
914 │stopped by the police?                             Very likely│      .│     0%│
915 │                                                   Somewhat   │      .│    40%│
916 │                                                   likely     │       │       │
917 │                                                   Somewhat   │      .│    19%│
918 │                                                   unlikely   │       │       │
919 │                                                   Very       │      .│     9%│
920 │                                                   unlikely   │       │       │
921 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
922
923                                   Custom Tables
924 ╭──────────────────────────────────────────────────────────────┬───────────────╮
925 │                                                              │  S3a. GENDER: │
926 │                                                              ├───────┬───────┤
927 │                                                              │  Male │ Female│
928 │                                                              ├───────┼───────┤
929 │                                                              │ Column│ Column│
930 │                                                              │   %   │   %   │
931 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
932 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
933 │too much to drink to drive safely will A. Get      certain    │       │       │
934 │stopped by the police?                             Somewhat   │      .│    40%│
935 │                                                   likely     │       │       │
936 │                                                   Somewhat   │      .│    19%│
937 │                                                   unlikely   │       │       │
938 │                                                   Very       │      .│     9%│
939 │                                                   unlikely   │       │       │
940 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
941
942                                   Custom Tables
943 ╭────────────────────────────────────────────────────────────────────┬─────────╮
944 │                                                                    │   S3a.  │
945 │                                                                    │ GENDER: │
946 │                                                                    ├─────────┤
947 │                                                                    │  Female │
948 │                                                                    ├─────────┤
949 │                                                                    │ Column %│
950 ├────────────────────────────────────────────────────────────────────┼─────────┤
951 │105b. How likely is it that drivers who have had too    Almost      │      32%│
952 │much to drink to drive safely will A. Get stopped by    certain     │         │
953 │the police?                                             Very likely │       0%│
954 │                                                        Somewhat    │      40%│
955 │                                                        likely      │         │
956 │                                                        Somewhat    │      19%│
957 │                                                        unlikely    │         │
958 │                                                        Very        │       9%│
959 │                                                        unlikely    │         │
960 ╰────────────────────────────────────────────────────────────────────┴─────────╯
961
962                                   Custom Tables
963 ╭────────────────────────────────────────────────────────────────────┬─────────╮
964 │                                                                    │   S3a.  │
965 │                                                                    │ GENDER: │
966 │                                                                    ├─────────┤
967 │                                                                    │  Female │
968 │                                                                    ├─────────┤
969 │                                                                    │ Column %│
970 ├────────────────────────────────────────────────────────────────────┼─────────┤
971 │105b. How likely is it that drivers who have had too    Almost      │      32%│
972 │much to drink to drive safely will A. Get stopped by    certain     │         │
973 │the police?                                             Somewhat    │      40%│
974 │                                                        likely      │         │
975 │                                                        Somewhat    │      19%│
976 │                                                        unlikely    │         │
977 │                                                        Very        │       9%│
978 │                                                        unlikely    │         │
979 ╰────────────────────────────────────────────────────────────────────┴─────────╯
980 ])
981 AT_CLEANUP
982
983 AT_SETUP([CTABLES sorting categories])
984 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
985 AT_DATA([ctables.sps],
986 [[GET 'nhtsa.sav'.
987 IF (QND5A=6) QND5A=-1.
988 IF (QND5A=5) QND5A=-2.
989 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
990         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
991         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
992         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
993 ]])
994 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
995                                   Custom Tables
996 ╭────────────────────────────────────────────────────────────────────────┬─────╮
997 │                                                                        │Count│
998 ├────────────────────────────────────────────────────────────────────────┼─────┤
999 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1000 │background?                                     -1.00                   │   78│
1001 │                                                Cuban                   │   20│
1002 │                                                Mexican                 │  311│
1003 │                                                Spanish                 │   48│
1004 │                                                South American          │   34│
1005 │                                                Central American        │    0│
1006 │                                                Puerto Rican, OR        │    0│
1007 │                                                Something else          │   68│
1008 │                                                Multiple - cannot choose│    7│
1009 │                                                one                     │     │
1010 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1011
1012                                   Custom Tables
1013 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1014 │                                                                        │Count│
1015 ├────────────────────────────────────────────────────────────────────────┼─────┤
1016 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1017 │background?                                     one                     │     │
1018 │                                                Something else          │   68│
1019 │                                                Puerto Rican, OR        │    0│
1020 │                                                Central American        │    0│
1021 │                                                South American          │   34│
1022 │                                                Spanish                 │   48│
1023 │                                                Mexican                 │  311│
1024 │                                                Cuban                   │   20│
1025 │                                                -1.00                   │   78│
1026 │                                                -2.00                   │   52│
1027 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1028
1029                                   Custom Tables
1030 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1031 │                                                                        │Count│
1032 ├────────────────────────────────────────────────────────────────────────┼─────┤
1033 │D5a. What would you say is your primary ethnic  Central American        │    0│
1034 │background?                                     Cuban                   │   20│
1035 │                                                Mexican                 │  311│
1036 │                                                Multiple - cannot choose│    7│
1037 │                                                one                     │     │
1038 │                                                Puerto Rican, OR        │    0│
1039 │                                                Something else          │   68│
1040 │                                                South American          │   34│
1041 │                                                Spanish                 │   48│
1042 │                                                -2.00                   │   52│
1043 │                                                -1.00                   │   78│
1044 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1045
1046                                   Custom Tables
1047 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1048 │                                                                        │Count│
1049 ├────────────────────────────────────────────────────────────────────────┼─────┤
1050 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1051 │background?                                     South American          │   34│
1052 │                                                Something else          │   68│
1053 │                                                Puerto Rican, OR        │    0│
1054 │                                                Multiple - cannot choose│    7│
1055 │                                                one                     │     │
1056 │                                                Mexican                 │  311│
1057 │                                                Cuban                   │   20│
1058 │                                                Central American        │    0│
1059 │                                                -1.00                   │   78│
1060 │                                                -2.00                   │   52│
1061 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1062 ])
1063 AT_CLEANUP
1064
1065 AT_SETUP([CTABLES simple nesting])
1066 AT_KEYWORDS([nest nested])
1067 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1068 AT_DATA([ctables.sps],
1069 [[GET 'nhtsa.sav'.
1070 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1071   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1072 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1073   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1074   /CLABELS ROW=OPPOSITE.
1075 ]])
1076 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1077                                   Custom Tables
1078 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1079 │                                                                 │     │ Table│
1080 │                                                                 │Count│   %  │
1081 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1082 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1083 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1084 │drive safely will A. Get stopped by                        Total │  700│   10%│
1085 │the police?                           ╶──────────────────────────┼─────┼──────┤
1086 │                                       Very       S3a.     Male  │  660│   10%│
1087 │                                       likely     GENDER:  Female│  842│   12%│
1088 │                                                           Total │ 1502│   22%│
1089 │                                      ╶──────────────────────────┼─────┼──────┤
1090 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1091 │                                       likely     GENDER:  Female│ 1589│   23%│
1092 │                                                           Total │ 2763│   40%│
1093 │                                      ╶──────────────────────────┼─────┼──────┤
1094 │                                       Somewhat   S3a.     Male  │  640│    9%│
1095 │                                       unlikely   GENDER:  Female│  667│   10%│
1096 │                                                           Total │ 1307│   19%│
1097 │                                      ╶──────────────────────────┼─────┼──────┤
1098 │                                       Very       S3a.     Male  │  311│    5%│
1099 │                                       unlikely   GENDER:  Female│  298│    4%│
1100 │                                                           Total │  609│    9%│
1101 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1102 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1103 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1104 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1105 │                                      ╶──────────────────────────┼─────┼──────┤
1106 │                                       Very       S3a.     Male  │ 1104│   16%│
1107 │                                       likely     GENDER:  Female│ 1715│   25%│
1108 │                                                           Total │ 2819│   41%│
1109 │                                      ╶──────────────────────────┼─────┼──────┤
1110 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1111 │                                       likely     GENDER:  Female│ 1214│   18%│
1112 │                                                           Total │ 2417│   35%│
1113 │                                      ╶──────────────────────────┼─────┼──────┤
1114 │                                       Somewhat   S3a.     Male  │  262│    4%│
1115 │                                       unlikely   GENDER:  Female│  168│    2%│
1116 │                                                           Total │  430│    6%│
1117 │                                      ╶──────────────────────────┼─────┼──────┤
1118 │                                       Very       S3a.     Male  │   81│    1%│
1119 │                                       unlikely   GENDER:  Female│   59│    1%│
1120 │                                                           Total │  140│    2%│
1121 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1122 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1123 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1124 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1125 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1126 │                                       Very       S3a.     Male  │  988│   14%│
1127 │                                       likely     GENDER:  Female│ 1049│   15%│
1128 │                                                           Total │ 2037│   30%│
1129 │                                      ╶──────────────────────────┼─────┼──────┤
1130 │                                       Somewhat   S3a.     Male  │  822│   12%│
1131 │                                       likely     GENDER:  Female│ 1210│   18%│
1132 │                                                           Total │ 2032│   30%│
1133 │                                      ╶──────────────────────────┼─────┼──────┤
1134 │                                       Somewhat   S3a.     Male  │  446│    7%│
1135 │                                       unlikely   GENDER:  Female│  548│    8%│
1136 │                                                           Total │  994│   15%│
1137 │                                      ╶──────────────────────────┼─────┼──────┤
1138 │                                       Very       S3a.     Male  │  268│    4%│
1139 │                                       unlikely   GENDER:  Female│  354│    5%│
1140 │                                                           Total │  622│    9%│
1141 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1142 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1143 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1144 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1145 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1146 │                                       Very       S3a.     Male  │  805│   12%│
1147 │                                       likely     GENDER:  Female│ 1029│   15%│
1148 │                                                           Total │ 1834│   27%│
1149 │                                      ╶──────────────────────────┼─────┼──────┤
1150 │                                       Somewhat   S3a.     Male  │  975│   14%│
1151 │                                       likely     GENDER:  Female│ 1332│   19%│
1152 │                                                           Total │ 2307│   34%│
1153 │                                      ╶──────────────────────────┼─────┼──────┤
1154 │                                       Somewhat   S3a.     Male  │  535│    8%│
1155 │                                       unlikely   GENDER:  Female│  560│    8%│
1156 │                                                           Total │ 1095│   16%│
1157 │                                      ╶──────────────────────────┼─────┼──────┤
1158 │                                       Very       S3a.     Male  │  270│    4%│
1159 │                                       unlikely   GENDER:  Female│  279│    4%│
1160 │                                                           Total │  549│    8%│
1161 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1162
1163                                   Custom Tables
1164 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1165 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1166 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1167 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1168 │                                 │        │ Table│         │         │        │
1169 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1170 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1171 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1172 │GENDER:        is it that drivers│        │      │         │         │        │
1173 │               who have had too  │        │      │         │         │        │
1174 │               much to drink to  │        │      │         │         │        │
1175 │               drive safely will │        │      │         │         │        │
1176 │               A. Get stopped by │        │      │         │         │        │
1177 │               the police?       │        │      │         │         │        │
1178 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1179 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1180 │               is it that drivers│        │      │         │         │        │
1181 │               who have had too  │        │      │         │         │        │
1182 │               much to drink to  │        │      │         │         │        │
1183 │               drive safely will │        │      │         │         │        │
1184 │               A. Get stopped by │        │      │         │         │        │
1185 │               the police?       │        │      │         │         │        │
1186 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1187 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1188 │               is it that drivers│        │      │         │         │        │
1189 │               who have had too  │        │      │         │         │        │
1190 │               much to drink to  │        │      │         │         │        │
1191 │               drive safely will │        │      │         │         │        │
1192 │               A. Get stopped by │        │      │         │         │        │
1193 │               the police?       │        │      │         │         │        │
1194 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1195 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1196 │GENDER:        is it that drivers│        │      │         │         │        │
1197 │               who have had too  │        │      │         │         │        │
1198 │               much to drink to  │        │      │         │         │        │
1199 │               drive safely will │        │      │         │         │        │
1200 │               B. Have an        │        │      │         │         │        │
1201 │               accident?         │        │      │         │         │        │
1202 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1203 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1204 │               is it that drivers│        │      │         │         │        │
1205 │               who have had too  │        │      │         │         │        │
1206 │               much to drink to  │        │      │         │         │        │
1207 │               drive safely will │        │      │         │         │        │
1208 │               B. Have an        │        │      │         │         │        │
1209 │               accident?         │        │      │         │         │        │
1210 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1211 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1212 │               is it that drivers│        │      │         │         │        │
1213 │               who have had too  │        │      │         │         │        │
1214 │               much to drink to  │        │      │         │         │        │
1215 │               drive safely will │        │      │         │         │        │
1216 │               B. Have an        │        │      │         │         │        │
1217 │               accident?         │        │      │         │         │        │
1218 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1219 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1220 │GENDER:        is it that drivers│        │      │         │         │        │
1221 │               who have had too  │        │      │         │         │        │
1222 │               much to drink to  │        │      │         │         │        │
1223 │               drive safely will │        │      │         │         │        │
1224 │               C. Be convicted   │        │      │         │         │        │
1225 │               for drunk driving?│        │      │         │         │        │
1226 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1227 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1228 │               is it that drivers│        │      │         │         │        │
1229 │               who have had too  │        │      │         │         │        │
1230 │               much to drink to  │        │      │         │         │        │
1231 │               drive safely will │        │      │         │         │        │
1232 │               C. Be convicted   │        │      │         │         │        │
1233 │               for drunk driving?│        │      │         │         │        │
1234 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1235 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1236 │               is it that drivers│        │      │         │         │        │
1237 │               who have had too  │        │      │         │         │        │
1238 │               much to drink to  │        │      │         │         │        │
1239 │               drive safely will │        │      │         │         │        │
1240 │               C. Be convicted   │        │      │         │         │        │
1241 │               for drunk driving?│        │      │         │         │        │
1242 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1243 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1244 │GENDER:        is it that drivers│        │      │         │         │        │
1245 │               who have had too  │        │      │         │         │        │
1246 │               much to drink to  │        │      │         │         │        │
1247 │               drive safely will │        │      │         │         │        │
1248 │               D. Be arrested for│        │      │         │         │        │
1249 │               drunk driving?    │        │      │         │         │        │
1250 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1251 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1252 │               is it that drivers│        │      │         │         │        │
1253 │               who have had too  │        │      │         │         │        │
1254 │               much to drink to  │        │      │         │         │        │
1255 │               drive safely will │        │      │         │         │        │
1256 │               D. Be arrested for│        │      │         │         │        │
1257 │               drunk driving?    │        │      │         │         │        │
1258 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1259 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1260 │               is it that drivers│        │      │         │         │        │
1261 │               who have had too  │        │      │         │         │        │
1262 │               much to drink to  │        │      │         │         │        │
1263 │               drive safely will │        │      │         │         │        │
1264 │               D. Be arrested for│        │      │         │         │        │
1265 │               drunk driving?    │        │      │         │         │        │
1266 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1267 ])
1268 AT_CLEANUP
1269
1270 AT_SETUP([CTABLES nesting and scale variables])
1271 AT_KEYWORDS([nest nested])
1272 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1273 AT_DATA([ctables.sps],
1274 [[GET 'nhtsa.sav'.
1275 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1276 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1277 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1278   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1279 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1280 ]])
1281 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1282                                   Custom Tables
1283 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1284 │                                                                 │S3a. GENDER:│
1285 │                                                                 ├─────┬──────┤
1286 │                                                                 │ Male│Female│
1287 │                                                                 ├─────┼──────┤
1288 │                                                                 │ Mean│ Mean │
1289 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1290 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1291 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1292 │                                                  week           │     │      │
1293 │                                                  Once a week or │   44│    54│
1294 │                                                  less           │     │      │
1295 │                                                  Only certain   │   34│    41│
1296 │                                                  times a year   │     │      │
1297 │                                                  Never          │   39│    55│
1298 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1299
1300                                   Custom Tables
1301 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1302 │                                                         │Minimum│Maximum│Mean│
1303 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1304 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1305 │What is  GENDER:         months, has there been a        │       │       │    │
1306 │your                     time when you felt you          │       │       │    │
1307 │age?                     should cut down on your      No │     16│     86│  46│
1308 │                         drinking?                       │       │       │    │
1309 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1310 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1311 │                         months, has there been a        │       │       │    │
1312 │                         time when you felt you          │       │       │    │
1313 │                         should cut down on your      No │     16│     86│  48│
1314 │                         drinking?                       │       │       │    │
1315 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1316 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1317 │What is  GENDER:         months, has there been a        │       │       │    │
1318 │your                     time when people criticized  No │     16│     86│  46│
1319 │age?                     your drinking?                  │       │       │    │
1320 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1321 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1322 │                         months, has there been a        │       │       │    │
1323 │                         time when people criticized  No │     16│     86│  48│
1324 │                         your drinking?                  │       │       │    │
1325 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1326
1327                                   Custom Tables
1328 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1329 │                             │S1. Including yourself, how many members of this│
1330 │                             │         household are age 16 or older?         │
1331 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1332 │                             │      │      │      │      │      │      │ 6 or │
1333 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1334 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1335 │                             │Column│Column│Column│Column│Column│Column│Column│
1336 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1337 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1338 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1339 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1340 │SOURCE:     likely           │      │      │      │      │      │      │      │
1341 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1342 │            that     likely  │      │      │      │      │      │      │      │
1343 │            drivers          │      │      │      │      │      │      │      │
1344 │            who have         │      │      │      │      │      │      │      │
1345 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1346 │            much to  likely  │      │      │      │      │      │      │      │
1347 │            drink to         │      │      │      │      │      │      │      │
1348 │            drive            │      │      │      │      │      │      │      │
1349 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1350 │            will A.  unlikely│      │      │      │      │      │      │      │
1351 │            Get              │      │      │      │      │      │      │      │
1352 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1353 │            by the   unlikely│      │      │      │      │      │      │      │
1354 │            police?          │      │      │      │      │      │      │      │
1355 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1356
1357                                   Custom Tables
1358 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1359 │                                                              │    │    Std   │
1360 │                                                              │Mean│ Deviation│
1361 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1362 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1363 │group           typical month did you have one or more        │    │          │
1364 │                alcoholic beverages to drink?                 │    │          │
1365 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1366 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1367 │                typical month did you have one or more        │    │          │
1368 │                alcoholic beverages to drink?                 │    │          │
1369 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1370 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1371 │                typical month did you have one or more        │    │          │
1372 │                alcoholic beverages to drink?                 │    │          │
1373 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1374 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1375 │                typical month did you have one or more        │    │          │
1376 │                alcoholic beverages to drink?                 │    │          │
1377 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1378 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1379 │                typical month did you have one or more        │    │          │
1380 │                alcoholic beverages to drink?                 │    │          │
1381 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1382 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1383 │       older    typical month did you have one or more        │    │          │
1384 │                alcoholic beverages to drink?                 │    │          │
1385 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1386 ])
1387 AT_CLEANUP
1388
1389
1390 AT_SETUP([CTABLES SLABELS])
1391 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1392 AT_DATA([ctables.sps],
1393 [[GET 'nhtsa.sav'.
1394 CTABLES /TABLE qn1 [COUNT COLPCT].
1395 CTABLES /TABLE qn1 [COUNT COLPCT]
1396     /SLABELS POSITION=ROW.
1397 CTABLES /TABLE qn1 [COUNT COLPCT]
1398     /SLABELS POSITION=ROW VISIBLE=NO.
1399 ]])
1400 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1401                                   Custom Tables
1402 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1403 │                                                                │     │ Column│
1404 │                                                                │Count│   %   │
1405 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1406 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1407 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1408 │                                             Once a week or less│  361│   5.2%│
1409 │                                             Only certain times │  130│   1.9%│
1410 │                                             a year             │     │       │
1411 │                                             Never              │  540│   7.7%│
1412 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1413
1414                                   Custom Tables
1415 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1416 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1417 │other motor vehicle?                                             Column │66.9%│
1418 │                                                                 %      │     │
1419 │                                            ╶───────────────────────────┼─────┤
1420 │                                             Several days a week Count  │ 1274│
1421 │                                                                 Column │18.3%│
1422 │                                                                 %      │     │
1423 │                                            ╶───────────────────────────┼─────┤
1424 │                                             Once a week or less Count  │  361│
1425 │                                                                 Column │ 5.2%│
1426 │                                                                 %      │     │
1427 │                                            ╶───────────────────────────┼─────┤
1428 │                                             Only certain times  Count  │  130│
1429 │                                             a year              Column │ 1.9%│
1430 │                                                                 %      │     │
1431 │                                            ╶───────────────────────────┼─────┤
1432 │                                             Never               Count  │  540│
1433 │                                                                 Column │ 7.7%│
1434 │                                                                 %      │     │
1435 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1436
1437                                   Custom Tables
1438 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1439 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1440 │motor vehicle?                                                          │66.9%│
1441 │                                                   Several days a week  │ 1274│
1442 │                                                                        │18.3%│
1443 │                                                   Once a week or less  │  361│
1444 │                                                                        │ 5.2%│
1445 │                                                   Only certain times a │  130│
1446 │                                                   year                 │ 1.9%│
1447 │                                                   Never                │  540│
1448 │                                                                        │ 7.7%│
1449 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1450 ])
1451 AT_CLEANUP
1452
1453 AT_SETUP([CTABLES simple totals])
1454 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1455 AT_DATA([ctables.sps],
1456 [[GET 'nhtsa.sav'.
1457 CTABLES /TABLE=qn17
1458     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1459 DESCRIPTIVES qn18/STATISTICS=MEAN.
1460 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1461     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1462 ]])
1463 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1464                                   Custom Tables
1465 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1466 │                                                                        │Count│
1467 ├────────────────────────────────────────────────────────────────────────┼─────┤
1468 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1469 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1470 │                                                      Light beer        │  620│
1471 │                                                      Wine              │ 1418│
1472 │                                                      Wine coolers      │  137│
1473 │                                                      Hard liquor or    │  888│
1474 │                                                      mixed drinks      │     │
1475 │                                                      Flavored malt     │   83│
1476 │                                                      drinks            │     │
1477 │                                                      Number responding │ 4221│
1478 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1479
1480                              Descriptive Statistics
1481 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1482 │                                                                    │  N │Mean│
1483 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1484 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1485 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1486 │Valid N (listwise)                                                  │6999│    │
1487 │Missing N (listwise)                                                │2781│    │
1488 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1489
1490                                   Custom Tables
1491 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1492 │                                                      │    │     │ Valid│Total│
1493 │                                                      │Mean│Count│   N  │  N  │
1494 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1495 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1496 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1497 │                you usually drink per sitting?        │    │     │      │     │
1498 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1499 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1500 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1501 │                you usually drink per sitting?        │    │     │      │     │
1502 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1503 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1504 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1505 │                you usually drink per sitting?        │    │     │      │     │
1506 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1507 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1508 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1509 │                you usually drink per sitting?        │    │     │      │     │
1510 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1511 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1512 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1513 │                you usually drink per sitting?        │    │     │      │     │
1514 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1515 ])
1516 AT_CLEANUP
1517
1518 AT_SETUP([CTABLES subtotals])
1519 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1520 AT_DATA([ctables.sps],
1521 [[GET 'nhtsa.sav'.
1522 CTABLES /TABLE=qn105ba BY qns1
1523     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1524 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1525     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1526 CTABLES /TABLE=qn105ba BY qns1
1527     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1528     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1529 ]])
1530 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1531                                                       Custom Tables
1532 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1533 │                                                         │ S1. Including yourself, how many members of this household │
1534 │                                                         │                    are age 16 or older?                    │
1535 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1536 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1537 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1538 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1539 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1540 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1541 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1542 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1543 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1544 │                                              likely     │       │       │         │       │        │      │          │
1545 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1546 │                                              unlikely   │       │       │         │       │        │      │          │
1547 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1548 │                                              unlikely   │       │       │         │       │        │      │          │
1549 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1550
1551                                                       Custom Tables
1552 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1553 │                                                        │  S1. Including yourself, how many members of this household │
1554 │                                                        │                     are age 16 or older?                    │
1555 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1556 │                                                        │        │        │        │        │       │        │  6 or  │
1557 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1558 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1559 │                                                        │        │        │        │        │ Column│        │        │
1560 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1561 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1562 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1563 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1564 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1565 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1566 │                                             likely     │        │        │        │        │       │        │        │
1567 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1568 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1569 │                                             unlikely   │        │        │        │        │       │        │        │
1570 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1571 │                                             unlikely   │        │        │        │        │       │        │        │
1572 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1573 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1574
1575                                                       Custom Tables
1576 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1577 │                                                         │ S1. Including yourself, how many members of this household │
1578 │                                                         │                    are age 16 or older?                    │
1579 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1580 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1581 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1582 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1583 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1584 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1585 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1586 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1587 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1588 │                                              likely     │       │       │         │       │        │      │          │
1589 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1590 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1591 │                                              unlikely   │       │       │         │       │        │      │          │
1592 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1593 │                                              unlikely   │       │       │         │       │        │      │          │
1594 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1595 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1596 ])
1597 AT_CLEANUP
1598
1599 AT_SETUP([CTABLES PCOMPUTE])
1600 AT_KEYWORDS([postcompute])
1601 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1602 AT_DATA([ctables.sps],
1603 [[GET 'nhtsa.sav'.
1604 CTABLES
1605     /PCOMPUTE &x=EXPR([3] + [4])
1606     /PCOMPUTE &y=EXPR([4] + [5])
1607     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1608     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1609     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1610     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1611
1612 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1613 CTABLES
1614     /PCOMPUTE &x=EXPR([3] + [4])
1615     /PCOMPUTE &y=EXPR([4] + [5])
1616     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1617     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1618     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1619     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1620 ]])
1621 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1622                                                                 Custom Tables
1623 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1624 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1625 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1626 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1627 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1628 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1629 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1630 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1631 │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%│
1632 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1633 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1634 │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%│
1635 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1636 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1637 │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%│
1638 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1639 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1640 │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%│
1641 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1642 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1643 │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%│
1644 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1645 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1646 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1647
1648                                                                 Custom Tables
1649 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1650 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1651 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1652 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1653 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1654 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1655 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1656 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1657 │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%│
1658 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1659 │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%│
1660 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1661 │                               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%│
1662 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1663 │                               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%│
1664 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1665 │                               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%│
1666 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1667 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1668 ])
1669 AT_CLEANUP
1670
1671 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1672 AT_KEYWORDS([postcompute])
1673 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1674 AT_DATA([ctables.sps],
1675 [[GET 'nhtsa.sav'.
1676 CTABLES
1677     /PCOMPUTE &x=EXPR(OTHERNM)
1678     /PCOMPUTE &y=EXPR(MISSING)
1679     /PPROPERTIES &x LABEL='Drivers'
1680     /PPROPERTIES &y LABEL='Missing Values 2'
1681     /TABLE=qn1 BY qns3a
1682     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1683 ]])
1684 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1685                                               Custom Tables
1686 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1687 │                                                                                          │S3a. GENDER:│
1688 │                                                                                          ├─────┬──────┤
1689 │                                                                                          │ Male│Female│
1690 │                                                                                          ├─────┼──────┤
1691 │                                                                                          │Count│ Count│
1692 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1693 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1694 │                                                                 Several days a week      │  440│   834│
1695 │                                                                 Once a week or less      │  125│   236│
1696 │                                                                 Only certain times a year│   58│    72│
1697 │                                                                 Never                    │  192│   348│
1698 │                                                                 Drivers                  │ 2928│  3504│
1699 │                                                                 Valid Values             │ 3120│  3852│
1700 │                                                                 Don't know               │    3│     5│
1701 │                                                                 Refused                  │    9│    10│
1702 │                                                                 Missing Values           │   12│    15│
1703 │                                                                 Missing Values 2         │   12│    15│
1704 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1705 ])
1706 AT_CLEANUP
1707
1708 AT_SETUP([CTABLES PCOMPUTE - THRU])
1709 AT_KEYWORDS([postcompute])
1710 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1711 AT_DATA([ctables.sps],
1712 [[GET 'nhtsa.sav'.
1713 CTABLES
1714     /PCOMPUTE &x=EXPR([1 THRU 2])
1715     /PCOMPUTE &y=EXPR([3 THRU 4])
1716     /PCOMPUTE &z=EXPR([5] + MISSING)
1717     /PPROPERTIES &x LABEL='Frequent Drivers'
1718     /PPROPERTIES &y LABEL='Infrequent Drivers'
1719     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1720     /TABLE=qn1 BY qns3a
1721     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1722 ]])
1723 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1724                                               Custom Tables
1725 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1726 │                                                                                          │S3a. GENDER:│
1727 │                                                                                          ├─────┬──────┤
1728 │                                                                                          │ Male│Female│
1729 │                                                                                          ├─────┼──────┤
1730 │                                                                                          │Count│ Count│
1731 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1732 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1733 │                                                                 Several days a week      │  440│   834│
1734 │                                                                 Frequent Drivers         │ 2745│  3196│
1735 │                                                                 Once a week or less      │  125│   236│
1736 │                                                                 Only certain times a year│   58│    72│
1737 │                                                                 Infrequent Drivers       │  183│   308│
1738 │                                                                 Drivers                  │ 2928│  3504│
1739 │                                                                 Never                    │  192│   348│
1740 │                                                                 Don't know               │    3│     5│
1741 │                                                                 Refused                  │    9│    10│
1742 │                                                                 Not Drivers or Missing   │  204│   363│
1743 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1744 ])
1745 AT_CLEANUP
1746
1747 dnl I'm not sure that this is the correct behavior (see
1748 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1749 dnl but at least this test will notify us if the behavior changes.
1750 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1751 AT_KEYWORDS([PCOMPUTE postcompute])
1752 AT_DATA([ctables.sps],
1753 [[DATA LIST LIST NOTABLE/x y z.
1754 WEIGHT by z.
1755 FORMATS ALL (F1.0).
1756 VARIABLE LEVEL x y (NOMINAL).
1757 BEGIN DATA.
1758 1 4 5
1759 1 5 2
1760 1 6 9
1761 2 4 2
1762 2 5 3
1763 2 6 4
1764 3 4 1
1765 3 5 6
1766 3 6 1
1767 END DATA.
1768
1769 CTABLES
1770     /PCOMPUTE &a = EXPR([1] + [2])
1771     /PCOMPUTE &b = EXPR([2] + [3])
1772     /PCOMPUTE &c = EXPR([4] * [5])
1773     /PCOMPUTE &d = EXPR([5] * [6])
1774     /TABLE x BY y
1775     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1776     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1777 ]])
1778 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1779 [[                   Custom Tables
1780 ╭───────────┬─────────────────────────────────────╮
1781 │           │                  y                  │
1782 │           ├─────┬─────────┬─────┬─────────┬─────┤
1783 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
1784 │           ├─────┼─────────┼─────┼─────────┼─────┤
1785 │           │Count│  Count  │Count│  Count  │Count│
1786 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1787 │x 1        │    5│       10│    2│       18│    9│
1788 │  [1] + [2]│    7│        .│    5│        .│   13│
1789 │  2        │    2│        6│    3│       12│    4│
1790 │  [2] + [3]│    3│        .│    9│        .│    5│
1791 │  3        │    1│        6│    6│        6│    1│
1792 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1793 ]])
1794 AT_CLEANUP
1795
1796 AT_SETUP([CTABLES string and date and time])
1797
1798 weight=1
1799 for gender in F M; do
1800     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1801         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1802             printf "$weight $gender $month $wkday\n"
1803             weight=$(expr \( $weight + 3 \) % 7 + 2)
1804         done
1805     done
1806 done > ctables.txt
1807
1808 AT_DATA([ctables.sps],
1809 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1810     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1811 WEIGHT by w.
1812 VARIABLE LEVEL w (SCALE).
1813 VARIABLE LEVEL gender fmon fday (NOMINAL).
1814 VARIABLE LABEL
1815   gender 'Gender'
1816   fmon 'Favorite month'
1817   fday 'Favorite day of the week'.
1818 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1819 CTABLES
1820     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1821     /PPROPERTIES &q2 LABEL='Q2'
1822     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1823     /PPROPERTIES &weekend LABEL='Weekend'
1824     /TABLE fmon BY gender > fday
1825     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1826                                 4 THRU 6, &q2,
1827                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
1828                                 OTHERNM, SUBTOTAL='Q4']
1829     /CATEGORIES VARIABLES=gender ['M', 'F']
1830     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1831     /SLABELS VISIBLE=NO.
1832 ]])
1833 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1834                                               Custom Tables
1835 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1836 │                  │                                       Gender                                      │
1837 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1838 │                  │                   Male                  │                  Female                 │
1839 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1840 │                  │         Favorite day of the week        │         Favorite day of the week        │
1841 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1842 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1843 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1844 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
1845 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1846 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1847 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
1848 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1849 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1850 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
1851 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
1852 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
1853 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
1854 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1855 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
1856 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1857 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1858 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1859 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
1860 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1861 ])
1862 AT_CLEANUP
1863
1864 AT_SETUP([CTABLES CLABELS])
1865 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1866 AT_DATA([ctables.sps],
1867 [[GET 'nhtsa.sav'.
1868 CTABLES /TABLE AgeGroup BY qns3a.
1869 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1870 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1871 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1872 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1873 ]])
1874 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1875              Custom Tables
1876 ╭───────────────────────┬────────────╮
1877 │                       │S3a. GENDER:│
1878 │                       ├─────┬──────┤
1879 │                       │ Male│Female│
1880 │                       ├─────┼──────┤
1881 │                       │Count│ Count│
1882 ├───────────────────────┼─────┼──────┤
1883 │Age group 15 or younger│    0│     0│
1884 │          16 to 25     │  594│   505│
1885 │          26 to 35     │  476│   491│
1886 │          36 to 45     │  489│   548│
1887 │          46 to 55     │  526│   649│
1888 │          56 to 65     │  516│   731│
1889 │          66 or older  │  531│   943│
1890 ╰───────────────────────┴─────┴──────╯
1891
1892                                                       Custom Tables
1893 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1894 │       │                                                 S3a. GENDER:                                                 │
1895 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1896 │       │                         Male                         │                         Female                        │
1897 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1898 │       │  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 │
1899 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1900 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1901 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1902 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1903 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1904 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1905 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1906
1907                 Custom Tables
1908 ╭──────────────────────────────┬────────────╮
1909 │                              │S3a. GENDER:│
1910 │                              ├────────────┤
1911 │                              │    Count   │
1912 ├──────────────────────────────┼────────────┤
1913 │Age group 15 or younger Male  │           0│
1914 │                        Female│           0│
1915 │         ╶────────────────────┼────────────┤
1916 │          16 to 25      Male  │         594│
1917 │                        Female│         505│
1918 │         ╶────────────────────┼────────────┤
1919 │          26 to 35      Male  │         476│
1920 │                        Female│         491│
1921 │         ╶────────────────────┼────────────┤
1922 │          36 to 45      Male  │         489│
1923 │                        Female│         548│
1924 │         ╶────────────────────┼────────────┤
1925 │          46 to 55      Male  │         526│
1926 │                        Female│         649│
1927 │         ╶────────────────────┼────────────┤
1928 │          56 to 65      Male  │         516│
1929 │                        Female│         731│
1930 │         ╶────────────────────┼────────────┤
1931 │          66 or older   Male  │         531│
1932 │                        Female│         943│
1933 ╰──────────────────────────────┴────────────╯
1934
1935       Custom Tables
1936 15 or younger
1937 ╭─────────┬────────────╮
1938 │         │S3a. GENDER:│
1939 │         ├─────┬──────┤
1940 │         │ Male│Female│
1941 │         ├─────┼──────┤
1942 │         │Count│ Count│
1943 ├─────────┼─────┼──────┤
1944 │Age group│    0│     0│
1945 ╰─────────┴─────┴──────╯
1946
1947       Custom Tables
1948 16 to 25
1949 ╭─────────┬────────────╮
1950 │         │S3a. GENDER:│
1951 │         ├─────┬──────┤
1952 │         │ Male│Female│
1953 │         ├─────┼──────┤
1954 │         │Count│ Count│
1955 ├─────────┼─────┼──────┤
1956 │Age group│  594│   505│
1957 ╰─────────┴─────┴──────╯
1958
1959       Custom Tables
1960 26 to 35
1961 ╭─────────┬────────────╮
1962 │         │S3a. GENDER:│
1963 │         ├─────┬──────┤
1964 │         │ Male│Female│
1965 │         ├─────┼──────┤
1966 │         │Count│ Count│
1967 ├─────────┼─────┼──────┤
1968 │Age group│  476│   491│
1969 ╰─────────┴─────┴──────╯
1970
1971       Custom Tables
1972 36 to 45
1973 ╭─────────┬────────────╮
1974 │         │S3a. GENDER:│
1975 │         ├─────┬──────┤
1976 │         │ Male│Female│
1977 │         ├─────┼──────┤
1978 │         │Count│ Count│
1979 ├─────────┼─────┼──────┤
1980 │Age group│  489│   548│
1981 ╰─────────┴─────┴──────╯
1982
1983       Custom Tables
1984 46 to 55
1985 ╭─────────┬────────────╮
1986 │         │S3a. GENDER:│
1987 │         ├─────┬──────┤
1988 │         │ Male│Female│
1989 │         ├─────┼──────┤
1990 │         │Count│ Count│
1991 ├─────────┼─────┼──────┤
1992 │Age group│  526│   649│
1993 ╰─────────┴─────┴──────╯
1994
1995       Custom Tables
1996 56 to 65
1997 ╭─────────┬────────────╮
1998 │         │S3a. GENDER:│
1999 │         ├─────┬──────┤
2000 │         │ Male│Female│
2001 │         ├─────┼──────┤
2002 │         │Count│ Count│
2003 ├─────────┼─────┼──────┤
2004 │Age group│  516│   731│
2005 ╰─────────┴─────┴──────╯
2006
2007       Custom Tables
2008 66 or older
2009 ╭─────────┬────────────╮
2010 │         │S3a. GENDER:│
2011 │         ├─────┬──────┤
2012 │         │ Male│Female│
2013 │         ├─────┼──────┤
2014 │         │Count│ Count│
2015 ├─────────┼─────┼──────┤
2016 │Age group│  531│   943│
2017 ╰─────────┴─────┴──────╯
2018
2019              Custom Tables
2020 Male
2021 ╭───────────────────────┬────────────╮
2022 │                       │S3a. GENDER:│
2023 │                       ├────────────┤
2024 │                       │    Count   │
2025 ├───────────────────────┼────────────┤
2026 │Age group 15 or younger│           0│
2027 │          16 to 25     │         594│
2028 │          26 to 35     │         476│
2029 │          36 to 45     │         489│
2030 │          46 to 55     │         526│
2031 │          56 to 65     │         516│
2032 │          66 or older  │         531│
2033 ╰───────────────────────┴────────────╯
2034
2035              Custom Tables
2036 Female
2037 ╭───────────────────────┬────────────╮
2038 │                       │S3a. GENDER:│
2039 │                       ├────────────┤
2040 │                       │    Count   │
2041 ├───────────────────────┼────────────┤
2042 │Age group 15 or younger│           0│
2043 │          16 to 25     │         505│
2044 │          26 to 35     │         491│
2045 │          36 to 45     │         548│
2046 │          46 to 55     │         649│
2047 │          56 to 65     │         731│
2048 │          66 or older  │         943│
2049 ╰───────────────────────┴────────────╯
2050 ])
2051 AT_CLEANUP
2052
2053 AT_SETUP([CTABLES missing values])
2054 AT_DATA([ctables.sps],
2055 [[DATA LIST LIST NOTABLE/x y.
2056 BEGIN DATA.
2057 1 1
2058 1 2
2059 1 3
2060 1 4
2061 1 5
2062 1 .
2063 2 1
2064 2 2
2065 2 3
2066 2 4
2067 2 5
2068 2 .
2069 3 1
2070 3 2
2071 3 3
2072 3 4
2073 3 5
2074 3 .
2075 4 1
2076 4 2
2077 4 3
2078 4 4
2079 4 5
2080 4 .
2081 5 1
2082 5 2
2083 5 3
2084 5 4
2085 5 5
2086 5 .
2087 . 1
2088 . 2
2089 . 3
2090 . 4
2091 . 5
2092 . .
2093 END DATA.
2094 MISSING VALUES x (1, 2) y (2, 3).
2095 VARIABLE LEVEL ALL (NOMINAL).
2096
2097 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2098                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2099     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2100 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2101                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2102     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2103 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2104                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2105     /CATEGORIES VARIABLES=ALL TOTAL=YES
2106     /SLABELS POSITION=ROW.
2107 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2108                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2109     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2110     /SLABELS POSITION=ROW.
2111 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2112                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2113     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2114     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2115     /SLABELS POSITION=ROW.
2116 ]])
2117 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2118                                Custom Tables
2119 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2120 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2121 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2122 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2123 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2124 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2125 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2126 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2127 dnl Note that Column Total N % doesn't add up to 100 because missing
2128 dnl values are included in the total but not shown as a category and this
2129 dnl is expected behavior.
2130
2131                                Custom Tables
2132 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2133 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2134 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2135 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2136 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2137 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2138 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2139 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2140 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2141 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2142 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2143 dnl values are included in the total but not shown as a category and this
2144 dnl is expected behavior.
2145
2146                      Custom Tables
2147 ╭────────────────────────┬───────────────────────────╮
2148 │                        │             y             │
2149 │                        ├──────┬──────┬──────┬──────┤
2150 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2151 ├────────────────────────┼──────┼──────┼──────┼──────┤
2152 │x 3.00  Count           │     1│     1│     1│     3│
2153 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2154 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2155 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2156 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2157 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2158 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2159 │        Valid N         │      │      │      │     3│
2160 │        Total N         │      │      │      │     6│
2161 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2162 │  4.00  Count           │     1│     1│     1│     3│
2163 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2164 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2165 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2166 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2167 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2168 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2169 │        Valid N         │      │      │      │     3│
2170 │        Total N         │      │      │      │     6│
2171 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2172 │  5.00  Count           │     1│     1│     1│     3│
2173 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2174 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2175 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2176 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2177 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2178 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2179 │        Valid N         │      │      │      │     3│
2180 │        Total N         │      │      │      │     6│
2181 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2182 │  Total Count           │     3│     3│     3│     9│
2183 │        Column %        │100.0%│100.0%│100.0%│     .│
2184 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2185 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2186 │        Row %           │     .│     .│     .│     .│
2187 │        Row Valid N %   │     .│     .│     .│     .│
2188 │        Row Total N %   │     .│     .│     .│     .│
2189 │        Valid N         │     3│     3│     3│     9│
2190 │        Total N         │     6│     6│     6│    36│
2191 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2192
2193                             Custom Tables
2194 ╭────────────────────────┬─────────────────────────────────────────╮
2195 │                        │                    y                    │
2196 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2197 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2198 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2199 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2200 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2201 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2202 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2203 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2204 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2205 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2206 │        Valid N         │      │      │      │      │      │     0│
2207 │        Total N         │      │      │      │      │      │     6│
2208 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2209 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2210 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2211 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2212 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2213 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2214 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2215 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2216 │        Valid N         │      │      │      │      │      │     0│
2217 │        Total N         │      │      │      │      │      │     6│
2218 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2219 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2220 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2221 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2222 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2223 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2224 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2225 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2226 │        Valid N         │      │      │      │      │      │     3│
2227 │        Total N         │      │      │      │      │      │     6│
2228 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2229 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2230 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2231 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2232 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2233 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2234 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2235 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2236 │        Valid N         │      │      │      │      │      │     3│
2237 │        Total N         │      │      │      │      │      │     6│
2238 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2239 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2240 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2241 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2242 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2243 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2244 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2245 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2246 │        Valid N         │      │      │      │      │      │     3│
2247 │        Total N         │      │      │      │      │      │     6│
2248 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2249 │  Total Count           │     5│     5│     5│     5│     5│    25│
2250 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2251 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2252 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2253 │        Row %           │     .│     .│     .│     .│     .│     .│
2254 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2255 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2256 │        Valid N         │     3│     0│     0│     3│     3│     9│
2257 │        Total N         │     6│     6│     6│     6│     6│    36│
2258 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2259
2260                         Custom Tables
2261 ╭────────────────────────┬──────────────────────────────────╮
2262 │                        │                 y                │
2263 │                        ├──────┬──────┬──────┬──────┬──────┤
2264 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2265 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2266 │x 1.00  Count           │     1│     1│     1│     1│     4│
2267 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2268 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2269 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2270 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2271 │        Row Valid N %   │     .│     .│     .│     .│     .│
2272 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2273 │        Valid N         │      │      │      │      │     0│
2274 │        Total N         │      │      │      │      │     6│
2275 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2276 │  2.00  Count           │     1│     1│     1│     1│     4│
2277 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2278 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2279 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2280 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2281 │        Row Valid N %   │     .│     .│     .│     .│     .│
2282 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2283 │        Valid N         │      │      │      │      │     0│
2284 │        Total N         │      │      │      │      │     6│
2285 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2286 │  3.00  Count           │     1│     1│     1│     1│     4│
2287 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2288 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2289 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2290 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2291 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2292 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2293 │        Valid N         │      │      │      │      │     3│
2294 │        Total N         │      │      │      │      │     6│
2295 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2296 │  4.00  Count           │     1│     1│     1│     1│     4│
2297 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2298 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2299 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2300 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2301 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2302 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2303 │        Valid N         │      │      │      │      │     3│
2304 │        Total N         │      │      │      │      │     6│
2305 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2306 │  Total Count           │     4│     4│     4│     4│    16│
2307 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2308 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2309 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2310 │        Row %           │     .│     .│     .│     .│     .│
2311 │        Row Valid N %   │     .│     .│     .│     .│     .│
2312 │        Row Total N %   │     .│     .│     .│     .│     .│
2313 │        Valid N         │     2│     0│     2│     2│     6│
2314 │        Total N         │     5│     5│     5│     5│    30│
2315 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2316 ])
2317 AT_CLEANUP
2318
2319 AT_SETUP([CTABLES SMISSING=LISTWISE])
2320 AT_KEYWORDS([SMISSING LISTWISE])
2321 AT_DATA([ctables.sps],
2322 [[DATA LIST LIST NOTABLE/x y z.
2323 BEGIN DATA.
2324 1  . 40
2325 1 10 50
2326 1 20 60
2327 1  .  .
2328 1 30  .
2329 END DATA.
2330 VARIABLE LEVEL x (NOMINAL).
2331
2332 CTABLES /TABLE (y + z) > x.
2333 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2334
2335 * The following doesn't come out as listwise because the tables are
2336 separate, not linked by an > operator.
2337 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2338 ]])
2339 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2340   Custom Tables
2341 ╭────────┬─────╮
2342 │        │ Mean│
2343 ├────────┼─────┤
2344 │y x 1.00│20.00│
2345 ├────────┼─────┤
2346 │z x 1.00│50.00│
2347 ╰────────┴─────╯
2348
2349   Custom Tables
2350 ╭────────┬─────╮
2351 │        │ Mean│
2352 ├────────┼─────┤
2353 │y x 1.00│15.00│
2354 ├────────┼─────┤
2355 │z x 1.00│55.00│
2356 ╰────────┴─────╯
2357
2358   Custom Tables
2359 ╭────────┬─────╮
2360 │        │ Mean│
2361 ├────────┼─────┤
2362 │y x 1.00│20.00│
2363 ├────────┼─────┤
2364 │z x 1.00│50.00│
2365 ╰────────┴─────╯
2366 ])
2367 AT_CLEANUP
2368
2369 AT_SETUP([CTABLES VLABELS - variables on different axes])
2370 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2371 AT_DATA([ctables.sps],
2372 [[GET 'nhtsa.sav'.
2373 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2374 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2375 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2376 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2377 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2378 ]])
2379 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2380                                  Custom Tables
2381 ╭────────────────────────────────────────────────────────────────┬────────────╮
2382 │                                                                │S3a. GENDER:│
2383 │                                                                ├─────┬──────┤
2384 │                                                                │ Male│Female│
2385 │                                                                ├─────┼──────┤
2386 │                                                                │Count│ Count│
2387 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2388 │D5a. What would you say is your primary    Cuban                │   13│     7│
2389 │ethnic background?                         Mexican              │  175│   136│
2390 │                                           Spanish              │   20│    28│
2391 │                                           South American       │   21│    13│
2392 │                                           Central American     │   27│    25│
2393 │                                           Puerto Rican, OR     │   37│    41│
2394 │                                           Something else       │   35│    33│
2395 │                                           Multiple - cannot    │    2│     5│
2396 │                                           choose one           │     │      │
2397 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2398
2399                   Custom Tables
2400 ╭──────────────────────────────────┬────────────╮
2401 │                                  │    QNS3A   │
2402 │                                  ├─────┬──────┤
2403 │                                  │ Male│Female│
2404 │                                  ├─────┼──────┤
2405 │                                  │Count│ Count│
2406 ├──────────────────────────────────┼─────┼──────┤
2407 │QND5A Cuban                       │   13│     7│
2408 │      Mexican                     │  175│   136│
2409 │      Spanish                     │   20│    28│
2410 │      South American              │   21│    13│
2411 │      Central American            │   27│    25│
2412 │      Puerto Rican, OR            │   37│    41│
2413 │      Something else              │   35│    33│
2414 │      Multiple - cannot choose one│    2│     5│
2415 ╰──────────────────────────────────┴─────┴──────╯
2416
2417                                  Custom Tables
2418 ╭────────────────────────────────────────────────────────────────┬────────────╮
2419 │                                                                │S3a. GENDER:│
2420 │                                                                ├─────┬──────┤
2421 │                                                                │ Male│Female│
2422 │                                                                ├─────┼──────┤
2423 │                                                                │Count│ Count│
2424 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2425 │D5a. What would you say is your primary    Cuban                │   13│     7│
2426 │ethnic background?                         Mexican              │  175│   136│
2427 │                                           Spanish              │   20│    28│
2428 │                                           South American       │   21│    13│
2429 │                                           Central American     │   27│    25│
2430 │                                           Puerto Rican, OR     │   37│    41│
2431 │                                           Something else       │   35│    33│
2432 │                                           Multiple - cannot    │    2│     5│
2433 │                                           choose one           │     │      │
2434 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2435
2436                                  Custom Tables
2437 ╭────────────────────────────────────────────────────────────┬────────────────╮
2438 │                                                            │   QNS3A S3a.   │
2439 │                                                            │     GENDER:    │
2440 │                                                            ├───────┬────────┤
2441 │                                                            │  Male │ Female │
2442 │                                                            ├───────┼────────┤
2443 │                                                            │ Count │  Count │
2444 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2445 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2446 │primary ethnic background?               Mexican            │    175│     136│
2447 │                                         Spanish            │     20│      28│
2448 │                                         South American     │     21│      13│
2449 │                                         Central American   │     27│      25│
2450 │                                         Puerto Rican, OR   │     37│      41│
2451 │                                         Something else     │     35│      33│
2452 │                                         Multiple - cannot  │      2│       5│
2453 │                                         choose one         │       │        │
2454 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2455
2456                Custom Tables
2457 ╭────────────────────────────┬─────┬──────╮
2458 │                            │ Male│Female│
2459 │                            ├─────┼──────┤
2460 │                            │Count│ Count│
2461 ├────────────────────────────┼─────┼──────┤
2462 │Cuban                       │   13│     7│
2463 │Mexican                     │  175│   136│
2464 │Spanish                     │   20│    28│
2465 │South American              │   21│    13│
2466 │Central American            │   27│    25│
2467 │Puerto Rican, OR            │   37│    41│
2468 │Something else              │   35│    33│
2469 │Multiple - cannot choose one│    2│     5│
2470 ╰────────────────────────────┴─────┴──────╯
2471 ])
2472 AT_CLEANUP
2473
2474 AT_SETUP([CTABLES VLABELS - stacked variables])
2475 AT_KEYWORDS([stack stacking])
2476 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2477 AT_DATA([ctables.sps],
2478 [[GET 'nhtsa.sav'.
2479 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2480 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2481 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2482 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2483 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2484 ]])
2485 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2486                                  Custom Tables
2487 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2488 │                                                                       │Count│
2489 ├───────────────────────────────────────────────────────────────────────┼─────┤
2490 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2491 │background?                                     Mexican                │  311│
2492 │                                                Spanish                │   48│
2493 │                                                South American         │   34│
2494 │                                                Central American       │   52│
2495 │                                                Puerto Rican, OR       │   78│
2496 │                                                Something else         │   68│
2497 │                                                Multiple - cannot      │    7│
2498 │                                                choose one             │     │
2499 ├───────────────────────────────────────────────────────────────────────┼─────┤
2500 │QNS3A                                           Male                   │ 3132│
2501 │                                                Female                 │ 3867│
2502 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2503
2504                   Custom Tables
2505 ╭─────────────────────────────────────────┬─────╮
2506 │                                         │Count│
2507 ├─────────────────────────────────────────┼─────┤
2508 │QND5A        Cuban                       │   20│
2509 │             Mexican                     │  311│
2510 │             Spanish                     │   48│
2511 │             South American              │   34│
2512 │             Central American            │   52│
2513 │             Puerto Rican, OR            │   78│
2514 │             Something else              │   68│
2515 │             Multiple - cannot choose one│    7│
2516 ├─────────────────────────────────────────┼─────┤
2517 │S3a. GENDER: Male                        │ 3132│
2518 │             Female                      │ 3867│
2519 ╰─────────────────────────────────────────┴─────╯
2520
2521                                  Custom Tables
2522 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2523 │                                                                       │Count│
2524 ├───────────────────────────────────────────────────────────────────────┼─────┤
2525 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2526 │background?                                     Mexican                │  311│
2527 │                                                Spanish                │   48│
2528 │                                                South American         │   34│
2529 │                                                Central American       │   52│
2530 │                                                Puerto Rican, OR       │   78│
2531 │                                                Something else         │   68│
2532 │                                                Multiple - cannot      │    7│
2533 │                                                choose one             │     │
2534 ├───────────────────────────────────────────────────────────────────────┼─────┤
2535 │Male                                                                   │ 3132│
2536 ├───────────────────────────────────────────────────────────────────────┼─────┤
2537 │Female                                                                 │ 3867│
2538 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2539
2540             Custom Tables
2541 ╭─────────────────────────────┬─────╮
2542 │                             │Count│
2543 ├─────────────────────────────┼─────┤
2544 │Cuban                        │   20│
2545 ├─────────────────────────────┼─────┤
2546 │Mexican                      │  311│
2547 ├─────────────────────────────┼─────┤
2548 │Spanish                      │   48│
2549 ├─────────────────────────────┼─────┤
2550 │South American               │   34│
2551 ├─────────────────────────────┼─────┤
2552 │Central American             │   52│
2553 ├─────────────────────────────┼─────┤
2554 │Puerto Rican, OR             │   78│
2555 ├─────────────────────────────┼─────┤
2556 │Something else               │   68│
2557 ├─────────────────────────────┼─────┤
2558 │Multiple - cannot choose one │    7│
2559 ├─────────────────────────────┼─────┤
2560 │S3a. GENDER:     Male        │ 3132│
2561 │                 Female      │ 3867│
2562 ╰─────────────────────────────┴─────╯
2563
2564             Custom Tables
2565 ╭────────────────────────────┬─────╮
2566 │                            │Count│
2567 ├────────────────────────────┼─────┤
2568 │Cuban                       │   20│
2569 │Mexican                     │  311│
2570 │Spanish                     │   48│
2571 │South American              │   34│
2572 │Central American            │   52│
2573 │Puerto Rican, OR            │   78│
2574 │Something else              │   68│
2575 │Multiple - cannot choose one│    7│
2576 │Male                        │ 3132│
2577 │Female                      │ 3867│
2578 ╰────────────────────────────┴─────╯
2579 ])
2580 AT_CLEANUP
2581
2582 AT_SETUP([CTABLES VLABELS - nested variables])
2583 AT_KEYWORDS([nest nesting])
2584 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2585 AT_DATA([ctables.sps],
2586 [[GET 'nhtsa.sav'.
2587 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2588 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2589 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2590 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2591 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2592 ]])
2593 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2594                                  Custom Tables
2595 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2596 │                                                                       │Count│
2597 ├───────────────────────────────────────────────────────────────────────┼─────┤
2598 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2599 │primary ethnic background?                                       Female│    7│
2600 │                                     ╶─────────────────────────────────┼─────┤
2601 │                                      Mexican              QNS3A Male  │  175│
2602 │                                                                 Female│  136│
2603 │                                     ╶─────────────────────────────────┼─────┤
2604 │                                      Spanish              QNS3A Male  │   20│
2605 │                                                                 Female│   28│
2606 │                                     ╶─────────────────────────────────┼─────┤
2607 │                                      South American       QNS3A Male  │   21│
2608 │                                                                 Female│   13│
2609 │                                     ╶─────────────────────────────────┼─────┤
2610 │                                      Central American     QNS3A Male  │   27│
2611 │                                                                 Female│   25│
2612 │                                     ╶─────────────────────────────────┼─────┤
2613 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2614 │                                                                 Female│   41│
2615 │                                     ╶─────────────────────────────────┼─────┤
2616 │                                      Something else       QNS3A Male  │   35│
2617 │                                                                 Female│   33│
2618 │                                     ╶─────────────────────────────────┼─────┤
2619 │                                      Multiple - cannot    QNS3A Male  │    2│
2620 │                                      choose one                 Female│    5│
2621 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2622
2623                          Custom Tables
2624 ╭──────────────────────────────────────────────────────┬─────╮
2625 │                                                      │Count│
2626 ├──────────────────────────────────────────────────────┼─────┤
2627 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2628 │                                                Female│    7│
2629 │     ╶────────────────────────────────────────────────┼─────┤
2630 │      Mexican                      S3a. GENDER: Male  │  175│
2631 │                                                Female│  136│
2632 │     ╶────────────────────────────────────────────────┼─────┤
2633 │      Spanish                      S3a. GENDER: Male  │   20│
2634 │                                                Female│   28│
2635 │     ╶────────────────────────────────────────────────┼─────┤
2636 │      South American               S3a. GENDER: Male  │   21│
2637 │                                                Female│   13│
2638 │     ╶────────────────────────────────────────────────┼─────┤
2639 │      Central American             S3a. GENDER: Male  │   27│
2640 │                                                Female│   25│
2641 │     ╶────────────────────────────────────────────────┼─────┤
2642 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2643 │                                                Female│   41│
2644 │     ╶────────────────────────────────────────────────┼─────┤
2645 │      Something else               S3a. GENDER: Male  │   35│
2646 │                                                Female│   33│
2647 │     ╶────────────────────────────────────────────────┼─────┤
2648 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2649 │                                                Female│    5│
2650 ╰──────────────────────────────────────────────────────┴─────╯
2651
2652                                  Custom Tables
2653 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2654 │                                                                       │Count│
2655 ├───────────────────────────────────────────────────────────────────────┼─────┤
2656 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2657 │ethnic background?                                               Female│    7│
2658 │                                          ╶────────────────────────────┼─────┤
2659 │                                           Mexican               Male  │  175│
2660 │                                                                 Female│  136│
2661 │                                          ╶────────────────────────────┼─────┤
2662 │                                           Spanish               Male  │   20│
2663 │                                                                 Female│   28│
2664 │                                          ╶────────────────────────────┼─────┤
2665 │                                           South American        Male  │   21│
2666 │                                                                 Female│   13│
2667 │                                          ╶────────────────────────────┼─────┤
2668 │                                           Central American      Male  │   27│
2669 │                                                                 Female│   25│
2670 │                                          ╶────────────────────────────┼─────┤
2671 │                                           Puerto Rican, OR      Male  │   37│
2672 │                                                                 Female│   41│
2673 │                                          ╶────────────────────────────┼─────┤
2674 │                                           Something else        Male  │   35│
2675 │                                                                 Female│   33│
2676 │                                          ╶────────────────────────────┼─────┤
2677 │                                           Multiple - cannot     Male  │    2│
2678 │                                           choose one            Female│    5│
2679 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2680
2681                       Custom Tables
2682 ╭────────────────────────────────────────────────┬─────╮
2683 │                                                │Count│
2684 ├────────────────────────────────────────────────┼─────┤
2685 │Cuban                        S3a. GENDER: Male  │   13│
2686 │                                          Female│    7│
2687 ├────────────────────────────────────────────────┼─────┤
2688 │Mexican                      S3a. GENDER: Male  │  175│
2689 │                                          Female│  136│
2690 ├────────────────────────────────────────────────┼─────┤
2691 │Spanish                      S3a. GENDER: Male  │   20│
2692 │                                          Female│   28│
2693 ├────────────────────────────────────────────────┼─────┤
2694 │South American               S3a. GENDER: Male  │   21│
2695 │                                          Female│   13│
2696 ├────────────────────────────────────────────────┼─────┤
2697 │Central American             S3a. GENDER: Male  │   27│
2698 │                                          Female│   25│
2699 ├────────────────────────────────────────────────┼─────┤
2700 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2701 │                                          Female│   41│
2702 ├────────────────────────────────────────────────┼─────┤
2703 │Something else               S3a. GENDER: Male  │   35│
2704 │                                          Female│   33│
2705 ├────────────────────────────────────────────────┼─────┤
2706 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2707 │                                          Female│    5│
2708 ╰────────────────────────────────────────────────┴─────╯
2709
2710                Custom Tables
2711 ╭───────────────────────────────────┬─────╮
2712 │                                   │Count│
2713 ├───────────────────────────────────┼─────┤
2714 │Cuban                        Male  │   13│
2715 │                             Female│    7│
2716 ├───────────────────────────────────┼─────┤
2717 │Mexican                      Male  │  175│
2718 │                             Female│  136│
2719 ├───────────────────────────────────┼─────┤
2720 │Spanish                      Male  │   20│
2721 │                             Female│   28│
2722 ├───────────────────────────────────┼─────┤
2723 │South American               Male  │   21│
2724 │                             Female│   13│
2725 ├───────────────────────────────────┼─────┤
2726 │Central American             Male  │   27│
2727 │                             Female│   25│
2728 ├───────────────────────────────────┼─────┤
2729 │Puerto Rican, OR             Male  │   37│
2730 │                             Female│   41│
2731 ├───────────────────────────────────┼─────┤
2732 │Something else               Male  │   35│
2733 │                             Female│   33│
2734 ├───────────────────────────────────┼─────┤
2735 │Multiple - cannot choose one Male  │    2│
2736 │                             Female│    5│
2737 ╰───────────────────────────────────┴─────╯
2738 ])
2739 AT_CLEANUP
2740
2741 AT_SETUP([CTABLES FORMAT EMPTY])
2742 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2743 AT_DATA([ctables.sps],
2744 [[GET 'nhtsa.sav'.
2745 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2746 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2747 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2748 ]])
2749 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2750                                  Custom Tables
2751 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2752 │                                             │   D5. ETHNICITY: Are you of   │
2753 │                                             │  Hispanic or Latino origin or │
2754 │                                             │            descent?           │
2755 │                                             ├───────────────┬───────────────┤
2756 │                                             │      Yes      │       No      │
2757 │                                             ├───────────────┼───────────────┤
2758 │                                             │     Count     │     Count     │
2759 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2760 │D5a. What would you say is   Cuban           │             20│              0│
2761 │your primary ethnic          Mexican         │            311│              0│
2762 │background?                  Spanish         │             48│              0│
2763 │                             South American  │             34│              0│
2764 │                             Central American│             52│              0│
2765 │                             Puerto Rican, OR│             78│              0│
2766 │                             Something else  │             68│              0│
2767 │                             Multiple -      │              7│              0│
2768 │                             cannot choose   │               │               │
2769 │                             one             │               │               │
2770 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2771
2772                                  Custom Tables
2773 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2774 │                                             │   D5. ETHNICITY: Are you of   │
2775 │                                             │  Hispanic or Latino origin or │
2776 │                                             │            descent?           │
2777 │                                             ├───────────────┬───────────────┤
2778 │                                             │      Yes      │       No      │
2779 │                                             ├───────────────┼───────────────┤
2780 │                                             │     Count     │     Count     │
2781 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2782 │D5a. What would you say is   Cuban           │             20│               │
2783 │your primary ethnic          Mexican         │            311│               │
2784 │background?                  Spanish         │             48│               │
2785 │                             South American  │             34│               │
2786 │                             Central American│             52│               │
2787 │                             Puerto Rican, OR│             78│               │
2788 │                             Something else  │             68│               │
2789 │                             Multiple -      │              7│               │
2790 │                             cannot choose   │               │               │
2791 │                             one             │               │               │
2792 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2793
2794                                  Custom Tables
2795 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2796 │                                             │   D5. ETHNICITY: Are you of   │
2797 │                                             │  Hispanic or Latino origin or │
2798 │                                             │            descent?           │
2799 │                                             ├───────────────┬───────────────┤
2800 │                                             │      Yes      │       No      │
2801 │                                             ├───────────────┼───────────────┤
2802 │                                             │     Count     │     Count     │
2803 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2804 │D5a. What would you say is   Cuban           │             20│n/a            │
2805 │your primary ethnic          Mexican         │            311│n/a            │
2806 │background?                  Spanish         │             48│n/a            │
2807 │                             South American  │             34│n/a            │
2808 │                             Central American│             52│n/a            │
2809 │                             Puerto Rican, OR│             78│n/a            │
2810 │                             Something else  │             68│n/a            │
2811 │                             Multiple -      │              7│n/a            │
2812 │                             cannot choose   │               │               │
2813 │                             one             │               │               │
2814 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2815 ])
2816 AT_CLEANUP
2817
2818 AT_SETUP([CTABLES FORMAT MISSING])
2819 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2820 AT_DATA([ctables.sps],
2821 [[GET 'nhtsa.sav'.
2822 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2823 ]])
2824 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2825                                  Custom Tables
2826 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2827 │                                             │   D5. ETHNICITY: Are you of   │
2828 │                                             │  Hispanic or Latino origin or │
2829 │                                             │            descent?           │
2830 │                                             ├───────────────┬───────────────┤
2831 │                                             │      Yes      │       No      │
2832 │                                             ├───────────────┼───────────────┤
2833 │                                             │    Column %   │    Column %   │
2834 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2835 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2836 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2837 │background?                  Spanish         │           7.8%│(no data)      │
2838 │                             South American  │           5.5%│(no data)      │
2839 │                             Central American│           8.4%│(no data)      │
2840 │                             Puerto Rican, OR│          12.6%│(no data)      │
2841 │                             Something else  │          11.0%│(no data)      │
2842 │                             Multiple -      │           1.1%│(no data)      │
2843 │                             cannot choose   │               │               │
2844 │                             one             │               │               │
2845 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2846 ])
2847 AT_CLEANUP
2848
2849 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2850 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2851 AT_DATA([ctables.sps],
2852 [[GET 'nhtsa.sav'.
2853 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2854 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2855 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2856 ]])
2857 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2858                                  Custom Tables
2859 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2860 │                                                              │Count│Column %│
2861 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2862 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2863 │occasion?                                        1            │  491│   34.9%│
2864 │                                                 2            │  462│   32.9%│
2865 │                                                 3            │  229│   16.3%│
2866 │                                                 4            │   82│    5.8%│
2867 │                                                 5            │   56│    4.0%│
2868 │                                                 6            │   32│    2.3%│
2869 │                                                 7            │    9│     .6%│
2870 │                                                 8            │    8│     .6%│
2871 │                                                 9            │    4│     .3%│
2872 │                                                 10           │    6│     .4%│
2873 │                                                 11           │    2│     .1%│
2874 │                                                 12           │    5│     .4%│
2875 │                                                 14           │    1│     .1%│
2876 │                                                 15           │    1│     .1%│
2877 │                                                 18           │    1│     .1%│
2878 │                                                 20           │    4│     .3%│
2879 │                                                 25           │    1│     .1%│
2880 │                                                 30           │    3│     .2%│
2881 │                                                 60           │    1│     .1%│
2882 │                                                 99+          │    0│     .0%│
2883 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2884
2885                                  Custom Tables
2886 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2887 │                                                              │Count│Column %│
2888 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2889 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2890 │occasion?                                        1            │  491│   34.9%│
2891 │                                                 2            │  462│   32.9%│
2892 │                                                 3            │  229│   16.3%│
2893 │                                                 4            │   82│    5.8%│
2894 │                                                 5            │   56│    4.0%│
2895 │                                                 6            │   32│    2.3%│
2896 │                                                 7            │    9│     .6%│
2897 │                                                 8            │    8│     .6%│
2898 │                                                 9            │<5   │     .3%│
2899 │                                                 10           │    6│     .4%│
2900 │                                                 11           │<5   │     .1%│
2901 │                                                 12           │    5│     .4%│
2902 │                                                 14           │<5   │     .1%│
2903 │                                                 15           │<5   │     .1%│
2904 │                                                 18           │<5   │     .1%│
2905 │                                                 20           │<5   │     .3%│
2906 │                                                 25           │<5   │     .1%│
2907 │                                                 30           │<5   │     .2%│
2908 │                                                 60           │<5   │     .1%│
2909 │                                                 99+          │<5   │     .0%│
2910 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2911
2912                                  Custom Tables
2913 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2914 │                                                              │Count│Column %│
2915 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2916 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2917 │occasion?                                        1            │  491│   34.9%│
2918 │                                                 2            │  462│   32.9%│
2919 │                                                 3            │  229│   16.3%│
2920 │                                                 4            │   82│    5.8%│
2921 │                                                 5            │   56│    4.0%│
2922 │                                                 6            │   32│    2.3%│
2923 │                                                 7            │<10  │     .6%│
2924 │                                                 8            │<10  │     .6%│
2925 │                                                 9            │<10  │     .3%│
2926 │                                                 10           │<10  │     .4%│
2927 │                                                 11           │<10  │     .1%│
2928 │                                                 12           │<10  │     .4%│
2929 │                                                 14           │<10  │     .1%│
2930 │                                                 15           │<10  │     .1%│
2931 │                                                 18           │<10  │     .1%│
2932 │                                                 20           │<10  │     .3%│
2933 │                                                 25           │<10  │     .1%│
2934 │                                                 30           │<10  │     .2%│
2935 │                                                 60           │<10  │     .1%│
2936 │                                                 99+          │<10  │     .0%│
2937 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2938 ])
2939 AT_CLEANUP
2940
2941 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2942 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2943 AT_DATA([ctables.sps],
2944 [[GET 'nhtsa.sav'.
2945 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2946 ]])
2947 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2948  Custom Tables
2949 ╭────────────╮
2950 │S3a. GENDER:│
2951 ├─────┬──────┤
2952 │ Male│Female│
2953 ├─────┼──────┤
2954 │Count│ Count│
2955 ├─────┼──────┤
2956 │ 3132│  3867│
2957 ╰─────┴──────╯
2958 ])
2959 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2960 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2961 maximumColumnWidth="192"
2962 minimumColumnWidth="96"
2963 ])
2964 AT_CLEANUP
2965
2966 AT_SETUP([CTABLES special formats])
2967 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2968 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2969 AT_DATA([ctables.sps],
2970 [[GET 'nhtsa.sav'.
2971 COMPUTE x = qnd3 - 4.
2972 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].
2973 ]])
2974 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2975                            Custom Tables
2976 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2977 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2978 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2979 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
2980 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2981 ])
2982 AT_CLEANUP
2983
2984 AT_SETUP([CTABLES TITLES])
2985 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2986 AT_DATA([ctables.sps],
2987 [[GET 'nhtsa.sav'.
2988 CTABLES
2989     /VLABELS VARIABLES=qn1 DISPLAY=NONE
2990     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
2991     /TITLES TITLE='How often do you drive?'
2992             CAPTION='Generated )TIME on )DATE'
2993             CORNER=')TABLE'.
2994 ]])
2995 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
2996 s&../../..&MM/DD/YY&'], [0], [dnl
2997                             How often do you drive?
2998 ╭───────────────────────────────────┬─────────────────────────────────────────╮
2999 │                                   │               S3a. GENDER:              │
3000 │                                   ├────────────────────┬────────────────────┤
3001 │                                   │        Male        │       Female       │
3002 │                                   ├────────────────────┼────────────────────┤
3003 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3004 │                                   │ you of Hispanic or │ you of Hispanic or │
3005 │                                   │  Latino origin or  │  Latino origin or  │
3006 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3007 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3008 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3009 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3010 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3011 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3012 │Every day                          │      218│      2066│      166│      2175│
3013 │Several days a week                │       44│       391│       45│       782│
3014 │Once a week or less                │       16│       109│       12│       223│
3015 │Only certain times a year          │       15│        41│       11│        61│
3016 │Never                              │       39│       150│       56│       278│
3017 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3018 Generated HH:MM:SS on MM/DD/YY
3019 ])
3020 AT_CLEANUP
3021
3022 AT_SETUP([CTABLES area definitions])
3023 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3024 AT_DATA([ctables.sps],
3025 [[GET 'nhtsa.sav'.
3026 CTABLES
3027     /VLABELS VARIABLES=ALL DISPLAY=NAME
3028     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3029     /SLABELS POSITION=ROW
3030     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3031     /SLABELS POSITION=ROW
3032     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3033     /SLABELS POSITION=ROW.
3034 ]])
3035 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3036                     Custom Tables
3037 Male
3038 ╭─────────────────────────────┬─────────────┬──────╮
3039 │                             │    QND7A    │ QN64B│
3040 │                             ├──────┬──────┼───┬──┤
3041 │                             │  Yes │  No  │   │  │
3042 │                             ├──────┼──────┤   │  │
3043 │                             │ QN86 │ QN86 │   │  │
3044 │                             ├───┬──┼───┬──┤   │  │
3045 │                             │Yes│No│Yes│No│Yes│No│
3046 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3047 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3048 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3049 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3050 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3051 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3052 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3053 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3054 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3055 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3056 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3057 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3058 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3059 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3060 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3061 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3062 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3063
3064                     Custom Tables
3065 Female
3066 ╭─────────────────────────────┬─────────────┬──────╮
3067 │                             │    QND7A    │ QN64B│
3068 │                             ├──────┬──────┼───┬──┤
3069 │                             │  Yes │  No  │   │  │
3070 │                             ├──────┼──────┤   │  │
3071 │                             │ QN86 │ QN86 │   │  │
3072 │                             ├───┬──┼───┬──┤   │  │
3073 │                             │Yes│No│Yes│No│Yes│No│
3074 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3075 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3076 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3077 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3078 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3079 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3080 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3081 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3082 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3083 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3084 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3085 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3086 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3087 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3088 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3089 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3090 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3091
3092                     Custom Tables
3093 Male
3094 ╭──────────────────────────────┬─────────────┬──────╮
3095 │                              │    QND7A    │ QN64B│
3096 │                              ├──────┬──────┼───┬──┤
3097 │                              │  Yes │  No  │   │  │
3098 │                              ├──────┼──────┤   │  │
3099 │                              │ QN86 │ QN86 │   │  │
3100 │                              ├───┬──┼───┬──┤   │  │
3101 │                              │Yes│No│Yes│No│Yes│No│
3102 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3103 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3104 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3105 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3106 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3107 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3108 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3109 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3110 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3111 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3112 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3113 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3114 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3115
3116                     Custom Tables
3117 Female
3118 ╭──────────────────────────────┬─────────────┬──────╮
3119 │                              │    QND7A    │ QN64B│
3120 │                              ├──────┬──────┼───┬──┤
3121 │                              │  Yes │  No  │   │  │
3122 │                              ├──────┼──────┤   │  │
3123 │                              │ QN86 │ QN86 │   │  │
3124 │                              ├───┬──┼───┬──┤   │  │
3125 │                              │Yes│No│Yes│No│Yes│No│
3126 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3127 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3128 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3129 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3130 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3131 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3132 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3133 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3134 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3135 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3136 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3137 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3138 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3139
3140                       Custom Tables
3141 Male
3142 ╭─────────────────────────────────┬─────────────┬──────╮
3143 │                                 │    QND7A    │ QN64B│
3144 │                                 ├──────┬──────┼───┬──┤
3145 │                                 │  Yes │  No  │   │  │
3146 │                                 ├──────┼──────┤   │  │
3147 │                                 │ QN86 │ QN86 │   │  │
3148 │                                 ├───┬──┼───┬──┤   │  │
3149 │                                 │Yes│No│Yes│No│Yes│No│
3150 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3151 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3152 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3153 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3154 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3155 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3156 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3157 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3158 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3159 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3160 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3161 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3162 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3163
3164                       Custom Tables
3165 Female
3166 ╭─────────────────────────────────┬─────────────┬──────╮
3167 │                                 │    QND7A    │ QN64B│
3168 │                                 ├──────┬──────┼───┬──┤
3169 │                                 │  Yes │  No  │   │  │
3170 │                                 ├──────┼──────┤   │  │
3171 │                                 │ QN86 │ QN86 │   │  │
3172 │                                 ├───┬──┼───┬──┤   │  │
3173 │                                 │Yes│No│Yes│No│Yes│No│
3174 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3175 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3176 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3177 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3178 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3179 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3180 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3181 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3182 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3183 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3184 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3185 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3186 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3187 ])
3188 AT_CLEANUP
3189
3190 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3191 AT_KEYWORDS([ROWLABELS OPPOSITE])
3192 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3193 AT_DATA([ctables.sps],
3194 [[GET 'nhtsa.sav'.
3195 CTABLES
3196     /VLABELS VARIABLES=ALL DISPLAY=NAME
3197     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3198     /SLABELS POSITION=ROW
3199     /CLABELS ROWLABELS=OPPOSITE
3200     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3201     /SLABELS POSITION=ROW
3202     /CLABELS ROWLABELS=OPPOSITE
3203     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3204     /SLABELS POSITION=ROW
3205     /CLABELS ROWLABELS=OPPOSITE.
3206 ]])
3207 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3208                                         Custom Tables
3209 Male
3210 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3211 │                                  │                          QN27                         │
3212 │                                  ├───────────────────────────┬───────────────────────────┤
3213 │                                  │            Yes            │             No            │
3214 │                                  ├───────────────────────────┼───────────────────────────┤
3215 │                                  │           QND7A           │           QND7A           │
3216 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3217 │                                  │     Yes     │      No     │     Yes     │      No     │
3218 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3219 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3220 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3221 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3222 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3223 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3224 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3225 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3226 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3227 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3228 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3229 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3230 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3231 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3232 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3233 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3234 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3235 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3236 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3237 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3238 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3239 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3240 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3241
3242                                         Custom Tables
3243 Female
3244 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3245 │                                  │                          QN27                         │
3246 │                                  ├───────────────────────────┬───────────────────────────┤
3247 │                                  │            Yes            │             No            │
3248 │                                  ├───────────────────────────┼───────────────────────────┤
3249 │                                  │           QND7A           │           QND7A           │
3250 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3251 │                                  │     Yes     │      No     │     Yes     │      No     │
3252 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3253 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3254 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3255 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3256 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3257 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3258 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3259 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3260 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3261 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3262 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3263 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3264 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3265 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3266 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3267 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3268 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3269 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3270 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3271 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3272 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3273 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3274 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3275
3276                                         Custom Tables
3277 Male
3278 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3279 │                                   │                          QN27                         │
3280 │                                   ├───────────────────────────┬───────────────────────────┤
3281 │                                   │            Yes            │             No            │
3282 │                                   ├───────────────────────────┼───────────────────────────┤
3283 │                                   │           QND7A           │           QND7A           │
3284 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3285 │                                   │     Yes     │      No     │     Yes     │      No     │
3286 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3287 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3288 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3289 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3290 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3291 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3292 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3293 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3294 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3295 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3296 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3297 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3298 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3299 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3300 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3301 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3302 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3303 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3304 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3305
3306                                         Custom Tables
3307 Female
3308 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3309 │                                   │                          QN27                         │
3310 │                                   ├───────────────────────────┬───────────────────────────┤
3311 │                                   │            Yes            │             No            │
3312 │                                   ├───────────────────────────┼───────────────────────────┤
3313 │                                   │           QND7A           │           QND7A           │
3314 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3315 │                                   │     Yes     │      No     │     Yes     │      No     │
3316 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3317 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3318 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3319 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3320 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3321 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3322 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3323 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3324 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3325 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3326 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3327 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3328 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3329 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3330 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3331 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3332 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3333 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3334 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3335
3336                                           Custom Tables
3337 Male
3338 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3339 │                                      │                          QN27                         │
3340 │                                      ├───────────────────────────┬───────────────────────────┤
3341 │                                      │            Yes            │             No            │
3342 │                                      ├───────────────────────────┼───────────────────────────┤
3343 │                                      │           QND7A           │           QND7A           │
3344 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3345 │                                      │     Yes     │      No     │     Yes     │      No     │
3346 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3347 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3348 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3349 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3350 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3351 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3352 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3353 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3354 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3355 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3356 │              No  QN57 Column ID      │  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3357 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3358 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3359 │     No  QN61 Yes QN57 Column ID      │ 18│17│ 19│20│ 22│21│ 23│24│ 25│26│ 27│28│ 29│30│ 32│31│
3360 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3361 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3362 │              No  QN57 Column ID      │ 18│17│ 19│20│ 22│21│ 23│24│ 25│26│ 27│28│ 29│30│ 32│31│
3363 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3364 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3365
3366                                           Custom Tables
3367 Female
3368 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3369 │                                      │                          QN27                         │
3370 │                                      ├───────────────────────────┬───────────────────────────┤
3371 │                                      │            Yes            │             No            │
3372 │                                      ├───────────────────────────┼───────────────────────────┤
3373 │                                      │           QND7A           │           QND7A           │
3374 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3375 │                                      │     Yes     │      No     │     Yes     │      No     │
3376 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3377 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3378 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3379 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3380 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3381 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3382 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3383 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│34│ 36│35│ 37│38│ 39│40│ 42│41│ 44│43│ 45│46│ 47│48│
3384 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3385 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3386 │              No  QN57 Column ID      │ 33│34│ 36│35│ 37│38│ 39│40│ 42│41│ 44│43│ 45│46│ 47│48│
3387 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3388 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3389 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 54│53│ 56│55│ 57│58│ 60│59│ 62│61│ 64│63│
3390 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3391 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3392 │              No  QN57 Column ID      │ 49│50│ 51│52│ 54│53│ 56│55│ 57│58│ 60│59│ 62│61│ 64│63│
3393 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3394 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3395 ])
3396 AT_CLEANUP
3397
3398 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3399 AT_KEYWORDS([COLLABELS OPPOSITE])
3400 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3401 AT_DATA([ctables.sps],
3402 [[GET 'nhtsa.sav'.
3403 CTABLES
3404     /VLABELS VARIABLES=ALL DISPLAY=NAME
3405     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3406     /SLABELS POSITION=ROW
3407     /CLABELS COLLABELS=OPPOSITE
3408     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3409     /SLABELS POSITION=ROW
3410     /CLABELS COLLABELS=OPPOSITE
3411     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3412     /SLABELS POSITION=ROW
3413     /CLABELS COLLABELS=OPPOSITE.
3414 ]])
3415 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3416                           Custom Tables
3417 Male
3418 ╭──────────────────────────────────────────┬───────────────────╮
3419 │                                          │        QN27       │
3420 │                                          ├─────────┬─────────┤
3421 │                                          │   Yes   │    No   │
3422 │                                          ├─────────┼─────────┤
3423 │                                          │  QND7A  │  QND7A  │
3424 │                                          ├────┬────┼────┬────┤
3425 │                                          │ Yes│ No │ Yes│ No │
3426 │                                          ├────┼────┼────┼────┤
3427 │                                          │QN86│QN86│QN86│QN86│
3428 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3429 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3430 │                               Layer ID   │   1│   1│   1│   1│
3431 │                               Subtable ID│   1│   1│   2│   2│
3432 │                          ╶───────────────┼────┼────┼────┼────┤
3433 │                           No  Table ID   │   1│   1│   1│   1│
3434 │                               Layer ID   │   1│   1│   1│   1│
3435 │                               Subtable ID│   1│   1│   2│   2│
3436 │                      ╶───────────────────┼────┼────┼────┼────┤
3437 │                       No  Yes Table ID   │   1│   1│   1│   1│
3438 │                               Layer ID   │   1│   1│   1│   1│
3439 │                               Subtable ID│   3│   3│   4│   4│
3440 │                          ╶───────────────┼────┼────┼────┼────┤
3441 │                           No  Table ID   │   1│   1│   1│   1│
3442 │                               Layer ID   │   1│   1│   1│   1│
3443 │                               Subtable ID│   3│   3│   4│   4│
3444 │             ╶────────────────────────────┼────┼────┼────┼────┤
3445 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3446 │                               Layer ID   │   1│   1│   1│   1│
3447 │                               Subtable ID│   5│   5│   6│   6│
3448 │                          ╶───────────────┼────┼────┼────┼────┤
3449 │                           No  Table ID   │   1│   1│   1│   1│
3450 │                               Layer ID   │   1│   1│   1│   1│
3451 │                               Subtable ID│   5│   5│   6│   6│
3452 │                      ╶───────────────────┼────┼────┼────┼────┤
3453 │                       No  Yes Table ID   │   1│   1│   1│   1│
3454 │                               Layer ID   │   1│   1│   1│   1│
3455 │                               Subtable ID│   7│   7│   8│   8│
3456 │                          ╶───────────────┼────┼────┼────┼────┤
3457 │                           No  Table ID   │   1│   1│   1│   1│
3458 │                               Layer ID   │   1│   1│   1│   1│
3459 │                               Subtable ID│   7│   7│   8│   8│
3460 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3461 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3462 │                               Layer ID   │   1│   1│   1│   1│
3463 │                               Subtable ID│   9│   9│  10│  10│
3464 │                          ╶───────────────┼────┼────┼────┼────┤
3465 │                           No  Table ID   │   1│   1│   1│   1│
3466 │                               Layer ID   │   1│   1│   1│   1│
3467 │                               Subtable ID│   9│   9│  10│  10│
3468 │                      ╶───────────────────┼────┼────┼────┼────┤
3469 │                       No  Yes Table ID   │   1│   1│   1│   1│
3470 │                               Layer ID   │   1│   1│   1│   1│
3471 │                               Subtable ID│  11│  11│  12│  12│
3472 │                          ╶───────────────┼────┼────┼────┼────┤
3473 │                           No  Table ID   │   1│   1│   1│   1│
3474 │                               Layer ID   │   1│   1│   1│   1│
3475 │                               Subtable ID│  11│  11│  12│  12│
3476 │             ╶────────────────────────────┼────┼────┼────┼────┤
3477 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3478 │                               Layer ID   │   1│   1│   1│   1│
3479 │                               Subtable ID│  13│  13│  14│  14│
3480 │                          ╶───────────────┼────┼────┼────┼────┤
3481 │                           No  Table ID   │   1│   1│   1│   1│
3482 │                               Layer ID   │   1│   1│   1│   1│
3483 │                               Subtable ID│  13│  13│  14│  14│
3484 │                      ╶───────────────────┼────┼────┼────┼────┤
3485 │                       No  Yes Table ID   │   1│   1│   1│   1│
3486 │                               Layer ID   │   1│   1│   1│   1│
3487 │                               Subtable ID│  15│  15│  16│  16│
3488 │                          ╶───────────────┼────┼────┼────┼────┤
3489 │                           No  Table ID   │   1│   1│   1│   1│
3490 │                               Layer ID   │   1│   1│   1│   1│
3491 │                               Subtable ID│  15│  15│  16│  16│
3492 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3493
3494                           Custom Tables
3495 Female
3496 ╭──────────────────────────────────────────┬───────────────────╮
3497 │                                          │        QN27       │
3498 │                                          ├─────────┬─────────┤
3499 │                                          │   Yes   │    No   │
3500 │                                          ├─────────┼─────────┤
3501 │                                          │  QND7A  │  QND7A  │
3502 │                                          ├────┬────┼────┬────┤
3503 │                                          │ Yes│ No │ Yes│ No │
3504 │                                          ├────┼────┼────┼────┤
3505 │                                          │QN86│QN86│QN86│QN86│
3506 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3507 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3508 │                               Layer ID   │   2│   2│   2│   2│
3509 │                               Subtable ID│  17│  17│  18│  18│
3510 │                          ╶───────────────┼────┼────┼────┼────┤
3511 │                           No  Table ID   │   1│   1│   1│   1│
3512 │                               Layer ID   │   2│   2│   2│   2│
3513 │                               Subtable ID│  17│  17│  18│  18│
3514 │                      ╶───────────────────┼────┼────┼────┼────┤
3515 │                       No  Yes Table ID   │   1│   1│   1│   1│
3516 │                               Layer ID   │   2│   2│   2│   2│
3517 │                               Subtable ID│  19│  19│  20│  20│
3518 │                          ╶───────────────┼────┼────┼────┼────┤
3519 │                           No  Table ID   │   1│   1│   1│   1│
3520 │                               Layer ID   │   2│   2│   2│   2│
3521 │                               Subtable ID│  19│  19│  20│  20│
3522 │             ╶────────────────────────────┼────┼────┼────┼────┤
3523 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3524 │                               Layer ID   │   2│   2│   2│   2│
3525 │                               Subtable ID│  21│  21│  22│  22│
3526 │                          ╶───────────────┼────┼────┼────┼────┤
3527 │                           No  Table ID   │   1│   1│   1│   1│
3528 │                               Layer ID   │   2│   2│   2│   2│
3529 │                               Subtable ID│  21│  21│  22│  22│
3530 │                      ╶───────────────────┼────┼────┼────┼────┤
3531 │                       No  Yes Table ID   │   1│   1│   1│   1│
3532 │                               Layer ID   │   2│   2│   2│   2│
3533 │                               Subtable ID│  23│  23│  24│  24│
3534 │                          ╶───────────────┼────┼────┼────┼────┤
3535 │                           No  Table ID   │   1│   1│   1│   1│
3536 │                               Layer ID   │   2│   2│   2│   2│
3537 │                               Subtable ID│  23│  23│  24│  24│
3538 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3539 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3540 │                               Layer ID   │   2│   2│   2│   2│
3541 │                               Subtable ID│  25│  25│  26│  26│
3542 │                          ╶───────────────┼────┼────┼────┼────┤
3543 │                           No  Table ID   │   1│   1│   1│   1│
3544 │                               Layer ID   │   2│   2│   2│   2│
3545 │                               Subtable ID│  25│  25│  26│  26│
3546 │                      ╶───────────────────┼────┼────┼────┼────┤
3547 │                       No  Yes Table ID   │   1│   1│   1│   1│
3548 │                               Layer ID   │   2│   2│   2│   2│
3549 │                               Subtable ID│  27│  27│  28│  28│
3550 │                          ╶───────────────┼────┼────┼────┼────┤
3551 │                           No  Table ID   │   1│   1│   1│   1│
3552 │                               Layer ID   │   2│   2│   2│   2│
3553 │                               Subtable ID│  27│  27│  28│  28│
3554 │             ╶────────────────────────────┼────┼────┼────┼────┤
3555 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3556 │                               Layer ID   │   2│   2│   2│   2│
3557 │                               Subtable ID│  29│  29│  30│  30│
3558 │                          ╶───────────────┼────┼────┼────┼────┤
3559 │                           No  Table ID   │   1│   1│   1│   1│
3560 │                               Layer ID   │   2│   2│   2│   2│
3561 │                               Subtable ID│  29│  29│  30│  30│
3562 │                      ╶───────────────────┼────┼────┼────┼────┤
3563 │                       No  Yes Table ID   │   1│   1│   1│   1│
3564 │                               Layer ID   │   2│   2│   2│   2│
3565 │                               Subtable ID│  31│  31│  32│  32│
3566 │                          ╶───────────────┼────┼────┼────┼────┤
3567 │                           No  Table ID   │   1│   1│   1│   1│
3568 │                               Layer ID   │   2│   2│   2│   2│
3569 │                               Subtable ID│  31│  31│  32│  32│
3570 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3571
3572                           Custom Tables
3573 Male
3574 ╭───────────────────────────────────────────┬───────────────────╮
3575 │                                           │        QN27       │
3576 │                                           ├─────────┬─────────┤
3577 │                                           │   Yes   │    No   │
3578 │                                           ├─────────┼─────────┤
3579 │                                           │  QND7A  │  QND7A  │
3580 │                                           ├────┬────┼────┬────┤
3581 │                                           │ Yes│ No │ Yes│ No │
3582 │                                           ├────┼────┼────┼────┤
3583 │                                           │QN86│QN86│QN86│QN86│
3584 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3585 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   1│   1│   3│   3│
3586 │                               Layer Row ID│   1│   1│   1│   1│
3587 │                          ╶────────────────┼────┼────┼────┼────┤
3588 │                           No  Row ID      │   2│   2│   4│   4│
3589 │                               Layer Row ID│   2│   2│   2│   2│
3590 │                      ╶────────────────────┼────┼────┼────┼────┤
3591 │                       No  Yes Row ID      │   6│   6│   7│   7│
3592 │                               Layer Row ID│   4│   4│   4│   4│
3593 │                          ╶────────────────┼────┼────┼────┼────┤
3594 │                           No  Row ID      │   5│   5│   8│   8│
3595 │                               Layer Row ID│   3│   3│   3│   3│
3596 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3597 │              No  QN57 Yes Yes Row ID      │  10│  10│  11│  11│
3598 │                               Layer Row ID│   6│   6│   6│   6│
3599 │                          ╶────────────────┼────┼────┼────┼────┤
3600 │                           No  Row ID      │   9│   9│  12│  12│
3601 │                               Layer Row ID│   5│   5│   5│   5│
3602 │                      ╶────────────────────┼────┼────┼────┼────┤
3603 │                       No  Yes Row ID      │  13│  13│  15│  15│
3604 │                               Layer Row ID│   7│   7│   7│   7│
3605 │                          ╶────────────────┼────┼────┼────┼────┤
3606 │                           No  Row ID      │  14│  14│  16│  16│
3607 │                               Layer Row ID│   8│   8│   8│   8│
3608 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3609 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  20│  20│
3610 │                               Layer Row ID│   9│   9│   9│   9│
3611 │                          ╶────────────────┼────┼────┼────┼────┤
3612 │                           No  Row ID      │  18│  18│  19│  19│
3613 │                               Layer Row ID│  10│  10│  10│  10│
3614 │                      ╶────────────────────┼────┼────┼────┼────┤
3615 │                       No  Yes Row ID      │  21│  21│  24│  24│
3616 │                               Layer Row ID│  11│  11│  11│  11│
3617 │                          ╶────────────────┼────┼────┼────┼────┤
3618 │                           No  Row ID      │  22│  22│  23│  23│
3619 │                               Layer Row ID│  12│  12│  12│  12│
3620 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3621 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
3622 │                               Layer Row ID│  13│  13│  13│  13│
3623 │                          ╶────────────────┼────┼────┼────┼────┤
3624 │                           No  Row ID      │  26│  26│  28│  28│
3625 │                               Layer Row ID│  14│  14│  14│  14│
3626 │                      ╶────────────────────┼────┼────┼────┼────┤
3627 │                       No  Yes Row ID      │  30│  30│  32│  32│
3628 │                               Layer Row ID│  16│  16│  16│  16│
3629 │                          ╶────────────────┼────┼────┼────┼────┤
3630 │                           No  Row ID      │  29│  29│  31│  31│
3631 │                               Layer Row ID│  15│  15│  15│  15│
3632 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3633
3634                           Custom Tables
3635 Female
3636 ╭───────────────────────────────────────────┬───────────────────╮
3637 │                                           │        QN27       │
3638 │                                           ├─────────┬─────────┤
3639 │                                           │   Yes   │    No   │
3640 │                                           ├─────────┼─────────┤
3641 │                                           │  QND7A  │  QND7A  │
3642 │                                           ├────┬────┼────┬────┤
3643 │                                           │ Yes│ No │ Yes│ No │
3644 │                                           ├────┼────┼────┼────┤
3645 │                                           │QN86│QN86│QN86│QN86│
3646 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3647 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  34│  34│  35│  35│
3648 │                               Layer Row ID│  18│  18│  18│  18│
3649 │                          ╶────────────────┼────┼────┼────┼────┤
3650 │                           No  Row ID      │  33│  33│  36│  36│
3651 │                               Layer Row ID│  17│  17│  17│  17│
3652 │                      ╶────────────────────┼────┼────┼────┼────┤
3653 │                       No  Yes Row ID      │  38│  38│  39│  39│
3654 │                               Layer Row ID│  20│  20│  20│  20│
3655 │                          ╶────────────────┼────┼────┼────┼────┤
3656 │                           No  Row ID      │  37│  37│  40│  40│
3657 │                               Layer Row ID│  19│  19│  19│  19│
3658 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3659 │              No  QN57 Yes Yes Row ID      │  42│  42│  43│  43│
3660 │                               Layer Row ID│  22│  22│  22│  22│
3661 │                          ╶────────────────┼────┼────┼────┼────┤
3662 │                           No  Row ID      │  41│  41│  44│  44│
3663 │                               Layer Row ID│  21│  21│  21│  21│
3664 │                      ╶────────────────────┼────┼────┼────┼────┤
3665 │                       No  Yes Row ID      │  45│  45│  47│  47│
3666 │                               Layer Row ID│  23│  23│  23│  23│
3667 │                          ╶────────────────┼────┼────┼────┼────┤
3668 │                           No  Row ID      │  46│  46│  48│  48│
3669 │                               Layer Row ID│  24│  24│  24│  24│
3670 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3671 │     No  QN61 Yes QN57 Yes Yes Row ID      │  50│  50│  51│  51│
3672 │                               Layer Row ID│  26│  26│  26│  26│
3673 │                          ╶────────────────┼────┼────┼────┼────┤
3674 │                           No  Row ID      │  49│  49│  52│  52│
3675 │                               Layer Row ID│  25│  25│  25│  25│
3676 │                      ╶────────────────────┼────┼────┼────┼────┤
3677 │                       No  Yes Row ID      │  53│  53│  55│  55│
3678 │                               Layer Row ID│  27│  27│  27│  27│
3679 │                          ╶────────────────┼────┼────┼────┼────┤
3680 │                           No  Row ID      │  54│  54│  56│  56│
3681 │                               Layer Row ID│  28│  28│  28│  28│
3682 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3683 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
3684 │                               Layer Row ID│  29│  29│  29│  29│
3685 │                          ╶────────────────┼────┼────┼────┼────┤
3686 │                           No  Row ID      │  58│  58│  60│  60│
3687 │                               Layer Row ID│  30│  30│  30│  30│
3688 │                      ╶────────────────────┼────┼────┼────┼────┤
3689 │                       No  Yes Row ID      │  62│  62│  64│  64│
3690 │                               Layer Row ID│  32│  32│  32│  32│
3691 │                          ╶────────────────┼────┼────┼────┼────┤
3692 │                           No  Row ID      │  61│  61│  63│  63│
3693 │                               Layer Row ID│  31│  31│  31│  31│
3694 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3695
3696                             Custom Tables
3697 Male
3698 ╭──────────────────────────────────────────────┬───────────────────╮
3699 │                                              │        QN27       │
3700 │                                              ├─────────┬─────────┤
3701 │                                              │   Yes   │    No   │
3702 │                                              ├─────────┼─────────┤
3703 │                                              │  QND7A  │  QND7A  │
3704 │                                              ├────┬────┼────┬────┤
3705 │                                              │ Yes│ No │ Yes│ No │
3706 │                                              ├────┼────┼────┼────┤
3707 │                                              │QN86│QN86│QN86│QN86│
3708 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3709 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
3710 │                               Layer Column ID│   1│   2│   3│   4│
3711 │                          ╶───────────────────┼────┼────┼────┼────┤
3712 │                           No  Column ID      │   1│   2│   3│   4│
3713 │                               Layer Column ID│   1│   2│   3│   4│
3714 │                      ╶───────────────────────┼────┼────┼────┼────┤
3715 │                       No  Yes Column ID      │   5│   6│   7│   8│
3716 │                               Layer Column ID│   1│   2│   3│   4│
3717 │                          ╶───────────────────┼────┼────┼────┼────┤
3718 │                           No  Column ID      │   5│   6│   7│   8│
3719 │                               Layer Column ID│   1│   2│   3│   4│
3720 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3721 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
3722 │                               Layer Column ID│   1│   2│   3│   4│
3723 │                          ╶───────────────────┼────┼────┼────┼────┤
3724 │                           No  Column ID      │   9│  10│  11│  12│
3725 │                               Layer Column ID│   1│   2│   3│   4│
3726 │                      ╶───────────────────────┼────┼────┼────┼────┤
3727 │                       No  Yes Column ID      │  13│  14│  15│  16│
3728 │                               Layer Column ID│   1│   2│   3│   4│
3729 │                          ╶───────────────────┼────┼────┼────┼────┤
3730 │                           No  Column ID      │  13│  14│  15│  16│
3731 │                               Layer Column ID│   1│   2│   3│   4│
3732 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3733 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
3734 │                               Layer Column ID│   1│   2│   3│   4│
3735 │                          ╶───────────────────┼────┼────┼────┼────┤
3736 │                           No  Column ID      │  17│  18│  19│  20│
3737 │                               Layer Column ID│   1│   2│   3│   4│
3738 │                      ╶───────────────────────┼────┼────┼────┼────┤
3739 │                       No  Yes Column ID      │  21│  22│  23│  24│
3740 │                               Layer Column ID│   1│   2│   3│   4│
3741 │                          ╶───────────────────┼────┼────┼────┼────┤
3742 │                           No  Column ID      │  21│  22│  23│  24│
3743 │                               Layer Column ID│   1│   2│   3│   4│
3744 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3745 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
3746 │                               Layer Column ID│   1│   2│   3│   4│
3747 │                          ╶───────────────────┼────┼────┼────┼────┤
3748 │                           No  Column ID      │  25│  26│  27│  28│
3749 │                               Layer Column ID│   1│   2│   3│   4│
3750 │                      ╶───────────────────────┼────┼────┼────┼────┤
3751 │                       No  Yes Column ID      │  29│  30│  31│  32│
3752 │                               Layer Column ID│   1│   2│   3│   4│
3753 │                          ╶───────────────────┼────┼────┼────┼────┤
3754 │                           No  Column ID      │  29│  30│  31│  32│
3755 │                               Layer Column ID│   1│   2│   3│   4│
3756 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3757
3758                             Custom Tables
3759 Female
3760 ╭──────────────────────────────────────────────┬───────────────────╮
3761 │                                              │        QN27       │
3762 │                                              ├─────────┬─────────┤
3763 │                                              │   Yes   │    No   │
3764 │                                              ├─────────┼─────────┤
3765 │                                              │  QND7A  │  QND7A  │
3766 │                                              ├────┬────┼────┬────┤
3767 │                                              │ Yes│ No │ Yes│ No │
3768 │                                              ├────┼────┼────┼────┤
3769 │                                              │QN86│QN86│QN86│QN86│
3770 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3771 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
3772 │                               Layer Column ID│   5│   6│   7│   8│
3773 │                          ╶───────────────────┼────┼────┼────┼────┤
3774 │                           No  Column ID      │  33│  34│  35│  36│
3775 │                               Layer Column ID│   5│   6│   7│   8│
3776 │                      ╶───────────────────────┼────┼────┼────┼────┤
3777 │                       No  Yes Column ID      │  37│  38│  39│  40│
3778 │                               Layer Column ID│   5│   6│   7│   8│
3779 │                          ╶───────────────────┼────┼────┼────┼────┤
3780 │                           No  Column ID      │  37│  38│  39│  40│
3781 │                               Layer Column ID│   5│   6│   7│   8│
3782 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3783 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
3784 │                               Layer Column ID│   5│   6│   7│   8│
3785 │                          ╶───────────────────┼────┼────┼────┼────┤
3786 │                           No  Column ID      │  41│  42│  43│  44│
3787 │                               Layer Column ID│   5│   6│   7│   8│
3788 │                      ╶───────────────────────┼────┼────┼────┼────┤
3789 │                       No  Yes Column ID      │  45│  46│  47│  48│
3790 │                               Layer Column ID│   5│   6│   7│   8│
3791 │                          ╶───────────────────┼────┼────┼────┼────┤
3792 │                           No  Column ID      │  45│  46│  47│  48│
3793 │                               Layer Column ID│   5│   6│   7│   8│
3794 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3795 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
3796 │                               Layer Column ID│   5│   6│   7│   8│
3797 │                          ╶───────────────────┼────┼────┼────┼────┤
3798 │                           No  Column ID      │  49│  50│  51│  52│
3799 │                               Layer Column ID│   5│   6│   7│   8│
3800 │                      ╶───────────────────────┼────┼────┼────┼────┤
3801 │                       No  Yes Column ID      │  53│  54│  55│  56│
3802 │                               Layer Column ID│   5│   6│   7│   8│
3803 │                          ╶───────────────────┼────┼────┼────┼────┤
3804 │                           No  Column ID      │  53│  54│  55│  56│
3805 │                               Layer Column ID│   5│   6│   7│   8│
3806 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3807 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
3808 │                               Layer Column ID│   5│   6│   7│   8│
3809 │                          ╶───────────────────┼────┼────┼────┼────┤
3810 │                           No  Column ID      │  57│  58│  59│  60│
3811 │                               Layer Column ID│   5│   6│   7│   8│
3812 │                      ╶───────────────────────┼────┼────┼────┼────┤
3813 │                       No  Yes Column ID      │  61│  62│  63│  64│
3814 │                               Layer Column ID│   5│   6│   7│   8│
3815 │                          ╶───────────────────┼────┼────┼────┼────┤
3816 │                           No  Column ID      │  61│  62│  63│  64│
3817 │                               Layer Column ID│   5│   6│   7│   8│
3818 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3819 ])
3820 AT_CLEANUP
3821
3822 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
3823 AT_KEYWORDS([ROWLABELS LAYER])
3824 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3825 AT_DATA([ctables.sps],
3826 [[GET 'nhtsa.sav'.
3827 CTABLES
3828     /VLABELS VARIABLES=ALL DISPLAY=NAME
3829     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3830     /SLABELS POSITION=ROW
3831     /CLABELS ROWLABELS=LAYER
3832     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3833     /SLABELS POSITION=ROW
3834     /CLABELS ROWLABELS=LAYER
3835     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3836     /SLABELS POSITION=ROW
3837     /CLABELS ROWLABELS=LAYER.
3838 ]])
3839 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3840                           Custom Tables
3841 Male
3842 Yes
3843 ╭──────────────────────────────────┬───────────────────────────╮
3844 │                                  │            QN27           │
3845 │                                  ├─────────────┬─────────────┤
3846 │                                  │     Yes     │      No     │
3847 │                                  ├─────────────┼─────────────┤
3848 │                                  │    QND7A    │    QND7A    │
3849 │                                  ├──────┬──────┼──────┬──────┤
3850 │                                  │  Yes │  No  │  Yes │  No  │
3851 │                                  ├──────┼──────┼──────┼──────┤
3852 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3853 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3854 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3855 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3856 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3857 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3858 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  7│ 7│
3859 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3860 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3861 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3862 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  7│ 7│
3863 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3864 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3865 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3866 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 15│15│
3867 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3868 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3869 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3870 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 15│15│
3871 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3872
3873                           Custom Tables
3874 Male
3875 No
3876 ╭──────────────────────────────────┬───────────────────────────╮
3877 │                                  │            QN27           │
3878 │                                  ├─────────────┬─────────────┤
3879 │                                  │     Yes     │      No     │
3880 │                                  ├─────────────┼─────────────┤
3881 │                                  │    QND7A    │    QND7A    │
3882 │                                  ├──────┬──────┼──────┬──────┤
3883 │                                  │  Yes │  No  │  Yes │  No  │
3884 │                                  ├──────┼──────┼──────┼──────┤
3885 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3886 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3887 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3888 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3889 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3890 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3891 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  8│ 8│
3892 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3893 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3894 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3895 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  8│ 8│
3896 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3897 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3898 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3899 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 16│16│
3900 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3901 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3902 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3903 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 16│16│
3904 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3905
3906                           Custom Tables
3907 Female
3908 Yes
3909 ╭──────────────────────────────────┬───────────────────────────╮
3910 │                                  │            QN27           │
3911 │                                  ├─────────────┬─────────────┤
3912 │                                  │     Yes     │      No     │
3913 │                                  ├─────────────┼─────────────┤
3914 │                                  │    QND7A    │    QND7A    │
3915 │                                  ├──────┬──────┼──────┬──────┤
3916 │                                  │  Yes │  No  │  Yes │  No  │
3917 │                                  ├──────┼──────┼──────┼──────┤
3918 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3919 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3920 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3921 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3922 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3923 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3924 │                       Subtable ID│ 18│18│ 20│20│ 21│21│ 23│23│
3925 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3926 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3927 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3928 │                       Subtable ID│ 18│18│ 20│20│ 21│21│ 23│23│
3929 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3930 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3931 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3932 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3933 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3934 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3935 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3936 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3937 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3938
3939                           Custom Tables
3940 Female
3941 No
3942 ╭──────────────────────────────────┬───────────────────────────╮
3943 │                                  │            QN27           │
3944 │                                  ├─────────────┬─────────────┤
3945 │                                  │     Yes     │      No     │
3946 │                                  ├─────────────┼─────────────┤
3947 │                                  │    QND7A    │    QND7A    │
3948 │                                  ├──────┬──────┼──────┬──────┤
3949 │                                  │  Yes │  No  │  Yes │  No  │
3950 │                                  ├──────┼──────┼──────┼──────┤
3951 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3952 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3953 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3954 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3955 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3956 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3957 │                       Subtable ID│ 17│17│ 19│19│ 22│22│ 24│24│
3958 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3959 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3960 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3961 │                       Subtable ID│ 17│17│ 19│19│ 22│22│ 24│24│
3962 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3963 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3964 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3965 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3966 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3967 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3968 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3969 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3970 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3971
3972                           Custom Tables
3973 Male
3974 Yes
3975 ╭───────────────────────────────────┬───────────────────────────╮
3976 │                                   │            QN27           │
3977 │                                   ├─────────────┬─────────────┤
3978 │                                   │     Yes     │      No     │
3979 │                                   ├─────────────┼─────────────┤
3980 │                                   │    QND7A    │    QND7A    │
3981 │                                   ├──────┬──────┼──────┬──────┤
3982 │                                   │  Yes │  No  │  Yes │  No  │
3983 │                                   ├──────┼──────┼──────┼──────┤
3984 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
3985 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
3986 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
3987 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3988 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  6│ 6│  7│ 7│
3989 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3990 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3991 │              No  QN57 Row ID      │ 10│10│ 11│11│ 13│13│ 15│15│
3992 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3993 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3994 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 20│20│ 21│21│ 24│24│
3995 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3996 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3997 │              No  QN57 Row ID      │ 25│25│ 28│28│ 30│30│ 31│31│
3998 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3999 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4000
4001                           Custom Tables
4002 Male
4003 No
4004 ╭───────────────────────────────────┬───────────────────────────╮
4005 │                                   │            QN27           │
4006 │                                   ├─────────────┬─────────────┤
4007 │                                   │     Yes     │      No     │
4008 │                                   ├─────────────┼─────────────┤
4009 │                                   │    QND7A    │    QND7A    │
4010 │                                   ├──────┬──────┼──────┬──────┤
4011 │                                   │  Yes │  No  │  Yes │  No  │
4012 │                                   ├──────┼──────┼──────┼──────┤
4013 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4014 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4015 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4016 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4017 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  5│ 5│  8│ 8│
4018 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4019 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4020 │              No  QN57 Row ID      │  9│ 9│ 12│12│ 14│14│ 16│16│
4021 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4022 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4023 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 19│19│ 22│22│ 23│23│
4024 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4025 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4026 │              No  QN57 Row ID      │ 26│26│ 27│27│ 29│29│ 32│32│
4027 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4028 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4029
4030                           Custom Tables
4031 Female
4032 Yes
4033 ╭───────────────────────────────────┬───────────────────────────╮
4034 │                                   │            QN27           │
4035 │                                   ├─────────────┬─────────────┤
4036 │                                   │     Yes     │      No     │
4037 │                                   ├─────────────┼─────────────┤
4038 │                                   │    QND7A    │    QND7A    │
4039 │                                   ├──────┬──────┼──────┬──────┤
4040 │                                   │  Yes │  No  │  Yes │  No  │
4041 │                                   ├──────┼──────┼──────┼──────┤
4042 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4043 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4044 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4045 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4046 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 39│39│
4047 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4048 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4049 │              No  QN57 Row ID      │ 41│41│ 43│43│ 46│46│ 47│47│
4050 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4051 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4052 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 51│51│ 53│53│ 56│56│
4053 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4054 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4055 │              No  QN57 Row ID      │ 58│58│ 59│59│ 62│62│ 63│63│
4056 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4057 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4058
4059                           Custom Tables
4060 Female
4061 No
4062 ╭───────────────────────────────────┬───────────────────────────╮
4063 │                                   │            QN27           │
4064 │                                   ├─────────────┬─────────────┤
4065 │                                   │     Yes     │      No     │
4066 │                                   ├─────────────┼─────────────┤
4067 │                                   │    QND7A    │    QND7A    │
4068 │                                   ├──────┬──────┼──────┬──────┤
4069 │                                   │  Yes │  No  │  Yes │  No  │
4070 │                                   ├──────┼──────┼──────┼──────┤
4071 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4072 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4073 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4074 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4075 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 40│40│
4076 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4077 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4078 │              No  QN57 Row ID      │ 42│42│ 44│44│ 45│45│ 48│48│
4079 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4080 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4081 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 52│52│ 54│54│ 55│55│
4082 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4083 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4084 │              No  QN57 Row ID      │ 57│57│ 60│60│ 61│61│ 64│64│
4085 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4086 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4087
4088                             Custom Tables
4089 Male
4090 Yes
4091 ╭──────────────────────────────────────┬───────────────────────────╮
4092 │                                      │            QN27           │
4093 │                                      ├─────────────┬─────────────┤
4094 │                                      │     Yes     │      No     │
4095 │                                      ├─────────────┼─────────────┤
4096 │                                      │    QND7A    │    QND7A    │
4097 │                                      ├──────┬──────┼──────┬──────┤
4098 │                                      │  Yes │  No  │  Yes │  No  │
4099 │                                      ├──────┼──────┼──────┼──────┤
4100 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4101 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4102 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4103 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4104 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 4│  6│ 8│  9│11│ 14│15│
4105 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4106 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4107 │              No  QN57 Column ID      │  1│ 4│  6│ 8│  9│11│ 14│15│
4108 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4109 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4110 │     No  QN61 Yes QN57 Column ID      │ 18│19│ 22│23│ 25│27│ 29│32│
4111 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4112 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4113 │              No  QN57 Column ID      │ 18│19│ 22│23│ 25│27│ 29│32│
4114 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4115 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4116
4117                             Custom Tables
4118 Male
4119 No
4120 ╭──────────────────────────────────────┬───────────────────────────╮
4121 │                                      │            QN27           │
4122 │                                      ├─────────────┬─────────────┤
4123 │                                      │     Yes     │      No     │
4124 │                                      ├─────────────┼─────────────┤
4125 │                                      │    QND7A    │    QND7A    │
4126 │                                      ├──────┬──────┼──────┬──────┤
4127 │                                      │  Yes │  No  │  Yes │  No  │
4128 │                                      ├──────┼──────┼──────┼──────┤
4129 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4130 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4131 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4132 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4133 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 3│  5│ 7│ 10│12│ 13│16│
4134 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4135 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4136 │              No  QN57 Column ID      │  2│ 3│  5│ 7│ 10│12│ 13│16│
4137 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4138 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4139 │     No  QN61 Yes QN57 Column ID      │ 17│20│ 21│24│ 26│28│ 30│31│
4140 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4141 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4142 │              No  QN57 Column ID      │ 17│20│ 21│24│ 26│28│ 30│31│
4143 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4144 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4145
4146                             Custom Tables
4147 Female
4148 Yes
4149 ╭──────────────────────────────────────┬───────────────────────────╮
4150 │                                      │            QN27           │
4151 │                                      ├─────────────┬─────────────┤
4152 │                                      │     Yes     │      No     │
4153 │                                      ├─────────────┼─────────────┤
4154 │                                      │    QND7A    │    QND7A    │
4155 │                                      ├──────┬──────┼──────┬──────┤
4156 │                                      │  Yes │  No  │  Yes │  No  │
4157 │                                      ├──────┼──────┼──────┼──────┤
4158 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4159 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4160 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4161 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4162 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│36│ 37│39│ 42│44│ 45│47│
4163 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4164 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4165 │              No  QN57 Column ID      │ 33│36│ 37│39│ 42│44│ 45│47│
4166 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4167 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4168 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 54│56│ 57│60│ 62│64│
4169 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4170 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4171 │              No  QN57 Column ID      │ 49│51│ 54│56│ 57│60│ 62│64│
4172 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4173 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4174
4175                             Custom Tables
4176 Female
4177 No
4178 ╭──────────────────────────────────────┬───────────────────────────╮
4179 │                                      │            QN27           │
4180 │                                      ├─────────────┬─────────────┤
4181 │                                      │     Yes     │      No     │
4182 │                                      ├─────────────┼─────────────┤
4183 │                                      │    QND7A    │    QND7A    │
4184 │                                      ├──────┬──────┼──────┬──────┤
4185 │                                      │  Yes │  No  │  Yes │  No  │
4186 │                                      ├──────┼──────┼──────┼──────┤
4187 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4188 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4189 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4190 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4191 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│35│ 38│40│ 41│43│ 46│48│
4192 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4193 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4194 │              No  QN57 Column ID      │ 34│35│ 38│40│ 41│43│ 46│48│
4195 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4196 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4197 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 53│55│ 58│59│ 61│63│
4198 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4199 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4200 │              No  QN57 Column ID      │ 50│52│ 53│55│ 58│59│ 61│63│
4201 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4202 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4203 ])
4204 AT_CLEANUP
4205
4206 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4207 AT_KEYWORDS([COLLABELS LAYER])
4208 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4209 AT_DATA([ctables.sps],
4210 [[GET 'nhtsa.sav'.
4211 CTABLES
4212     /VLABELS VARIABLES=ALL DISPLAY=NAME
4213     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4214     /SLABELS POSITION=ROW
4215     /CLABELS COLLABELS=LAYER
4216     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4217     /SLABELS POSITION=ROW
4218     /CLABELS COLLABELS=LAYER
4219     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4220     /SLABELS POSITION=ROW
4221     /CLABELS COLLABELS=LAYER.
4222 ]])
4223 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4224                         Custom Tables
4225 Male
4226 Yes
4227 ╭──────────────────────────────────────┬───────────────────╮
4228 │                                      │        QN27       │
4229 │                                      ├─────────┬─────────┤
4230 │                                      │   Yes   │    No   │
4231 │                                      ├─────────┼─────────┤
4232 │                                      │  QND7A  │  QND7A  │
4233 │                                      ├────┬────┼────┬────┤
4234 │                                      │ Yes│ No │ Yes│ No │
4235 │                                      ├────┼────┼────┼────┤
4236 │                                      │QN86│QN86│QN86│QN86│
4237 ├──────────────────────────────────────┼────┼────┼────┼────┤
4238 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4239 │                           Layer ID   │   2│   2│   2│   2│
4240 │                           Subtable ID│   2│   2│   4│   4│
4241 │                      ╶───────────────┼────┼────┼────┼────┤
4242 │                       No  Table ID   │   1│   1│   1│   1│
4243 │                           Layer ID   │   2│   2│   2│   2│
4244 │                           Subtable ID│   2│   2│   4│   4│
4245 │             ╶────────────────────────┼────┼────┼────┼────┤
4246 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4247 │                           Layer ID   │   2│   2│   2│   2│
4248 │                           Subtable ID│   5│   5│   8│   8│
4249 │                      ╶───────────────┼────┼────┼────┼────┤
4250 │                       No  Table ID   │   1│   1│   1│   1│
4251 │                           Layer ID   │   2│   2│   2│   2│
4252 │                           Subtable ID│   5│   5│   8│   8│
4253 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4254 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4255 │                           Layer ID   │   2│   2│   2│   2│
4256 │                           Subtable ID│   9│   9│  12│  12│
4257 │                      ╶───────────────┼────┼────┼────┼────┤
4258 │                       No  Table ID   │   1│   1│   1│   1│
4259 │                           Layer ID   │   2│   2│   2│   2│
4260 │                           Subtable ID│   9│   9│  12│  12│
4261 │             ╶────────────────────────┼────┼────┼────┼────┤
4262 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4263 │                           Layer ID   │   2│   2│   2│   2│
4264 │                           Subtable ID│  14│  14│  15│  15│
4265 │                      ╶───────────────┼────┼────┼────┼────┤
4266 │                       No  Table ID   │   1│   1│   1│   1│
4267 │                           Layer ID   │   2│   2│   2│   2│
4268 │                           Subtable ID│  14│  14│  15│  15│
4269 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4270
4271                         Custom Tables
4272 Male
4273 No
4274 ╭──────────────────────────────────────┬───────────────────╮
4275 │                                      │        QN27       │
4276 │                                      ├─────────┬─────────┤
4277 │                                      │   Yes   │    No   │
4278 │                                      ├─────────┼─────────┤
4279 │                                      │  QND7A  │  QND7A  │
4280 │                                      ├────┬────┼────┬────┤
4281 │                                      │ Yes│ No │ Yes│ No │
4282 │                                      ├────┼────┼────┼────┤
4283 │                                      │QN86│QN86│QN86│QN86│
4284 ├──────────────────────────────────────┼────┼────┼────┼────┤
4285 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4286 │                           Layer ID   │   1│   1│   1│   1│
4287 │                           Subtable ID│   1│   1│   3│   3│
4288 │                      ╶───────────────┼────┼────┼────┼────┤
4289 │                       No  Table ID   │   1│   1│   1│   1│
4290 │                           Layer ID   │   1│   1│   1│   1│
4291 │                           Subtable ID│   1│   1│   3│   3│
4292 │             ╶────────────────────────┼────┼────┼────┼────┤
4293 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4294 │                           Layer ID   │   1│   1│   1│   1│
4295 │                           Subtable ID│   6│   6│   7│   7│
4296 │                      ╶───────────────┼────┼────┼────┼────┤
4297 │                       No  Table ID   │   1│   1│   1│   1│
4298 │                           Layer ID   │   1│   1│   1│   1│
4299 │                           Subtable ID│   6│   6│   7│   7│
4300 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4301 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4302 │                           Layer ID   │   1│   1│   1│   1│
4303 │                           Subtable ID│  10│  10│  11│  11│
4304 │                      ╶───────────────┼────┼────┼────┼────┤
4305 │                       No  Table ID   │   1│   1│   1│   1│
4306 │                           Layer ID   │   1│   1│   1│   1│
4307 │                           Subtable ID│  10│  10│  11│  11│
4308 │             ╶────────────────────────┼────┼────┼────┼────┤
4309 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4310 │                           Layer ID   │   1│   1│   1│   1│
4311 │                           Subtable ID│  13│  13│  16│  16│
4312 │                      ╶───────────────┼────┼────┼────┼────┤
4313 │                       No  Table ID   │   1│   1│   1│   1│
4314 │                           Layer ID   │   1│   1│   1│   1│
4315 │                           Subtable ID│  13│  13│  16│  16│
4316 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4317
4318                         Custom Tables
4319 Female
4320 Yes
4321 ╭──────────────────────────────────────┬───────────────────╮
4322 │                                      │        QN27       │
4323 │                                      ├─────────┬─────────┤
4324 │                                      │   Yes   │    No   │
4325 │                                      ├─────────┼─────────┤
4326 │                                      │  QND7A  │  QND7A  │
4327 │                                      ├────┬────┼────┬────┤
4328 │                                      │ Yes│ No │ Yes│ No │
4329 │                                      ├────┼────┼────┼────┤
4330 │                                      │QN86│QN86│QN86│QN86│
4331 ├──────────────────────────────────────┼────┼────┼────┼────┤
4332 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4333 │                           Layer ID   │   4│   4│   4│   4│
4334 │                           Subtable ID│  18│  18│  20│  20│
4335 │                      ╶───────────────┼────┼────┼────┼────┤
4336 │                       No  Table ID   │   1│   1│   1│   1│
4337 │                           Layer ID   │   4│   4│   4│   4│
4338 │                           Subtable ID│  18│  18│  20│  20│
4339 │             ╶────────────────────────┼────┼────┼────┼────┤
4340 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4341 │                           Layer ID   │   4│   4│   4│   4│
4342 │                           Subtable ID│  21│  21│  23│  23│
4343 │                      ╶───────────────┼────┼────┼────┼────┤
4344 │                       No  Table ID   │   1│   1│   1│   1│
4345 │                           Layer ID   │   4│   4│   4│   4│
4346 │                           Subtable ID│  21│  21│  23│  23│
4347 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4348 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4349 │                           Layer ID   │   4│   4│   4│   4│
4350 │                           Subtable ID│  25│  25│  28│  28│
4351 │                      ╶───────────────┼────┼────┼────┼────┤
4352 │                       No  Table ID   │   1│   1│   1│   1│
4353 │                           Layer ID   │   4│   4│   4│   4│
4354 │                           Subtable ID│  25│  25│  28│  28│
4355 │             ╶────────────────────────┼────┼────┼────┼────┤
4356 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4357 │                           Layer ID   │   4│   4│   4│   4│
4358 │                           Subtable ID│  30│  30│  32│  32│
4359 │                      ╶───────────────┼────┼────┼────┼────┤
4360 │                       No  Table ID   │   1│   1│   1│   1│
4361 │                           Layer ID   │   4│   4│   4│   4│
4362 │                           Subtable ID│  30│  30│  32│  32│
4363 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4364
4365                         Custom Tables
4366 Female
4367 No
4368 ╭──────────────────────────────────────┬───────────────────╮
4369 │                                      │        QN27       │
4370 │                                      ├─────────┬─────────┤
4371 │                                      │   Yes   │    No   │
4372 │                                      ├─────────┼─────────┤
4373 │                                      │  QND7A  │  QND7A  │
4374 │                                      ├────┬────┼────┬────┤
4375 │                                      │ Yes│ No │ Yes│ No │
4376 │                                      ├────┼────┼────┼────┤
4377 │                                      │QN86│QN86│QN86│QN86│
4378 ├──────────────────────────────────────┼────┼────┼────┼────┤
4379 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4380 │                           Layer ID   │   3│   3│   3│   3│
4381 │                           Subtable ID│  17│  17│  19│  19│
4382 │                      ╶───────────────┼────┼────┼────┼────┤
4383 │                       No  Table ID   │   1│   1│   1│   1│
4384 │                           Layer ID   │   3│   3│   3│   3│
4385 │                           Subtable ID│  17│  17│  19│  19│
4386 │             ╶────────────────────────┼────┼────┼────┼────┤
4387 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4388 │                           Layer ID   │   3│   3│   3│   3│
4389 │                           Subtable ID│  22│  22│  24│  24│
4390 │                      ╶───────────────┼────┼────┼────┼────┤
4391 │                       No  Table ID   │   1│   1│   1│   1│
4392 │                           Layer ID   │   3│   3│   3│   3│
4393 │                           Subtable ID│  22│  22│  24│  24│
4394 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4395 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4396 │                           Layer ID   │   3│   3│   3│   3│
4397 │                           Subtable ID│  26│  26│  27│  27│
4398 │                      ╶───────────────┼────┼────┼────┼────┤
4399 │                       No  Table ID   │   1│   1│   1│   1│
4400 │                           Layer ID   │   3│   3│   3│   3│
4401 │                           Subtable ID│  26│  26│  27│  27│
4402 │             ╶────────────────────────┼────┼────┼────┼────┤
4403 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4404 │                           Layer ID   │   3│   3│   3│   3│
4405 │                           Subtable ID│  29│  29│  31│  31│
4406 │                      ╶───────────────┼────┼────┼────┼────┤
4407 │                       No  Table ID   │   1│   1│   1│   1│
4408 │                           Layer ID   │   3│   3│   3│   3│
4409 │                           Subtable ID│  29│  29│  31│  31│
4410 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4411
4412                         Custom Tables
4413 Male
4414 Yes
4415 ╭───────────────────────────────────────┬───────────────────╮
4416 │                                       │        QN27       │
4417 │                                       ├─────────┬─────────┤
4418 │                                       │   Yes   │    No   │
4419 │                                       ├─────────┼─────────┤
4420 │                                       │  QND7A  │  QND7A  │
4421 │                                       ├────┬────┼────┬────┤
4422 │                                       │ Yes│ No │ Yes│ No │
4423 │                                       ├────┼────┼────┼────┤
4424 │                                       │QN86│QN86│QN86│QN86│
4425 ├───────────────────────────────────────┼────┼────┼────┼────┤
4426 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4427 │                           Layer Row ID│   1│   1│   1│   1│
4428 │                      ╶────────────────┼────┼────┼────┼────┤
4429 │                       No  Row ID      │   6│   6│   7│   7│
4430 │                           Layer Row ID│   4│   4│   4│   4│
4431 │             ╶─────────────────────────┼────┼────┼────┼────┤
4432 │              No  QN57 Yes Row ID      │  10│  10│  11│  11│
4433 │                           Layer Row ID│   6│   6│   6│   6│
4434 │                      ╶────────────────┼────┼────┼────┼────┤
4435 │                       No  Row ID      │  13│  13│  15│  15│
4436 │                           Layer Row ID│   7│   7│   7│   7│
4437 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4438 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  20│  20│
4439 │                           Layer Row ID│   9│   9│   9│   9│
4440 │                      ╶────────────────┼────┼────┼────┼────┤
4441 │                       No  Row ID      │  21│  21│  24│  24│
4442 │                           Layer Row ID│  11│  11│  11│  11│
4443 │             ╶─────────────────────────┼────┼────┼────┼────┤
4444 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4445 │                           Layer Row ID│  13│  13│  13│  13│
4446 │                      ╶────────────────┼────┼────┼────┼────┤
4447 │                       No  Row ID      │  30│  30│  32│  32│
4448 │                           Layer Row ID│  16│  16│  16│  16│
4449 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4450
4451                         Custom Tables
4452 Male
4453 No
4454 ╭───────────────────────────────────────┬───────────────────╮
4455 │                                       │        QN27       │
4456 │                                       ├─────────┬─────────┤
4457 │                                       │   Yes   │    No   │
4458 │                                       ├─────────┼─────────┤
4459 │                                       │  QND7A  │  QND7A  │
4460 │                                       ├────┬────┼────┬────┤
4461 │                                       │ Yes│ No │ Yes│ No │
4462 │                                       ├────┼────┼────┼────┤
4463 │                                       │QN86│QN86│QN86│QN86│
4464 ├───────────────────────────────────────┼────┼────┼────┼────┤
4465 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4466 │                           Layer Row ID│   2│   2│   2│   2│
4467 │                      ╶────────────────┼────┼────┼────┼────┤
4468 │                       No  Row ID      │   5│   5│   8│   8│
4469 │                           Layer Row ID│   3│   3│   3│   3│
4470 │             ╶─────────────────────────┼────┼────┼────┼────┤
4471 │              No  QN57 Yes Row ID      │   9│   9│  12│  12│
4472 │                           Layer Row ID│   5│   5│   5│   5│
4473 │                      ╶────────────────┼────┼────┼────┼────┤
4474 │                       No  Row ID      │  14│  14│  16│  16│
4475 │                           Layer Row ID│   8│   8│   8│   8│
4476 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4477 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  19│  19│
4478 │                           Layer Row ID│  10│  10│  10│  10│
4479 │                      ╶────────────────┼────┼────┼────┼────┤
4480 │                       No  Row ID      │  22│  22│  23│  23│
4481 │                           Layer Row ID│  12│  12│  12│  12│
4482 │             ╶─────────────────────────┼────┼────┼────┼────┤
4483 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4484 │                           Layer Row ID│  14│  14│  14│  14│
4485 │                      ╶────────────────┼────┼────┼────┼────┤
4486 │                       No  Row ID      │  29│  29│  31│  31│
4487 │                           Layer Row ID│  15│  15│  15│  15│
4488 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4489
4490                         Custom Tables
4491 Female
4492 Yes
4493 ╭───────────────────────────────────────┬───────────────────╮
4494 │                                       │        QN27       │
4495 │                                       ├─────────┬─────────┤
4496 │                                       │   Yes   │    No   │
4497 │                                       ├─────────┼─────────┤
4498 │                                       │  QND7A  │  QND7A  │
4499 │                                       ├────┬────┼────┬────┤
4500 │                                       │ Yes│ No │ Yes│ No │
4501 │                                       ├────┼────┼────┼────┤
4502 │                                       │QN86│QN86│QN86│QN86│
4503 ├───────────────────────────────────────┼────┼────┼────┼────┤
4504 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  35│  35│
4505 │                           Layer Row ID│  18│  18│  18│  18│
4506 │                      ╶────────────────┼────┼────┼────┼────┤
4507 │                       No  Row ID      │  38│  38│  39│  39│
4508 │                           Layer Row ID│  20│  20│  20│  20│
4509 │             ╶─────────────────────────┼────┼────┼────┼────┤
4510 │              No  QN57 Yes Row ID      │  42│  42│  43│  43│
4511 │                           Layer Row ID│  22│  22│  22│  22│
4512 │                      ╶────────────────┼────┼────┼────┼────┤
4513 │                       No  Row ID      │  45│  45│  47│  47│
4514 │                           Layer Row ID│  23│  23│  23│  23│
4515 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4516 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  51│  51│
4517 │                           Layer Row ID│  26│  26│  26│  26│
4518 │                      ╶────────────────┼────┼────┼────┼────┤
4519 │                       No  Row ID      │  53│  53│  55│  55│
4520 │                           Layer Row ID│  27│  27│  27│  27│
4521 │             ╶─────────────────────────┼────┼────┼────┼────┤
4522 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4523 │                           Layer Row ID│  29│  29│  29│  29│
4524 │                      ╶────────────────┼────┼────┼────┼────┤
4525 │                       No  Row ID      │  62│  62│  64│  64│
4526 │                           Layer Row ID│  32│  32│  32│  32│
4527 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4528
4529                         Custom Tables
4530 Female
4531 No
4532 ╭───────────────────────────────────────┬───────────────────╮
4533 │                                       │        QN27       │
4534 │                                       ├─────────┬─────────┤
4535 │                                       │   Yes   │    No   │
4536 │                                       ├─────────┼─────────┤
4537 │                                       │  QND7A  │  QND7A  │
4538 │                                       ├────┬────┼────┬────┤
4539 │                                       │ Yes│ No │ Yes│ No │
4540 │                                       ├────┼────┼────┼────┤
4541 │                                       │QN86│QN86│QN86│QN86│
4542 ├───────────────────────────────────────┼────┼────┼────┼────┤
4543 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  36│  36│
4544 │                           Layer Row ID│  17│  17│  17│  17│
4545 │                      ╶────────────────┼────┼────┼────┼────┤
4546 │                       No  Row ID      │  37│  37│  40│  40│
4547 │                           Layer Row ID│  19│  19│  19│  19│
4548 │             ╶─────────────────────────┼────┼────┼────┼────┤
4549 │              No  QN57 Yes Row ID      │  41│  41│  44│  44│
4550 │                           Layer Row ID│  21│  21│  21│  21│
4551 │                      ╶────────────────┼────┼────┼────┼────┤
4552 │                       No  Row ID      │  46│  46│  48│  48│
4553 │                           Layer Row ID│  24│  24│  24│  24│
4554 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4555 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  52│  52│
4556 │                           Layer Row ID│  25│  25│  25│  25│
4557 │                      ╶────────────────┼────┼────┼────┼────┤
4558 │                       No  Row ID      │  54│  54│  56│  56│
4559 │                           Layer Row ID│  28│  28│  28│  28│
4560 │             ╶─────────────────────────┼────┼────┼────┼────┤
4561 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
4562 │                           Layer Row ID│  30│  30│  30│  30│
4563 │                      ╶────────────────┼────┼────┼────┼────┤
4564 │                       No  Row ID      │  61│  61│  63│  63│
4565 │                           Layer Row ID│  31│  31│  31│  31│
4566 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4567
4568                           Custom Tables
4569 Male
4570 Yes
4571 ╭──────────────────────────────────────────┬───────────────────╮
4572 │                                          │        QN27       │
4573 │                                          ├─────────┬─────────┤
4574 │                                          │   Yes   │    No   │
4575 │                                          ├─────────┼─────────┤
4576 │                                          │  QND7A  │  QND7A  │
4577 │                                          ├────┬────┼────┬────┤
4578 │                                          │ Yes│ No │ Yes│ No │
4579 │                                          ├────┼────┼────┼────┤
4580 │                                          │QN86│QN86│QN86│QN86│
4581 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4582 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   7│
4583 │                           Layer Column ID│   2│   4│   6│   7│
4584 │                      ╶───────────────────┼────┼────┼────┼────┤
4585 │                       No  Column ID      │   2│   4│   6│   7│
4586 │                           Layer Column ID│   2│   4│   6│   7│
4587 │             ╶────────────────────────────┼────┼────┼────┼────┤
4588 │              No  QN57 Yes Column ID      │   9│  12│  13│  16│
4589 │                           Layer Column ID│   2│   4│   6│   7│
4590 │                      ╶───────────────────┼────┼────┼────┼────┤
4591 │                       No  Column ID      │   9│  12│  13│  16│
4592 │                           Layer Column ID│   2│   4│   6│   7│
4593 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4594 │     No  QN61 Yes QN57 Yes Column ID      │  18│  19│  22│  24│
4595 │                           Layer Column ID│   2│   4│   6│   7│
4596 │                      ╶───────────────────┼────┼────┼────┼────┤
4597 │                       No  Column ID      │  18│  19│  22│  24│
4598 │                           Layer Column ID│   2│   4│   6│   7│
4599 │             ╶────────────────────────────┼────┼────┼────┼────┤
4600 │              No  QN57 Yes Column ID      │  25│  27│  29│  32│
4601 │                           Layer Column ID│   2│   4│   6│   7│
4602 │                      ╶───────────────────┼────┼────┼────┼────┤
4603 │                       No  Column ID      │  25│  27│  29│  32│
4604 │                           Layer Column ID│   2│   4│   6│   7│
4605 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4606
4607                           Custom Tables
4608 Male
4609 No
4610 ╭──────────────────────────────────────────┬───────────────────╮
4611 │                                          │        QN27       │
4612 │                                          ├─────────┬─────────┤
4613 │                                          │   Yes   │    No   │
4614 │                                          ├─────────┼─────────┤
4615 │                                          │  QND7A  │  QND7A  │
4616 │                                          ├────┬────┼────┬────┤
4617 │                                          │ Yes│ No │ Yes│ No │
4618 │                                          ├────┼────┼────┼────┤
4619 │                                          │QN86│QN86│QN86│QN86│
4620 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4621 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   8│
4622 │                           Layer Column ID│   1│   3│   5│   8│
4623 │                      ╶───────────────────┼────┼────┼────┼────┤
4624 │                       No  Column ID      │   1│   3│   5│   8│
4625 │                           Layer Column ID│   1│   3│   5│   8│
4626 │             ╶────────────────────────────┼────┼────┼────┼────┤
4627 │              No  QN57 Yes Column ID      │  10│  11│  14│  15│
4628 │                           Layer Column ID│   1│   3│   5│   8│
4629 │                      ╶───────────────────┼────┼────┼────┼────┤
4630 │                       No  Column ID      │  10│  11│  14│  15│
4631 │                           Layer Column ID│   1│   3│   5│   8│
4632 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4633 │     No  QN61 Yes QN57 Yes Column ID      │  17│  20│  21│  23│
4634 │                           Layer Column ID│   1│   3│   5│   8│
4635 │                      ╶───────────────────┼────┼────┼────┼────┤
4636 │                       No  Column ID      │  17│  20│  21│  23│
4637 │                           Layer Column ID│   1│   3│   5│   8│
4638 │             ╶────────────────────────────┼────┼────┼────┼────┤
4639 │              No  QN57 Yes Column ID      │  26│  28│  30│  31│
4640 │                           Layer Column ID│   1│   3│   5│   8│
4641 │                      ╶───────────────────┼────┼────┼────┼────┤
4642 │                       No  Column ID      │  26│  28│  30│  31│
4643 │                           Layer Column ID│   1│   3│   5│   8│
4644 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4645
4646                           Custom Tables
4647 Female
4648 Yes
4649 ╭──────────────────────────────────────────┬───────────────────╮
4650 │                                          │        QN27       │
4651 │                                          ├─────────┬─────────┤
4652 │                                          │   Yes   │    No   │
4653 │                                          ├─────────┼─────────┤
4654 │                                          │  QND7A  │  QND7A  │
4655 │                                          ├────┬────┼────┬────┤
4656 │                                          │ Yes│ No │ Yes│ No │
4657 │                                          ├────┼────┼────┼────┤
4658 │                                          │QN86│QN86│QN86│QN86│
4659 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4660 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  37│  40│
4661 │                           Layer Column ID│  10│  12│  13│  16│
4662 │                      ╶───────────────────┼────┼────┼────┼────┤
4663 │                       No  Column ID      │  34│  36│  37│  40│
4664 │                           Layer Column ID│  10│  12│  13│  16│
4665 │             ╶────────────────────────────┼────┼────┼────┼────┤
4666 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
4667 │                           Layer Column ID│  10│  12│  13│  16│
4668 │                      ╶───────────────────┼────┼────┼────┼────┤
4669 │                       No  Column ID      │  41│  43│  45│  47│
4670 │                           Layer Column ID│  10│  12│  13│  16│
4671 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4672 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  54│  55│
4673 │                           Layer Column ID│  10│  12│  13│  16│
4674 │                      ╶───────────────────┼────┼────┼────┼────┤
4675 │                       No  Column ID      │  49│  51│  54│  55│
4676 │                           Layer Column ID│  10│  12│  13│  16│
4677 │             ╶────────────────────────────┼────┼────┼────┼────┤
4678 │              No  QN57 Yes Column ID      │  58│  60│  62│  63│
4679 │                           Layer Column ID│  10│  12│  13│  16│
4680 │                      ╶───────────────────┼────┼────┼────┼────┤
4681 │                       No  Column ID      │  58│  60│  62│  63│
4682 │                           Layer Column ID│  10│  12│  13│  16│
4683 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4684
4685                           Custom Tables
4686 Female
4687 No
4688 ╭──────────────────────────────────────────┬───────────────────╮
4689 │                                          │        QN27       │
4690 │                                          ├─────────┬─────────┤
4691 │                                          │   Yes   │    No   │
4692 │                                          ├─────────┼─────────┤
4693 │                                          │  QND7A  │  QND7A  │
4694 │                                          ├────┬────┼────┬────┤
4695 │                                          │ Yes│ No │ Yes│ No │
4696 │                                          ├────┼────┼────┼────┤
4697 │                                          │QN86│QN86│QN86│QN86│
4698 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4699 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  38│  39│
4700 │                           Layer Column ID│   9│  11│  14│  15│
4701 │                      ╶───────────────────┼────┼────┼────┼────┤
4702 │                       No  Column ID      │  33│  35│  38│  39│
4703 │                           Layer Column ID│   9│  11│  14│  15│
4704 │             ╶────────────────────────────┼────┼────┼────┼────┤
4705 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
4706 │                           Layer Column ID│   9│  11│  14│  15│
4707 │                      ╶───────────────────┼────┼────┼────┼────┤
4708 │                       No  Column ID      │  42│  44│  46│  48│
4709 │                           Layer Column ID│   9│  11│  14│  15│
4710 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4711 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  53│  56│
4712 │                           Layer Column ID│   9│  11│  14│  15│
4713 │                      ╶───────────────────┼────┼────┼────┼────┤
4714 │                       No  Column ID      │  50│  52│  53│  56│
4715 │                           Layer Column ID│   9│  11│  14│  15│
4716 │             ╶────────────────────────────┼────┼────┼────┼────┤
4717 │              No  QN57 Yes Column ID      │  57│  59│  61│  64│
4718 │                           Layer Column ID│   9│  11│  14│  15│
4719 │                      ╶───────────────────┼────┼────┼────┼────┤
4720 │                       No  Column ID      │  57│  59│  61│  64│
4721 │                           Layer Column ID│   9│  11│  14│  15│
4722 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4723 ])
4724 AT_CLEANUP
4725
4726 AT_SETUP([CTABLES categorical summary functions])
4727 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4728 AT_DATA([ctables.sps],
4729 [[GET 'nhtsa.sav'.
4730 CTABLES
4731     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
4732     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
4733     /SLABELS POSITION=ROW.
4734 ]])
4735 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4736                                                       Custom Tables
4737 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
4738 │                 │                     D5a. What would you say is your primary ethnic background?                     │
4739 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
4740 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
4741 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
4742 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
4743 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4744 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
4745 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
4746 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
4747 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4748 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4749 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
4750 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4751 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4752 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
4753 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
4754 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4755 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
4756 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
4757 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
4758 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4759 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4760 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
4761 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4762 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4763 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
4764 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
4765 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4766 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
4767 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
4768 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
4769 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4770 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4771 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
4772 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4773 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4774 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
4775 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
4776 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4777 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
4778 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
4779 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
4780 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4781 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4782 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
4783 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4784 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4785 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
4786 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
4787 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
4788 ])
4789 AT_CLEANUP
4790
4791 AT_SETUP([CTABLES scale summary functions])
4792 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4793 AT_DATA([ctables.sps],
4794 [[GET 'nhtsa.sav'.
4795 SET TVAR=NAME.
4796
4797 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4798   CTABLES later, to make the results easier to verify.
4799 SPLIT FILE BY REGION.
4800 FREQUENCIES
4801     qn19a
4802     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4803     /FORMAT NOTABLE /MISSING=INCLUDE.
4804 SPLIT FILE OFF.
4805
4806 CTABLES
4807     /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
4808     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, COLPCT.SUM]
4809     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
4810     /SLABELS POSITION=ROW.
4811 ]])
4812 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4813          Statistics
4814 ╭────────────────┬────────╮
4815 │REGION          │  QN19A │
4816 ├────────────────┼────────┤
4817 │NE     N Valid  │     936│
4818 │         Missing│     473│
4819 │      ╶─────────┼────────┤
4820 │       Mean     │   19.33│
4821 │      ╶─────────┼────────┤
4822 │       S.E. Mean│     .14│
4823 │      ╶─────────┼────────┤
4824 │       Median   │   18.00│
4825 │      ╶─────────┼────────┤
4826 │       Mode     │   18.00│
4827 │      ╶─────────┼────────┤
4828 │       Std Dev  │    4.41│
4829 │      ╶─────────┼────────┤
4830 │       Variance │   19.41│
4831 │      ╶─────────┼────────┤
4832 │       Range    │   59.00│
4833 │      ╶─────────┼────────┤
4834 │       Minimum  │     .00│
4835 │      ╶─────────┼────────┤
4836 │       Maximum  │   59.00│
4837 │      ╶─────────┼────────┤
4838 │       Sum      │18092.00│
4839 ├────────────────┼────────┤
4840 │MW     N Valid  │    1019│
4841 │         Missing│     635│
4842 │      ╶─────────┼────────┤
4843 │       Mean     │   19.83│
4844 │      ╶─────────┼────────┤
4845 │       S.E. Mean│     .16│
4846 │      ╶─────────┼────────┤
4847 │       Median   │   19.00│
4848 │      ╶─────────┼────────┤
4849 │       Mode     │   18.00│
4850 │      ╶─────────┼────────┤
4851 │       Std Dev  │    5.15│
4852 │      ╶─────────┼────────┤
4853 │       Variance │   26.47│
4854 │      ╶─────────┼────────┤
4855 │       Range    │   71.00│
4856 │      ╶─────────┼────────┤
4857 │       Minimum  │    4.00│
4858 │      ╶─────────┼────────┤
4859 │       Maximum  │   75.00│
4860 │      ╶─────────┼────────┤
4861 │       Sum      │20206.00│
4862 ├────────────────┼────────┤
4863 │S      N Valid  │    1276│
4864 │         Missing│    1114│
4865 │      ╶─────────┼────────┤
4866 │       Mean     │   20.29│
4867 │      ╶─────────┼────────┤
4868 │       S.E. Mean│     .18│
4869 │      ╶─────────┼────────┤
4870 │       Median   │   19.00│
4871 │      ╶─────────┼────────┤
4872 │       Mode     │   18.00│
4873 │      ╶─────────┼────────┤
4874 │       Std Dev  │    6.44│
4875 │      ╶─────────┼────────┤
4876 │       Variance │   41.43│
4877 │      ╶─────────┼────────┤
4878 │       Range    │   75.00│
4879 │      ╶─────────┼────────┤
4880 │       Minimum  │    4.00│
4881 │      ╶─────────┼────────┤
4882 │       Maximum  │   79.00│
4883 │      ╶─────────┼────────┤
4884 │       Sum      │25886.00│
4885 ├────────────────┼────────┤
4886 │W      N Valid  │     950│
4887 │         Missing│     596│
4888 │      ╶─────────┼────────┤
4889 │       Mean     │   19.87│
4890 │      ╶─────────┼────────┤
4891 │       S.E. Mean│     .17│
4892 │      ╶─────────┼────────┤
4893 │       Median   │   19.00│
4894 │      ╶─────────┼────────┤
4895 │       Mode     │   18.00│
4896 │      ╶─────────┼────────┤
4897 │       Std Dev  │    5.25│
4898 │      ╶─────────┼────────┤
4899 │       Variance │   27.59│
4900 │      ╶─────────┼────────┤
4901 │       Range    │   61.00│
4902 │      ╶─────────┼────────┤
4903 │       Minimum  │    4.00│
4904 │      ╶─────────┼────────┤
4905 │       Maximum  │   65.00│
4906 │      ╶─────────┼────────┤
4907 │       Sum      │18877.00│
4908 ╰────────────────┴────────╯
4909
4910              Custom Tables
4911 ╭───────────────────────────┬────────╮
4912 │                           │  QN19A │
4913 ├───────────────────────────┼────────┤
4914 │REGION NE Valid N          │     936│
4915 │          Missing          │  473.00│
4916 │          Mean             │   19.33│
4917 │          Std Error of Mean│     .14│
4918 │          Median           │   18.00│
4919 │          Mode             │   18.00│
4920 │          Std Deviation    │    4.41│
4921 │          Variance         │   19.41│
4922 │          Range            │   59.00│
4923 │          Minimum          │     .00│
4924 │          Maximum          │   59.00│
4925 │          Sum              │18092.00│
4926 │          Count            │    1409│
4927 │          Total N          │    1409│
4928 │          Column Sum %     │   21.8%│
4929 │      ╶────────────────────┼────────┤
4930 │       MW Valid N          │    1019│
4931 │          Missing          │  635.00│
4932 │          Mean             │   19.83│
4933 │          Std Error of Mean│     .16│
4934 │          Median           │   19.00│
4935 │          Mode             │   18.00│
4936 │          Std Deviation    │    5.15│
4937 │          Variance         │   26.47│
4938 │          Range            │   71.00│
4939 │          Minimum          │    4.00│
4940 │          Maximum          │   75.00│
4941 │          Sum              │20206.00│
4942 │          Count            │    1654│
4943 │          Total N          │    1654│
4944 │          Column Sum %     │   24.3%│
4945 │      ╶────────────────────┼────────┤
4946 │       S  Valid N          │    1276│
4947 │          Missing          │ 1114.00│
4948 │          Mean             │   20.29│
4949 │          Std Error of Mean│     .18│
4950 │          Median           │   19.00│
4951 │          Mode             │   18.00│
4952 │          Std Deviation    │    6.44│
4953 │          Variance         │   41.43│
4954 │          Range            │   75.00│
4955 │          Minimum          │    4.00│
4956 │          Maximum          │   79.00│
4957 │          Sum              │25886.00│
4958 │          Count            │    2390│
4959 │          Total N          │    2390│
4960 │          Column Sum %     │   31.2%│
4961 │      ╶────────────────────┼────────┤
4962 │       W  Valid N          │     950│
4963 │          Missing          │  596.00│
4964 │          Mean             │   19.87│
4965 │          Std Error of Mean│     .17│
4966 │          Median           │   19.00│
4967 │          Mode             │   18.00│
4968 │          Std Deviation    │    5.25│
4969 │          Variance         │   27.59│
4970 │          Range            │   61.00│
4971 │          Minimum          │    4.00│
4972 │          Maximum          │   65.00│
4973 │          Sum              │18877.00│
4974 │          Count            │    1546│
4975 │          Total N          │    1546│
4976 │          Column Sum %     │   22.7%│
4977 ╰───────────────────────────┴────────╯
4978 ])
4979 AT_CLEANUP
4980
4981
4982 AT_SETUP([CTABLES hidden scale VLABELS])
4983 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4984 AT_DATA([ctables.sps],
4985 [[GET 'nhtsa.sav'.
4986 CTABLES
4987     /TABLE region BY qn19a + qn35
4988     /SLABELS POSITION=ROW.
4989 CTABLES
4990     /VLABELS VARIABLE=qn19a DISPLAY=NONE
4991     /TABLE region BY qn19a + qn35
4992     /SLABELS POSITION=ROW.
4993 CTABLES
4994     /VLABELS VARIABLE=qn35 DISPLAY=NONE
4995     /TABLE region BY qn19a + qn35
4996     /SLABELS POSITION=ROW.
4997
4998 * This one in particular caused a crash because no categories were
4999   created on the column axis, so passing in 0 for the index was still
5000   too big for that number of categories.  It was fixed by creating a
5001   name-only category for each variable despite the "NONE" request,
5002   then hiding the entire dimension's labels if all its labels were
5003   set to "NONE".
5004 CTABLES
5005     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5006     /TABLE region BY qn19a + qn35
5007     /SLABELS POSITION=ROW.
5008 ]])
5009 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5010                                  Custom Tables
5011 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5012 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5013 │              │   when you first starting  │   many times have you driven a  │
5014 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5015 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5016 │              │      sips of alcohol.      │            beverages?           │
5017 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5018 │Region NE Mean│                       19.33│                                2│
5019 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5020 │       MW Mean│                       19.83│                                2│
5021 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5022 │       S  Mean│                       20.29│                                2│
5023 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5024 │       W  Mean│                       19.87│                                2│
5025 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5026
5027                                  Custom Tables
5028 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5029 │              │     │  35. In the past thirty days, how many times have you  │
5030 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5031 │              │QN19A│                  alcoholic beverages?                  │
5032 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5033 │Region NE Mean│19.33│                                                       2│
5034 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5035 │       MW Mean│19.83│                                                       2│
5036 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5037 │       S  Mean│20.29│                                                       2│
5038 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5039 │       W  Mean│19.87│                                                       2│
5040 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5041
5042                                  Custom Tables
5043 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5044 │              │   19a. About how old were you when you first starting   │    │
5045 │              │  drinking alcohol, not counting small tastes or sips of │    │
5046 │              │                         alcohol.                        │qn35│
5047 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5048 │Region NE Mean│                                                    19.33│   2│
5049 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5050 │       MW Mean│                                                    19.83│   2│
5051 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5052 │       S  Mean│                                                    20.29│   2│
5053 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5054 │       W  Mean│                                                    19.87│   2│
5055 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5056
5057       Custom Tables
5058 ╭──────────────┬───────╮
5059 │Region NE Mean│19.33 2│
5060 │      ╶───────┼───────┤
5061 │       MW Mean│19.83 2│
5062 │      ╶───────┼───────┤
5063 │       S  Mean│20.29 2│
5064 │      ╶───────┼───────┤
5065 │       W  Mean│19.87 2│
5066 ╰──────────────┴───────╯
5067 ])
5068 AT_CLEANUP
5069
5070 AT_SETUP([CTABLES with SPLIT FILE])
5071 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5072 AT_DATA([ctables.sps],
5073 [[GET 'nhtsa.sav'.
5074
5075 SORT CASES BY qns3a.
5076
5077 CTABLES /TABLE qn105ba.
5078
5079 * Layered split has no effect on output.
5080 SPLIT FILE BY qns3a.
5081 CTABLES /TABLE qn105ba.
5082
5083 * Add column variable qns3a to compare against separate splits.
5084 CTABLES /TABLE qn105ba BY qns3a.
5085
5086 * Separate splits are truly output separately.
5087 SPLIT FILE SEPARATE BY qns3a.
5088 CTABLES /TABLE qn105ba.
5089 ]])
5090 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5091                                   Custom Tables
5092 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5093 │                                                                        │Count│
5094 ├────────────────────────────────────────────────────────────────────────┼─────┤
5095 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5096 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5097 │                                                            Very likely │ 1502│
5098 │                                                            Somewhat    │ 2763│
5099 │                                                            likely      │     │
5100 │                                                            Somewhat    │ 1307│
5101 │                                                            unlikely    │     │
5102 │                                                            Very        │  609│
5103 │                                                            unlikely    │     │
5104 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5105
5106                                   Custom Tables
5107 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5108 │                                                                        │Count│
5109 ├────────────────────────────────────────────────────────────────────────┼─────┤
5110 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5111 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5112 │                                                            Very likely │ 1502│
5113 │                                                            Somewhat    │ 2763│
5114 │                                                            likely      │     │
5115 │                                                            Somewhat    │ 1307│
5116 │                                                            unlikely    │     │
5117 │                                                            Very        │  609│
5118 │                                                            unlikely    │     │
5119 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5120
5121                                   Custom Tables
5122 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5123 │                                                                 │S3a. GENDER:│
5124 │                                                                 ├─────┬──────┤
5125 │                                                                 │ Male│Female│
5126 │                                                                 ├─────┼──────┤
5127 │                                                                 │Count│ Count│
5128 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5129 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5130 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5131 │the police?                                          Very likely │  660│   842│
5132 │                                                     Somewhat    │ 1174│  1589│
5133 │                                                     likely      │     │      │
5134 │                                                     Somewhat    │  640│   667│
5135 │                                                     unlikely    │     │      │
5136 │                                                     Very        │  311│   298│
5137 │                                                     unlikely    │     │      │
5138 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5139
5140     Split Values
5141 ╭────────────┬─────╮
5142 │Variable    │Value│
5143 ├────────────┼─────┤
5144 │S3a. GENDER:│Male │
5145 ╰────────────┴─────╯
5146
5147                                   Custom Tables
5148 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5149 │                                                                        │Count│
5150 ├────────────────────────────────────────────────────────────────────────┼─────┤
5151 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5152 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5153 │                                                            Very likely │  660│
5154 │                                                            Somewhat    │ 1174│
5155 │                                                            likely      │     │
5156 │                                                            Somewhat    │  640│
5157 │                                                            unlikely    │     │
5158 │                                                            Very        │  311│
5159 │                                                            unlikely    │     │
5160 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5161
5162      Split Values
5163 ╭────────────┬──────╮
5164 │Variable    │ Value│
5165 ├────────────┼──────┤
5166 │S3a. GENDER:│Female│
5167 ╰────────────┴──────╯
5168
5169                                   Custom Tables
5170 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5171 │                                                                        │Count│
5172 ├────────────────────────────────────────────────────────────────────────┼─────┤
5173 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5174 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5175 │                                                            Very likely │  842│
5176 │                                                            Somewhat    │ 1589│
5177 │                                                            likely      │     │
5178 │                                                            Somewhat    │  667│
5179 │                                                            unlikely    │     │
5180 │                                                            Very        │  298│
5181 │                                                            unlikely    │     │
5182 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5183 ])
5184 AT_CLEANUP
5185
5186 AT_SETUP([CTABLES variable level inference])
5187 AT_DATA([data.txt], [dnl
5188 dnl n1 has 10 unique small values -> nominal.
5189 dnl n2 has 23 unique small values -> nominal.
5190 dnl n3 is all missing -> nominal.
5191 dnl s1 has 24 unique small values -> scale.
5192 dnl s2 has one negative value -> scale.
5193 dnl s3 has one non-integer value -> scale.
5194 dnl s4 has no valid values less than 10 -> scale.
5195 dnl s5 has no valid values less than 10,000 -> scale.
5196 1  1  . 1  1  1    10 10001
5197 2  2  . 2  2  2    11 10002
5198 3  3  . 3  3  3    12 10003
5199 4  4  . 4  4  4    13 10004
5200 5  5  . 5  5  5    14 10005
5201 6  6  . 6  6  6    15 10006
5202 7  7  . 7  7  7    16 10007
5203 8  8  . 8  8  8    17 10008
5204 9  9  . 9  9  9    18 10009
5205 10 10 . 10 10 10.5 19 110000
5206 1  11 . 11 -1 1    11 10001
5207 2  12 . 12 2  2    12 10002
5208 3  13 . 13 3  3    13 10003
5209 4  14 . 14 4  4    14 10004
5210 5  15 . 15 5  5    15 10005
5211 6  16 . 16 6  6    16 10006
5212 7  17 . 17 7  7    17 10007
5213 8  18 . 18 8  8    18 10008
5214 9  19 . 19 9  9    19 10009
5215 1  20 . 20 1  1    20 10001
5216 2  21 . 21 2  2    21 10002
5217 3  22 . 22 3  3    22 10003
5218 4  23 . 23 4  4    23 10004
5219 5  23 . 24 5  5    24 10005
5220 6  23 . 24 6  6    25 10006
5221 ])
5222
5223 AT_DATA([ctables.sps], [dnl
5224 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5225
5226 * Nominal formats (copied from data that will default to scale).
5227 COMPUTE n4=s1.
5228 COMPUTE n5=s1.
5229 FORMATS n4(WKDAY5) n5(MONTH5).
5230
5231 * Scale formats (copied from data that will default to nominal).
5232 COMPUTE s6=n1.
5233 COMPUTE s7=n1.
5234 COMPUTE s8=n1.
5235 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5236
5237 STRING string(A8).
5238
5239 DISPLAY DICTIONARY.
5240 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5241 DISPLAY DICTIONARY.
5242 ])
5243
5244 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5245                                     Variables
5246 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5247 │      │        │  Measurement │     │     │         │            │            │
5248 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5249 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5250 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5251 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5252 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5253 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5254 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5255 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5256 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5257 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5258 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5259 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5260 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5261 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5262 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5263 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5264 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5265
5266         Custom Tables
5267 ╭────────────┬─────┬────────╮
5268 │            │Count│  Mean  │
5269 ├────────────┼─────┼────────┤
5270 │n1     1.00 │    3│        │
5271 │       2.00 │    3│        │
5272 │       3.00 │    3│        │
5273 │       4.00 │    3│        │
5274 │       5.00 │    3│        │
5275 │       6.00 │    3│        │
5276 │       7.00 │    2│        │
5277 │       8.00 │    2│        │
5278 │       9.00 │    2│        │
5279 │       10.00│    1│        │
5280 ├────────────┼─────┼────────┤
5281 │n2     1.00 │    1│        │
5282 │       2.00 │    1│        │
5283 │       3.00 │    1│        │
5284 │       4.00 │    1│        │
5285 │       5.00 │    1│        │
5286 │       6.00 │    1│        │
5287 │       7.00 │    1│        │
5288 │       8.00 │    1│        │
5289 │       9.00 │    1│        │
5290 │       10.00│    1│        │
5291 │       11.00│    1│        │
5292 │       12.00│    1│        │
5293 │       13.00│    1│        │
5294 │       14.00│    1│        │
5295 │       15.00│    1│        │
5296 │       16.00│    1│        │
5297 │       17.00│    1│        │
5298 │       18.00│    1│        │
5299 │       19.00│    1│        │
5300 │       20.00│    1│        │
5301 │       21.00│    1│        │
5302 │       22.00│    1│        │
5303 │       23.00│    3│        │
5304 ├────────────┼─────┼────────┤
5305 │string      │   25│        │
5306 ├────────────┼─────┼────────┤
5307 │s1          │     │   12.96│
5308 ├────────────┼─────┼────────┤
5309 │s2          │     │    4.76│
5310 ├────────────┼─────┼────────┤
5311 │s3          │     │    4.86│
5312 ├────────────┼─────┼────────┤
5313 │s4          │     │   16.60│
5314 ├────────────┼─────┼────────┤
5315 │s5          │     │14004.44│
5316 ╰────────────┴─────┴────────╯
5317
5318                                     Variables
5319 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5320 │      │        │  Measurement │     │     │         │            │            │
5321 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5322 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5323 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5324 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5325 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5326 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5327 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5328 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5329 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5330 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5331 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5332 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5333 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5334 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5335 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5336 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5337 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5338 ])
5339 AT_CLEANUP