improve scale summary test
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet tested:
4 dnl - Summary functions:
5 dnl   * U-prefix for unweighted summaries.
6 dnl   * areaPCT.SUM and UareaPCT.SUM functions.
7 dnl   * WEIGHT and adjustment weights.
8 dnl   * details of missing value handling in summaries.
9 dnl
10 dnl Not for v1:
11 dnl - Multiple response sets
12 dnl - MRSETS subcommand.
13 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
14 dnl - SIGTEST
15 dnl - COMPARETEST
16 dnl - Summary functions:
17 dnl   * .LCL and .UCL suffixes.
18 dnl   * .SE suffixes.
19 dnl - Summary functions:
20 dnl   * )CILEVEL in summary label specification
21 dnl - CATEGORIES:
22 dnl   * Data-dependent sorting.
23
24 AT_SETUP([CTABLES parsing])
25 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
26 AT_DATA([ctables.sps],
27 [[GET 'nhtsa.sav'.
28 CTABLES
29     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
30     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
31     /FORMAT UNITS=CM EMPTY="(-)"
32     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
33     /VLABELS VARIABLES=qn17 DISPLAY=NAME
34     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
35     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
36     /VLABELS VARIABLES=qn20 DISPLAY=NONE
37     /MRSETS COUNTDUPLICATES=NO
38     /MRSETS COUNTDUPLICATES=YES
39     /SMISSING VARIABLE
40     /SMISSING LISTWISE
41     /WEIGHT VARIABLE=qns3a
42     /HIDESMALLCOUNTS
43     /HIDESMALLCOUNTS COUNT=10
44     /TABLE qnsa1
45     /SLABELS POSITION=COLUMN VISIBLE=YES
46     /SLABELS VISIBLE=NO POSITION=ROW
47     /SLABELS POSITION=LAYER
48     /CLABELS AUTO
49     /CLABELS ROWLABELS=OPPOSITE
50     /CRITERIA CILEVEL=50
51     /CATEGORIES VARIABLES=qn1 qn17
52                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
53                 POSITION=BEFORE EMPTY=INCLUDE.
54 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
55 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
56 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
57 ]])
58 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
59          Custom Tables
60 Count
61 ╭───────────────────┬────┬────╮
62 │                   │ RDD│CELL│
63 ├───────────────────┼────┼────┤
64 │Sa1. SAMPLE SOURCE:│5392│1607│
65 ╰───────────────────┴────┴────╯
66
67        Custom Tables
68 RDD
69 ╭───────────────────┬─────╮
70 │                   │Count│
71 ├───────────────────┼─────┤
72 │Sa1. SAMPLE SOURCE:│ 5392│
73 ╰───────────────────┴─────╯
74
75           Custom Tables
76 ╭────────────────────────┬─────╮
77 │                        │Count│
78 ├────────────────────────┼─────┤
79 │Sa1. SAMPLE SOURCE: RDD │ 5392│
80 │                    CELL│ 1607│
81 ╰────────────────────────┴─────╯
82
83           Custom Tables
84 ╭────────────────────────┬─────╮
85 │                        │Count│
86 ├────────────────────────┼─────┤
87 │Sa1. SAMPLE SOURCE: RDD │ 5392│
88 │                    CELL│ 1607│
89 ╰────────────────────────┴─────╯
90 ])
91 AT_CLEANUP
92
93 AT_SETUP([CTABLES parsing - negative])
94 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
95 AT_DATA([ctables.sps],
96 [[GET 'nhtsa.sav'.
97 CTABLES.
98 CTABLES /FORMAT MINCOLWIDTH='foo'.
99 CTABLES /TABLE qn1 [**].
100 CTABLES /TABLE qn1 [NOTAFUNCTION].
101 CTABLES /TABLE (qn1.
102 CTABLES /TABLE **.
103 CTABLES /TABLE NOTAVAR.
104 STRING string(A8).
105 CTABLES /TABLE string[S].
106 CTABLES /TABLE qn1 [PTILE 101].
107 CTABLES /TABLE qn1 [MEAN F0.1].
108 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
109 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
110 CTABLES /TABLE qn1 [MEAN TOTALS].
111 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
112 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
113 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
114 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
115 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
116 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
117 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
118 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
119 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
120 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
121 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
122 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
123 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
124 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
127 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
128 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
129 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
130 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
131 CTABLES /PCOMPUTE &k=EXPR([LO **]).
132 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
133 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
134 CTABLES /PCOMPUTE &k=EXPR([1**]).
135 CTABLES /PCOMPUTE &k=EXPR((1x)).
136 CTABLES /PCOMPUTE **k.
137 CTABLES /PCOMPUTE &1.
138 CTABLES /PCOMPUTE &k**.
139 CTABLES /PCOMPUTE &k=**.
140 CTABLES /PCOMPUTE &k=EXPR**.
141 CTABLES /PCOMPUTE &k=EXPR(1x).
142 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
143 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
144 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
145 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
146 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
147 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
148 CTABLES /FORMAT EMPTY=**.
149 CTABLES /FORMAT MISSING=**.
150 CTABLES /FORMAT **.
151 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
152 CTABLES /VLABELS **.
153 CTABLES /VLABELS VARIABLES=NOTAVAR.
154 CTABLES /VLABELS VARIABLES=qn1 **.
155 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
156 CTABLES /MRSETS **.
157 CTABLES /MRSETS COUNTDUPLICATES=**.
158 CTABLES /SMISSING **.
159 CTABLES /WEIGHT **.
160 CTABLES /WEIGHT VARIABLE=NOTAVAR.
161 CTABLES /HIDESMALLCOUNTS COUNT=1.
162 CTABLES /QUUX.
163 CTABLES /HIDESMALLCOUNTS COUNT=2.
164 CTABLES /TABLE qn1**.
165 CTABLES /TABLE qn1 /SLABELS POSITION=**.
166 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
167 CTABLES /TABLE qn1 /SLABELS **.
168 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
169 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
170 CTABLES /TABLE qn1 /CLABELS **.
171 CTABLES /TABLE qn1 /CRITERIA **.
172 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
173 CTABLES /TABLE qn1 /TITLES **.
174 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
175 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
176 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
177 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
178 CTABLES /TABLE qn1 /SIGTEST **.
179 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
180 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
181 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
182 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
183 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
184 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
185 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
186 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
187 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
188 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
189 CTABLES /TABLE qn1 /COMPARETEST **.
190 CTABLES /TABLE qn1 / **.
191 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
192 CTABLES /TABLE qn20 > qnd1.
193 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
194 NUMERIC datetime (DATETIME17.0).
195 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
196 ]])
197 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
198 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
199
200 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
201 negative number for MINCOLWIDTH.
202
203 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
204 identifier.
205
206 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
207 summary function name.
208
209 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
210
211 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
212 identifier.
213
214 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
215
216 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
217 scale variable.
218    10 | CTABLES /TABLE string[S].
219       |                ^~~~~~~~~
220
221 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
222 between 0 and 100 for PTILE.
223
224 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
225 requires a width between 1 and 40.
226
227 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
228 format NEGPAREN requires width 2 or greater.
229
230 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
231 format NEGPAREN requires width greater than decimals.
232
233 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
234 scale variables.
235    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
236       |                     ^~~~
237
238 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
239    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
240       |                ^~~
241
242 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
243
244 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
245 scale variables.
246    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
247       |                     ^~~~
248
249 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
250    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
251       |                ^~~
252
253 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
254
255 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
256
257 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
258
259 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
260
261 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
262
263 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
264
265 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
266 identifier.
267
268 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
269    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
270       |                                               ^~
271
272 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
273 between 0 and 100 for PTILE.
274
275 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
276 `@:}@'.
277
278 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
279 `@{:@'.
280
281 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
282 or EXCLUDE.
283
284 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
285 NO.
286
287 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
288
289 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
290 or AFTER.
291
292 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
293 or EXCLUDE.
294
295 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
296 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
297
298 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
299 LABEL, POSITION, or EMPTY.
300
301 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
302 integer for SUBTOTAL.
303
304 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
305
306 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
307
308 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
309
310 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
311
312 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
313
314 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
315
316 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
317
318 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
319
320 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
321
322 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
323
324 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
325
326 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
327
328 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
329 the previous definition.
330    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
331       |                               ^~~~~~~~~~~~~~~~~~~
332
333 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
334    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
335       |          ^~~~~~~~~~~~~~~~~~~
336
337 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
338 `/'.
339
340 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
341 Expecting summary function name.
342
343 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
344 between 0 and 100 for PTILE.
345
346 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
347
348 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
349 NO.
350
351 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
352 FORMAT, or HIDESOURCECATS.
353
354 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
355
356 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
357
358 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
359 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
360
361 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
362 MAXCOLWIDTH.
363
364 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
365 VARIABLES.
366
367 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
368
369 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
370 DISPLAY.
371
372 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
373 DEFAULT, NAME, LABEL, BOTH, or NONE.
374
375 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
376 COUNTDUPLICATES.
377
378 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
379 NO.
380
381 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
382 VARIABLE or LISTWISE.
383
384 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
385 VARIABLE.
386
387 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
388
389 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
390 greater for HIDESMALLCOUNTS COUNT.
391
392 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
393 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
394 HIDESMALLCOUNTS, or TABLE.
395
396 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
397 `/'.
398
399 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
400
401 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
402 ROW, or LAYER.
403
404 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
405 NO.
406
407 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
408 POSITION or VISIBLE.
409
410 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
411 OPPOSITE or LAYER.
412
413 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
414 OPPOSITE or LAYER.
415
416 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
417 ROWLABELS, or COLLABELS.
418
419 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
420 CILEVEL.
421
422 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
423 in @<:@0,100@:}@ for CILEVEL.
424
425 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
426 CAPTION, CORNER, or TITLE.
427
428 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
429 CHISQUARE.
430
431 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
432 in @<:@0,1@:}@ for ALPHA.
433
434 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
435 NO.
436
437 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
438 ALLVISIBLE or SUBTOTALS.
439
440 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
441 ALPHA, INCLUDEMRSETS, or CATEGORIES.
442
443 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
444 MEAN.
445
446 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
447 in (0,1) for ALPHA.
448
449 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
450 for ALPHA.
451
452 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
453 BONFERRONI, BH, or NONE.
454
455 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
456 NO.
457
458 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
459 or TESTEDCATS.
460
461 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
462 ALLVISIBLE or SUBTOTALS.
463
464 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
465 NO.
466
467 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
468 SIMPLE.
469
470 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
471 NO.
472
473 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
474 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
475 SHOWSIG.
476
477 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
478 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
479
480 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
481 specified.
482
483 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
484    97 | CTABLES /TABLE qn20 > qnd1.
485       |                ^~~~~~~~~~~
486
487 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
488    97 | CTABLES /TABLE qn20 > qnd1.
489       |                ^~~~
490
491 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
492    97 | CTABLES /TABLE qn20 > qnd1.
493       |                       ^~~~
494
495 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
496 categorical variables at the innermost nesting level.
497    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
498       |                ^~~~~~~~~~~~~~~~~~~~
499
500 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
501 summary.
502    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
503       |                ^~~
504
505 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
506 specification as format DATETIME: Day (123) must be between 1 and 31..
507   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
508       |                                                    ^~~~~
509 ]])
510 AT_CLEANUP
511
512 AT_SETUP([CTABLES parsing - more negative])
513 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
514 AT_DATA([ctables.sps],
515 [[GET 'nhtsa.sav'.
516 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
517 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
518 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
519
520 STRING string(A8).
521 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
522 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
523
524 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
525
526 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
527 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
528 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
529 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
530
531 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
532 CTABLES /PCOMPUTE &x=EXPR([**]).
533 CTABLES /PCOMPUTE &x=EXPR(**).
534
535 CTABLES /TABLE.
536
537 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
538 ]])
539 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
540 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
541 category not included in the category list.
542     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
543 VARIABLES=qn1 [&pc].
544       |
545 ^~~
546
547 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
548     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
549 VARIABLES=qn1 [&pc].
550       |                            ^~~~~~~~
551
552 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
553 list of categories here.
554     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
555 VARIABLES=qn1 [&pc].
556       |
557 ^~~~
558
559 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
560 category not included in the category list.
561     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
562 [&pc].
563       |
564 ^~~
565
566 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
567     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
568 [&pc].
569       |                            ^~~~~
570
571 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
572 variable's CATEGORIES specification.
573
574 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
575 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
576 subtotals by position, e.g. SUBTOTAL[1].
577     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
578 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
579       |
580 ^~~~~~~~~~~~~~~~~~~~~~~~
581
582 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
583 position.
584     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
585 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
586       |                            ^~~~~~~~
587
588 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
589 applied only to string variables, but this subcommand tries to apply it to
590 numeric variable QN1.
591     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
592       |                                               ^~~~~~~~
593
594 ctables.sps:8.53: error: CTABLES: This category specification may be applied
595 only to numeric variables, but this subcommand tries to apply it to string
596 variable string.
597     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
598       |                                                     ^
599
600 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
601 based on a summary function.
602
603 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
604 moved to be categorical, but qnd1 is a scale variable.
605
606 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
607 moved to have the same width, but QN1 has width 0 and string has width 8.
608
609 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
610 moved to have the same value labels, but QN1 and QNSA1 have different value
611 labels.
612
613 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
614 moved to have the same category specifications, but QN105BA and QN105BB have
615 different category specifications.
616
617 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
618 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
619 this warning, insert parentheses.
620    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
621       |                           ^~~~~~~
622
623 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
624 `/'.
625
626 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
627
628 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
629
630 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
631 variable must be specified.
632
633 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
634
635 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
636 summary.
637    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
638       |                                                  ^~~~~
639
640 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
641 summary.
642    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
643       |                ^~~~~
644
645 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
646 summary.
647    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
648       |                                 ^~~~~
649
650 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
651 has a summary even if the syntax does not explicitly specify one.
652    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
653       |                                 ^~~~~
654 ]])
655 AT_CLEANUP
656
657 AT_SETUP([CTABLES one categorical variable])
658 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
659 AT_DATA([ctables.sps],
660 [[GET 'nhtsa.sav'.
661 CTABLES /TABLE qn1.
662 CTABLES /TABLE BY qn1.
663 CTABLES /TABLE BY BY qn1.
664 ]])
665 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
666                                   Custom Tables
667 ╭────────────────────────────────────────────────────────────────────────┬─────╮
668 │                                                                        │Count│
669 ├────────────────────────────────────────────────────────────────────────┼─────┤
670 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
671 │motor vehicle?                                     Several days a week  │ 1274│
672 │                                                   Once a week or less  │  361│
673 │                                                   Only certain times a │  130│
674 │                                                   year                 │     │
675 │                                                   Never                │  540│
676 ╰────────────────────────────────────────────────────────────────────────┴─────╯
677
678                                   Custom Tables
679 ╭──────────────────────────────────────────────────────────────────────────────╮
680 │        1. How often do you usually drive a car or other motor vehicle?       │
681 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
682 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
683 │Every day│       week       │       less       │          year          │Never│
684 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
685 │  Count  │       Count      │       Count      │          Count         │Count│
686 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
687 │     4667│              1274│               361│                     130│  540│
688 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
689
690 Custom Tables
691 Every day
692 ╭─────╮
693 │Count│
694 ├─────┤
695 │ 4667│
696 ╰─────╯
697 ])
698 AT_CLEANUP
699
700 AT_SETUP([CTABLES one string variable])
701 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
702 AT_DATA([ctables.sps],
703 [[GET 'nhtsa.sav'.
704 STRING licensed(A8).
705 MISSING VALUES licensed('DontKnow', 'Refused').
706 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
707 CTABLES /TABLE licensed.
708 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
709 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
710 * Notice that the string matching is case-sensitive.
711 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
712 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
713 CTABLES
714     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
715     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
716     /TABLE licensed
717     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
718 CTABLES
719     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
720     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
721     /TABLE licensed
722     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
723 ]])
724 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
725     Custom Tables
726 ╭────────────┬─────╮
727 │            │Count│
728 ├────────────┼─────┤
729 │licensed No │  572│
730 │         Yes│ 6379│
731 ╰────────────┴─────╯
732
733           Custom Tables
734 ╭─────────────────┬─────┬───────╮
735 │                 │Count│Valid N│
736 ├─────────────────┼─────┼───────┤
737 │licensed DontKnow│    4│       │
738 │         No      │  572│       │
739 │         Refused │   44│       │
740 │         Yes     │ 6379│       │
741 │         Total   │ 6999│   6951│
742 ╰─────────────────┴─────┴───────╯
743
744      Custom Tables
745 ╭──────────────┬─────╮
746 │              │Count│
747 ├──────────────┼─────┤
748 │licensed Yes  │ 6379│
749 │         No   │  572│
750 │         Total│ 6951│
751 ╰──────────────┴─────╯
752
753      Custom Tables
754 ╭──────────────┬─────╮
755 │              │Count│
756 ├──────────────┼─────┤
757 │licensed Yes  │ 6379│
758 │         no   │    0│
759 │         Total│ 6379│
760 ╰──────────────┴─────╯
761
762       Custom Tables
763 ╭────────────────┬─────╮
764 │                │Count│
765 ├────────────────┼─────┤
766 │licensed No     │  572│
767 │         Refused│   44│
768 │         Yes    │ 6379│
769 │         Total  │ 6995│
770 ╰────────────────┴─────╯
771
772       Custom Tables
773 ╭────────────────┬─────╮
774 │                │Count│
775 ├────────────────┼─────┤
776 │licensed Yes    │ 6379│
777 │         Not Yes│  620│
778 ╰────────────────┴─────╯
779
780       Custom Tables
781 ╭────────────────┬─────╮
782 │                │Count│
783 ├────────────────┼─────┤
784 │licensed Yes    │ 6379│
785 │         Not Yes│  620│
786 ╰────────────────┴─────╯
787 ])
788 AT_CLEANUP
789
790 AT_SETUP([CTABLES one scale variable])
791 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
792 AT_DATA([ctables.sps],
793 [[GET 'nhtsa.sav'.
794 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
795 CTABLES /TABLE BY qnd1.
796 CTABLES /TABLE BY BY qnd1.
797 ]])
798 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
799                                   Custom Tables
800 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
801 │                      │     │       │       │    │     Std    │       │       │
802 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
803 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
804 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
805 │age?                  │     │       │       │    │            │       │       │
806 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
807
808         Custom Tables
809 ╭──────────────────────────╮
810 │D1. AGE: What is your age?│
811 ├──────────────────────────┤
812 │           Mean           │
813 ├──────────────────────────┤
814 │                        48│
815 ╰──────────────────────────╯
816
817 Custom Tables
818 D1. AGE: What is your age?
819 ╭────╮
820 │Mean│
821 ├────┤
822 │  48│
823 ╰────╯
824 ])
825 AT_CLEANUP
826
827 AT_SETUP([CTABLES simple stacking])
828 AT_KEYWORDS([stack stacked])
829 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
830 AT_DATA([ctables.sps],
831 [[GET 'nhtsa.sav'.
832 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
833 ]])
834 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
835                                   Custom Tables
836 ╭───────────────────────────────────────────────────────────────┬──────────────╮
837 │                                                               │ S3a. GENDER: │
838 │                                                               ├──────┬───────┤
839 │                                                               │ Male │ Female│
840 │                                                               ├──────┼───────┤
841 │                                                               │Column│ Column│
842 │                                                               │   %  │   %   │
843 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
844 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
845 │too much to drink to drive safely will A. Get      certain     │      │       │
846 │stopped by the police?                             Very likely │   21%│    22%│
847 │                                                   Somewhat    │   38%│    42%│
848 │                                                   likely      │      │       │
849 │                                                   Somewhat    │   21%│    18%│
850 │                                                   unlikely    │      │       │
851 │                                                   Very        │   10%│     8%│
852 │                                                   unlikely    │      │       │
853 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
854 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
855 │too much to drink to drive safely will B. Have an  certain     │      │       │
856 │accident?                                          Very likely │   36%│    45%│
857 │                                                   Somewhat    │   39%│    32%│
858 │                                                   likely      │      │       │
859 │                                                   Somewhat    │    9%│     4%│
860 │                                                   unlikely    │      │       │
861 │                                                   Very        │    3%│     2%│
862 │                                                   unlikely    │      │       │
863 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
864 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
865 │too much to drink to drive safely will C. Be       certain     │      │       │
866 │convicted for drunk driving?                       Very likely │   32%│    28%│
867 │                                                   Somewhat    │   27%│    32%│
868 │                                                   likely      │      │       │
869 │                                                   Somewhat    │   15%│    15%│
870 │                                                   unlikely    │      │       │
871 │                                                   Very        │    9%│     9%│
872 │                                                   unlikely    │      │       │
873 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
874 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
875 │too much to drink to drive safely will D. Be       certain     │      │       │
876 │arrested for drunk driving?                        Very likely │   26%│    27%│
877 │                                                   Somewhat    │   32%│    35%│
878 │                                                   likely      │      │       │
879 │                                                   Somewhat    │   17%│    15%│
880 │                                                   unlikely    │      │       │
881 │                                                   Very        │    9%│     7%│
882 │                                                   unlikely    │      │       │
883 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
884 ])
885 AT_CLEANUP
886
887 AT_SETUP([CTABLES show or hide empty categories])
888 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
889 AT_DATA([ctables.sps],
890 [[GET 'nhtsa.sav'.
891 IF (qn105ba = 2) qn105ba = 1.
892 IF (qns3a = 1) qns3a = 2.
893 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
894 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
895     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
896 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
897     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
898 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
899     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
900 ]])
901 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
902                                   Custom Tables
903 ╭──────────────────────────────────────────────────────────────┬───────────────╮
904 │                                                              │  S3a. GENDER: │
905 │                                                              ├───────┬───────┤
906 │                                                              │  Male │ Female│
907 │                                                              ├───────┼───────┤
908 │                                                              │ Column│ Column│
909 │                                                              │   %   │   %   │
910 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
911 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
912 │too much to drink to drive safely will A. Get      certain    │       │       │
913 │stopped by the police?                             Very likely│      .│     0%│
914 │                                                   Somewhat   │      .│    40%│
915 │                                                   likely     │       │       │
916 │                                                   Somewhat   │      .│    19%│
917 │                                                   unlikely   │       │       │
918 │                                                   Very       │      .│     9%│
919 │                                                   unlikely   │       │       │
920 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
921
922                                   Custom Tables
923 ╭──────────────────────────────────────────────────────────────┬───────────────╮
924 │                                                              │  S3a. GENDER: │
925 │                                                              ├───────┬───────┤
926 │                                                              │  Male │ Female│
927 │                                                              ├───────┼───────┤
928 │                                                              │ Column│ Column│
929 │                                                              │   %   │   %   │
930 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
931 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
932 │too much to drink to drive safely will A. Get      certain    │       │       │
933 │stopped by the police?                             Somewhat   │      .│    40%│
934 │                                                   likely     │       │       │
935 │                                                   Somewhat   │      .│    19%│
936 │                                                   unlikely   │       │       │
937 │                                                   Very       │      .│     9%│
938 │                                                   unlikely   │       │       │
939 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
940
941                                   Custom Tables
942 ╭────────────────────────────────────────────────────────────────────┬─────────╮
943 │                                                                    │   S3a.  │
944 │                                                                    │ GENDER: │
945 │                                                                    ├─────────┤
946 │                                                                    │  Female │
947 │                                                                    ├─────────┤
948 │                                                                    │ Column %│
949 ├────────────────────────────────────────────────────────────────────┼─────────┤
950 │105b. How likely is it that drivers who have had too    Almost      │      32%│
951 │much to drink to drive safely will A. Get stopped by    certain     │         │
952 │the police?                                             Very likely │       0%│
953 │                                                        Somewhat    │      40%│
954 │                                                        likely      │         │
955 │                                                        Somewhat    │      19%│
956 │                                                        unlikely    │         │
957 │                                                        Very        │       9%│
958 │                                                        unlikely    │         │
959 ╰────────────────────────────────────────────────────────────────────┴─────────╯
960
961                                   Custom Tables
962 ╭────────────────────────────────────────────────────────────────────┬─────────╮
963 │                                                                    │   S3a.  │
964 │                                                                    │ GENDER: │
965 │                                                                    ├─────────┤
966 │                                                                    │  Female │
967 │                                                                    ├─────────┤
968 │                                                                    │ Column %│
969 ├────────────────────────────────────────────────────────────────────┼─────────┤
970 │105b. How likely is it that drivers who have had too    Almost      │      32%│
971 │much to drink to drive safely will A. Get stopped by    certain     │         │
972 │the police?                                             Somewhat    │      40%│
973 │                                                        likely      │         │
974 │                                                        Somewhat    │      19%│
975 │                                                        unlikely    │         │
976 │                                                        Very        │       9%│
977 │                                                        unlikely    │         │
978 ╰────────────────────────────────────────────────────────────────────┴─────────╯
979 ])
980 AT_CLEANUP
981
982 AT_SETUP([CTABLES sorting categories])
983 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
984 AT_DATA([ctables.sps],
985 [[GET 'nhtsa.sav'.
986 IF (QND5A=6) QND5A=-1.
987 IF (QND5A=5) QND5A=-2.
988 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
989         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
990         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
991         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
992 ]])
993 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
994                                   Custom Tables
995 ╭────────────────────────────────────────────────────────────────────────┬─────╮
996 │                                                                        │Count│
997 ├────────────────────────────────────────────────────────────────────────┼─────┤
998 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
999 │background?                                     -1.00                   │   78│
1000 │                                                Cuban                   │   20│
1001 │                                                Mexican                 │  311│
1002 │                                                Spanish                 │   48│
1003 │                                                South American          │   34│
1004 │                                                Central American        │    0│
1005 │                                                Puerto Rican, OR        │    0│
1006 │                                                Something else          │   68│
1007 │                                                Multiple - cannot choose│    7│
1008 │                                                one                     │     │
1009 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1010
1011                                   Custom Tables
1012 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1013 │                                                                        │Count│
1014 ├────────────────────────────────────────────────────────────────────────┼─────┤
1015 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1016 │background?                                     one                     │     │
1017 │                                                Something else          │   68│
1018 │                                                Puerto Rican, OR        │    0│
1019 │                                                Central American        │    0│
1020 │                                                South American          │   34│
1021 │                                                Spanish                 │   48│
1022 │                                                Mexican                 │  311│
1023 │                                                Cuban                   │   20│
1024 │                                                -1.00                   │   78│
1025 │                                                -2.00                   │   52│
1026 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1027
1028                                   Custom Tables
1029 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1030 │                                                                        │Count│
1031 ├────────────────────────────────────────────────────────────────────────┼─────┤
1032 │D5a. What would you say is your primary ethnic  Central American        │    0│
1033 │background?                                     Cuban                   │   20│
1034 │                                                Mexican                 │  311│
1035 │                                                Multiple - cannot choose│    7│
1036 │                                                one                     │     │
1037 │                                                Puerto Rican, OR        │    0│
1038 │                                                Something else          │   68│
1039 │                                                South American          │   34│
1040 │                                                Spanish                 │   48│
1041 │                                                -2.00                   │   52│
1042 │                                                -1.00                   │   78│
1043 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1044
1045                                   Custom Tables
1046 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1047 │                                                                        │Count│
1048 ├────────────────────────────────────────────────────────────────────────┼─────┤
1049 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1050 │background?                                     South American          │   34│
1051 │                                                Something else          │   68│
1052 │                                                Puerto Rican, OR        │    0│
1053 │                                                Multiple - cannot choose│    7│
1054 │                                                one                     │     │
1055 │                                                Mexican                 │  311│
1056 │                                                Cuban                   │   20│
1057 │                                                Central American        │    0│
1058 │                                                -1.00                   │   78│
1059 │                                                -2.00                   │   52│
1060 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1061 ])
1062 AT_CLEANUP
1063
1064 AT_SETUP([CTABLES simple nesting])
1065 AT_KEYWORDS([nest nested])
1066 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1067 AT_DATA([ctables.sps],
1068 [[GET 'nhtsa.sav'.
1069 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1070   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1071 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1072   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1073   /CLABELS ROW=OPPOSITE.
1074 ]])
1075 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1076                                   Custom Tables
1077 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1078 │                                                                 │     │ Table│
1079 │                                                                 │Count│   %  │
1080 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1081 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1082 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1083 │drive safely will A. Get stopped by                        Total │  700│   10%│
1084 │the police?                           ╶──────────────────────────┼─────┼──────┤
1085 │                                       Very       S3a.     Male  │  660│   10%│
1086 │                                       likely     GENDER:  Female│  842│   12%│
1087 │                                                           Total │ 1502│   22%│
1088 │                                      ╶──────────────────────────┼─────┼──────┤
1089 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1090 │                                       likely     GENDER:  Female│ 1589│   23%│
1091 │                                                           Total │ 2763│   40%│
1092 │                                      ╶──────────────────────────┼─────┼──────┤
1093 │                                       Somewhat   S3a.     Male  │  640│    9%│
1094 │                                       unlikely   GENDER:  Female│  667│   10%│
1095 │                                                           Total │ 1307│   19%│
1096 │                                      ╶──────────────────────────┼─────┼──────┤
1097 │                                       Very       S3a.     Male  │  311│    5%│
1098 │                                       unlikely   GENDER:  Female│  298│    4%│
1099 │                                                           Total │  609│    9%│
1100 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1101 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1102 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1103 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1104 │                                      ╶──────────────────────────┼─────┼──────┤
1105 │                                       Very       S3a.     Male  │ 1104│   16%│
1106 │                                       likely     GENDER:  Female│ 1715│   25%│
1107 │                                                           Total │ 2819│   41%│
1108 │                                      ╶──────────────────────────┼─────┼──────┤
1109 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1110 │                                       likely     GENDER:  Female│ 1214│   18%│
1111 │                                                           Total │ 2417│   35%│
1112 │                                      ╶──────────────────────────┼─────┼──────┤
1113 │                                       Somewhat   S3a.     Male  │  262│    4%│
1114 │                                       unlikely   GENDER:  Female│  168│    2%│
1115 │                                                           Total │  430│    6%│
1116 │                                      ╶──────────────────────────┼─────┼──────┤
1117 │                                       Very       S3a.     Male  │   81│    1%│
1118 │                                       unlikely   GENDER:  Female│   59│    1%│
1119 │                                                           Total │  140│    2%│
1120 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1121 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1122 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1123 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1124 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1125 │                                       Very       S3a.     Male  │  988│   14%│
1126 │                                       likely     GENDER:  Female│ 1049│   15%│
1127 │                                                           Total │ 2037│   30%│
1128 │                                      ╶──────────────────────────┼─────┼──────┤
1129 │                                       Somewhat   S3a.     Male  │  822│   12%│
1130 │                                       likely     GENDER:  Female│ 1210│   18%│
1131 │                                                           Total │ 2032│   30%│
1132 │                                      ╶──────────────────────────┼─────┼──────┤
1133 │                                       Somewhat   S3a.     Male  │  446│    7%│
1134 │                                       unlikely   GENDER:  Female│  548│    8%│
1135 │                                                           Total │  994│   15%│
1136 │                                      ╶──────────────────────────┼─────┼──────┤
1137 │                                       Very       S3a.     Male  │  268│    4%│
1138 │                                       unlikely   GENDER:  Female│  354│    5%│
1139 │                                                           Total │  622│    9%│
1140 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1141 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1142 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1143 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1144 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1145 │                                       Very       S3a.     Male  │  805│   12%│
1146 │                                       likely     GENDER:  Female│ 1029│   15%│
1147 │                                                           Total │ 1834│   27%│
1148 │                                      ╶──────────────────────────┼─────┼──────┤
1149 │                                       Somewhat   S3a.     Male  │  975│   14%│
1150 │                                       likely     GENDER:  Female│ 1332│   19%│
1151 │                                                           Total │ 2307│   34%│
1152 │                                      ╶──────────────────────────┼─────┼──────┤
1153 │                                       Somewhat   S3a.     Male  │  535│    8%│
1154 │                                       unlikely   GENDER:  Female│  560│    8%│
1155 │                                                           Total │ 1095│   16%│
1156 │                                      ╶──────────────────────────┼─────┼──────┤
1157 │                                       Very       S3a.     Male  │  270│    4%│
1158 │                                       unlikely   GENDER:  Female│  279│    4%│
1159 │                                                           Total │  549│    8%│
1160 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1161
1162                                   Custom Tables
1163 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1164 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1165 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1166 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1167 │                                 │        │ Table│         │         │        │
1168 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1169 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1170 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1171 │GENDER:        is it that drivers│        │      │         │         │        │
1172 │               who have had too  │        │      │         │         │        │
1173 │               much to drink to  │        │      │         │         │        │
1174 │               drive safely will │        │      │         │         │        │
1175 │               A. Get stopped by │        │      │         │         │        │
1176 │               the police?       │        │      │         │         │        │
1177 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1178 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1179 │               is it that drivers│        │      │         │         │        │
1180 │               who have had too  │        │      │         │         │        │
1181 │               much to drink to  │        │      │         │         │        │
1182 │               drive safely will │        │      │         │         │        │
1183 │               A. Get stopped by │        │      │         │         │        │
1184 │               the police?       │        │      │         │         │        │
1185 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1186 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1187 │               is it that drivers│        │      │         │         │        │
1188 │               who have had too  │        │      │         │         │        │
1189 │               much to drink to  │        │      │         │         │        │
1190 │               drive safely will │        │      │         │         │        │
1191 │               A. Get stopped by │        │      │         │         │        │
1192 │               the police?       │        │      │         │         │        │
1193 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1194 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1195 │GENDER:        is it that drivers│        │      │         │         │        │
1196 │               who have had too  │        │      │         │         │        │
1197 │               much to drink to  │        │      │         │         │        │
1198 │               drive safely will │        │      │         │         │        │
1199 │               B. Have an        │        │      │         │         │        │
1200 │               accident?         │        │      │         │         │        │
1201 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1202 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1203 │               is it that drivers│        │      │         │         │        │
1204 │               who have had too  │        │      │         │         │        │
1205 │               much to drink to  │        │      │         │         │        │
1206 │               drive safely will │        │      │         │         │        │
1207 │               B. Have an        │        │      │         │         │        │
1208 │               accident?         │        │      │         │         │        │
1209 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1210 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1211 │               is it that drivers│        │      │         │         │        │
1212 │               who have had too  │        │      │         │         │        │
1213 │               much to drink to  │        │      │         │         │        │
1214 │               drive safely will │        │      │         │         │        │
1215 │               B. Have an        │        │      │         │         │        │
1216 │               accident?         │        │      │         │         │        │
1217 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1218 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1219 │GENDER:        is it that drivers│        │      │         │         │        │
1220 │               who have had too  │        │      │         │         │        │
1221 │               much to drink to  │        │      │         │         │        │
1222 │               drive safely will │        │      │         │         │        │
1223 │               C. Be convicted   │        │      │         │         │        │
1224 │               for drunk driving?│        │      │         │         │        │
1225 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1226 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1227 │               is it that drivers│        │      │         │         │        │
1228 │               who have had too  │        │      │         │         │        │
1229 │               much to drink to  │        │      │         │         │        │
1230 │               drive safely will │        │      │         │         │        │
1231 │               C. Be convicted   │        │      │         │         │        │
1232 │               for drunk driving?│        │      │         │         │        │
1233 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1234 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1235 │               is it that drivers│        │      │         │         │        │
1236 │               who have had too  │        │      │         │         │        │
1237 │               much to drink to  │        │      │         │         │        │
1238 │               drive safely will │        │      │         │         │        │
1239 │               C. Be convicted   │        │      │         │         │        │
1240 │               for drunk driving?│        │      │         │         │        │
1241 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1242 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1243 │GENDER:        is it that drivers│        │      │         │         │        │
1244 │               who have had too  │        │      │         │         │        │
1245 │               much to drink to  │        │      │         │         │        │
1246 │               drive safely will │        │      │         │         │        │
1247 │               D. Be arrested for│        │      │         │         │        │
1248 │               drunk driving?    │        │      │         │         │        │
1249 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1250 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1251 │               is it that drivers│        │      │         │         │        │
1252 │               who have had too  │        │      │         │         │        │
1253 │               much to drink to  │        │      │         │         │        │
1254 │               drive safely will │        │      │         │         │        │
1255 │               D. Be arrested for│        │      │         │         │        │
1256 │               drunk driving?    │        │      │         │         │        │
1257 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1258 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1259 │               is it that drivers│        │      │         │         │        │
1260 │               who have had too  │        │      │         │         │        │
1261 │               much to drink to  │        │      │         │         │        │
1262 │               drive safely will │        │      │         │         │        │
1263 │               D. Be arrested for│        │      │         │         │        │
1264 │               drunk driving?    │        │      │         │         │        │
1265 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1266 ])
1267 AT_CLEANUP
1268
1269 AT_SETUP([CTABLES nesting and scale variables])
1270 AT_KEYWORDS([nest nested])
1271 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1272 AT_DATA([ctables.sps],
1273 [[GET 'nhtsa.sav'.
1274 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1275 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1276 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1277   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1278 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1279 ]])
1280 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1281                                   Custom Tables
1282 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1283 │                                                                 │S3a. GENDER:│
1284 │                                                                 ├─────┬──────┤
1285 │                                                                 │ Male│Female│
1286 │                                                                 ├─────┼──────┤
1287 │                                                                 │ Mean│ Mean │
1288 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1289 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1290 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1291 │                                                  week           │     │      │
1292 │                                                  Once a week or │   44│    54│
1293 │                                                  less           │     │      │
1294 │                                                  Only certain   │   34│    41│
1295 │                                                  times a year   │     │      │
1296 │                                                  Never          │   39│    55│
1297 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1298
1299                                   Custom Tables
1300 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1301 │                                                         │Minimum│Maximum│Mean│
1302 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1303 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1304 │What is  GENDER:         months, has there been a        │       │       │    │
1305 │your                     time when you felt you          │       │       │    │
1306 │age?                     should cut down on your      No │     16│     86│  46│
1307 │                         drinking?                       │       │       │    │
1308 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1309 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1310 │                         months, has there been a        │       │       │    │
1311 │                         time when you felt you          │       │       │    │
1312 │                         should cut down on your      No │     16│     86│  48│
1313 │                         drinking?                       │       │       │    │
1314 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1315 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1316 │What is  GENDER:         months, has there been a        │       │       │    │
1317 │your                     time when people criticized  No │     16│     86│  46│
1318 │age?                     your drinking?                  │       │       │    │
1319 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1320 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1321 │                         months, has there been a        │       │       │    │
1322 │                         time when people criticized  No │     16│     86│  48│
1323 │                         your drinking?                  │       │       │    │
1324 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1325
1326                                   Custom Tables
1327 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1328 │                             │S1. Including yourself, how many members of this│
1329 │                             │         household are age 16 or older?         │
1330 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1331 │                             │      │      │      │      │      │      │ 6 or │
1332 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1333 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1334 │                             │Column│Column│Column│Column│Column│Column│Column│
1335 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1336 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1337 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1338 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1339 │SOURCE:     likely           │      │      │      │      │      │      │      │
1340 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1341 │            that     likely  │      │      │      │      │      │      │      │
1342 │            drivers          │      │      │      │      │      │      │      │
1343 │            who have         │      │      │      │      │      │      │      │
1344 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1345 │            much to  likely  │      │      │      │      │      │      │      │
1346 │            drink to         │      │      │      │      │      │      │      │
1347 │            drive            │      │      │      │      │      │      │      │
1348 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1349 │            will A.  unlikely│      │      │      │      │      │      │      │
1350 │            Get              │      │      │      │      │      │      │      │
1351 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1352 │            by the   unlikely│      │      │      │      │      │      │      │
1353 │            police?          │      │      │      │      │      │      │      │
1354 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1355
1356                                   Custom Tables
1357 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1358 │                                                              │    │    Std   │
1359 │                                                              │Mean│ Deviation│
1360 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1361 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1362 │group           typical month did you have one or more        │    │          │
1363 │                alcoholic beverages to drink?                 │    │          │
1364 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1365 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1366 │                typical month did you have one or more        │    │          │
1367 │                alcoholic beverages to drink?                 │    │          │
1368 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1369 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1370 │                typical month did you have one or more        │    │          │
1371 │                alcoholic beverages to drink?                 │    │          │
1372 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1373 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1374 │                typical month did you have one or more        │    │          │
1375 │                alcoholic beverages to drink?                 │    │          │
1376 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1377 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1378 │                typical month did you have one or more        │    │          │
1379 │                alcoholic beverages to drink?                 │    │          │
1380 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1381 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1382 │       older    typical month did you have one or more        │    │          │
1383 │                alcoholic beverages to drink?                 │    │          │
1384 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1385 ])
1386 AT_CLEANUP
1387
1388
1389 AT_SETUP([CTABLES SLABELS])
1390 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1391 AT_DATA([ctables.sps],
1392 [[GET 'nhtsa.sav'.
1393 CTABLES /TABLE qn1 [COUNT COLPCT].
1394 CTABLES /TABLE qn1 [COUNT COLPCT]
1395     /SLABELS POSITION=ROW.
1396 CTABLES /TABLE qn1 [COUNT COLPCT]
1397     /SLABELS POSITION=ROW VISIBLE=NO.
1398 ]])
1399 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1400                                   Custom Tables
1401 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1402 │                                                                │     │ Column│
1403 │                                                                │Count│   %   │
1404 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1405 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1406 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1407 │                                             Once a week or less│  361│   5.2%│
1408 │                                             Only certain times │  130│   1.9%│
1409 │                                             a year             │     │       │
1410 │                                             Never              │  540│   7.7%│
1411 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1412
1413                                   Custom Tables
1414 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1415 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1416 │other motor vehicle?                                             Column │66.9%│
1417 │                                                                 %      │     │
1418 │                                            ╶───────────────────────────┼─────┤
1419 │                                             Several days a week Count  │ 1274│
1420 │                                                                 Column │18.3%│
1421 │                                                                 %      │     │
1422 │                                            ╶───────────────────────────┼─────┤
1423 │                                             Once a week or less Count  │  361│
1424 │                                                                 Column │ 5.2%│
1425 │                                                                 %      │     │
1426 │                                            ╶───────────────────────────┼─────┤
1427 │                                             Only certain times  Count  │  130│
1428 │                                             a year              Column │ 1.9%│
1429 │                                                                 %      │     │
1430 │                                            ╶───────────────────────────┼─────┤
1431 │                                             Never               Count  │  540│
1432 │                                                                 Column │ 7.7%│
1433 │                                                                 %      │     │
1434 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1435
1436                                   Custom Tables
1437 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1438 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1439 │motor vehicle?                                                          │66.9%│
1440 │                                                   Several days a week  │ 1274│
1441 │                                                                        │18.3%│
1442 │                                                   Once a week or less  │  361│
1443 │                                                                        │ 5.2%│
1444 │                                                   Only certain times a │  130│
1445 │                                                   year                 │ 1.9%│
1446 │                                                   Never                │  540│
1447 │                                                                        │ 7.7%│
1448 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1449 ])
1450 AT_CLEANUP
1451
1452 AT_SETUP([CTABLES simple totals])
1453 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1454 AT_DATA([ctables.sps],
1455 [[GET 'nhtsa.sav'.
1456 CTABLES /TABLE=qn17
1457     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1458 DESCRIPTIVES qn18/STATISTICS=MEAN.
1459 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1460     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1461 ]])
1462 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1463                                   Custom Tables
1464 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1465 │                                                                        │Count│
1466 ├────────────────────────────────────────────────────────────────────────┼─────┤
1467 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1468 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1469 │                                                      Light beer        │  620│
1470 │                                                      Wine              │ 1418│
1471 │                                                      Wine coolers      │  137│
1472 │                                                      Hard liquor or    │  888│
1473 │                                                      mixed drinks      │     │
1474 │                                                      Flavored malt     │   83│
1475 │                                                      drinks            │     │
1476 │                                                      Number responding │ 4221│
1477 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1478
1479                              Descriptive Statistics
1480 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1481 │                                                                    │  N │Mean│
1482 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1483 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1484 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1485 │Valid N (listwise)                                                  │6999│    │
1486 │Missing N (listwise)                                                │2781│    │
1487 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1488
1489                                   Custom Tables
1490 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1491 │                                                      │    │     │ Valid│Total│
1492 │                                                      │Mean│Count│   N  │  N  │
1493 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1494 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1495 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1496 │                you usually drink per sitting?        │    │     │      │     │
1497 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1498 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1499 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1500 │                you usually drink per sitting?        │    │     │      │     │
1501 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1502 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1503 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1504 │                you usually drink per sitting?        │    │     │      │     │
1505 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1506 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1507 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1508 │                you usually drink per sitting?        │    │     │      │     │
1509 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1510 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1511 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1512 │                you usually drink per sitting?        │    │     │      │     │
1513 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1514 ])
1515 AT_CLEANUP
1516
1517 AT_SETUP([CTABLES subtotals])
1518 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1519 AT_DATA([ctables.sps],
1520 [[GET 'nhtsa.sav'.
1521 CTABLES /TABLE=qn105ba BY qns1
1522     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1523 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1524     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1525 CTABLES /TABLE=qn105ba BY qns1
1526     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1527     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1528 ]])
1529 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1530                                                       Custom Tables
1531 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1532 │                                                         │ S1. Including yourself, how many members of this household │
1533 │                                                         │                    are age 16 or older?                    │
1534 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1535 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1536 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1537 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1538 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1539 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1540 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1541 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1542 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1543 │                                              likely     │       │       │         │       │        │      │          │
1544 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1545 │                                              unlikely   │       │       │         │       │        │      │          │
1546 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1547 │                                              unlikely   │       │       │         │       │        │      │          │
1548 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1549
1550                                                       Custom Tables
1551 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1552 │                                                        │  S1. Including yourself, how many members of this household │
1553 │                                                        │                     are age 16 or older?                    │
1554 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1555 │                                                        │        │        │        │        │       │        │  6 or  │
1556 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1557 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1558 │                                                        │        │        │        │        │ Column│        │        │
1559 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1560 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1561 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1562 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1563 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1564 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1565 │                                             likely     │        │        │        │        │       │        │        │
1566 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1567 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1568 │                                             unlikely   │        │        │        │        │       │        │        │
1569 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1570 │                                             unlikely   │        │        │        │        │       │        │        │
1571 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1572 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1573
1574                                                       Custom Tables
1575 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1576 │                                                         │ S1. Including yourself, how many members of this household │
1577 │                                                         │                    are age 16 or older?                    │
1578 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1579 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1580 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1581 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1582 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1583 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1584 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1585 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1586 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1587 │                                              likely     │       │       │         │       │        │      │          │
1588 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1589 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1590 │                                              unlikely   │       │       │         │       │        │      │          │
1591 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1592 │                                              unlikely   │       │       │         │       │        │      │          │
1593 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1594 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1595 ])
1596 AT_CLEANUP
1597
1598 AT_SETUP([CTABLES PCOMPUTE])
1599 AT_KEYWORDS([postcompute])
1600 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1601 AT_DATA([ctables.sps],
1602 [[GET 'nhtsa.sav'.
1603 CTABLES
1604     /PCOMPUTE &x=EXPR([3] + [4])
1605     /PCOMPUTE &y=EXPR([4] + [5])
1606     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1607     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1608     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1609     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1610
1611 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1612 CTABLES
1613     /PCOMPUTE &x=EXPR([3] + [4])
1614     /PCOMPUTE &y=EXPR([4] + [5])
1615     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1616     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1617     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1618     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1619 ]])
1620 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1621                                                                 Custom Tables
1622 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1623 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1624 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1625 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1626 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1627 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1628 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1629 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1630 │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%│
1631 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1632 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1633 │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%│
1634 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1635 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1636 │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%│
1637 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1638 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1639 │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%│
1640 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1641 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1642 │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%│
1643 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1644 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1645 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1646
1647                                                                 Custom Tables
1648 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1649 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1650 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1651 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1652 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1653 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1654 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1655 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1656 │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%│
1657 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1658 │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%│
1659 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1660 │                               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%│
1661 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1662 │                               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%│
1663 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1664 │                               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%│
1665 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1666 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1667 ])
1668 AT_CLEANUP
1669
1670 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1671 AT_KEYWORDS([postcompute])
1672 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1673 AT_DATA([ctables.sps],
1674 [[GET 'nhtsa.sav'.
1675 CTABLES
1676     /PCOMPUTE &x=EXPR(OTHERNM)
1677     /PCOMPUTE &y=EXPR(MISSING)
1678     /PPROPERTIES &x LABEL='Drivers'
1679     /PPROPERTIES &y LABEL='Missing Values 2'
1680     /TABLE=qn1 BY qns3a
1681     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1682 ]])
1683 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1684                                               Custom Tables
1685 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1686 │                                                                                          │S3a. GENDER:│
1687 │                                                                                          ├─────┬──────┤
1688 │                                                                                          │ Male│Female│
1689 │                                                                                          ├─────┼──────┤
1690 │                                                                                          │Count│ Count│
1691 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1692 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1693 │                                                                 Several days a week      │  440│   834│
1694 │                                                                 Once a week or less      │  125│   236│
1695 │                                                                 Only certain times a year│   58│    72│
1696 │                                                                 Never                    │  192│   348│
1697 │                                                                 Drivers                  │ 2928│  3504│
1698 │                                                                 Valid Values             │ 3120│  3852│
1699 │                                                                 Don't know               │    3│     5│
1700 │                                                                 Refused                  │    9│    10│
1701 │                                                                 Missing Values           │   12│    15│
1702 │                                                                 Missing Values 2         │   12│    15│
1703 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1704 ])
1705 AT_CLEANUP
1706
1707 AT_SETUP([CTABLES PCOMPUTE - THRU])
1708 AT_KEYWORDS([postcompute])
1709 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1710 AT_DATA([ctables.sps],
1711 [[GET 'nhtsa.sav'.
1712 CTABLES
1713     /PCOMPUTE &x=EXPR([1 THRU 2])
1714     /PCOMPUTE &y=EXPR([3 THRU 4])
1715     /PCOMPUTE &z=EXPR([5] + MISSING)
1716     /PPROPERTIES &x LABEL='Frequent Drivers'
1717     /PPROPERTIES &y LABEL='Infrequent Drivers'
1718     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1719     /TABLE=qn1 BY qns3a
1720     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1721 ]])
1722 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1723                                               Custom Tables
1724 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1725 │                                                                                          │S3a. GENDER:│
1726 │                                                                                          ├─────┬──────┤
1727 │                                                                                          │ Male│Female│
1728 │                                                                                          ├─────┼──────┤
1729 │                                                                                          │Count│ Count│
1730 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1731 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1732 │                                                                 Several days a week      │  440│   834│
1733 │                                                                 Frequent Drivers         │ 2745│  3196│
1734 │                                                                 Once a week or less      │  125│   236│
1735 │                                                                 Only certain times a year│   58│    72│
1736 │                                                                 Infrequent Drivers       │  183│   308│
1737 │                                                                 Drivers                  │ 2928│  3504│
1738 │                                                                 Never                    │  192│   348│
1739 │                                                                 Don't know               │    3│     5│
1740 │                                                                 Refused                  │    9│    10│
1741 │                                                                 Not Drivers or Missing   │  204│   363│
1742 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1743 ])
1744 AT_CLEANUP
1745
1746 dnl I'm not sure that this is the correct behavior (see
1747 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1748 dnl but at least this test will notify us if the behavior changes.
1749 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1750 AT_KEYWORDS([PCOMPUTE postcompute])
1751 AT_DATA([ctables.sps],
1752 [[DATA LIST LIST NOTABLE/x y z.
1753 WEIGHT by z.
1754 FORMATS ALL (F1.0).
1755 VARIABLE LEVEL x y (NOMINAL).
1756 BEGIN DATA.
1757 1 4 5
1758 1 5 2
1759 1 6 9
1760 2 4 2
1761 2 5 3
1762 2 6 4
1763 3 4 1
1764 3 5 6
1765 3 6 1
1766 END DATA.
1767
1768 CTABLES
1769     /PCOMPUTE &a = EXPR([1] + [2])
1770     /PCOMPUTE &b = EXPR([2] + [3])
1771     /PCOMPUTE &c = EXPR([4] * [5])
1772     /PCOMPUTE &d = EXPR([5] * [6])
1773     /TABLE x BY y
1774     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1775     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1776 ]])
1777 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1778 [[                   Custom Tables
1779 ╭───────────┬─────────────────────────────────────╮
1780 │           │                  y                  │
1781 │           ├─────┬─────────┬─────┬─────────┬─────┤
1782 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
1783 │           ├─────┼─────────┼─────┼─────────┼─────┤
1784 │           │Count│  Count  │Count│  Count  │Count│
1785 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1786 │x 1        │    5│       10│    2│       18│    9│
1787 │  [1] + [2]│    7│        .│    5│        .│   13│
1788 │  2        │    2│        6│    3│       12│    4│
1789 │  [2] + [3]│    3│        .│    9│        .│    5│
1790 │  3        │    1│        6│    6│        6│    1│
1791 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1792 ]])
1793 AT_CLEANUP
1794
1795 AT_SETUP([CTABLES string and date and time])
1796
1797 weight=1
1798 for gender in F M; do
1799     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1800         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1801             printf "$weight $gender $month $wkday\n"
1802             weight=$(expr \( $weight + 3 \) % 7 + 2)
1803         done
1804     done
1805 done > ctables.txt
1806
1807 AT_DATA([ctables.sps],
1808 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1809     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1810 WEIGHT by w.
1811 VARIABLE LEVEL w (SCALE).
1812 VARIABLE LEVEL gender fmon fday (NOMINAL).
1813 VARIABLE LABEL
1814   gender 'Gender'
1815   fmon 'Favorite month'
1816   fday 'Favorite day of the week'.
1817 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1818 CTABLES
1819     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1820     /PPROPERTIES &q2 LABEL='Q2'
1821     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1822     /PPROPERTIES &weekend LABEL='Weekend'
1823     /TABLE fmon BY gender > fday
1824     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1825                                 4 THRU 6, &q2,
1826                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
1827                                 OTHERNM, SUBTOTAL='Q4']
1828     /CATEGORIES VARIABLES=gender ['M', 'F']
1829     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1830     /SLABELS VISIBLE=NO.
1831 ]])
1832 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1833                                               Custom Tables
1834 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1835 │                  │                                       Gender                                      │
1836 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1837 │                  │                   Male                  │                  Female                 │
1838 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1839 │                  │         Favorite day of the week        │         Favorite day of the week        │
1840 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1841 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1842 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1843 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
1844 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1845 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1846 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
1847 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1848 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1849 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
1850 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
1851 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
1852 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
1853 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1854 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
1855 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1856 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1857 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1858 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
1859 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1860 ])
1861 AT_CLEANUP
1862
1863 AT_SETUP([CTABLES CLABELS])
1864 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1865 AT_DATA([ctables.sps],
1866 [[GET 'nhtsa.sav'.
1867 CTABLES /TABLE AgeGroup BY qns3a.
1868 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1869 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1870 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1871 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1872 ]])
1873 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1874              Custom Tables
1875 ╭───────────────────────┬────────────╮
1876 │                       │S3a. GENDER:│
1877 │                       ├─────┬──────┤
1878 │                       │ Male│Female│
1879 │                       ├─────┼──────┤
1880 │                       │Count│ Count│
1881 ├───────────────────────┼─────┼──────┤
1882 │Age group 15 or younger│    0│     0│
1883 │          16 to 25     │  594│   505│
1884 │          26 to 35     │  476│   491│
1885 │          36 to 45     │  489│   548│
1886 │          46 to 55     │  526│   649│
1887 │          56 to 65     │  516│   731│
1888 │          66 or older  │  531│   943│
1889 ╰───────────────────────┴─────┴──────╯
1890
1891                                                       Custom Tables
1892 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1893 │       │                                                 S3a. GENDER:                                                 │
1894 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1895 │       │                         Male                         │                         Female                        │
1896 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1897 │       │  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 │
1898 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1899 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1900 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1901 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1902 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1903 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1904 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1905
1906                 Custom Tables
1907 ╭──────────────────────────────┬────────────╮
1908 │                              │S3a. GENDER:│
1909 │                              ├────────────┤
1910 │                              │    Count   │
1911 ├──────────────────────────────┼────────────┤
1912 │Age group 15 or younger Male  │           0│
1913 │                        Female│           0│
1914 │         ╶────────────────────┼────────────┤
1915 │          16 to 25      Male  │         594│
1916 │                        Female│         505│
1917 │         ╶────────────────────┼────────────┤
1918 │          26 to 35      Male  │         476│
1919 │                        Female│         491│
1920 │         ╶────────────────────┼────────────┤
1921 │          36 to 45      Male  │         489│
1922 │                        Female│         548│
1923 │         ╶────────────────────┼────────────┤
1924 │          46 to 55      Male  │         526│
1925 │                        Female│         649│
1926 │         ╶────────────────────┼────────────┤
1927 │          56 to 65      Male  │         516│
1928 │                        Female│         731│
1929 │         ╶────────────────────┼────────────┤
1930 │          66 or older   Male  │         531│
1931 │                        Female│         943│
1932 ╰──────────────────────────────┴────────────╯
1933
1934       Custom Tables
1935 15 or younger
1936 ╭─────────┬────────────╮
1937 │         │S3a. GENDER:│
1938 │         ├─────┬──────┤
1939 │         │ Male│Female│
1940 │         ├─────┼──────┤
1941 │         │Count│ Count│
1942 ├─────────┼─────┼──────┤
1943 │Age group│    0│     0│
1944 ╰─────────┴─────┴──────╯
1945
1946       Custom Tables
1947 16 to 25
1948 ╭─────────┬────────────╮
1949 │         │S3a. GENDER:│
1950 │         ├─────┬──────┤
1951 │         │ Male│Female│
1952 │         ├─────┼──────┤
1953 │         │Count│ Count│
1954 ├─────────┼─────┼──────┤
1955 │Age group│  594│   505│
1956 ╰─────────┴─────┴──────╯
1957
1958       Custom Tables
1959 26 to 35
1960 ╭─────────┬────────────╮
1961 │         │S3a. GENDER:│
1962 │         ├─────┬──────┤
1963 │         │ Male│Female│
1964 │         ├─────┼──────┤
1965 │         │Count│ Count│
1966 ├─────────┼─────┼──────┤
1967 │Age group│  476│   491│
1968 ╰─────────┴─────┴──────╯
1969
1970       Custom Tables
1971 36 to 45
1972 ╭─────────┬────────────╮
1973 │         │S3a. GENDER:│
1974 │         ├─────┬──────┤
1975 │         │ Male│Female│
1976 │         ├─────┼──────┤
1977 │         │Count│ Count│
1978 ├─────────┼─────┼──────┤
1979 │Age group│  489│   548│
1980 ╰─────────┴─────┴──────╯
1981
1982       Custom Tables
1983 46 to 55
1984 ╭─────────┬────────────╮
1985 │         │S3a. GENDER:│
1986 │         ├─────┬──────┤
1987 │         │ Male│Female│
1988 │         ├─────┼──────┤
1989 │         │Count│ Count│
1990 ├─────────┼─────┼──────┤
1991 │Age group│  526│   649│
1992 ╰─────────┴─────┴──────╯
1993
1994       Custom Tables
1995 56 to 65
1996 ╭─────────┬────────────╮
1997 │         │S3a. GENDER:│
1998 │         ├─────┬──────┤
1999 │         │ Male│Female│
2000 │         ├─────┼──────┤
2001 │         │Count│ Count│
2002 ├─────────┼─────┼──────┤
2003 │Age group│  516│   731│
2004 ╰─────────┴─────┴──────╯
2005
2006       Custom Tables
2007 66 or older
2008 ╭─────────┬────────────╮
2009 │         │S3a. GENDER:│
2010 │         ├─────┬──────┤
2011 │         │ Male│Female│
2012 │         ├─────┼──────┤
2013 │         │Count│ Count│
2014 ├─────────┼─────┼──────┤
2015 │Age group│  531│   943│
2016 ╰─────────┴─────┴──────╯
2017
2018              Custom Tables
2019 Male
2020 ╭───────────────────────┬────────────╮
2021 │                       │S3a. GENDER:│
2022 │                       ├────────────┤
2023 │                       │    Count   │
2024 ├───────────────────────┼────────────┤
2025 │Age group 15 or younger│           0│
2026 │          16 to 25     │         594│
2027 │          26 to 35     │         476│
2028 │          36 to 45     │         489│
2029 │          46 to 55     │         526│
2030 │          56 to 65     │         516│
2031 │          66 or older  │         531│
2032 ╰───────────────────────┴────────────╯
2033
2034              Custom Tables
2035 Female
2036 ╭───────────────────────┬────────────╮
2037 │                       │S3a. GENDER:│
2038 │                       ├────────────┤
2039 │                       │    Count   │
2040 ├───────────────────────┼────────────┤
2041 │Age group 15 or younger│           0│
2042 │          16 to 25     │         505│
2043 │          26 to 35     │         491│
2044 │          36 to 45     │         548│
2045 │          46 to 55     │         649│
2046 │          56 to 65     │         731│
2047 │          66 or older  │         943│
2048 ╰───────────────────────┴────────────╯
2049 ])
2050 AT_CLEANUP
2051
2052 AT_SETUP([CTABLES missing values])
2053 AT_DATA([ctables.sps],
2054 [[DATA LIST LIST NOTABLE/x y.
2055 BEGIN DATA.
2056 1 1
2057 1 2
2058 1 3
2059 1 4
2060 1 5
2061 1 .
2062 2 1
2063 2 2
2064 2 3
2065 2 4
2066 2 5
2067 2 .
2068 3 1
2069 3 2
2070 3 3
2071 3 4
2072 3 5
2073 3 .
2074 4 1
2075 4 2
2076 4 3
2077 4 4
2078 4 5
2079 4 .
2080 5 1
2081 5 2
2082 5 3
2083 5 4
2084 5 5
2085 5 .
2086 . 1
2087 . 2
2088 . 3
2089 . 4
2090 . 5
2091 . .
2092 END DATA.
2093 MISSING VALUES x (1, 2) y (2, 3).
2094 VARIABLE LEVEL ALL (NOMINAL).
2095
2096 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2097                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2098     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2099 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2100                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2101     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2102 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2103                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2104     /CATEGORIES VARIABLES=ALL TOTAL=YES
2105     /SLABELS POSITION=ROW.
2106 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2107                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2108     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2109     /SLABELS POSITION=ROW.
2110 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2111                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2112     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2113     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2114     /SLABELS POSITION=ROW.
2115 ]])
2116 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2117                                Custom Tables
2118 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2119 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2120 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2121 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2122 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2123 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2124 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2125 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2126 dnl Note that Column Total N % doesn't add up to 100 because missing
2127 dnl values are included in the total but not shown as a category and this
2128 dnl is expected behavior.
2129
2130                                Custom Tables
2131 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2132 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2133 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2134 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2135 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2136 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2137 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2138 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2139 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2140 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2141 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2142 dnl values are included in the total but not shown as a category and this
2143 dnl is expected behavior.
2144
2145                      Custom Tables
2146 ╭────────────────────────┬───────────────────────────╮
2147 │                        │             y             │
2148 │                        ├──────┬──────┬──────┬──────┤
2149 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2150 ├────────────────────────┼──────┼──────┼──────┼──────┤
2151 │x 3.00  Count           │     1│     1│     1│     3│
2152 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2153 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2154 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2155 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2156 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2157 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2158 │        Valid N         │      │      │      │     3│
2159 │        Total N         │      │      │      │     6│
2160 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2161 │  4.00  Count           │     1│     1│     1│     3│
2162 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2163 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2164 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2165 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2166 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2167 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2168 │        Valid N         │      │      │      │     3│
2169 │        Total N         │      │      │      │     6│
2170 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2171 │  5.00  Count           │     1│     1│     1│     3│
2172 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2173 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2174 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2175 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2176 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2177 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2178 │        Valid N         │      │      │      │     3│
2179 │        Total N         │      │      │      │     6│
2180 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2181 │  Total Count           │     3│     3│     3│     9│
2182 │        Column %        │100.0%│100.0%│100.0%│     .│
2183 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2184 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2185 │        Row %           │     .│     .│     .│     .│
2186 │        Row Valid N %   │     .│     .│     .│     .│
2187 │        Row Total N %   │     .│     .│     .│     .│
2188 │        Valid N         │     3│     3│     3│     9│
2189 │        Total N         │     6│     6│     6│    36│
2190 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2191
2192                             Custom Tables
2193 ╭────────────────────────┬─────────────────────────────────────────╮
2194 │                        │                    y                    │
2195 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2196 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2197 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2198 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2199 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2200 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2201 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2202 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2203 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2204 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2205 │        Valid N         │      │      │      │      │      │     0│
2206 │        Total N         │      │      │      │      │      │     6│
2207 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2208 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2209 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2210 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2211 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2212 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2213 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2214 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2215 │        Valid N         │      │      │      │      │      │     0│
2216 │        Total N         │      │      │      │      │      │     6│
2217 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2218 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2219 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2220 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2221 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2222 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2223 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2224 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2225 │        Valid N         │      │      │      │      │      │     3│
2226 │        Total N         │      │      │      │      │      │     6│
2227 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2228 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2229 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2230 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2231 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2232 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2233 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2234 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2235 │        Valid N         │      │      │      │      │      │     3│
2236 │        Total N         │      │      │      │      │      │     6│
2237 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2238 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2239 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2240 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2241 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2242 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2243 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2244 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2245 │        Valid N         │      │      │      │      │      │     3│
2246 │        Total N         │      │      │      │      │      │     6│
2247 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2248 │  Total Count           │     5│     5│     5│     5│     5│    25│
2249 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2250 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2251 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2252 │        Row %           │     .│     .│     .│     .│     .│     .│
2253 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2254 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2255 │        Valid N         │     3│     0│     0│     3│     3│     9│
2256 │        Total N         │     6│     6│     6│     6│     6│    36│
2257 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2258
2259                         Custom Tables
2260 ╭────────────────────────┬──────────────────────────────────╮
2261 │                        │                 y                │
2262 │                        ├──────┬──────┬──────┬──────┬──────┤
2263 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2264 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2265 │x 1.00  Count           │     1│     1│     1│     1│     4│
2266 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2267 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2268 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2269 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2270 │        Row Valid N %   │     .│     .│     .│     .│     .│
2271 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2272 │        Valid N         │      │      │      │      │     0│
2273 │        Total N         │      │      │      │      │     6│
2274 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2275 │  2.00  Count           │     1│     1│     1│     1│     4│
2276 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2277 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2278 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2279 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2280 │        Row Valid N %   │     .│     .│     .│     .│     .│
2281 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2282 │        Valid N         │      │      │      │      │     0│
2283 │        Total N         │      │      │      │      │     6│
2284 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2285 │  3.00  Count           │     1│     1│     1│     1│     4│
2286 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2287 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2288 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2289 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2290 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2291 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2292 │        Valid N         │      │      │      │      │     3│
2293 │        Total N         │      │      │      │      │     6│
2294 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2295 │  4.00  Count           │     1│     1│     1│     1│     4│
2296 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2297 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2298 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2299 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2300 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2301 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2302 │        Valid N         │      │      │      │      │     3│
2303 │        Total N         │      │      │      │      │     6│
2304 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2305 │  Total Count           │     4│     4│     4│     4│    16│
2306 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2307 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2308 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2309 │        Row %           │     .│     .│     .│     .│     .│
2310 │        Row Valid N %   │     .│     .│     .│     .│     .│
2311 │        Row Total N %   │     .│     .│     .│     .│     .│
2312 │        Valid N         │     2│     0│     2│     2│     6│
2313 │        Total N         │     5│     5│     5│     5│    30│
2314 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2315 ])
2316 AT_CLEANUP
2317
2318 AT_SETUP([CTABLES SMISSING=LISTWISE])
2319 AT_KEYWORDS([SMISSING LISTWISE])
2320 AT_DATA([ctables.sps],
2321 [[DATA LIST LIST NOTABLE/x y z.
2322 BEGIN DATA.
2323 1  . 40
2324 1 10 50
2325 1 20 60
2326 1  .  .
2327 1 30  .
2328 END DATA.
2329 VARIABLE LEVEL x (NOMINAL).
2330
2331 CTABLES /TABLE (y + z) > x.
2332 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2333
2334 * The following doesn't come out as listwise because the tables are
2335 separate, not linked by an > operator.
2336 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2337 ]])
2338 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2339   Custom Tables
2340 ╭────────┬─────╮
2341 │        │ Mean│
2342 ├────────┼─────┤
2343 │y x 1.00│20.00│
2344 ├────────┼─────┤
2345 │z x 1.00│50.00│
2346 ╰────────┴─────╯
2347
2348   Custom Tables
2349 ╭────────┬─────╮
2350 │        │ Mean│
2351 ├────────┼─────┤
2352 │y x 1.00│15.00│
2353 ├────────┼─────┤
2354 │z x 1.00│55.00│
2355 ╰────────┴─────╯
2356
2357   Custom Tables
2358 ╭────────┬─────╮
2359 │        │ Mean│
2360 ├────────┼─────┤
2361 │y x 1.00│20.00│
2362 ├────────┼─────┤
2363 │z x 1.00│50.00│
2364 ╰────────┴─────╯
2365 ])
2366 AT_CLEANUP
2367
2368 AT_SETUP([CTABLES VLABELS - variables on different axes])
2369 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2370 AT_DATA([ctables.sps],
2371 [[GET 'nhtsa.sav'.
2372 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2373 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2374 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2375 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2376 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2377 ]])
2378 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2379                                  Custom Tables
2380 ╭────────────────────────────────────────────────────────────────┬────────────╮
2381 │                                                                │S3a. GENDER:│
2382 │                                                                ├─────┬──────┤
2383 │                                                                │ Male│Female│
2384 │                                                                ├─────┼──────┤
2385 │                                                                │Count│ Count│
2386 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2387 │D5a. What would you say is your primary    Cuban                │   13│     7│
2388 │ethnic background?                         Mexican              │  175│   136│
2389 │                                           Spanish              │   20│    28│
2390 │                                           South American       │   21│    13│
2391 │                                           Central American     │   27│    25│
2392 │                                           Puerto Rican, OR     │   37│    41│
2393 │                                           Something else       │   35│    33│
2394 │                                           Multiple - cannot    │    2│     5│
2395 │                                           choose one           │     │      │
2396 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2397
2398                   Custom Tables
2399 ╭──────────────────────────────────┬────────────╮
2400 │                                  │    QNS3A   │
2401 │                                  ├─────┬──────┤
2402 │                                  │ Male│Female│
2403 │                                  ├─────┼──────┤
2404 │                                  │Count│ Count│
2405 ├──────────────────────────────────┼─────┼──────┤
2406 │QND5A Cuban                       │   13│     7│
2407 │      Mexican                     │  175│   136│
2408 │      Spanish                     │   20│    28│
2409 │      South American              │   21│    13│
2410 │      Central American            │   27│    25│
2411 │      Puerto Rican, OR            │   37│    41│
2412 │      Something else              │   35│    33│
2413 │      Multiple - cannot choose one│    2│     5│
2414 ╰──────────────────────────────────┴─────┴──────╯
2415
2416                                  Custom Tables
2417 ╭────────────────────────────────────────────────────────────────┬────────────╮
2418 │                                                                │S3a. GENDER:│
2419 │                                                                ├─────┬──────┤
2420 │                                                                │ Male│Female│
2421 │                                                                ├─────┼──────┤
2422 │                                                                │Count│ Count│
2423 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2424 │D5a. What would you say is your primary    Cuban                │   13│     7│
2425 │ethnic background?                         Mexican              │  175│   136│
2426 │                                           Spanish              │   20│    28│
2427 │                                           South American       │   21│    13│
2428 │                                           Central American     │   27│    25│
2429 │                                           Puerto Rican, OR     │   37│    41│
2430 │                                           Something else       │   35│    33│
2431 │                                           Multiple - cannot    │    2│     5│
2432 │                                           choose one           │     │      │
2433 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2434
2435                                  Custom Tables
2436 ╭────────────────────────────────────────────────────────────┬────────────────╮
2437 │                                                            │   QNS3A S3a.   │
2438 │                                                            │     GENDER:    │
2439 │                                                            ├───────┬────────┤
2440 │                                                            │  Male │ Female │
2441 │                                                            ├───────┼────────┤
2442 │                                                            │ Count │  Count │
2443 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2444 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2445 │primary ethnic background?               Mexican            │    175│     136│
2446 │                                         Spanish            │     20│      28│
2447 │                                         South American     │     21│      13│
2448 │                                         Central American   │     27│      25│
2449 │                                         Puerto Rican, OR   │     37│      41│
2450 │                                         Something else     │     35│      33│
2451 │                                         Multiple - cannot  │      2│       5│
2452 │                                         choose one         │       │        │
2453 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2454
2455                Custom Tables
2456 ╭────────────────────────────┬─────┬──────╮
2457 │                            │ Male│Female│
2458 │                            ├─────┼──────┤
2459 │                            │Count│ Count│
2460 ├────────────────────────────┼─────┼──────┤
2461 │Cuban                       │   13│     7│
2462 │Mexican                     │  175│   136│
2463 │Spanish                     │   20│    28│
2464 │South American              │   21│    13│
2465 │Central American            │   27│    25│
2466 │Puerto Rican, OR            │   37│    41│
2467 │Something else              │   35│    33│
2468 │Multiple - cannot choose one│    2│     5│
2469 ╰────────────────────────────┴─────┴──────╯
2470 ])
2471 AT_CLEANUP
2472
2473 AT_SETUP([CTABLES VLABELS - stacked variables])
2474 AT_KEYWORDS([stack stacking])
2475 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2476 AT_DATA([ctables.sps],
2477 [[GET 'nhtsa.sav'.
2478 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2479 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2480 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2481 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2482 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2483 ]])
2484 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2485                                  Custom Tables
2486 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2487 │                                                                       │Count│
2488 ├───────────────────────────────────────────────────────────────────────┼─────┤
2489 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2490 │background?                                     Mexican                │  311│
2491 │                                                Spanish                │   48│
2492 │                                                South American         │   34│
2493 │                                                Central American       │   52│
2494 │                                                Puerto Rican, OR       │   78│
2495 │                                                Something else         │   68│
2496 │                                                Multiple - cannot      │    7│
2497 │                                                choose one             │     │
2498 ├───────────────────────────────────────────────────────────────────────┼─────┤
2499 │QNS3A                                           Male                   │ 3132│
2500 │                                                Female                 │ 3867│
2501 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2502
2503                   Custom Tables
2504 ╭─────────────────────────────────────────┬─────╮
2505 │                                         │Count│
2506 ├─────────────────────────────────────────┼─────┤
2507 │QND5A        Cuban                       │   20│
2508 │             Mexican                     │  311│
2509 │             Spanish                     │   48│
2510 │             South American              │   34│
2511 │             Central American            │   52│
2512 │             Puerto Rican, OR            │   78│
2513 │             Something else              │   68│
2514 │             Multiple - cannot choose one│    7│
2515 ├─────────────────────────────────────────┼─────┤
2516 │S3a. GENDER: Male                        │ 3132│
2517 │             Female                      │ 3867│
2518 ╰─────────────────────────────────────────┴─────╯
2519
2520                                  Custom Tables
2521 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2522 │                                                                       │Count│
2523 ├───────────────────────────────────────────────────────────────────────┼─────┤
2524 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2525 │background?                                     Mexican                │  311│
2526 │                                                Spanish                │   48│
2527 │                                                South American         │   34│
2528 │                                                Central American       │   52│
2529 │                                                Puerto Rican, OR       │   78│
2530 │                                                Something else         │   68│
2531 │                                                Multiple - cannot      │    7│
2532 │                                                choose one             │     │
2533 ├───────────────────────────────────────────────────────────────────────┼─────┤
2534 │Male                                                                   │ 3132│
2535 ├───────────────────────────────────────────────────────────────────────┼─────┤
2536 │Female                                                                 │ 3867│
2537 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2538
2539             Custom Tables
2540 ╭─────────────────────────────┬─────╮
2541 │                             │Count│
2542 ├─────────────────────────────┼─────┤
2543 │Cuban                        │   20│
2544 ├─────────────────────────────┼─────┤
2545 │Mexican                      │  311│
2546 ├─────────────────────────────┼─────┤
2547 │Spanish                      │   48│
2548 ├─────────────────────────────┼─────┤
2549 │South American               │   34│
2550 ├─────────────────────────────┼─────┤
2551 │Central American             │   52│
2552 ├─────────────────────────────┼─────┤
2553 │Puerto Rican, OR             │   78│
2554 ├─────────────────────────────┼─────┤
2555 │Something else               │   68│
2556 ├─────────────────────────────┼─────┤
2557 │Multiple - cannot choose one │    7│
2558 ├─────────────────────────────┼─────┤
2559 │S3a. GENDER:     Male        │ 3132│
2560 │                 Female      │ 3867│
2561 ╰─────────────────────────────┴─────╯
2562
2563             Custom Tables
2564 ╭────────────────────────────┬─────╮
2565 │                            │Count│
2566 ├────────────────────────────┼─────┤
2567 │Cuban                       │   20│
2568 │Mexican                     │  311│
2569 │Spanish                     │   48│
2570 │South American              │   34│
2571 │Central American            │   52│
2572 │Puerto Rican, OR            │   78│
2573 │Something else              │   68│
2574 │Multiple - cannot choose one│    7│
2575 │Male                        │ 3132│
2576 │Female                      │ 3867│
2577 ╰────────────────────────────┴─────╯
2578 ])
2579 AT_CLEANUP
2580
2581 AT_SETUP([CTABLES VLABELS - nested variables])
2582 AT_KEYWORDS([nest nesting])
2583 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2584 AT_DATA([ctables.sps],
2585 [[GET 'nhtsa.sav'.
2586 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2587 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2588 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2589 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2590 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2591 ]])
2592 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2593                                  Custom Tables
2594 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2595 │                                                                       │Count│
2596 ├───────────────────────────────────────────────────────────────────────┼─────┤
2597 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2598 │primary ethnic background?                                       Female│    7│
2599 │                                     ╶─────────────────────────────────┼─────┤
2600 │                                      Mexican              QNS3A Male  │  175│
2601 │                                                                 Female│  136│
2602 │                                     ╶─────────────────────────────────┼─────┤
2603 │                                      Spanish              QNS3A Male  │   20│
2604 │                                                                 Female│   28│
2605 │                                     ╶─────────────────────────────────┼─────┤
2606 │                                      South American       QNS3A Male  │   21│
2607 │                                                                 Female│   13│
2608 │                                     ╶─────────────────────────────────┼─────┤
2609 │                                      Central American     QNS3A Male  │   27│
2610 │                                                                 Female│   25│
2611 │                                     ╶─────────────────────────────────┼─────┤
2612 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2613 │                                                                 Female│   41│
2614 │                                     ╶─────────────────────────────────┼─────┤
2615 │                                      Something else       QNS3A Male  │   35│
2616 │                                                                 Female│   33│
2617 │                                     ╶─────────────────────────────────┼─────┤
2618 │                                      Multiple - cannot    QNS3A Male  │    2│
2619 │                                      choose one                 Female│    5│
2620 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2621
2622                          Custom Tables
2623 ╭──────────────────────────────────────────────────────┬─────╮
2624 │                                                      │Count│
2625 ├──────────────────────────────────────────────────────┼─────┤
2626 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2627 │                                                Female│    7│
2628 │     ╶────────────────────────────────────────────────┼─────┤
2629 │      Mexican                      S3a. GENDER: Male  │  175│
2630 │                                                Female│  136│
2631 │     ╶────────────────────────────────────────────────┼─────┤
2632 │      Spanish                      S3a. GENDER: Male  │   20│
2633 │                                                Female│   28│
2634 │     ╶────────────────────────────────────────────────┼─────┤
2635 │      South American               S3a. GENDER: Male  │   21│
2636 │                                                Female│   13│
2637 │     ╶────────────────────────────────────────────────┼─────┤
2638 │      Central American             S3a. GENDER: Male  │   27│
2639 │                                                Female│   25│
2640 │     ╶────────────────────────────────────────────────┼─────┤
2641 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2642 │                                                Female│   41│
2643 │     ╶────────────────────────────────────────────────┼─────┤
2644 │      Something else               S3a. GENDER: Male  │   35│
2645 │                                                Female│   33│
2646 │     ╶────────────────────────────────────────────────┼─────┤
2647 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2648 │                                                Female│    5│
2649 ╰──────────────────────────────────────────────────────┴─────╯
2650
2651                                  Custom Tables
2652 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2653 │                                                                       │Count│
2654 ├───────────────────────────────────────────────────────────────────────┼─────┤
2655 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2656 │ethnic background?                                               Female│    7│
2657 │                                          ╶────────────────────────────┼─────┤
2658 │                                           Mexican               Male  │  175│
2659 │                                                                 Female│  136│
2660 │                                          ╶────────────────────────────┼─────┤
2661 │                                           Spanish               Male  │   20│
2662 │                                                                 Female│   28│
2663 │                                          ╶────────────────────────────┼─────┤
2664 │                                           South American        Male  │   21│
2665 │                                                                 Female│   13│
2666 │                                          ╶────────────────────────────┼─────┤
2667 │                                           Central American      Male  │   27│
2668 │                                                                 Female│   25│
2669 │                                          ╶────────────────────────────┼─────┤
2670 │                                           Puerto Rican, OR      Male  │   37│
2671 │                                                                 Female│   41│
2672 │                                          ╶────────────────────────────┼─────┤
2673 │                                           Something else        Male  │   35│
2674 │                                                                 Female│   33│
2675 │                                          ╶────────────────────────────┼─────┤
2676 │                                           Multiple - cannot     Male  │    2│
2677 │                                           choose one            Female│    5│
2678 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2679
2680                       Custom Tables
2681 ╭────────────────────────────────────────────────┬─────╮
2682 │                                                │Count│
2683 ├────────────────────────────────────────────────┼─────┤
2684 │Cuban                        S3a. GENDER: Male  │   13│
2685 │                                          Female│    7│
2686 ├────────────────────────────────────────────────┼─────┤
2687 │Mexican                      S3a. GENDER: Male  │  175│
2688 │                                          Female│  136│
2689 ├────────────────────────────────────────────────┼─────┤
2690 │Spanish                      S3a. GENDER: Male  │   20│
2691 │                                          Female│   28│
2692 ├────────────────────────────────────────────────┼─────┤
2693 │South American               S3a. GENDER: Male  │   21│
2694 │                                          Female│   13│
2695 ├────────────────────────────────────────────────┼─────┤
2696 │Central American             S3a. GENDER: Male  │   27│
2697 │                                          Female│   25│
2698 ├────────────────────────────────────────────────┼─────┤
2699 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2700 │                                          Female│   41│
2701 ├────────────────────────────────────────────────┼─────┤
2702 │Something else               S3a. GENDER: Male  │   35│
2703 │                                          Female│   33│
2704 ├────────────────────────────────────────────────┼─────┤
2705 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2706 │                                          Female│    5│
2707 ╰────────────────────────────────────────────────┴─────╯
2708
2709                Custom Tables
2710 ╭───────────────────────────────────┬─────╮
2711 │                                   │Count│
2712 ├───────────────────────────────────┼─────┤
2713 │Cuban                        Male  │   13│
2714 │                             Female│    7│
2715 ├───────────────────────────────────┼─────┤
2716 │Mexican                      Male  │  175│
2717 │                             Female│  136│
2718 ├───────────────────────────────────┼─────┤
2719 │Spanish                      Male  │   20│
2720 │                             Female│   28│
2721 ├───────────────────────────────────┼─────┤
2722 │South American               Male  │   21│
2723 │                             Female│   13│
2724 ├───────────────────────────────────┼─────┤
2725 │Central American             Male  │   27│
2726 │                             Female│   25│
2727 ├───────────────────────────────────┼─────┤
2728 │Puerto Rican, OR             Male  │   37│
2729 │                             Female│   41│
2730 ├───────────────────────────────────┼─────┤
2731 │Something else               Male  │   35│
2732 │                             Female│   33│
2733 ├───────────────────────────────────┼─────┤
2734 │Multiple - cannot choose one Male  │    2│
2735 │                             Female│    5│
2736 ╰───────────────────────────────────┴─────╯
2737 ])
2738 AT_CLEANUP
2739
2740 AT_SETUP([CTABLES FORMAT EMPTY])
2741 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2742 AT_DATA([ctables.sps],
2743 [[GET 'nhtsa.sav'.
2744 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2745 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2746 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2747 ]])
2748 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2749                                  Custom Tables
2750 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2751 │                                             │   D5. ETHNICITY: Are you of   │
2752 │                                             │  Hispanic or Latino origin or │
2753 │                                             │            descent?           │
2754 │                                             ├───────────────┬───────────────┤
2755 │                                             │      Yes      │       No      │
2756 │                                             ├───────────────┼───────────────┤
2757 │                                             │     Count     │     Count     │
2758 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2759 │D5a. What would you say is   Cuban           │             20│              0│
2760 │your primary ethnic          Mexican         │            311│              0│
2761 │background?                  Spanish         │             48│              0│
2762 │                             South American  │             34│              0│
2763 │                             Central American│             52│              0│
2764 │                             Puerto Rican, OR│             78│              0│
2765 │                             Something else  │             68│              0│
2766 │                             Multiple -      │              7│              0│
2767 │                             cannot choose   │               │               │
2768 │                             one             │               │               │
2769 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2770
2771                                  Custom Tables
2772 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2773 │                                             │   D5. ETHNICITY: Are you of   │
2774 │                                             │  Hispanic or Latino origin or │
2775 │                                             │            descent?           │
2776 │                                             ├───────────────┬───────────────┤
2777 │                                             │      Yes      │       No      │
2778 │                                             ├───────────────┼───────────────┤
2779 │                                             │     Count     │     Count     │
2780 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2781 │D5a. What would you say is   Cuban           │             20│               │
2782 │your primary ethnic          Mexican         │            311│               │
2783 │background?                  Spanish         │             48│               │
2784 │                             South American  │             34│               │
2785 │                             Central American│             52│               │
2786 │                             Puerto Rican, OR│             78│               │
2787 │                             Something else  │             68│               │
2788 │                             Multiple -      │              7│               │
2789 │                             cannot choose   │               │               │
2790 │                             one             │               │               │
2791 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2792
2793                                  Custom Tables
2794 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2795 │                                             │   D5. ETHNICITY: Are you of   │
2796 │                                             │  Hispanic or Latino origin or │
2797 │                                             │            descent?           │
2798 │                                             ├───────────────┬───────────────┤
2799 │                                             │      Yes      │       No      │
2800 │                                             ├───────────────┼───────────────┤
2801 │                                             │     Count     │     Count     │
2802 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2803 │D5a. What would you say is   Cuban           │             20│n/a            │
2804 │your primary ethnic          Mexican         │            311│n/a            │
2805 │background?                  Spanish         │             48│n/a            │
2806 │                             South American  │             34│n/a            │
2807 │                             Central American│             52│n/a            │
2808 │                             Puerto Rican, OR│             78│n/a            │
2809 │                             Something else  │             68│n/a            │
2810 │                             Multiple -      │              7│n/a            │
2811 │                             cannot choose   │               │               │
2812 │                             one             │               │               │
2813 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2814 ])
2815 AT_CLEANUP
2816
2817 AT_SETUP([CTABLES FORMAT MISSING])
2818 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2819 AT_DATA([ctables.sps],
2820 [[GET 'nhtsa.sav'.
2821 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2822 ]])
2823 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2824                                  Custom Tables
2825 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2826 │                                             │   D5. ETHNICITY: Are you of   │
2827 │                                             │  Hispanic or Latino origin or │
2828 │                                             │            descent?           │
2829 │                                             ├───────────────┬───────────────┤
2830 │                                             │      Yes      │       No      │
2831 │                                             ├───────────────┼───────────────┤
2832 │                                             │    Column %   │    Column %   │
2833 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2834 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2835 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2836 │background?                  Spanish         │           7.8%│(no data)      │
2837 │                             South American  │           5.5%│(no data)      │
2838 │                             Central American│           8.4%│(no data)      │
2839 │                             Puerto Rican, OR│          12.6%│(no data)      │
2840 │                             Something else  │          11.0%│(no data)      │
2841 │                             Multiple -      │           1.1%│(no data)      │
2842 │                             cannot choose   │               │               │
2843 │                             one             │               │               │
2844 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2845 ])
2846 AT_CLEANUP
2847
2848 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2849 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2850 AT_DATA([ctables.sps],
2851 [[GET 'nhtsa.sav'.
2852 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2853 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2854 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2855 ]])
2856 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2857                                  Custom Tables
2858 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2859 │                                                              │Count│Column %│
2860 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2861 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2862 │occasion?                                        1            │  491│   34.9%│
2863 │                                                 2            │  462│   32.9%│
2864 │                                                 3            │  229│   16.3%│
2865 │                                                 4            │   82│    5.8%│
2866 │                                                 5            │   56│    4.0%│
2867 │                                                 6            │   32│    2.3%│
2868 │                                                 7            │    9│     .6%│
2869 │                                                 8            │    8│     .6%│
2870 │                                                 9            │    4│     .3%│
2871 │                                                 10           │    6│     .4%│
2872 │                                                 11           │    2│     .1%│
2873 │                                                 12           │    5│     .4%│
2874 │                                                 14           │    1│     .1%│
2875 │                                                 15           │    1│     .1%│
2876 │                                                 18           │    1│     .1%│
2877 │                                                 20           │    4│     .3%│
2878 │                                                 25           │    1│     .1%│
2879 │                                                 30           │    3│     .2%│
2880 │                                                 60           │    1│     .1%│
2881 │                                                 99+          │    0│     .0%│
2882 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2883
2884                                  Custom Tables
2885 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2886 │                                                              │Count│Column %│
2887 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2888 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2889 │occasion?                                        1            │  491│   34.9%│
2890 │                                                 2            │  462│   32.9%│
2891 │                                                 3            │  229│   16.3%│
2892 │                                                 4            │   82│    5.8%│
2893 │                                                 5            │   56│    4.0%│
2894 │                                                 6            │   32│    2.3%│
2895 │                                                 7            │    9│     .6%│
2896 │                                                 8            │    8│     .6%│
2897 │                                                 9            │<5   │     .3%│
2898 │                                                 10           │    6│     .4%│
2899 │                                                 11           │<5   │     .1%│
2900 │                                                 12           │    5│     .4%│
2901 │                                                 14           │<5   │     .1%│
2902 │                                                 15           │<5   │     .1%│
2903 │                                                 18           │<5   │     .1%│
2904 │                                                 20           │<5   │     .3%│
2905 │                                                 25           │<5   │     .1%│
2906 │                                                 30           │<5   │     .2%│
2907 │                                                 60           │<5   │     .1%│
2908 │                                                 99+          │<5   │     .0%│
2909 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2910
2911                                  Custom Tables
2912 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2913 │                                                              │Count│Column %│
2914 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2915 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2916 │occasion?                                        1            │  491│   34.9%│
2917 │                                                 2            │  462│   32.9%│
2918 │                                                 3            │  229│   16.3%│
2919 │                                                 4            │   82│    5.8%│
2920 │                                                 5            │   56│    4.0%│
2921 │                                                 6            │   32│    2.3%│
2922 │                                                 7            │<10  │     .6%│
2923 │                                                 8            │<10  │     .6%│
2924 │                                                 9            │<10  │     .3%│
2925 │                                                 10           │<10  │     .4%│
2926 │                                                 11           │<10  │     .1%│
2927 │                                                 12           │<10  │     .4%│
2928 │                                                 14           │<10  │     .1%│
2929 │                                                 15           │<10  │     .1%│
2930 │                                                 18           │<10  │     .1%│
2931 │                                                 20           │<10  │     .3%│
2932 │                                                 25           │<10  │     .1%│
2933 │                                                 30           │<10  │     .2%│
2934 │                                                 60           │<10  │     .1%│
2935 │                                                 99+          │<10  │     .0%│
2936 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2937 ])
2938 AT_CLEANUP
2939
2940 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2941 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2942 AT_DATA([ctables.sps],
2943 [[GET 'nhtsa.sav'.
2944 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2945 ]])
2946 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2947  Custom Tables
2948 ╭────────────╮
2949 │S3a. GENDER:│
2950 ├─────┬──────┤
2951 │ Male│Female│
2952 ├─────┼──────┤
2953 │Count│ Count│
2954 ├─────┼──────┤
2955 │ 3132│  3867│
2956 ╰─────┴──────╯
2957 ])
2958 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2959 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2960 maximumColumnWidth="192"
2961 minimumColumnWidth="96"
2962 ])
2963 AT_CLEANUP
2964
2965 AT_SETUP([CTABLES special formats])
2966 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2967 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2968 AT_DATA([ctables.sps],
2969 [[GET 'nhtsa.sav'.
2970 COMPUTE x = qnd3 - 4.
2971 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].
2972 ]])
2973 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2974                            Custom Tables
2975 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2976 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2977 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2978 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
2979 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2980 ])
2981 AT_CLEANUP
2982
2983 AT_SETUP([CTABLES TITLES])
2984 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2985 AT_DATA([ctables.sps],
2986 [[GET 'nhtsa.sav'.
2987 CTABLES
2988     /VLABELS VARIABLES=qn1 DISPLAY=NONE
2989     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
2990     /TITLES TITLE='How often do you drive?'
2991             CAPTION='Generated )TIME on )DATE'
2992             CORNER=')TABLE'.
2993 ]])
2994 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
2995 s&../../..&MM/DD/YY&'], [0], [dnl
2996                             How often do you drive?
2997 ╭───────────────────────────────────┬─────────────────────────────────────────╮
2998 │                                   │               S3a. GENDER:              │
2999 │                                   ├────────────────────┬────────────────────┤
3000 │                                   │        Male        │       Female       │
3001 │                                   ├────────────────────┼────────────────────┤
3002 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3003 │                                   │ you of Hispanic or │ you of Hispanic or │
3004 │                                   │  Latino origin or  │  Latino origin or  │
3005 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3006 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3007 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3008 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3009 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3010 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3011 │Every day                          │      218│      2066│      166│      2175│
3012 │Several days a week                │       44│       391│       45│       782│
3013 │Once a week or less                │       16│       109│       12│       223│
3014 │Only certain times a year          │       15│        41│       11│        61│
3015 │Never                              │       39│       150│       56│       278│
3016 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3017 Generated HH:MM:SS on MM/DD/YY
3018 ])
3019 AT_CLEANUP
3020
3021 AT_SETUP([CTABLES area definitions])
3022 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3023 AT_DATA([ctables.sps],
3024 [[GET 'nhtsa.sav'.
3025 CTABLES
3026     /VLABELS VARIABLES=ALL DISPLAY=NAME
3027     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3028     /SLABELS POSITION=ROW
3029     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3030     /SLABELS POSITION=ROW
3031     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3032     /SLABELS POSITION=ROW.
3033 ]])
3034 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3035                     Custom Tables
3036 Male
3037 ╭─────────────────────────────┬─────────────┬──────╮
3038 │                             │    QND7A    │ QN64B│
3039 │                             ├──────┬──────┼───┬──┤
3040 │                             │  Yes │  No  │   │  │
3041 │                             ├──────┼──────┤   │  │
3042 │                             │ QN86 │ QN86 │   │  │
3043 │                             ├───┬──┼───┬──┤   │  │
3044 │                             │Yes│No│Yes│No│Yes│No│
3045 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3046 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3047 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3048 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3049 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3050 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3051 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3052 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3053 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3054 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3055 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3056 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3057 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3058 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3059 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3060 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3061 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3062
3063                     Custom Tables
3064 Female
3065 ╭─────────────────────────────┬─────────────┬──────╮
3066 │                             │    QND7A    │ QN64B│
3067 │                             ├──────┬──────┼───┬──┤
3068 │                             │  Yes │  No  │   │  │
3069 │                             ├──────┼──────┤   │  │
3070 │                             │ QN86 │ QN86 │   │  │
3071 │                             ├───┬──┼───┬──┤   │  │
3072 │                             │Yes│No│Yes│No│Yes│No│
3073 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3074 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3075 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3076 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3077 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3078 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3079 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3080 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3081 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3082 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3083 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3084 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3085 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3086 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3087 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3088 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3089 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3090
3091                     Custom Tables
3092 Male
3093 ╭──────────────────────────────┬─────────────┬──────╮
3094 │                              │    QND7A    │ QN64B│
3095 │                              ├──────┬──────┼───┬──┤
3096 │                              │  Yes │  No  │   │  │
3097 │                              ├──────┼──────┤   │  │
3098 │                              │ QN86 │ QN86 │   │  │
3099 │                              ├───┬──┼───┬──┤   │  │
3100 │                              │Yes│No│Yes│No│Yes│No│
3101 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3102 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3103 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3104 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3105 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3106 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3107 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3108 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3109 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3110 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3111 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3112 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3113 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3114
3115                     Custom Tables
3116 Female
3117 ╭──────────────────────────────┬─────────────┬──────╮
3118 │                              │    QND7A    │ QN64B│
3119 │                              ├──────┬──────┼───┬──┤
3120 │                              │  Yes │  No  │   │  │
3121 │                              ├──────┼──────┤   │  │
3122 │                              │ QN86 │ QN86 │   │  │
3123 │                              ├───┬──┼───┬──┤   │  │
3124 │                              │Yes│No│Yes│No│Yes│No│
3125 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3126 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3127 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3128 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3129 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3130 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3131 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3132 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3133 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3134 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3135 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3136 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3137 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3138
3139                       Custom Tables
3140 Male
3141 ╭─────────────────────────────────┬─────────────┬──────╮
3142 │                                 │    QND7A    │ QN64B│
3143 │                                 ├──────┬──────┼───┬──┤
3144 │                                 │  Yes │  No  │   │  │
3145 │                                 ├──────┼──────┤   │  │
3146 │                                 │ QN86 │ QN86 │   │  │
3147 │                                 ├───┬──┼───┬──┤   │  │
3148 │                                 │Yes│No│Yes│No│Yes│No│
3149 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3150 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3151 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3152 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3153 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3154 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3155 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3156 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3157 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3158 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3159 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3160 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3161 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3162
3163                       Custom Tables
3164 Female
3165 ╭─────────────────────────────────┬─────────────┬──────╮
3166 │                                 │    QND7A    │ QN64B│
3167 │                                 ├──────┬──────┼───┬──┤
3168 │                                 │  Yes │  No  │   │  │
3169 │                                 ├──────┼──────┤   │  │
3170 │                                 │ QN86 │ QN86 │   │  │
3171 │                                 ├───┬──┼───┬──┤   │  │
3172 │                                 │Yes│No│Yes│No│Yes│No│
3173 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3174 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3175 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3176 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3177 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3178 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3179 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3180 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3181 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3182 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3183 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3184 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3185 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3186 ])
3187 AT_CLEANUP
3188
3189 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3190 AT_KEYWORDS([ROWLABELS OPPOSITE])
3191 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3192 AT_DATA([ctables.sps],
3193 [[GET 'nhtsa.sav'.
3194 CTABLES
3195     /VLABELS VARIABLES=ALL DISPLAY=NAME
3196     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3197     /SLABELS POSITION=ROW
3198     /CLABELS ROWLABELS=OPPOSITE
3199     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3200     /SLABELS POSITION=ROW
3201     /CLABELS ROWLABELS=OPPOSITE
3202     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3203     /SLABELS POSITION=ROW
3204     /CLABELS ROWLABELS=OPPOSITE.
3205 ]])
3206 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3207                                         Custom Tables
3208 Male
3209 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3210 │                                  │                          QN27                         │
3211 │                                  ├───────────────────────────┬───────────────────────────┤
3212 │                                  │            Yes            │             No            │
3213 │                                  ├───────────────────────────┼───────────────────────────┤
3214 │                                  │           QND7A           │           QND7A           │
3215 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3216 │                                  │     Yes     │      No     │     Yes     │      No     │
3217 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3218 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3219 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3220 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3221 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3222 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3223 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3224 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3225 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3226 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3227 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3228 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3229 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3230 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3231 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3232 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3233 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3234 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3235 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3236 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3237 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3238 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3239 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3240
3241                                         Custom Tables
3242 Female
3243 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3244 │                                  │                          QN27                         │
3245 │                                  ├───────────────────────────┬───────────────────────────┤
3246 │                                  │            Yes            │             No            │
3247 │                                  ├───────────────────────────┼───────────────────────────┤
3248 │                                  │           QND7A           │           QND7A           │
3249 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3250 │                                  │     Yes     │      No     │     Yes     │      No     │
3251 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3252 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3253 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3254 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3255 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3256 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3257 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3258 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3259 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3260 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3261 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3262 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3263 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3264 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3265 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3266 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3267 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3268 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3269 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3270 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3271 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3272 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3273 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3274
3275                                         Custom Tables
3276 Male
3277 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3278 │                                   │                          QN27                         │
3279 │                                   ├───────────────────────────┬───────────────────────────┤
3280 │                                   │            Yes            │             No            │
3281 │                                   ├───────────────────────────┼───────────────────────────┤
3282 │                                   │           QND7A           │           QND7A           │
3283 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3284 │                                   │     Yes     │      No     │     Yes     │      No     │
3285 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3286 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3287 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3288 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3289 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3290 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3291 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3292 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3293 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3294 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3295 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3296 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3297 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3298 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3299 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3300 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3301 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3302 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3303 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3304
3305                                         Custom Tables
3306 Female
3307 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3308 │                                   │                          QN27                         │
3309 │                                   ├───────────────────────────┬───────────────────────────┤
3310 │                                   │            Yes            │             No            │
3311 │                                   ├───────────────────────────┼───────────────────────────┤
3312 │                                   │           QND7A           │           QND7A           │
3313 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3314 │                                   │     Yes     │      No     │     Yes     │      No     │
3315 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3316 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3317 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3318 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3319 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3320 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3321 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3322 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3323 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3324 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3325 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3326 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3327 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3328 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3329 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3330 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3331 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3332 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3333 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3334
3335                                           Custom Tables
3336 Male
3337 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3338 │                                      │                          QN27                         │
3339 │                                      ├───────────────────────────┬───────────────────────────┤
3340 │                                      │            Yes            │             No            │
3341 │                                      ├───────────────────────────┼───────────────────────────┤
3342 │                                      │           QND7A           │           QND7A           │
3343 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3344 │                                      │     Yes     │      No     │     Yes     │      No     │
3345 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3346 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3347 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3348 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3349 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3350 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3351 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3352 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3353 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3354 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3355 │              No  QN57 Column ID      │  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3356 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3357 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3358 │     No  QN61 Yes QN57 Column ID      │ 18│17│ 19│20│ 22│21│ 23│24│ 25│26│ 27│28│ 29│30│ 32│31│
3359 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3360 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3361 │              No  QN57 Column ID      │ 18│17│ 19│20│ 22│21│ 23│24│ 25│26│ 27│28│ 29│30│ 32│31│
3362 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3363 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3364
3365                                           Custom Tables
3366 Female
3367 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3368 │                                      │                          QN27                         │
3369 │                                      ├───────────────────────────┬───────────────────────────┤
3370 │                                      │            Yes            │             No            │
3371 │                                      ├───────────────────────────┼───────────────────────────┤
3372 │                                      │           QND7A           │           QND7A           │
3373 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3374 │                                      │     Yes     │      No     │     Yes     │      No     │
3375 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3376 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3377 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3378 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3379 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3380 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3381 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3382 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│34│ 36│35│ 37│38│ 39│40│ 42│41│ 44│43│ 45│46│ 47│48│
3383 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3384 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3385 │              No  QN57 Column ID      │ 33│34│ 36│35│ 37│38│ 39│40│ 42│41│ 44│43│ 45│46│ 47│48│
3386 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3387 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3388 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 54│53│ 56│55│ 57│58│ 60│59│ 62│61│ 64│63│
3389 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3390 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3391 │              No  QN57 Column ID      │ 49│50│ 51│52│ 54│53│ 56│55│ 57│58│ 60│59│ 62│61│ 64│63│
3392 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3393 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3394 ])
3395 AT_CLEANUP
3396
3397 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3398 AT_KEYWORDS([COLLABELS OPPOSITE])
3399 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3400 AT_DATA([ctables.sps],
3401 [[GET 'nhtsa.sav'.
3402 CTABLES
3403     /VLABELS VARIABLES=ALL DISPLAY=NAME
3404     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3405     /SLABELS POSITION=ROW
3406     /CLABELS COLLABELS=OPPOSITE
3407     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3408     /SLABELS POSITION=ROW
3409     /CLABELS COLLABELS=OPPOSITE
3410     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3411     /SLABELS POSITION=ROW
3412     /CLABELS COLLABELS=OPPOSITE.
3413 ]])
3414 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3415                           Custom Tables
3416 Male
3417 ╭──────────────────────────────────────────┬───────────────────╮
3418 │                                          │        QN27       │
3419 │                                          ├─────────┬─────────┤
3420 │                                          │   Yes   │    No   │
3421 │                                          ├─────────┼─────────┤
3422 │                                          │  QND7A  │  QND7A  │
3423 │                                          ├────┬────┼────┬────┤
3424 │                                          │ Yes│ No │ Yes│ No │
3425 │                                          ├────┼────┼────┼────┤
3426 │                                          │QN86│QN86│QN86│QN86│
3427 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3428 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3429 │                               Layer ID   │   1│   1│   1│   1│
3430 │                               Subtable ID│   1│   1│   2│   2│
3431 │                          ╶───────────────┼────┼────┼────┼────┤
3432 │                           No  Table ID   │   1│   1│   1│   1│
3433 │                               Layer ID   │   1│   1│   1│   1│
3434 │                               Subtable ID│   1│   1│   2│   2│
3435 │                      ╶───────────────────┼────┼────┼────┼────┤
3436 │                       No  Yes Table ID   │   1│   1│   1│   1│
3437 │                               Layer ID   │   1│   1│   1│   1│
3438 │                               Subtable ID│   3│   3│   4│   4│
3439 │                          ╶───────────────┼────┼────┼────┼────┤
3440 │                           No  Table ID   │   1│   1│   1│   1│
3441 │                               Layer ID   │   1│   1│   1│   1│
3442 │                               Subtable ID│   3│   3│   4│   4│
3443 │             ╶────────────────────────────┼────┼────┼────┼────┤
3444 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3445 │                               Layer ID   │   1│   1│   1│   1│
3446 │                               Subtable ID│   5│   5│   6│   6│
3447 │                          ╶───────────────┼────┼────┼────┼────┤
3448 │                           No  Table ID   │   1│   1│   1│   1│
3449 │                               Layer ID   │   1│   1│   1│   1│
3450 │                               Subtable ID│   5│   5│   6│   6│
3451 │                      ╶───────────────────┼────┼────┼────┼────┤
3452 │                       No  Yes Table ID   │   1│   1│   1│   1│
3453 │                               Layer ID   │   1│   1│   1│   1│
3454 │                               Subtable ID│   7│   7│   8│   8│
3455 │                          ╶───────────────┼────┼────┼────┼────┤
3456 │                           No  Table ID   │   1│   1│   1│   1│
3457 │                               Layer ID   │   1│   1│   1│   1│
3458 │                               Subtable ID│   7│   7│   8│   8│
3459 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3460 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3461 │                               Layer ID   │   1│   1│   1│   1│
3462 │                               Subtable ID│   9│   9│  10│  10│
3463 │                          ╶───────────────┼────┼────┼────┼────┤
3464 │                           No  Table ID   │   1│   1│   1│   1│
3465 │                               Layer ID   │   1│   1│   1│   1│
3466 │                               Subtable ID│   9│   9│  10│  10│
3467 │                      ╶───────────────────┼────┼────┼────┼────┤
3468 │                       No  Yes Table ID   │   1│   1│   1│   1│
3469 │                               Layer ID   │   1│   1│   1│   1│
3470 │                               Subtable ID│  11│  11│  12│  12│
3471 │                          ╶───────────────┼────┼────┼────┼────┤
3472 │                           No  Table ID   │   1│   1│   1│   1│
3473 │                               Layer ID   │   1│   1│   1│   1│
3474 │                               Subtable ID│  11│  11│  12│  12│
3475 │             ╶────────────────────────────┼────┼────┼────┼────┤
3476 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3477 │                               Layer ID   │   1│   1│   1│   1│
3478 │                               Subtable ID│  13│  13│  14│  14│
3479 │                          ╶───────────────┼────┼────┼────┼────┤
3480 │                           No  Table ID   │   1│   1│   1│   1│
3481 │                               Layer ID   │   1│   1│   1│   1│
3482 │                               Subtable ID│  13│  13│  14│  14│
3483 │                      ╶───────────────────┼────┼────┼────┼────┤
3484 │                       No  Yes Table ID   │   1│   1│   1│   1│
3485 │                               Layer ID   │   1│   1│   1│   1│
3486 │                               Subtable ID│  15│  15│  16│  16│
3487 │                          ╶───────────────┼────┼────┼────┼────┤
3488 │                           No  Table ID   │   1│   1│   1│   1│
3489 │                               Layer ID   │   1│   1│   1│   1│
3490 │                               Subtable ID│  15│  15│  16│  16│
3491 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3492
3493                           Custom Tables
3494 Female
3495 ╭──────────────────────────────────────────┬───────────────────╮
3496 │                                          │        QN27       │
3497 │                                          ├─────────┬─────────┤
3498 │                                          │   Yes   │    No   │
3499 │                                          ├─────────┼─────────┤
3500 │                                          │  QND7A  │  QND7A  │
3501 │                                          ├────┬────┼────┬────┤
3502 │                                          │ Yes│ No │ Yes│ No │
3503 │                                          ├────┼────┼────┼────┤
3504 │                                          │QN86│QN86│QN86│QN86│
3505 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3506 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3507 │                               Layer ID   │   2│   2│   2│   2│
3508 │                               Subtable ID│  17│  17│  18│  18│
3509 │                          ╶───────────────┼────┼────┼────┼────┤
3510 │                           No  Table ID   │   1│   1│   1│   1│
3511 │                               Layer ID   │   2│   2│   2│   2│
3512 │                               Subtable ID│  17│  17│  18│  18│
3513 │                      ╶───────────────────┼────┼────┼────┼────┤
3514 │                       No  Yes Table ID   │   1│   1│   1│   1│
3515 │                               Layer ID   │   2│   2│   2│   2│
3516 │                               Subtable ID│  19│  19│  20│  20│
3517 │                          ╶───────────────┼────┼────┼────┼────┤
3518 │                           No  Table ID   │   1│   1│   1│   1│
3519 │                               Layer ID   │   2│   2│   2│   2│
3520 │                               Subtable ID│  19│  19│  20│  20│
3521 │             ╶────────────────────────────┼────┼────┼────┼────┤
3522 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3523 │                               Layer ID   │   2│   2│   2│   2│
3524 │                               Subtable ID│  21│  21│  22│  22│
3525 │                          ╶───────────────┼────┼────┼────┼────┤
3526 │                           No  Table ID   │   1│   1│   1│   1│
3527 │                               Layer ID   │   2│   2│   2│   2│
3528 │                               Subtable ID│  21│  21│  22│  22│
3529 │                      ╶───────────────────┼────┼────┼────┼────┤
3530 │                       No  Yes Table ID   │   1│   1│   1│   1│
3531 │                               Layer ID   │   2│   2│   2│   2│
3532 │                               Subtable ID│  23│  23│  24│  24│
3533 │                          ╶───────────────┼────┼────┼────┼────┤
3534 │                           No  Table ID   │   1│   1│   1│   1│
3535 │                               Layer ID   │   2│   2│   2│   2│
3536 │                               Subtable ID│  23│  23│  24│  24│
3537 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3538 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3539 │                               Layer ID   │   2│   2│   2│   2│
3540 │                               Subtable ID│  25│  25│  26│  26│
3541 │                          ╶───────────────┼────┼────┼────┼────┤
3542 │                           No  Table ID   │   1│   1│   1│   1│
3543 │                               Layer ID   │   2│   2│   2│   2│
3544 │                               Subtable ID│  25│  25│  26│  26│
3545 │                      ╶───────────────────┼────┼────┼────┼────┤
3546 │                       No  Yes Table ID   │   1│   1│   1│   1│
3547 │                               Layer ID   │   2│   2│   2│   2│
3548 │                               Subtable ID│  27│  27│  28│  28│
3549 │                          ╶───────────────┼────┼────┼────┼────┤
3550 │                           No  Table ID   │   1│   1│   1│   1│
3551 │                               Layer ID   │   2│   2│   2│   2│
3552 │                               Subtable ID│  27│  27│  28│  28│
3553 │             ╶────────────────────────────┼────┼────┼────┼────┤
3554 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3555 │                               Layer ID   │   2│   2│   2│   2│
3556 │                               Subtable ID│  29│  29│  30│  30│
3557 │                          ╶───────────────┼────┼────┼────┼────┤
3558 │                           No  Table ID   │   1│   1│   1│   1│
3559 │                               Layer ID   │   2│   2│   2│   2│
3560 │                               Subtable ID│  29│  29│  30│  30│
3561 │                      ╶───────────────────┼────┼────┼────┼────┤
3562 │                       No  Yes Table ID   │   1│   1│   1│   1│
3563 │                               Layer ID   │   2│   2│   2│   2│
3564 │                               Subtable ID│  31│  31│  32│  32│
3565 │                          ╶───────────────┼────┼────┼────┼────┤
3566 │                           No  Table ID   │   1│   1│   1│   1│
3567 │                               Layer ID   │   2│   2│   2│   2│
3568 │                               Subtable ID│  31│  31│  32│  32│
3569 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3570
3571                           Custom Tables
3572 Male
3573 ╭───────────────────────────────────────────┬───────────────────╮
3574 │                                           │        QN27       │
3575 │                                           ├─────────┬─────────┤
3576 │                                           │   Yes   │    No   │
3577 │                                           ├─────────┼─────────┤
3578 │                                           │  QND7A  │  QND7A  │
3579 │                                           ├────┬────┼────┬────┤
3580 │                                           │ Yes│ No │ Yes│ No │
3581 │                                           ├────┼────┼────┼────┤
3582 │                                           │QN86│QN86│QN86│QN86│
3583 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3584 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   1│   1│   3│   3│
3585 │                               Layer Row ID│   1│   1│   1│   1│
3586 │                          ╶────────────────┼────┼────┼────┼────┤
3587 │                           No  Row ID      │   2│   2│   4│   4│
3588 │                               Layer Row ID│   2│   2│   2│   2│
3589 │                      ╶────────────────────┼────┼────┼────┼────┤
3590 │                       No  Yes Row ID      │   6│   6│   7│   7│
3591 │                               Layer Row ID│   4│   4│   4│   4│
3592 │                          ╶────────────────┼────┼────┼────┼────┤
3593 │                           No  Row ID      │   5│   5│   8│   8│
3594 │                               Layer Row ID│   3│   3│   3│   3│
3595 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3596 │              No  QN57 Yes Yes Row ID      │  10│  10│  11│  11│
3597 │                               Layer Row ID│   6│   6│   6│   6│
3598 │                          ╶────────────────┼────┼────┼────┼────┤
3599 │                           No  Row ID      │   9│   9│  12│  12│
3600 │                               Layer Row ID│   5│   5│   5│   5│
3601 │                      ╶────────────────────┼────┼────┼────┼────┤
3602 │                       No  Yes Row ID      │  13│  13│  15│  15│
3603 │                               Layer Row ID│   7│   7│   7│   7│
3604 │                          ╶────────────────┼────┼────┼────┼────┤
3605 │                           No  Row ID      │  14│  14│  16│  16│
3606 │                               Layer Row ID│   8│   8│   8│   8│
3607 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3608 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  20│  20│
3609 │                               Layer Row ID│   9│   9│   9│   9│
3610 │                          ╶────────────────┼────┼────┼────┼────┤
3611 │                           No  Row ID      │  18│  18│  19│  19│
3612 │                               Layer Row ID│  10│  10│  10│  10│
3613 │                      ╶────────────────────┼────┼────┼────┼────┤
3614 │                       No  Yes Row ID      │  21│  21│  24│  24│
3615 │                               Layer Row ID│  11│  11│  11│  11│
3616 │                          ╶────────────────┼────┼────┼────┼────┤
3617 │                           No  Row ID      │  22│  22│  23│  23│
3618 │                               Layer Row ID│  12│  12│  12│  12│
3619 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3620 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
3621 │                               Layer Row ID│  13│  13│  13│  13│
3622 │                          ╶────────────────┼────┼────┼────┼────┤
3623 │                           No  Row ID      │  26│  26│  28│  28│
3624 │                               Layer Row ID│  14│  14│  14│  14│
3625 │                      ╶────────────────────┼────┼────┼────┼────┤
3626 │                       No  Yes Row ID      │  30│  30│  32│  32│
3627 │                               Layer Row ID│  16│  16│  16│  16│
3628 │                          ╶────────────────┼────┼────┼────┼────┤
3629 │                           No  Row ID      │  29│  29│  31│  31│
3630 │                               Layer Row ID│  15│  15│  15│  15│
3631 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3632
3633                           Custom Tables
3634 Female
3635 ╭───────────────────────────────────────────┬───────────────────╮
3636 │                                           │        QN27       │
3637 │                                           ├─────────┬─────────┤
3638 │                                           │   Yes   │    No   │
3639 │                                           ├─────────┼─────────┤
3640 │                                           │  QND7A  │  QND7A  │
3641 │                                           ├────┬────┼────┬────┤
3642 │                                           │ Yes│ No │ Yes│ No │
3643 │                                           ├────┼────┼────┼────┤
3644 │                                           │QN86│QN86│QN86│QN86│
3645 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3646 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  34│  34│  35│  35│
3647 │                               Layer Row ID│  18│  18│  18│  18│
3648 │                          ╶────────────────┼────┼────┼────┼────┤
3649 │                           No  Row ID      │  33│  33│  36│  36│
3650 │                               Layer Row ID│  17│  17│  17│  17│
3651 │                      ╶────────────────────┼────┼────┼────┼────┤
3652 │                       No  Yes Row ID      │  38│  38│  39│  39│
3653 │                               Layer Row ID│  20│  20│  20│  20│
3654 │                          ╶────────────────┼────┼────┼────┼────┤
3655 │                           No  Row ID      │  37│  37│  40│  40│
3656 │                               Layer Row ID│  19│  19│  19│  19│
3657 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3658 │              No  QN57 Yes Yes Row ID      │  42│  42│  43│  43│
3659 │                               Layer Row ID│  22│  22│  22│  22│
3660 │                          ╶────────────────┼────┼────┼────┼────┤
3661 │                           No  Row ID      │  41│  41│  44│  44│
3662 │                               Layer Row ID│  21│  21│  21│  21│
3663 │                      ╶────────────────────┼────┼────┼────┼────┤
3664 │                       No  Yes Row ID      │  45│  45│  47│  47│
3665 │                               Layer Row ID│  23│  23│  23│  23│
3666 │                          ╶────────────────┼────┼────┼────┼────┤
3667 │                           No  Row ID      │  46│  46│  48│  48│
3668 │                               Layer Row ID│  24│  24│  24│  24│
3669 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3670 │     No  QN61 Yes QN57 Yes Yes Row ID      │  50│  50│  51│  51│
3671 │                               Layer Row ID│  26│  26│  26│  26│
3672 │                          ╶────────────────┼────┼────┼────┼────┤
3673 │                           No  Row ID      │  49│  49│  52│  52│
3674 │                               Layer Row ID│  25│  25│  25│  25│
3675 │                      ╶────────────────────┼────┼────┼────┼────┤
3676 │                       No  Yes Row ID      │  53│  53│  55│  55│
3677 │                               Layer Row ID│  27│  27│  27│  27│
3678 │                          ╶────────────────┼────┼────┼────┼────┤
3679 │                           No  Row ID      │  54│  54│  56│  56│
3680 │                               Layer Row ID│  28│  28│  28│  28│
3681 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3682 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
3683 │                               Layer Row ID│  29│  29│  29│  29│
3684 │                          ╶────────────────┼────┼────┼────┼────┤
3685 │                           No  Row ID      │  58│  58│  60│  60│
3686 │                               Layer Row ID│  30│  30│  30│  30│
3687 │                      ╶────────────────────┼────┼────┼────┼────┤
3688 │                       No  Yes Row ID      │  62│  62│  64│  64│
3689 │                               Layer Row ID│  32│  32│  32│  32│
3690 │                          ╶────────────────┼────┼────┼────┼────┤
3691 │                           No  Row ID      │  61│  61│  63│  63│
3692 │                               Layer Row ID│  31│  31│  31│  31│
3693 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3694
3695                             Custom Tables
3696 Male
3697 ╭──────────────────────────────────────────────┬───────────────────╮
3698 │                                              │        QN27       │
3699 │                                              ├─────────┬─────────┤
3700 │                                              │   Yes   │    No   │
3701 │                                              ├─────────┼─────────┤
3702 │                                              │  QND7A  │  QND7A  │
3703 │                                              ├────┬────┼────┬────┤
3704 │                                              │ Yes│ No │ Yes│ No │
3705 │                                              ├────┼────┼────┼────┤
3706 │                                              │QN86│QN86│QN86│QN86│
3707 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3708 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
3709 │                               Layer Column ID│   1│   2│   3│   4│
3710 │                          ╶───────────────────┼────┼────┼────┼────┤
3711 │                           No  Column ID      │   1│   2│   3│   4│
3712 │                               Layer Column ID│   1│   2│   3│   4│
3713 │                      ╶───────────────────────┼────┼────┼────┼────┤
3714 │                       No  Yes Column ID      │   5│   6│   7│   8│
3715 │                               Layer Column ID│   1│   2│   3│   4│
3716 │                          ╶───────────────────┼────┼────┼────┼────┤
3717 │                           No  Column ID      │   5│   6│   7│   8│
3718 │                               Layer Column ID│   1│   2│   3│   4│
3719 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3720 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
3721 │                               Layer Column ID│   1│   2│   3│   4│
3722 │                          ╶───────────────────┼────┼────┼────┼────┤
3723 │                           No  Column ID      │   9│  10│  11│  12│
3724 │                               Layer Column ID│   1│   2│   3│   4│
3725 │                      ╶───────────────────────┼────┼────┼────┼────┤
3726 │                       No  Yes Column ID      │  13│  14│  15│  16│
3727 │                               Layer Column ID│   1│   2│   3│   4│
3728 │                          ╶───────────────────┼────┼────┼────┼────┤
3729 │                           No  Column ID      │  13│  14│  15│  16│
3730 │                               Layer Column ID│   1│   2│   3│   4│
3731 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3732 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
3733 │                               Layer Column ID│   1│   2│   3│   4│
3734 │                          ╶───────────────────┼────┼────┼────┼────┤
3735 │                           No  Column ID      │  17│  18│  19│  20│
3736 │                               Layer Column ID│   1│   2│   3│   4│
3737 │                      ╶───────────────────────┼────┼────┼────┼────┤
3738 │                       No  Yes Column ID      │  21│  22│  23│  24│
3739 │                               Layer Column ID│   1│   2│   3│   4│
3740 │                          ╶───────────────────┼────┼────┼────┼────┤
3741 │                           No  Column ID      │  21│  22│  23│  24│
3742 │                               Layer Column ID│   1│   2│   3│   4│
3743 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3744 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
3745 │                               Layer Column ID│   1│   2│   3│   4│
3746 │                          ╶───────────────────┼────┼────┼────┼────┤
3747 │                           No  Column ID      │  25│  26│  27│  28│
3748 │                               Layer Column ID│   1│   2│   3│   4│
3749 │                      ╶───────────────────────┼────┼────┼────┼────┤
3750 │                       No  Yes Column ID      │  29│  30│  31│  32│
3751 │                               Layer Column ID│   1│   2│   3│   4│
3752 │                          ╶───────────────────┼────┼────┼────┼────┤
3753 │                           No  Column ID      │  29│  30│  31│  32│
3754 │                               Layer Column ID│   1│   2│   3│   4│
3755 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3756
3757                             Custom Tables
3758 Female
3759 ╭──────────────────────────────────────────────┬───────────────────╮
3760 │                                              │        QN27       │
3761 │                                              ├─────────┬─────────┤
3762 │                                              │   Yes   │    No   │
3763 │                                              ├─────────┼─────────┤
3764 │                                              │  QND7A  │  QND7A  │
3765 │                                              ├────┬────┼────┬────┤
3766 │                                              │ Yes│ No │ Yes│ No │
3767 │                                              ├────┼────┼────┼────┤
3768 │                                              │QN86│QN86│QN86│QN86│
3769 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3770 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
3771 │                               Layer Column ID│   5│   6│   7│   8│
3772 │                          ╶───────────────────┼────┼────┼────┼────┤
3773 │                           No  Column ID      │  33│  34│  35│  36│
3774 │                               Layer Column ID│   5│   6│   7│   8│
3775 │                      ╶───────────────────────┼────┼────┼────┼────┤
3776 │                       No  Yes Column ID      │  37│  38│  39│  40│
3777 │                               Layer Column ID│   5│   6│   7│   8│
3778 │                          ╶───────────────────┼────┼────┼────┼────┤
3779 │                           No  Column ID      │  37│  38│  39│  40│
3780 │                               Layer Column ID│   5│   6│   7│   8│
3781 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3782 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
3783 │                               Layer Column ID│   5│   6│   7│   8│
3784 │                          ╶───────────────────┼────┼────┼────┼────┤
3785 │                           No  Column ID      │  41│  42│  43│  44│
3786 │                               Layer Column ID│   5│   6│   7│   8│
3787 │                      ╶───────────────────────┼────┼────┼────┼────┤
3788 │                       No  Yes Column ID      │  45│  46│  47│  48│
3789 │                               Layer Column ID│   5│   6│   7│   8│
3790 │                          ╶───────────────────┼────┼────┼────┼────┤
3791 │                           No  Column ID      │  45│  46│  47│  48│
3792 │                               Layer Column ID│   5│   6│   7│   8│
3793 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3794 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
3795 │                               Layer Column ID│   5│   6│   7│   8│
3796 │                          ╶───────────────────┼────┼────┼────┼────┤
3797 │                           No  Column ID      │  49│  50│  51│  52│
3798 │                               Layer Column ID│   5│   6│   7│   8│
3799 │                      ╶───────────────────────┼────┼────┼────┼────┤
3800 │                       No  Yes Column ID      │  53│  54│  55│  56│
3801 │                               Layer Column ID│   5│   6│   7│   8│
3802 │                          ╶───────────────────┼────┼────┼────┼────┤
3803 │                           No  Column ID      │  53│  54│  55│  56│
3804 │                               Layer Column ID│   5│   6│   7│   8│
3805 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3806 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
3807 │                               Layer Column ID│   5│   6│   7│   8│
3808 │                          ╶───────────────────┼────┼────┼────┼────┤
3809 │                           No  Column ID      │  57│  58│  59│  60│
3810 │                               Layer Column ID│   5│   6│   7│   8│
3811 │                      ╶───────────────────────┼────┼────┼────┼────┤
3812 │                       No  Yes Column ID      │  61│  62│  63│  64│
3813 │                               Layer Column ID│   5│   6│   7│   8│
3814 │                          ╶───────────────────┼────┼────┼────┼────┤
3815 │                           No  Column ID      │  61│  62│  63│  64│
3816 │                               Layer Column ID│   5│   6│   7│   8│
3817 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3818 ])
3819 AT_CLEANUP
3820
3821 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
3822 AT_KEYWORDS([ROWLABELS LAYER])
3823 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3824 AT_DATA([ctables.sps],
3825 [[GET 'nhtsa.sav'.
3826 CTABLES
3827     /VLABELS VARIABLES=ALL DISPLAY=NAME
3828     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3829     /SLABELS POSITION=ROW
3830     /CLABELS ROWLABELS=LAYER
3831     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3832     /SLABELS POSITION=ROW
3833     /CLABELS ROWLABELS=LAYER
3834     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3835     /SLABELS POSITION=ROW
3836     /CLABELS ROWLABELS=LAYER.
3837 ]])
3838 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3839                           Custom Tables
3840 Male
3841 Yes
3842 ╭──────────────────────────────────┬───────────────────────────╮
3843 │                                  │            QN27           │
3844 │                                  ├─────────────┬─────────────┤
3845 │                                  │     Yes     │      No     │
3846 │                                  ├─────────────┼─────────────┤
3847 │                                  │    QND7A    │    QND7A    │
3848 │                                  ├──────┬──────┼──────┬──────┤
3849 │                                  │  Yes │  No  │  Yes │  No  │
3850 │                                  ├──────┼──────┼──────┼──────┤
3851 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3852 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3853 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3854 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3855 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3856 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3857 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  7│ 7│
3858 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3859 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3860 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3861 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  7│ 7│
3862 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3863 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3864 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3865 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 15│15│
3866 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3867 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3868 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3869 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 15│15│
3870 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3871
3872                           Custom Tables
3873 Male
3874 No
3875 ╭──────────────────────────────────┬───────────────────────────╮
3876 │                                  │            QN27           │
3877 │                                  ├─────────────┬─────────────┤
3878 │                                  │     Yes     │      No     │
3879 │                                  ├─────────────┼─────────────┤
3880 │                                  │    QND7A    │    QND7A    │
3881 │                                  ├──────┬──────┼──────┬──────┤
3882 │                                  │  Yes │  No  │  Yes │  No  │
3883 │                                  ├──────┼──────┼──────┼──────┤
3884 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3885 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3886 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3887 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3888 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3889 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3890 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  8│ 8│
3891 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3892 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3893 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3894 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  8│ 8│
3895 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3896 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3897 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3898 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 16│16│
3899 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3900 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3901 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3902 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 16│16│
3903 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3904
3905                           Custom Tables
3906 Female
3907 Yes
3908 ╭──────────────────────────────────┬───────────────────────────╮
3909 │                                  │            QN27           │
3910 │                                  ├─────────────┬─────────────┤
3911 │                                  │     Yes     │      No     │
3912 │                                  ├─────────────┼─────────────┤
3913 │                                  │    QND7A    │    QND7A    │
3914 │                                  ├──────┬──────┼──────┬──────┤
3915 │                                  │  Yes │  No  │  Yes │  No  │
3916 │                                  ├──────┼──────┼──────┼──────┤
3917 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3918 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3919 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3920 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3921 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3922 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3923 │                       Subtable ID│ 18│18│ 20│20│ 21│21│ 23│23│
3924 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3925 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3926 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3927 │                       Subtable ID│ 18│18│ 20│20│ 21│21│ 23│23│
3928 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3929 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3930 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3931 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3932 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3933 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3934 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3935 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3936 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3937
3938                           Custom Tables
3939 Female
3940 No
3941 ╭──────────────────────────────────┬───────────────────────────╮
3942 │                                  │            QN27           │
3943 │                                  ├─────────────┬─────────────┤
3944 │                                  │     Yes     │      No     │
3945 │                                  ├─────────────┼─────────────┤
3946 │                                  │    QND7A    │    QND7A    │
3947 │                                  ├──────┬──────┼──────┬──────┤
3948 │                                  │  Yes │  No  │  Yes │  No  │
3949 │                                  ├──────┼──────┼──────┼──────┤
3950 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3951 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3952 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3953 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3954 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3955 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3956 │                       Subtable ID│ 17│17│ 19│19│ 22│22│ 24│24│
3957 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3958 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3959 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3960 │                       Subtable ID│ 17│17│ 19│19│ 22│22│ 24│24│
3961 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3962 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3963 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3964 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3965 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3966 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3967 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3968 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3969 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3970
3971                           Custom Tables
3972 Male
3973 Yes
3974 ╭───────────────────────────────────┬───────────────────────────╮
3975 │                                   │            QN27           │
3976 │                                   ├─────────────┬─────────────┤
3977 │                                   │     Yes     │      No     │
3978 │                                   ├─────────────┼─────────────┤
3979 │                                   │    QND7A    │    QND7A    │
3980 │                                   ├──────┬──────┼──────┬──────┤
3981 │                                   │  Yes │  No  │  Yes │  No  │
3982 │                                   ├──────┼──────┼──────┼──────┤
3983 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
3984 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
3985 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
3986 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3987 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  6│ 6│  7│ 7│
3988 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3989 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3990 │              No  QN57 Row ID      │ 10│10│ 11│11│ 13│13│ 15│15│
3991 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3992 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3993 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 20│20│ 21│21│ 24│24│
3994 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3995 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3996 │              No  QN57 Row ID      │ 25│25│ 28│28│ 30│30│ 31│31│
3997 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3998 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3999
4000                           Custom Tables
4001 Male
4002 No
4003 ╭───────────────────────────────────┬───────────────────────────╮
4004 │                                   │            QN27           │
4005 │                                   ├─────────────┬─────────────┤
4006 │                                   │     Yes     │      No     │
4007 │                                   ├─────────────┼─────────────┤
4008 │                                   │    QND7A    │    QND7A    │
4009 │                                   ├──────┬──────┼──────┬──────┤
4010 │                                   │  Yes │  No  │  Yes │  No  │
4011 │                                   ├──────┼──────┼──────┼──────┤
4012 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4013 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4014 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4015 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4016 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  5│ 5│  8│ 8│
4017 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4018 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4019 │              No  QN57 Row ID      │  9│ 9│ 12│12│ 14│14│ 16│16│
4020 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4021 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4022 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 19│19│ 22│22│ 23│23│
4023 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4024 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4025 │              No  QN57 Row ID      │ 26│26│ 27│27│ 29│29│ 32│32│
4026 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4027 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4028
4029                           Custom Tables
4030 Female
4031 Yes
4032 ╭───────────────────────────────────┬───────────────────────────╮
4033 │                                   │            QN27           │
4034 │                                   ├─────────────┬─────────────┤
4035 │                                   │     Yes     │      No     │
4036 │                                   ├─────────────┼─────────────┤
4037 │                                   │    QND7A    │    QND7A    │
4038 │                                   ├──────┬──────┼──────┬──────┤
4039 │                                   │  Yes │  No  │  Yes │  No  │
4040 │                                   ├──────┼──────┼──────┼──────┤
4041 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4042 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4043 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4044 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4045 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 39│39│
4046 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4047 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4048 │              No  QN57 Row ID      │ 41│41│ 43│43│ 46│46│ 47│47│
4049 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4050 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4051 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 51│51│ 53│53│ 56│56│
4052 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4053 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4054 │              No  QN57 Row ID      │ 58│58│ 59│59│ 62│62│ 63│63│
4055 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4056 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4057
4058                           Custom Tables
4059 Female
4060 No
4061 ╭───────────────────────────────────┬───────────────────────────╮
4062 │                                   │            QN27           │
4063 │                                   ├─────────────┬─────────────┤
4064 │                                   │     Yes     │      No     │
4065 │                                   ├─────────────┼─────────────┤
4066 │                                   │    QND7A    │    QND7A    │
4067 │                                   ├──────┬──────┼──────┬──────┤
4068 │                                   │  Yes │  No  │  Yes │  No  │
4069 │                                   ├──────┼──────┼──────┼──────┤
4070 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4071 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4072 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4073 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4074 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 40│40│
4075 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4076 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4077 │              No  QN57 Row ID      │ 42│42│ 44│44│ 45│45│ 48│48│
4078 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4079 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4080 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 52│52│ 54│54│ 55│55│
4081 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4082 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4083 │              No  QN57 Row ID      │ 57│57│ 60│60│ 61│61│ 64│64│
4084 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4085 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4086
4087                             Custom Tables
4088 Male
4089 Yes
4090 ╭──────────────────────────────────────┬───────────────────────────╮
4091 │                                      │            QN27           │
4092 │                                      ├─────────────┬─────────────┤
4093 │                                      │     Yes     │      No     │
4094 │                                      ├─────────────┼─────────────┤
4095 │                                      │    QND7A    │    QND7A    │
4096 │                                      ├──────┬──────┼──────┬──────┤
4097 │                                      │  Yes │  No  │  Yes │  No  │
4098 │                                      ├──────┼──────┼──────┼──────┤
4099 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4100 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4101 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4102 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4103 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 4│  6│ 8│  9│11│ 14│15│
4104 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4105 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4106 │              No  QN57 Column ID      │  1│ 4│  6│ 8│  9│11│ 14│15│
4107 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4108 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4109 │     No  QN61 Yes QN57 Column ID      │ 18│19│ 22│23│ 25│27│ 29│32│
4110 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4111 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4112 │              No  QN57 Column ID      │ 18│19│ 22│23│ 25│27│ 29│32│
4113 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4114 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4115
4116                             Custom Tables
4117 Male
4118 No
4119 ╭──────────────────────────────────────┬───────────────────────────╮
4120 │                                      │            QN27           │
4121 │                                      ├─────────────┬─────────────┤
4122 │                                      │     Yes     │      No     │
4123 │                                      ├─────────────┼─────────────┤
4124 │                                      │    QND7A    │    QND7A    │
4125 │                                      ├──────┬──────┼──────┬──────┤
4126 │                                      │  Yes │  No  │  Yes │  No  │
4127 │                                      ├──────┼──────┼──────┼──────┤
4128 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4129 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4130 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4131 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4132 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 3│  5│ 7│ 10│12│ 13│16│
4133 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4134 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4135 │              No  QN57 Column ID      │  2│ 3│  5│ 7│ 10│12│ 13│16│
4136 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4137 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4138 │     No  QN61 Yes QN57 Column ID      │ 17│20│ 21│24│ 26│28│ 30│31│
4139 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4140 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4141 │              No  QN57 Column ID      │ 17│20│ 21│24│ 26│28│ 30│31│
4142 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4143 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4144
4145                             Custom Tables
4146 Female
4147 Yes
4148 ╭──────────────────────────────────────┬───────────────────────────╮
4149 │                                      │            QN27           │
4150 │                                      ├─────────────┬─────────────┤
4151 │                                      │     Yes     │      No     │
4152 │                                      ├─────────────┼─────────────┤
4153 │                                      │    QND7A    │    QND7A    │
4154 │                                      ├──────┬──────┼──────┬──────┤
4155 │                                      │  Yes │  No  │  Yes │  No  │
4156 │                                      ├──────┼──────┼──────┼──────┤
4157 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4158 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4159 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4160 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4161 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│36│ 37│39│ 42│44│ 45│47│
4162 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4163 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4164 │              No  QN57 Column ID      │ 33│36│ 37│39│ 42│44│ 45│47│
4165 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4166 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4167 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 54│56│ 57│60│ 62│64│
4168 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4169 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4170 │              No  QN57 Column ID      │ 49│51│ 54│56│ 57│60│ 62│64│
4171 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4172 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4173
4174                             Custom Tables
4175 Female
4176 No
4177 ╭──────────────────────────────────────┬───────────────────────────╮
4178 │                                      │            QN27           │
4179 │                                      ├─────────────┬─────────────┤
4180 │                                      │     Yes     │      No     │
4181 │                                      ├─────────────┼─────────────┤
4182 │                                      │    QND7A    │    QND7A    │
4183 │                                      ├──────┬──────┼──────┬──────┤
4184 │                                      │  Yes │  No  │  Yes │  No  │
4185 │                                      ├──────┼──────┼──────┼──────┤
4186 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4187 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4188 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4189 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4190 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│35│ 38│40│ 41│43│ 46│48│
4191 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4192 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4193 │              No  QN57 Column ID      │ 34│35│ 38│40│ 41│43│ 46│48│
4194 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4195 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4196 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 53│55│ 58│59│ 61│63│
4197 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4198 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4199 │              No  QN57 Column ID      │ 50│52│ 53│55│ 58│59│ 61│63│
4200 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4201 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4202 ])
4203 AT_CLEANUP
4204
4205 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4206 AT_KEYWORDS([COLLABELS LAYER])
4207 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4208 AT_DATA([ctables.sps],
4209 [[GET 'nhtsa.sav'.
4210 CTABLES
4211     /VLABELS VARIABLES=ALL DISPLAY=NAME
4212     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4213     /SLABELS POSITION=ROW
4214     /CLABELS COLLABELS=LAYER
4215     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4216     /SLABELS POSITION=ROW
4217     /CLABELS COLLABELS=LAYER
4218     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4219     /SLABELS POSITION=ROW
4220     /CLABELS COLLABELS=LAYER.
4221 ]])
4222 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4223                         Custom Tables
4224 Male
4225 Yes
4226 ╭──────────────────────────────────────┬───────────────────╮
4227 │                                      │        QN27       │
4228 │                                      ├─────────┬─────────┤
4229 │                                      │   Yes   │    No   │
4230 │                                      ├─────────┼─────────┤
4231 │                                      │  QND7A  │  QND7A  │
4232 │                                      ├────┬────┼────┬────┤
4233 │                                      │ Yes│ No │ Yes│ No │
4234 │                                      ├────┼────┼────┼────┤
4235 │                                      │QN86│QN86│QN86│QN86│
4236 ├──────────────────────────────────────┼────┼────┼────┼────┤
4237 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4238 │                           Layer ID   │   2│   2│   2│   2│
4239 │                           Subtable ID│   2│   2│   4│   4│
4240 │                      ╶───────────────┼────┼────┼────┼────┤
4241 │                       No  Table ID   │   1│   1│   1│   1│
4242 │                           Layer ID   │   2│   2│   2│   2│
4243 │                           Subtable ID│   2│   2│   4│   4│
4244 │             ╶────────────────────────┼────┼────┼────┼────┤
4245 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4246 │                           Layer ID   │   2│   2│   2│   2│
4247 │                           Subtable ID│   5│   5│   8│   8│
4248 │                      ╶───────────────┼────┼────┼────┼────┤
4249 │                       No  Table ID   │   1│   1│   1│   1│
4250 │                           Layer ID   │   2│   2│   2│   2│
4251 │                           Subtable ID│   5│   5│   8│   8│
4252 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4253 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4254 │                           Layer ID   │   2│   2│   2│   2│
4255 │                           Subtable ID│   9│   9│  12│  12│
4256 │                      ╶───────────────┼────┼────┼────┼────┤
4257 │                       No  Table ID   │   1│   1│   1│   1│
4258 │                           Layer ID   │   2│   2│   2│   2│
4259 │                           Subtable ID│   9│   9│  12│  12│
4260 │             ╶────────────────────────┼────┼────┼────┼────┤
4261 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4262 │                           Layer ID   │   2│   2│   2│   2│
4263 │                           Subtable ID│  14│  14│  15│  15│
4264 │                      ╶───────────────┼────┼────┼────┼────┤
4265 │                       No  Table ID   │   1│   1│   1│   1│
4266 │                           Layer ID   │   2│   2│   2│   2│
4267 │                           Subtable ID│  14│  14│  15│  15│
4268 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4269
4270                         Custom Tables
4271 Male
4272 No
4273 ╭──────────────────────────────────────┬───────────────────╮
4274 │                                      │        QN27       │
4275 │                                      ├─────────┬─────────┤
4276 │                                      │   Yes   │    No   │
4277 │                                      ├─────────┼─────────┤
4278 │                                      │  QND7A  │  QND7A  │
4279 │                                      ├────┬────┼────┬────┤
4280 │                                      │ Yes│ No │ Yes│ No │
4281 │                                      ├────┼────┼────┼────┤
4282 │                                      │QN86│QN86│QN86│QN86│
4283 ├──────────────────────────────────────┼────┼────┼────┼────┤
4284 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4285 │                           Layer ID   │   1│   1│   1│   1│
4286 │                           Subtable ID│   1│   1│   3│   3│
4287 │                      ╶───────────────┼────┼────┼────┼────┤
4288 │                       No  Table ID   │   1│   1│   1│   1│
4289 │                           Layer ID   │   1│   1│   1│   1│
4290 │                           Subtable ID│   1│   1│   3│   3│
4291 │             ╶────────────────────────┼────┼────┼────┼────┤
4292 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4293 │                           Layer ID   │   1│   1│   1│   1│
4294 │                           Subtable ID│   6│   6│   7│   7│
4295 │                      ╶───────────────┼────┼────┼────┼────┤
4296 │                       No  Table ID   │   1│   1│   1│   1│
4297 │                           Layer ID   │   1│   1│   1│   1│
4298 │                           Subtable ID│   6│   6│   7│   7│
4299 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4300 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4301 │                           Layer ID   │   1│   1│   1│   1│
4302 │                           Subtable ID│  10│  10│  11│  11│
4303 │                      ╶───────────────┼────┼────┼────┼────┤
4304 │                       No  Table ID   │   1│   1│   1│   1│
4305 │                           Layer ID   │   1│   1│   1│   1│
4306 │                           Subtable ID│  10│  10│  11│  11│
4307 │             ╶────────────────────────┼────┼────┼────┼────┤
4308 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4309 │                           Layer ID   │   1│   1│   1│   1│
4310 │                           Subtable ID│  13│  13│  16│  16│
4311 │                      ╶───────────────┼────┼────┼────┼────┤
4312 │                       No  Table ID   │   1│   1│   1│   1│
4313 │                           Layer ID   │   1│   1│   1│   1│
4314 │                           Subtable ID│  13│  13│  16│  16│
4315 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4316
4317                         Custom Tables
4318 Female
4319 Yes
4320 ╭──────────────────────────────────────┬───────────────────╮
4321 │                                      │        QN27       │
4322 │                                      ├─────────┬─────────┤
4323 │                                      │   Yes   │    No   │
4324 │                                      ├─────────┼─────────┤
4325 │                                      │  QND7A  │  QND7A  │
4326 │                                      ├────┬────┼────┬────┤
4327 │                                      │ Yes│ No │ Yes│ No │
4328 │                                      ├────┼────┼────┼────┤
4329 │                                      │QN86│QN86│QN86│QN86│
4330 ├──────────────────────────────────────┼────┼────┼────┼────┤
4331 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4332 │                           Layer ID   │   4│   4│   4│   4│
4333 │                           Subtable ID│  18│  18│  20│  20│
4334 │                      ╶───────────────┼────┼────┼────┼────┤
4335 │                       No  Table ID   │   1│   1│   1│   1│
4336 │                           Layer ID   │   4│   4│   4│   4│
4337 │                           Subtable ID│  18│  18│  20│  20│
4338 │             ╶────────────────────────┼────┼────┼────┼────┤
4339 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4340 │                           Layer ID   │   4│   4│   4│   4│
4341 │                           Subtable ID│  21│  21│  23│  23│
4342 │                      ╶───────────────┼────┼────┼────┼────┤
4343 │                       No  Table ID   │   1│   1│   1│   1│
4344 │                           Layer ID   │   4│   4│   4│   4│
4345 │                           Subtable ID│  21│  21│  23│  23│
4346 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4347 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4348 │                           Layer ID   │   4│   4│   4│   4│
4349 │                           Subtable ID│  25│  25│  28│  28│
4350 │                      ╶───────────────┼────┼────┼────┼────┤
4351 │                       No  Table ID   │   1│   1│   1│   1│
4352 │                           Layer ID   │   4│   4│   4│   4│
4353 │                           Subtable ID│  25│  25│  28│  28│
4354 │             ╶────────────────────────┼────┼────┼────┼────┤
4355 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4356 │                           Layer ID   │   4│   4│   4│   4│
4357 │                           Subtable ID│  30│  30│  32│  32│
4358 │                      ╶───────────────┼────┼────┼────┼────┤
4359 │                       No  Table ID   │   1│   1│   1│   1│
4360 │                           Layer ID   │   4│   4│   4│   4│
4361 │                           Subtable ID│  30│  30│  32│  32│
4362 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4363
4364                         Custom Tables
4365 Female
4366 No
4367 ╭──────────────────────────────────────┬───────────────────╮
4368 │                                      │        QN27       │
4369 │                                      ├─────────┬─────────┤
4370 │                                      │   Yes   │    No   │
4371 │                                      ├─────────┼─────────┤
4372 │                                      │  QND7A  │  QND7A  │
4373 │                                      ├────┬────┼────┬────┤
4374 │                                      │ Yes│ No │ Yes│ No │
4375 │                                      ├────┼────┼────┼────┤
4376 │                                      │QN86│QN86│QN86│QN86│
4377 ├──────────────────────────────────────┼────┼────┼────┼────┤
4378 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4379 │                           Layer ID   │   3│   3│   3│   3│
4380 │                           Subtable ID│  17│  17│  19│  19│
4381 │                      ╶───────────────┼────┼────┼────┼────┤
4382 │                       No  Table ID   │   1│   1│   1│   1│
4383 │                           Layer ID   │   3│   3│   3│   3│
4384 │                           Subtable ID│  17│  17│  19│  19│
4385 │             ╶────────────────────────┼────┼────┼────┼────┤
4386 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4387 │                           Layer ID   │   3│   3│   3│   3│
4388 │                           Subtable ID│  22│  22│  24│  24│
4389 │                      ╶───────────────┼────┼────┼────┼────┤
4390 │                       No  Table ID   │   1│   1│   1│   1│
4391 │                           Layer ID   │   3│   3│   3│   3│
4392 │                           Subtable ID│  22│  22│  24│  24│
4393 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4394 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4395 │                           Layer ID   │   3│   3│   3│   3│
4396 │                           Subtable ID│  26│  26│  27│  27│
4397 │                      ╶───────────────┼────┼────┼────┼────┤
4398 │                       No  Table ID   │   1│   1│   1│   1│
4399 │                           Layer ID   │   3│   3│   3│   3│
4400 │                           Subtable ID│  26│  26│  27│  27│
4401 │             ╶────────────────────────┼────┼────┼────┼────┤
4402 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4403 │                           Layer ID   │   3│   3│   3│   3│
4404 │                           Subtable ID│  29│  29│  31│  31│
4405 │                      ╶───────────────┼────┼────┼────┼────┤
4406 │                       No  Table ID   │   1│   1│   1│   1│
4407 │                           Layer ID   │   3│   3│   3│   3│
4408 │                           Subtable ID│  29│  29│  31│  31│
4409 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4410
4411                         Custom Tables
4412 Male
4413 Yes
4414 ╭───────────────────────────────────────┬───────────────────╮
4415 │                                       │        QN27       │
4416 │                                       ├─────────┬─────────┤
4417 │                                       │   Yes   │    No   │
4418 │                                       ├─────────┼─────────┤
4419 │                                       │  QND7A  │  QND7A  │
4420 │                                       ├────┬────┼────┬────┤
4421 │                                       │ Yes│ No │ Yes│ No │
4422 │                                       ├────┼────┼────┼────┤
4423 │                                       │QN86│QN86│QN86│QN86│
4424 ├───────────────────────────────────────┼────┼────┼────┼────┤
4425 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4426 │                           Layer Row ID│   1│   1│   1│   1│
4427 │                      ╶────────────────┼────┼────┼────┼────┤
4428 │                       No  Row ID      │   6│   6│   7│   7│
4429 │                           Layer Row ID│   4│   4│   4│   4│
4430 │             ╶─────────────────────────┼────┼────┼────┼────┤
4431 │              No  QN57 Yes Row ID      │  10│  10│  11│  11│
4432 │                           Layer Row ID│   6│   6│   6│   6│
4433 │                      ╶────────────────┼────┼────┼────┼────┤
4434 │                       No  Row ID      │  13│  13│  15│  15│
4435 │                           Layer Row ID│   7│   7│   7│   7│
4436 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4437 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  20│  20│
4438 │                           Layer Row ID│   9│   9│   9│   9│
4439 │                      ╶────────────────┼────┼────┼────┼────┤
4440 │                       No  Row ID      │  21│  21│  24│  24│
4441 │                           Layer Row ID│  11│  11│  11│  11│
4442 │             ╶─────────────────────────┼────┼────┼────┼────┤
4443 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4444 │                           Layer Row ID│  13│  13│  13│  13│
4445 │                      ╶────────────────┼────┼────┼────┼────┤
4446 │                       No  Row ID      │  30│  30│  32│  32│
4447 │                           Layer Row ID│  16│  16│  16│  16│
4448 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4449
4450                         Custom Tables
4451 Male
4452 No
4453 ╭───────────────────────────────────────┬───────────────────╮
4454 │                                       │        QN27       │
4455 │                                       ├─────────┬─────────┤
4456 │                                       │   Yes   │    No   │
4457 │                                       ├─────────┼─────────┤
4458 │                                       │  QND7A  │  QND7A  │
4459 │                                       ├────┬────┼────┬────┤
4460 │                                       │ Yes│ No │ Yes│ No │
4461 │                                       ├────┼────┼────┼────┤
4462 │                                       │QN86│QN86│QN86│QN86│
4463 ├───────────────────────────────────────┼────┼────┼────┼────┤
4464 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4465 │                           Layer Row ID│   2│   2│   2│   2│
4466 │                      ╶────────────────┼────┼────┼────┼────┤
4467 │                       No  Row ID      │   5│   5│   8│   8│
4468 │                           Layer Row ID│   3│   3│   3│   3│
4469 │             ╶─────────────────────────┼────┼────┼────┼────┤
4470 │              No  QN57 Yes Row ID      │   9│   9│  12│  12│
4471 │                           Layer Row ID│   5│   5│   5│   5│
4472 │                      ╶────────────────┼────┼────┼────┼────┤
4473 │                       No  Row ID      │  14│  14│  16│  16│
4474 │                           Layer Row ID│   8│   8│   8│   8│
4475 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4476 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  19│  19│
4477 │                           Layer Row ID│  10│  10│  10│  10│
4478 │                      ╶────────────────┼────┼────┼────┼────┤
4479 │                       No  Row ID      │  22│  22│  23│  23│
4480 │                           Layer Row ID│  12│  12│  12│  12│
4481 │             ╶─────────────────────────┼────┼────┼────┼────┤
4482 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4483 │                           Layer Row ID│  14│  14│  14│  14│
4484 │                      ╶────────────────┼────┼────┼────┼────┤
4485 │                       No  Row ID      │  29│  29│  31│  31│
4486 │                           Layer Row ID│  15│  15│  15│  15│
4487 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4488
4489                         Custom Tables
4490 Female
4491 Yes
4492 ╭───────────────────────────────────────┬───────────────────╮
4493 │                                       │        QN27       │
4494 │                                       ├─────────┬─────────┤
4495 │                                       │   Yes   │    No   │
4496 │                                       ├─────────┼─────────┤
4497 │                                       │  QND7A  │  QND7A  │
4498 │                                       ├────┬────┼────┬────┤
4499 │                                       │ Yes│ No │ Yes│ No │
4500 │                                       ├────┼────┼────┼────┤
4501 │                                       │QN86│QN86│QN86│QN86│
4502 ├───────────────────────────────────────┼────┼────┼────┼────┤
4503 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  35│  35│
4504 │                           Layer Row ID│  18│  18│  18│  18│
4505 │                      ╶────────────────┼────┼────┼────┼────┤
4506 │                       No  Row ID      │  38│  38│  39│  39│
4507 │                           Layer Row ID│  20│  20│  20│  20│
4508 │             ╶─────────────────────────┼────┼────┼────┼────┤
4509 │              No  QN57 Yes Row ID      │  42│  42│  43│  43│
4510 │                           Layer Row ID│  22│  22│  22│  22│
4511 │                      ╶────────────────┼────┼────┼────┼────┤
4512 │                       No  Row ID      │  45│  45│  47│  47│
4513 │                           Layer Row ID│  23│  23│  23│  23│
4514 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4515 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  51│  51│
4516 │                           Layer Row ID│  26│  26│  26│  26│
4517 │                      ╶────────────────┼────┼────┼────┼────┤
4518 │                       No  Row ID      │  53│  53│  55│  55│
4519 │                           Layer Row ID│  27│  27│  27│  27│
4520 │             ╶─────────────────────────┼────┼────┼────┼────┤
4521 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4522 │                           Layer Row ID│  29│  29│  29│  29│
4523 │                      ╶────────────────┼────┼────┼────┼────┤
4524 │                       No  Row ID      │  62│  62│  64│  64│
4525 │                           Layer Row ID│  32│  32│  32│  32│
4526 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4527
4528                         Custom Tables
4529 Female
4530 No
4531 ╭───────────────────────────────────────┬───────────────────╮
4532 │                                       │        QN27       │
4533 │                                       ├─────────┬─────────┤
4534 │                                       │   Yes   │    No   │
4535 │                                       ├─────────┼─────────┤
4536 │                                       │  QND7A  │  QND7A  │
4537 │                                       ├────┬────┼────┬────┤
4538 │                                       │ Yes│ No │ Yes│ No │
4539 │                                       ├────┼────┼────┼────┤
4540 │                                       │QN86│QN86│QN86│QN86│
4541 ├───────────────────────────────────────┼────┼────┼────┼────┤
4542 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  36│  36│
4543 │                           Layer Row ID│  17│  17│  17│  17│
4544 │                      ╶────────────────┼────┼────┼────┼────┤
4545 │                       No  Row ID      │  37│  37│  40│  40│
4546 │                           Layer Row ID│  19│  19│  19│  19│
4547 │             ╶─────────────────────────┼────┼────┼────┼────┤
4548 │              No  QN57 Yes Row ID      │  41│  41│  44│  44│
4549 │                           Layer Row ID│  21│  21│  21│  21│
4550 │                      ╶────────────────┼────┼────┼────┼────┤
4551 │                       No  Row ID      │  46│  46│  48│  48│
4552 │                           Layer Row ID│  24│  24│  24│  24│
4553 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4554 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  52│  52│
4555 │                           Layer Row ID│  25│  25│  25│  25│
4556 │                      ╶────────────────┼────┼────┼────┼────┤
4557 │                       No  Row ID      │  54│  54│  56│  56│
4558 │                           Layer Row ID│  28│  28│  28│  28│
4559 │             ╶─────────────────────────┼────┼────┼────┼────┤
4560 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
4561 │                           Layer Row ID│  30│  30│  30│  30│
4562 │                      ╶────────────────┼────┼────┼────┼────┤
4563 │                       No  Row ID      │  61│  61│  63│  63│
4564 │                           Layer Row ID│  31│  31│  31│  31│
4565 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4566
4567                           Custom Tables
4568 Male
4569 Yes
4570 ╭──────────────────────────────────────────┬───────────────────╮
4571 │                                          │        QN27       │
4572 │                                          ├─────────┬─────────┤
4573 │                                          │   Yes   │    No   │
4574 │                                          ├─────────┼─────────┤
4575 │                                          │  QND7A  │  QND7A  │
4576 │                                          ├────┬────┼────┬────┤
4577 │                                          │ Yes│ No │ Yes│ No │
4578 │                                          ├────┼────┼────┼────┤
4579 │                                          │QN86│QN86│QN86│QN86│
4580 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4581 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   7│
4582 │                           Layer Column ID│   2│   4│   6│   7│
4583 │                      ╶───────────────────┼────┼────┼────┼────┤
4584 │                       No  Column ID      │   2│   4│   6│   7│
4585 │                           Layer Column ID│   2│   4│   6│   7│
4586 │             ╶────────────────────────────┼────┼────┼────┼────┤
4587 │              No  QN57 Yes Column ID      │   9│  12│  13│  16│
4588 │                           Layer Column ID│   2│   4│   6│   7│
4589 │                      ╶───────────────────┼────┼────┼────┼────┤
4590 │                       No  Column ID      │   9│  12│  13│  16│
4591 │                           Layer Column ID│   2│   4│   6│   7│
4592 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4593 │     No  QN61 Yes QN57 Yes Column ID      │  18│  19│  22│  24│
4594 │                           Layer Column ID│   2│   4│   6│   7│
4595 │                      ╶───────────────────┼────┼────┼────┼────┤
4596 │                       No  Column ID      │  18│  19│  22│  24│
4597 │                           Layer Column ID│   2│   4│   6│   7│
4598 │             ╶────────────────────────────┼────┼────┼────┼────┤
4599 │              No  QN57 Yes Column ID      │  25│  27│  29│  32│
4600 │                           Layer Column ID│   2│   4│   6│   7│
4601 │                      ╶───────────────────┼────┼────┼────┼────┤
4602 │                       No  Column ID      │  25│  27│  29│  32│
4603 │                           Layer Column ID│   2│   4│   6│   7│
4604 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4605
4606                           Custom Tables
4607 Male
4608 No
4609 ╭──────────────────────────────────────────┬───────────────────╮
4610 │                                          │        QN27       │
4611 │                                          ├─────────┬─────────┤
4612 │                                          │   Yes   │    No   │
4613 │                                          ├─────────┼─────────┤
4614 │                                          │  QND7A  │  QND7A  │
4615 │                                          ├────┬────┼────┬────┤
4616 │                                          │ Yes│ No │ Yes│ No │
4617 │                                          ├────┼────┼────┼────┤
4618 │                                          │QN86│QN86│QN86│QN86│
4619 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4620 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   8│
4621 │                           Layer Column ID│   1│   3│   5│   8│
4622 │                      ╶───────────────────┼────┼────┼────┼────┤
4623 │                       No  Column ID      │   1│   3│   5│   8│
4624 │                           Layer Column ID│   1│   3│   5│   8│
4625 │             ╶────────────────────────────┼────┼────┼────┼────┤
4626 │              No  QN57 Yes Column ID      │  10│  11│  14│  15│
4627 │                           Layer Column ID│   1│   3│   5│   8│
4628 │                      ╶───────────────────┼────┼────┼────┼────┤
4629 │                       No  Column ID      │  10│  11│  14│  15│
4630 │                           Layer Column ID│   1│   3│   5│   8│
4631 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4632 │     No  QN61 Yes QN57 Yes Column ID      │  17│  20│  21│  23│
4633 │                           Layer Column ID│   1│   3│   5│   8│
4634 │                      ╶───────────────────┼────┼────┼────┼────┤
4635 │                       No  Column ID      │  17│  20│  21│  23│
4636 │                           Layer Column ID│   1│   3│   5│   8│
4637 │             ╶────────────────────────────┼────┼────┼────┼────┤
4638 │              No  QN57 Yes Column ID      │  26│  28│  30│  31│
4639 │                           Layer Column ID│   1│   3│   5│   8│
4640 │                      ╶───────────────────┼────┼────┼────┼────┤
4641 │                       No  Column ID      │  26│  28│  30│  31│
4642 │                           Layer Column ID│   1│   3│   5│   8│
4643 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4644
4645                           Custom Tables
4646 Female
4647 Yes
4648 ╭──────────────────────────────────────────┬───────────────────╮
4649 │                                          │        QN27       │
4650 │                                          ├─────────┬─────────┤
4651 │                                          │   Yes   │    No   │
4652 │                                          ├─────────┼─────────┤
4653 │                                          │  QND7A  │  QND7A  │
4654 │                                          ├────┬────┼────┬────┤
4655 │                                          │ Yes│ No │ Yes│ No │
4656 │                                          ├────┼────┼────┼────┤
4657 │                                          │QN86│QN86│QN86│QN86│
4658 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4659 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  37│  40│
4660 │                           Layer Column ID│  10│  12│  13│  16│
4661 │                      ╶───────────────────┼────┼────┼────┼────┤
4662 │                       No  Column ID      │  34│  36│  37│  40│
4663 │                           Layer Column ID│  10│  12│  13│  16│
4664 │             ╶────────────────────────────┼────┼────┼────┼────┤
4665 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
4666 │                           Layer Column ID│  10│  12│  13│  16│
4667 │                      ╶───────────────────┼────┼────┼────┼────┤
4668 │                       No  Column ID      │  41│  43│  45│  47│
4669 │                           Layer Column ID│  10│  12│  13│  16│
4670 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4671 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  54│  55│
4672 │                           Layer Column ID│  10│  12│  13│  16│
4673 │                      ╶───────────────────┼────┼────┼────┼────┤
4674 │                       No  Column ID      │  49│  51│  54│  55│
4675 │                           Layer Column ID│  10│  12│  13│  16│
4676 │             ╶────────────────────────────┼────┼────┼────┼────┤
4677 │              No  QN57 Yes Column ID      │  58│  60│  62│  63│
4678 │                           Layer Column ID│  10│  12│  13│  16│
4679 │                      ╶───────────────────┼────┼────┼────┼────┤
4680 │                       No  Column ID      │  58│  60│  62│  63│
4681 │                           Layer Column ID│  10│  12│  13│  16│
4682 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4683
4684                           Custom Tables
4685 Female
4686 No
4687 ╭──────────────────────────────────────────┬───────────────────╮
4688 │                                          │        QN27       │
4689 │                                          ├─────────┬─────────┤
4690 │                                          │   Yes   │    No   │
4691 │                                          ├─────────┼─────────┤
4692 │                                          │  QND7A  │  QND7A  │
4693 │                                          ├────┬────┼────┬────┤
4694 │                                          │ Yes│ No │ Yes│ No │
4695 │                                          ├────┼────┼────┼────┤
4696 │                                          │QN86│QN86│QN86│QN86│
4697 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4698 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  38│  39│
4699 │                           Layer Column ID│   9│  11│  14│  15│
4700 │                      ╶───────────────────┼────┼────┼────┼────┤
4701 │                       No  Column ID      │  33│  35│  38│  39│
4702 │                           Layer Column ID│   9│  11│  14│  15│
4703 │             ╶────────────────────────────┼────┼────┼────┼────┤
4704 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
4705 │                           Layer Column ID│   9│  11│  14│  15│
4706 │                      ╶───────────────────┼────┼────┼────┼────┤
4707 │                       No  Column ID      │  42│  44│  46│  48│
4708 │                           Layer Column ID│   9│  11│  14│  15│
4709 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4710 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  53│  56│
4711 │                           Layer Column ID│   9│  11│  14│  15│
4712 │                      ╶───────────────────┼────┼────┼────┼────┤
4713 │                       No  Column ID      │  50│  52│  53│  56│
4714 │                           Layer Column ID│   9│  11│  14│  15│
4715 │             ╶────────────────────────────┼────┼────┼────┼────┤
4716 │              No  QN57 Yes Column ID      │  57│  59│  61│  64│
4717 │                           Layer Column ID│   9│  11│  14│  15│
4718 │                      ╶───────────────────┼────┼────┼────┼────┤
4719 │                       No  Column ID      │  57│  59│  61│  64│
4720 │                           Layer Column ID│   9│  11│  14│  15│
4721 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4722 ])
4723 AT_CLEANUP
4724
4725 AT_SETUP([CTABLES categorical summary functions])
4726 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4727 AT_DATA([ctables.sps],
4728 [[GET 'nhtsa.sav'.
4729 CTABLES
4730     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
4731     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
4732     /SLABELS POSITION=ROW.
4733 ]])
4734 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4735                                                       Custom Tables
4736 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
4737 │                 │                     D5a. What would you say is your primary ethnic background?                     │
4738 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
4739 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
4740 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
4741 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
4742 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4743 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
4744 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
4745 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
4746 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4747 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4748 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
4749 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4750 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4751 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
4752 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
4753 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4754 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
4755 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
4756 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
4757 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4758 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4759 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
4760 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4761 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4762 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
4763 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
4764 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4765 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
4766 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
4767 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
4768 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4769 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4770 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
4771 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4772 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4773 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
4774 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
4775 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4776 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
4777 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
4778 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
4779 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4780 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4781 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
4782 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4783 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4784 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
4785 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
4786 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
4787 ])
4788 AT_CLEANUP
4789
4790 AT_SETUP([CTABLES scale summary functions])
4791 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4792 AT_DATA([ctables.sps],
4793 [[GET 'nhtsa.sav'.
4794 SET TVAR=NAME.
4795
4796 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4797   CTABLES later, to make the results easier to verify.
4798 SPLIT FILE BY REGION.
4799 FREQUENCIES
4800     qn19a
4801     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4802     /FORMAT NOTABLE /MISSING=INCLUDE.
4803 SPLIT FILE OFF.
4804
4805 CTABLES
4806     /VLABELS VARIABLE=qn19a DISPLAY=NONE
4807     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
4808     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
4809     /SLABELS POSITION=ROW
4810     /CLABELS ROWLABELS=OPPOSITE.
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 │                        │   NE   │   MW   │    S   │    W   │
4913 ├────────────────────────┼────────┼────────┼────────┼────────┤
4914 │REGION Valid N          │     936│    1019│    1276│     950│
4915 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
4916 │       Mean             │   19.33│   19.83│   20.29│   19.87│
4917 │       Std Error of Mean│     .14│     .16│     .18│     .17│
4918 │       Median           │   18.00│   19.00│   19.00│   19.00│
4919 │       Mode             │   18.00│   18.00│   18.00│   18.00│
4920 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
4921 │       Variance         │   19.41│   26.47│   41.43│   27.59│
4922 │       Range            │   59.00│   71.00│   75.00│   61.00│
4923 │       Minimum          │     .00│    4.00│    4.00│    4.00│
4924 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
4925 │       Sum              │18092.00│20206.00│25886.00│18877.00│
4926 │       Count            │    1409│    1654│    2390│    1546│
4927 │       Total N          │    1409│    1654│    2390│    1546│
4928 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
4929 ╰────────────────────────┴────────┴────────┴────────┴────────╯
4930 ])
4931 AT_CLEANUP
4932
4933
4934 AT_SETUP([CTABLES hidden scale VLABELS])
4935 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4936 AT_DATA([ctables.sps],
4937 [[GET 'nhtsa.sav'.
4938 CTABLES
4939     /TABLE region BY qn19a + qn35
4940     /SLABELS POSITION=ROW.
4941 CTABLES
4942     /VLABELS VARIABLE=qn19a DISPLAY=NONE
4943     /TABLE region BY qn19a + qn35
4944     /SLABELS POSITION=ROW.
4945 CTABLES
4946     /VLABELS VARIABLE=qn35 DISPLAY=NONE
4947     /TABLE region BY qn19a + qn35
4948     /SLABELS POSITION=ROW.
4949
4950 * This one in particular caused a crash because no categories were
4951   created on the column axis, so passing in 0 for the index was still
4952   too big for that number of categories.  It was fixed by creating a
4953   name-only category for each variable despite the "NONE" request,
4954   then hiding the entire dimension's labels if all its labels were
4955   set to "NONE".
4956 CTABLES
4957     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
4958     /TABLE region BY qn19a + qn35
4959     /SLABELS POSITION=ROW.
4960 ]])
4961 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
4962                                  Custom Tables
4963 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
4964 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
4965 │              │   when you first starting  │   many times have you driven a  │
4966 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
4967 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
4968 │              │      sips of alcohol.      │            beverages?           │
4969 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
4970 │Region NE Mean│                       19.33│                                2│
4971 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
4972 │       MW Mean│                       19.83│                                2│
4973 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
4974 │       S  Mean│                       20.29│                                2│
4975 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
4976 │       W  Mean│                       19.87│                                2│
4977 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
4978
4979                                  Custom Tables
4980 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
4981 │              │     │  35. In the past thirty days, how many times have you  │
4982 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
4983 │              │QN19A│                  alcoholic beverages?                  │
4984 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
4985 │Region NE Mean│19.33│                                                       2│
4986 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
4987 │       MW Mean│19.83│                                                       2│
4988 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
4989 │       S  Mean│20.29│                                                       2│
4990 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
4991 │       W  Mean│19.87│                                                       2│
4992 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
4993
4994                                  Custom Tables
4995 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
4996 │              │   19a. About how old were you when you first starting   │    │
4997 │              │  drinking alcohol, not counting small tastes or sips of │    │
4998 │              │                         alcohol.                        │qn35│
4999 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5000 │Region NE Mean│                                                    19.33│   2│
5001 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5002 │       MW Mean│                                                    19.83│   2│
5003 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5004 │       S  Mean│                                                    20.29│   2│
5005 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5006 │       W  Mean│                                                    19.87│   2│
5007 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5008
5009       Custom Tables
5010 ╭──────────────┬───────╮
5011 │Region NE Mean│19.33 2│
5012 │      ╶───────┼───────┤
5013 │       MW Mean│19.83 2│
5014 │      ╶───────┼───────┤
5015 │       S  Mean│20.29 2│
5016 │      ╶───────┼───────┤
5017 │       W  Mean│19.87 2│
5018 ╰──────────────┴───────╯
5019 ])
5020 AT_CLEANUP
5021
5022 AT_SETUP([CTABLES with SPLIT FILE])
5023 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5024 AT_DATA([ctables.sps],
5025 [[GET 'nhtsa.sav'.
5026
5027 SORT CASES BY qns3a.
5028
5029 CTABLES /TABLE qn105ba.
5030
5031 * Layered split has no effect on output.
5032 SPLIT FILE BY qns3a.
5033 CTABLES /TABLE qn105ba.
5034
5035 * Add column variable qns3a to compare against separate splits.
5036 CTABLES /TABLE qn105ba BY qns3a.
5037
5038 * Separate splits are truly output separately.
5039 SPLIT FILE SEPARATE BY qns3a.
5040 CTABLES /TABLE qn105ba.
5041 ]])
5042 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5043                                   Custom Tables
5044 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5045 │                                                                        │Count│
5046 ├────────────────────────────────────────────────────────────────────────┼─────┤
5047 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5048 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5049 │                                                            Very likely │ 1502│
5050 │                                                            Somewhat    │ 2763│
5051 │                                                            likely      │     │
5052 │                                                            Somewhat    │ 1307│
5053 │                                                            unlikely    │     │
5054 │                                                            Very        │  609│
5055 │                                                            unlikely    │     │
5056 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5057
5058                                   Custom Tables
5059 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5060 │                                                                        │Count│
5061 ├────────────────────────────────────────────────────────────────────────┼─────┤
5062 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5063 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5064 │                                                            Very likely │ 1502│
5065 │                                                            Somewhat    │ 2763│
5066 │                                                            likely      │     │
5067 │                                                            Somewhat    │ 1307│
5068 │                                                            unlikely    │     │
5069 │                                                            Very        │  609│
5070 │                                                            unlikely    │     │
5071 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5072
5073                                   Custom Tables
5074 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5075 │                                                                 │S3a. GENDER:│
5076 │                                                                 ├─────┬──────┤
5077 │                                                                 │ Male│Female│
5078 │                                                                 ├─────┼──────┤
5079 │                                                                 │Count│ Count│
5080 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5081 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5082 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5083 │the police?                                          Very likely │  660│   842│
5084 │                                                     Somewhat    │ 1174│  1589│
5085 │                                                     likely      │     │      │
5086 │                                                     Somewhat    │  640│   667│
5087 │                                                     unlikely    │     │      │
5088 │                                                     Very        │  311│   298│
5089 │                                                     unlikely    │     │      │
5090 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5091
5092     Split Values
5093 ╭────────────┬─────╮
5094 │Variable    │Value│
5095 ├────────────┼─────┤
5096 │S3a. GENDER:│Male │
5097 ╰────────────┴─────╯
5098
5099                                   Custom Tables
5100 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5101 │                                                                        │Count│
5102 ├────────────────────────────────────────────────────────────────────────┼─────┤
5103 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5104 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5105 │                                                            Very likely │  660│
5106 │                                                            Somewhat    │ 1174│
5107 │                                                            likely      │     │
5108 │                                                            Somewhat    │  640│
5109 │                                                            unlikely    │     │
5110 │                                                            Very        │  311│
5111 │                                                            unlikely    │     │
5112 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5113
5114      Split Values
5115 ╭────────────┬──────╮
5116 │Variable    │ Value│
5117 ├────────────┼──────┤
5118 │S3a. GENDER:│Female│
5119 ╰────────────┴──────╯
5120
5121                                   Custom Tables
5122 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5123 │                                                                        │Count│
5124 ├────────────────────────────────────────────────────────────────────────┼─────┤
5125 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5126 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5127 │                                                            Very likely │  842│
5128 │                                                            Somewhat    │ 1589│
5129 │                                                            likely      │     │
5130 │                                                            Somewhat    │  667│
5131 │                                                            unlikely    │     │
5132 │                                                            Very        │  298│
5133 │                                                            unlikely    │     │
5134 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5135 ])
5136 AT_CLEANUP
5137
5138 AT_SETUP([CTABLES variable level inference])
5139 AT_DATA([data.txt], [dnl
5140 dnl n1 has 10 unique small values -> nominal.
5141 dnl n2 has 23 unique small values -> nominal.
5142 dnl n3 is all missing -> nominal.
5143 dnl s1 has 24 unique small values -> scale.
5144 dnl s2 has one negative value -> scale.
5145 dnl s3 has one non-integer value -> scale.
5146 dnl s4 has no valid values less than 10 -> scale.
5147 dnl s5 has no valid values less than 10,000 -> scale.
5148 1  1  . 1  1  1    10 10001
5149 2  2  . 2  2  2    11 10002
5150 3  3  . 3  3  3    12 10003
5151 4  4  . 4  4  4    13 10004
5152 5  5  . 5  5  5    14 10005
5153 6  6  . 6  6  6    15 10006
5154 7  7  . 7  7  7    16 10007
5155 8  8  . 8  8  8    17 10008
5156 9  9  . 9  9  9    18 10009
5157 10 10 . 10 10 10.5 19 110000
5158 1  11 . 11 -1 1    11 10001
5159 2  12 . 12 2  2    12 10002
5160 3  13 . 13 3  3    13 10003
5161 4  14 . 14 4  4    14 10004
5162 5  15 . 15 5  5    15 10005
5163 6  16 . 16 6  6    16 10006
5164 7  17 . 17 7  7    17 10007
5165 8  18 . 18 8  8    18 10008
5166 9  19 . 19 9  9    19 10009
5167 1  20 . 20 1  1    20 10001
5168 2  21 . 21 2  2    21 10002
5169 3  22 . 22 3  3    22 10003
5170 4  23 . 23 4  4    23 10004
5171 5  23 . 24 5  5    24 10005
5172 6  23 . 24 6  6    25 10006
5173 ])
5174
5175 AT_DATA([ctables.sps], [dnl
5176 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5177
5178 * Nominal formats (copied from data that will default to scale).
5179 COMPUTE n4=s1.
5180 COMPUTE n5=s1.
5181 FORMATS n4(WKDAY5) n5(MONTH5).
5182
5183 * Scale formats (copied from data that will default to nominal).
5184 COMPUTE s6=n1.
5185 COMPUTE s7=n1.
5186 COMPUTE s8=n1.
5187 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5188
5189 STRING string(A8).
5190
5191 DISPLAY DICTIONARY.
5192 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5193 DISPLAY DICTIONARY.
5194 ])
5195
5196 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5197                                     Variables
5198 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5199 │      │        │  Measurement │     │     │         │            │            │
5200 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5201 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5202 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5203 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5204 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5205 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5206 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5207 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5208 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5209 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5210 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5211 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5212 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5213 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5214 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5215 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5216 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5217
5218         Custom Tables
5219 ╭────────────┬─────┬────────╮
5220 │            │Count│  Mean  │
5221 ├────────────┼─────┼────────┤
5222 │n1     1.00 │    3│        │
5223 │       2.00 │    3│        │
5224 │       3.00 │    3│        │
5225 │       4.00 │    3│        │
5226 │       5.00 │    3│        │
5227 │       6.00 │    3│        │
5228 │       7.00 │    2│        │
5229 │       8.00 │    2│        │
5230 │       9.00 │    2│        │
5231 │       10.00│    1│        │
5232 ├────────────┼─────┼────────┤
5233 │n2     1.00 │    1│        │
5234 │       2.00 │    1│        │
5235 │       3.00 │    1│        │
5236 │       4.00 │    1│        │
5237 │       5.00 │    1│        │
5238 │       6.00 │    1│        │
5239 │       7.00 │    1│        │
5240 │       8.00 │    1│        │
5241 │       9.00 │    1│        │
5242 │       10.00│    1│        │
5243 │       11.00│    1│        │
5244 │       12.00│    1│        │
5245 │       13.00│    1│        │
5246 │       14.00│    1│        │
5247 │       15.00│    1│        │
5248 │       16.00│    1│        │
5249 │       17.00│    1│        │
5250 │       18.00│    1│        │
5251 │       19.00│    1│        │
5252 │       20.00│    1│        │
5253 │       21.00│    1│        │
5254 │       22.00│    1│        │
5255 │       23.00│    3│        │
5256 ├────────────┼─────┼────────┤
5257 │string      │   25│        │
5258 ├────────────┼─────┼────────┤
5259 │s1          │     │   12.96│
5260 ├────────────┼─────┼────────┤
5261 │s2          │     │    4.76│
5262 ├────────────┼─────┼────────┤
5263 │s3          │     │    4.86│
5264 ├────────────┼─────┼────────┤
5265 │s4          │     │   16.60│
5266 ├────────────┼─────┼────────┤
5267 │s5          │     │14004.44│
5268 ╰────────────┴─────┴────────╯
5269
5270                                     Variables
5271 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5272 │      │        │  Measurement │     │     │         │            │            │
5273 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5274 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5275 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5276 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5277 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5278 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5279 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5280 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5281 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5282 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5283 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5284 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5285 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5286 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5287 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5288 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5289 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5290 ])
5291 AT_CLEANUP