testing progresses
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet tested:
4 dnl - Summary functions:
5 dnl   * WEIGHT and adjustment weights.
6 dnl   * details of missing value handling in summaries.
7 dnl
8 dnl Not for v1:
9 dnl - Multiple response sets
10 dnl - MRSETS subcommand.
11 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
12 dnl - SIGTEST
13 dnl - COMPARETEST
14 dnl - Summary functions:
15 dnl   * .LCL and .UCL suffixes.
16 dnl   * .SE suffixes.
17 dnl - Summary functions:
18 dnl   * )CILEVEL in summary label specification
19 dnl - CATEGORIES:
20 dnl   * Data-dependent sorting.
21
22 AT_SETUP([CTABLES parsing])
23 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
24 AT_DATA([ctables.sps],
25 [[GET 'nhtsa.sav'.
26 CTABLES
27     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
28     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
29     /FORMAT UNITS=CM EMPTY="(-)"
30     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
31     /VLABELS VARIABLES=qn17 DISPLAY=NAME
32     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
33     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
34     /VLABELS VARIABLES=qn20 DISPLAY=NONE
35     /MRSETS COUNTDUPLICATES=NO
36     /MRSETS COUNTDUPLICATES=YES
37     /SMISSING VARIABLE
38     /SMISSING LISTWISE
39     /WEIGHT VARIABLE=qns3a
40     /HIDESMALLCOUNTS
41     /HIDESMALLCOUNTS COUNT=10
42     /TABLE qnsa1
43     /SLABELS POSITION=COLUMN VISIBLE=YES
44     /SLABELS VISIBLE=NO POSITION=ROW
45     /SLABELS POSITION=LAYER
46     /CLABELS AUTO
47     /CLABELS ROWLABELS=OPPOSITE
48     /CRITERIA CILEVEL=50
49     /CATEGORIES VARIABLES=qn1 qn17
50                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
51                 POSITION=BEFORE EMPTY=INCLUDE.
52 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
53 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
54 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
55 ]])
56 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
57          Custom Tables
58 Count
59 ╭───────────────────┬────┬────╮
60 │                   │ RDD│CELL│
61 ├───────────────────┼────┼────┤
62 │Sa1. SAMPLE SOURCE:│5392│1607│
63 ╰───────────────────┴────┴────╯
64
65        Custom Tables
66 RDD
67 ╭───────────────────┬─────╮
68 │                   │Count│
69 ├───────────────────┼─────┤
70 │Sa1. SAMPLE SOURCE:│ 5392│
71 ╰───────────────────┴─────╯
72
73           Custom Tables
74 ╭────────────────────────┬─────╮
75 │                        │Count│
76 ├────────────────────────┼─────┤
77 │Sa1. SAMPLE SOURCE: RDD │ 5392│
78 │                    CELL│ 1607│
79 ╰────────────────────────┴─────╯
80
81           Custom Tables
82 ╭────────────────────────┬─────╮
83 │                        │Count│
84 ├────────────────────────┼─────┤
85 │Sa1. SAMPLE SOURCE: RDD │ 5392│
86 │                    CELL│ 1607│
87 ╰────────────────────────┴─────╯
88 ])
89 AT_CLEANUP
90
91 AT_SETUP([CTABLES parsing - negative])
92 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
93 AT_DATA([ctables.sps],
94 [[GET 'nhtsa.sav'.
95 CTABLES.
96 CTABLES /FORMAT MINCOLWIDTH='foo'.
97 CTABLES /TABLE qn1 [**].
98 CTABLES /TABLE qn1 [NOTAFUNCTION].
99 CTABLES /TABLE (qn1.
100 CTABLES /TABLE **.
101 CTABLES /TABLE NOTAVAR.
102 STRING string(A8).
103 CTABLES /TABLE string[S].
104 CTABLES /TABLE qn1 [PTILE 101].
105 CTABLES /TABLE qn1 [MEAN F0.1].
106 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
107 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
108 CTABLES /TABLE qn1 [MEAN TOTALS].
109 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
110 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
111 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
112 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
113 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
114 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
115 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
116 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
117 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
118 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
119 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
120 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
121 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
122 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
123 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
124 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
127 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
128 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
129 CTABLES /PCOMPUTE &k=EXPR([LO **]).
130 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
131 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
132 CTABLES /PCOMPUTE &k=EXPR([1**]).
133 CTABLES /PCOMPUTE &k=EXPR((1x)).
134 CTABLES /PCOMPUTE **k.
135 CTABLES /PCOMPUTE &1.
136 CTABLES /PCOMPUTE &k**.
137 CTABLES /PCOMPUTE &k=**.
138 CTABLES /PCOMPUTE &k=EXPR**.
139 CTABLES /PCOMPUTE &k=EXPR(1x).
140 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
141 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
142 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
143 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
144 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
145 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
146 CTABLES /FORMAT EMPTY=**.
147 CTABLES /FORMAT MISSING=**.
148 CTABLES /FORMAT **.
149 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
150 CTABLES /VLABELS **.
151 CTABLES /VLABELS VARIABLES=NOTAVAR.
152 CTABLES /VLABELS VARIABLES=qn1 **.
153 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
154 CTABLES /MRSETS **.
155 CTABLES /MRSETS COUNTDUPLICATES=**.
156 CTABLES /SMISSING **.
157 CTABLES /WEIGHT **.
158 CTABLES /WEIGHT VARIABLE=NOTAVAR.
159 CTABLES /HIDESMALLCOUNTS COUNT=1.
160 CTABLES /QUUX.
161 CTABLES /HIDESMALLCOUNTS COUNT=2.
162 CTABLES /TABLE qn1**.
163 CTABLES /TABLE qn1 /SLABELS POSITION=**.
164 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
165 CTABLES /TABLE qn1 /SLABELS **.
166 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
167 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
168 CTABLES /TABLE qn1 /CLABELS **.
169 CTABLES /TABLE qn1 /CRITERIA **.
170 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
171 CTABLES /TABLE qn1 /TITLES **.
172 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
173 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
174 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
175 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
176 CTABLES /TABLE qn1 /SIGTEST **.
177 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
178 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
179 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
180 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
181 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
182 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
183 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
184 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
185 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
186 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
187 CTABLES /TABLE qn1 /COMPARETEST **.
188 CTABLES /TABLE qn1 / **.
189 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
190 CTABLES /TABLE qn20 > qnd1.
191 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
192 NUMERIC datetime (DATETIME17.0).
193 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
194 ]])
195 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
196 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
197
198 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
199 negative number for MINCOLWIDTH.
200
201 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
202 identifier.
203
204 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
205 summary function name.
206
207 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
208
209 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
210 identifier.
211
212 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
213
214 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
215 scale variable.
216    10 | CTABLES /TABLE string[S].
217       |                ^~~~~~~~~
218
219 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
220 between 0 and 100 for PTILE.
221
222 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
223 requires a width between 1 and 40.
224
225 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
226 format NEGPAREN requires width 2 or greater.
227
228 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
229 format NEGPAREN requires width greater than decimals.
230
231 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
232 scale variables.
233    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
234       |                     ^~~~
235
236 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
237    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
238       |                ^~~
239
240 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
241
242 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
243 scale variables.
244    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
245       |                     ^~~~
246
247 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
248    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
249       |                ^~~
250
251 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
252
253 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
254
255 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
256
257 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
258
259 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
260
261 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
262
263 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
264 identifier.
265
266 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
267    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
268       |                                               ^~
269
270 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
271 between 0 and 100 for PTILE.
272
273 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
274 `@:}@'.
275
276 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
277 `@{:@'.
278
279 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
280 or EXCLUDE.
281
282 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
283 NO.
284
285 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
286
287 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
288 or AFTER.
289
290 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
291 or EXCLUDE.
292
293 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
294 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
295
296 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
297 LABEL, POSITION, or EMPTY.
298
299 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
300 integer for SUBTOTAL.
301
302 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
303
304 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
305
306 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
307
308 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
309
310 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
311
312 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
313
314 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
315
316 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
317
318 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
319
320 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
321
322 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
323
324 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
325
326 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
327 the previous definition.
328    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
329       |                               ^~~~~~~~~~~~~~~~~~~
330
331 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
332    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
333       |          ^~~~~~~~~~~~~~~~~~~
334
335 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
336 `/'.
337
338 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
339 Expecting summary function name.
340
341 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
342 between 0 and 100 for PTILE.
343
344 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
345
346 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
347 NO.
348
349 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
350 FORMAT, or HIDESOURCECATS.
351
352 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
353
354 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
355
356 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
357 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
358
359 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
360 MAXCOLWIDTH.
361
362 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
363 VARIABLES.
364
365 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
366
367 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
368 DISPLAY.
369
370 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
371 DEFAULT, NAME, LABEL, BOTH, or NONE.
372
373 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
374 COUNTDUPLICATES.
375
376 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
377 NO.
378
379 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
380 VARIABLE or LISTWISE.
381
382 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
383 VARIABLE.
384
385 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
386
387 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
388 greater for HIDESMALLCOUNTS COUNT.
389
390 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
391 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
392 HIDESMALLCOUNTS, or TABLE.
393
394 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
395 `/'.
396
397 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
398
399 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
400 ROW, or LAYER.
401
402 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
403 NO.
404
405 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
406 POSITION or VISIBLE.
407
408 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
409 OPPOSITE or LAYER.
410
411 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
412 OPPOSITE or LAYER.
413
414 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
415 ROWLABELS, or COLLABELS.
416
417 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
418 CILEVEL.
419
420 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
421 in @<:@0,100@:}@ for CILEVEL.
422
423 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
424 CAPTION, CORNER, or TITLE.
425
426 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
427 CHISQUARE.
428
429 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
430 in @<:@0,1@:}@ for ALPHA.
431
432 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
433 NO.
434
435 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
436 ALLVISIBLE or SUBTOTALS.
437
438 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
439 ALPHA, INCLUDEMRSETS, or CATEGORIES.
440
441 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
442 MEAN.
443
444 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
445 in (0,1) for ALPHA.
446
447 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
448 for ALPHA.
449
450 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
451 BONFERRONI, BH, or NONE.
452
453 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
454 NO.
455
456 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
457 or TESTEDCATS.
458
459 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
460 ALLVISIBLE or SUBTOTALS.
461
462 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
463 NO.
464
465 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
466 SIMPLE.
467
468 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
469 NO.
470
471 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
472 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
473 SHOWSIG.
474
475 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
476 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
477
478 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
479 specified.
480
481 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
482    97 | CTABLES /TABLE qn20 > qnd1.
483       |                ^~~~~~~~~~~
484
485 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
486    97 | CTABLES /TABLE qn20 > qnd1.
487       |                ^~~~
488
489 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
490    97 | CTABLES /TABLE qn20 > qnd1.
491       |                       ^~~~
492
493 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
494 categorical variables at the innermost nesting level.
495    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
496       |                ^~~~~~~~~~~~~~~~~~~~
497
498 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
499 summary.
500    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
501       |                ^~~
502
503 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
504 specification as format DATETIME: Day (123) must be between 1 and 31..
505   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
506       |                                                    ^~~~~
507 ]])
508 AT_CLEANUP
509
510 AT_SETUP([CTABLES parsing - more negative])
511 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
512 AT_DATA([ctables.sps],
513 [[GET 'nhtsa.sav'.
514 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
515 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
516 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
517
518 STRING string(A8).
519 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
520 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
521
522 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
523
524 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
525 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
526 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
527 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
528
529 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
530 CTABLES /PCOMPUTE &x=EXPR([**]).
531 CTABLES /PCOMPUTE &x=EXPR(**).
532
533 CTABLES /TABLE.
534
535 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
536 ]])
537 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
538 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
539 category not included in the category list.
540     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
541 VARIABLES=qn1 [&pc].
542       |
543 ^~~
544
545 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
546     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
547 VARIABLES=qn1 [&pc].
548       |                            ^~~~~~~~
549
550 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
551 list of categories here.
552     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
553 VARIABLES=qn1 [&pc].
554       |
555 ^~~~
556
557 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
558 category not included in the category list.
559     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
560 [&pc].
561       |
562 ^~~
563
564 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
565     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
566 [&pc].
567       |                            ^~~~~
568
569 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
570 variable's CATEGORIES specification.
571
572 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
573 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
574 subtotals by position, e.g. SUBTOTAL[1].
575     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
576 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
577       |
578 ^~~~~~~~~~~~~~~~~~~~~~~~
579
580 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
581 position.
582     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
583 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
584       |                            ^~~~~~~~
585
586 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
587 applied only to string variables, but this subcommand tries to apply it to
588 numeric variable QN1.
589     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
590       |                                               ^~~~~~~~
591
592 ctables.sps:8.53: error: CTABLES: This category specification may be applied
593 only to numeric variables, but this subcommand tries to apply it to string
594 variable string.
595     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
596       |                                                     ^
597
598 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
599 based on a summary function.
600
601 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
602 moved to be categorical, but qnd1 is a scale variable.
603
604 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
605 moved to have the same width, but QN1 has width 0 and string has width 8.
606
607 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
608 moved to have the same value labels, but QN1 and QNSA1 have different value
609 labels.
610
611 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
612 moved to have the same category specifications, but QN105BA and QN105BB have
613 different category specifications.
614
615 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
616 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
617 this warning, insert parentheses.
618    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
619       |                           ^~~~~~~
620
621 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
622 `/'.
623
624 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
625
626 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
627
628 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
629 variable must be specified.
630
631 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
632
633 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
634 summary.
635    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
636       |                                                  ^~~~~
637
638 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
639 summary.
640    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
641       |                ^~~~~
642
643 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
644 summary.
645    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
646       |                                 ^~~~~
647
648 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
649 has a summary even if the syntax does not explicitly specify one.
650    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
651       |                                 ^~~~~
652 ]])
653 AT_CLEANUP
654
655 AT_SETUP([CTABLES one categorical variable])
656 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
657 AT_DATA([ctables.sps],
658 [[GET 'nhtsa.sav'.
659 CTABLES /TABLE qn1.
660 CTABLES /TABLE BY qn1.
661 CTABLES /TABLE BY BY qn1.
662 ]])
663 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
664                                   Custom Tables
665 ╭────────────────────────────────────────────────────────────────────────┬─────╮
666 │                                                                        │Count│
667 ├────────────────────────────────────────────────────────────────────────┼─────┤
668 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
669 │motor vehicle?                                     Several days a week  │ 1274│
670 │                                                   Once a week or less  │  361│
671 │                                                   Only certain times a │  130│
672 │                                                   year                 │     │
673 │                                                   Never                │  540│
674 ╰────────────────────────────────────────────────────────────────────────┴─────╯
675
676                                   Custom Tables
677 ╭──────────────────────────────────────────────────────────────────────────────╮
678 │        1. How often do you usually drive a car or other motor vehicle?       │
679 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
680 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
681 │Every day│       week       │       less       │          year          │Never│
682 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
683 │  Count  │       Count      │       Count      │          Count         │Count│
684 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
685 │     4667│              1274│               361│                     130│  540│
686 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
687
688 Custom Tables
689 Every day
690 ╭─────╮
691 │Count│
692 ├─────┤
693 │ 4667│
694 ╰─────╯
695 ])
696 AT_CLEANUP
697
698 AT_SETUP([CTABLES one string variable])
699 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
700 AT_DATA([ctables.sps],
701 [[GET 'nhtsa.sav'.
702 STRING licensed(A8).
703 MISSING VALUES licensed('DontKnow', 'Refused').
704 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
705 CTABLES /TABLE licensed.
706 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
707 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
708 * Notice that the string matching is case-sensitive.
709 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
710 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
711 CTABLES
712     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
713     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
714     /TABLE licensed
715     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
716 CTABLES
717     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
718     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
719     /TABLE licensed
720     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
721 ]])
722 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
723     Custom Tables
724 ╭────────────┬─────╮
725 │            │Count│
726 ├────────────┼─────┤
727 │licensed No │  572│
728 │         Yes│ 6379│
729 ╰────────────┴─────╯
730
731           Custom Tables
732 ╭─────────────────┬─────┬───────╮
733 │                 │Count│Valid N│
734 ├─────────────────┼─────┼───────┤
735 │licensed DontKnow│    4│       │
736 │         No      │  572│       │
737 │         Refused │   44│       │
738 │         Yes     │ 6379│       │
739 │         Total   │ 6999│   6951│
740 ╰─────────────────┴─────┴───────╯
741
742      Custom Tables
743 ╭──────────────┬─────╮
744 │              │Count│
745 ├──────────────┼─────┤
746 │licensed Yes  │ 6379│
747 │         No   │  572│
748 │         Total│ 6951│
749 ╰──────────────┴─────╯
750
751      Custom Tables
752 ╭──────────────┬─────╮
753 │              │Count│
754 ├──────────────┼─────┤
755 │licensed Yes  │ 6379│
756 │         no   │    0│
757 │         Total│ 6379│
758 ╰──────────────┴─────╯
759
760       Custom Tables
761 ╭────────────────┬─────╮
762 │                │Count│
763 ├────────────────┼─────┤
764 │licensed No     │  572│
765 │         Refused│   44│
766 │         Yes    │ 6379│
767 │         Total  │ 6995│
768 ╰────────────────┴─────╯
769
770       Custom Tables
771 ╭────────────────┬─────╮
772 │                │Count│
773 ├────────────────┼─────┤
774 │licensed Yes    │ 6379│
775 │         Not Yes│  620│
776 ╰────────────────┴─────╯
777
778       Custom Tables
779 ╭────────────────┬─────╮
780 │                │Count│
781 ├────────────────┼─────┤
782 │licensed Yes    │ 6379│
783 │         Not Yes│  620│
784 ╰────────────────┴─────╯
785 ])
786 AT_CLEANUP
787
788 AT_SETUP([CTABLES one scale variable])
789 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
790 AT_DATA([ctables.sps],
791 [[GET 'nhtsa.sav'.
792 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
793 CTABLES /TABLE BY qnd1.
794 CTABLES /TABLE BY BY qnd1.
795 ]])
796 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
797                                   Custom Tables
798 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
799 │                      │     │       │       │    │     Std    │       │       │
800 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
801 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
802 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
803 │age?                  │     │       │       │    │            │       │       │
804 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
805
806         Custom Tables
807 ╭──────────────────────────╮
808 │D1. AGE: What is your age?│
809 ├──────────────────────────┤
810 │           Mean           │
811 ├──────────────────────────┤
812 │                        48│
813 ╰──────────────────────────╯
814
815 Custom Tables
816 D1. AGE: What is your age?
817 ╭────╮
818 │Mean│
819 ├────┤
820 │  48│
821 ╰────╯
822 ])
823 AT_CLEANUP
824
825 AT_SETUP([CTABLES simple stacking])
826 AT_KEYWORDS([stack stacked])
827 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
828 AT_DATA([ctables.sps],
829 [[GET 'nhtsa.sav'.
830 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
831 ]])
832 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
833                                   Custom Tables
834 ╭───────────────────────────────────────────────────────────────┬──────────────╮
835 │                                                               │ S3a. GENDER: │
836 │                                                               ├──────┬───────┤
837 │                                                               │ Male │ Female│
838 │                                                               ├──────┼───────┤
839 │                                                               │Column│ Column│
840 │                                                               │   %  │   %   │
841 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
842 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
843 │too much to drink to drive safely will A. Get      certain     │      │       │
844 │stopped by the police?                             Very likely │   21%│    22%│
845 │                                                   Somewhat    │   38%│    42%│
846 │                                                   likely      │      │       │
847 │                                                   Somewhat    │   21%│    18%│
848 │                                                   unlikely    │      │       │
849 │                                                   Very        │   10%│     8%│
850 │                                                   unlikely    │      │       │
851 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
852 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
853 │too much to drink to drive safely will B. Have an  certain     │      │       │
854 │accident?                                          Very likely │   36%│    45%│
855 │                                                   Somewhat    │   39%│    32%│
856 │                                                   likely      │      │       │
857 │                                                   Somewhat    │    9%│     4%│
858 │                                                   unlikely    │      │       │
859 │                                                   Very        │    3%│     2%│
860 │                                                   unlikely    │      │       │
861 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
862 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
863 │too much to drink to drive safely will C. Be       certain     │      │       │
864 │convicted for drunk driving?                       Very likely │   32%│    28%│
865 │                                                   Somewhat    │   27%│    32%│
866 │                                                   likely      │      │       │
867 │                                                   Somewhat    │   15%│    15%│
868 │                                                   unlikely    │      │       │
869 │                                                   Very        │    9%│     9%│
870 │                                                   unlikely    │      │       │
871 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
872 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
873 │too much to drink to drive safely will D. Be       certain     │      │       │
874 │arrested for drunk driving?                        Very likely │   26%│    27%│
875 │                                                   Somewhat    │   32%│    35%│
876 │                                                   likely      │      │       │
877 │                                                   Somewhat    │   17%│    15%│
878 │                                                   unlikely    │      │       │
879 │                                                   Very        │    9%│     7%│
880 │                                                   unlikely    │      │       │
881 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
882 ])
883 AT_CLEANUP
884
885 AT_SETUP([CTABLES show or hide empty categories])
886 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
887 AT_DATA([ctables.sps],
888 [[GET 'nhtsa.sav'.
889 IF (qn105ba = 2) qn105ba = 1.
890 IF (qns3a = 1) qns3a = 2.
891 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
892 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
893     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
894 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
895     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
896 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
897     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
898 ]])
899 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
900                                   Custom Tables
901 ╭──────────────────────────────────────────────────────────────┬───────────────╮
902 │                                                              │  S3a. GENDER: │
903 │                                                              ├───────┬───────┤
904 │                                                              │  Male │ Female│
905 │                                                              ├───────┼───────┤
906 │                                                              │ Column│ Column│
907 │                                                              │   %   │   %   │
908 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
909 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
910 │too much to drink to drive safely will A. Get      certain    │       │       │
911 │stopped by the police?                             Very likely│      .│     0%│
912 │                                                   Somewhat   │      .│    40%│
913 │                                                   likely     │       │       │
914 │                                                   Somewhat   │      .│    19%│
915 │                                                   unlikely   │       │       │
916 │                                                   Very       │      .│     9%│
917 │                                                   unlikely   │       │       │
918 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
919
920                                   Custom Tables
921 ╭──────────────────────────────────────────────────────────────┬───────────────╮
922 │                                                              │  S3a. GENDER: │
923 │                                                              ├───────┬───────┤
924 │                                                              │  Male │ Female│
925 │                                                              ├───────┼───────┤
926 │                                                              │ Column│ Column│
927 │                                                              │   %   │   %   │
928 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
929 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
930 │too much to drink to drive safely will A. Get      certain    │       │       │
931 │stopped by the police?                             Somewhat   │      .│    40%│
932 │                                                   likely     │       │       │
933 │                                                   Somewhat   │      .│    19%│
934 │                                                   unlikely   │       │       │
935 │                                                   Very       │      .│     9%│
936 │                                                   unlikely   │       │       │
937 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
938
939                                   Custom Tables
940 ╭────────────────────────────────────────────────────────────────────┬─────────╮
941 │                                                                    │   S3a.  │
942 │                                                                    │ GENDER: │
943 │                                                                    ├─────────┤
944 │                                                                    │  Female │
945 │                                                                    ├─────────┤
946 │                                                                    │ Column %│
947 ├────────────────────────────────────────────────────────────────────┼─────────┤
948 │105b. How likely is it that drivers who have had too    Almost      │      32%│
949 │much to drink to drive safely will A. Get stopped by    certain     │         │
950 │the police?                                             Very likely │       0%│
951 │                                                        Somewhat    │      40%│
952 │                                                        likely      │         │
953 │                                                        Somewhat    │      19%│
954 │                                                        unlikely    │         │
955 │                                                        Very        │       9%│
956 │                                                        unlikely    │         │
957 ╰────────────────────────────────────────────────────────────────────┴─────────╯
958
959                                   Custom Tables
960 ╭────────────────────────────────────────────────────────────────────┬─────────╮
961 │                                                                    │   S3a.  │
962 │                                                                    │ GENDER: │
963 │                                                                    ├─────────┤
964 │                                                                    │  Female │
965 │                                                                    ├─────────┤
966 │                                                                    │ Column %│
967 ├────────────────────────────────────────────────────────────────────┼─────────┤
968 │105b. How likely is it that drivers who have had too    Almost      │      32%│
969 │much to drink to drive safely will A. Get stopped by    certain     │         │
970 │the police?                                             Somewhat    │      40%│
971 │                                                        likely      │         │
972 │                                                        Somewhat    │      19%│
973 │                                                        unlikely    │         │
974 │                                                        Very        │       9%│
975 │                                                        unlikely    │         │
976 ╰────────────────────────────────────────────────────────────────────┴─────────╯
977 ])
978 AT_CLEANUP
979
980 AT_SETUP([CTABLES sorting categories])
981 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
982 AT_DATA([ctables.sps],
983 [[GET 'nhtsa.sav'.
984 IF (QND5A=6) QND5A=-1.
985 IF (QND5A=5) QND5A=-2.
986 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
987         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
988         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
989         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
990 ]])
991 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
992                                   Custom Tables
993 ╭────────────────────────────────────────────────────────────────────────┬─────╮
994 │                                                                        │Count│
995 ├────────────────────────────────────────────────────────────────────────┼─────┤
996 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
997 │background?                                     -1.00                   │   78│
998 │                                                Cuban                   │   20│
999 │                                                Mexican                 │  311│
1000 │                                                Spanish                 │   48│
1001 │                                                South American          │   34│
1002 │                                                Central American        │    0│
1003 │                                                Puerto Rican, OR        │    0│
1004 │                                                Something else          │   68│
1005 │                                                Multiple - cannot choose│    7│
1006 │                                                one                     │     │
1007 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1008
1009                                   Custom Tables
1010 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1011 │                                                                        │Count│
1012 ├────────────────────────────────────────────────────────────────────────┼─────┤
1013 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1014 │background?                                     one                     │     │
1015 │                                                Something else          │   68│
1016 │                                                Puerto Rican, OR        │    0│
1017 │                                                Central American        │    0│
1018 │                                                South American          │   34│
1019 │                                                Spanish                 │   48│
1020 │                                                Mexican                 │  311│
1021 │                                                Cuban                   │   20│
1022 │                                                -1.00                   │   78│
1023 │                                                -2.00                   │   52│
1024 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1025
1026                                   Custom Tables
1027 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1028 │                                                                        │Count│
1029 ├────────────────────────────────────────────────────────────────────────┼─────┤
1030 │D5a. What would you say is your primary ethnic  Central American        │    0│
1031 │background?                                     Cuban                   │   20│
1032 │                                                Mexican                 │  311│
1033 │                                                Multiple - cannot choose│    7│
1034 │                                                one                     │     │
1035 │                                                Puerto Rican, OR        │    0│
1036 │                                                Something else          │   68│
1037 │                                                South American          │   34│
1038 │                                                Spanish                 │   48│
1039 │                                                -2.00                   │   52│
1040 │                                                -1.00                   │   78│
1041 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1042
1043                                   Custom Tables
1044 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1045 │                                                                        │Count│
1046 ├────────────────────────────────────────────────────────────────────────┼─────┤
1047 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1048 │background?                                     South American          │   34│
1049 │                                                Something else          │   68│
1050 │                                                Puerto Rican, OR        │    0│
1051 │                                                Multiple - cannot choose│    7│
1052 │                                                one                     │     │
1053 │                                                Mexican                 │  311│
1054 │                                                Cuban                   │   20│
1055 │                                                Central American        │    0│
1056 │                                                -1.00                   │   78│
1057 │                                                -2.00                   │   52│
1058 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1059 ])
1060 AT_CLEANUP
1061
1062 AT_SETUP([CTABLES simple nesting])
1063 AT_KEYWORDS([nest nested])
1064 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1065 AT_DATA([ctables.sps],
1066 [[GET 'nhtsa.sav'.
1067 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1068   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1069 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1070   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1071   /CLABELS ROW=OPPOSITE.
1072 ]])
1073 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1074                                   Custom Tables
1075 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1076 │                                                                 │     │ Table│
1077 │                                                                 │Count│   %  │
1078 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1079 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1080 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1081 │drive safely will A. Get stopped by                        Total │  700│   10%│
1082 │the police?                           ╶──────────────────────────┼─────┼──────┤
1083 │                                       Very       S3a.     Male  │  660│   10%│
1084 │                                       likely     GENDER:  Female│  842│   12%│
1085 │                                                           Total │ 1502│   22%│
1086 │                                      ╶──────────────────────────┼─────┼──────┤
1087 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1088 │                                       likely     GENDER:  Female│ 1589│   23%│
1089 │                                                           Total │ 2763│   40%│
1090 │                                      ╶──────────────────────────┼─────┼──────┤
1091 │                                       Somewhat   S3a.     Male  │  640│    9%│
1092 │                                       unlikely   GENDER:  Female│  667│   10%│
1093 │                                                           Total │ 1307│   19%│
1094 │                                      ╶──────────────────────────┼─────┼──────┤
1095 │                                       Very       S3a.     Male  │  311│    5%│
1096 │                                       unlikely   GENDER:  Female│  298│    4%│
1097 │                                                           Total │  609│    9%│
1098 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1099 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1100 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1101 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1102 │                                      ╶──────────────────────────┼─────┼──────┤
1103 │                                       Very       S3a.     Male  │ 1104│   16%│
1104 │                                       likely     GENDER:  Female│ 1715│   25%│
1105 │                                                           Total │ 2819│   41%│
1106 │                                      ╶──────────────────────────┼─────┼──────┤
1107 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1108 │                                       likely     GENDER:  Female│ 1214│   18%│
1109 │                                                           Total │ 2417│   35%│
1110 │                                      ╶──────────────────────────┼─────┼──────┤
1111 │                                       Somewhat   S3a.     Male  │  262│    4%│
1112 │                                       unlikely   GENDER:  Female│  168│    2%│
1113 │                                                           Total │  430│    6%│
1114 │                                      ╶──────────────────────────┼─────┼──────┤
1115 │                                       Very       S3a.     Male  │   81│    1%│
1116 │                                       unlikely   GENDER:  Female│   59│    1%│
1117 │                                                           Total │  140│    2%│
1118 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1119 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1120 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1121 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1122 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1123 │                                       Very       S3a.     Male  │  988│   14%│
1124 │                                       likely     GENDER:  Female│ 1049│   15%│
1125 │                                                           Total │ 2037│   30%│
1126 │                                      ╶──────────────────────────┼─────┼──────┤
1127 │                                       Somewhat   S3a.     Male  │  822│   12%│
1128 │                                       likely     GENDER:  Female│ 1210│   18%│
1129 │                                                           Total │ 2032│   30%│
1130 │                                      ╶──────────────────────────┼─────┼──────┤
1131 │                                       Somewhat   S3a.     Male  │  446│    7%│
1132 │                                       unlikely   GENDER:  Female│  548│    8%│
1133 │                                                           Total │  994│   15%│
1134 │                                      ╶──────────────────────────┼─────┼──────┤
1135 │                                       Very       S3a.     Male  │  268│    4%│
1136 │                                       unlikely   GENDER:  Female│  354│    5%│
1137 │                                                           Total │  622│    9%│
1138 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1139 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1140 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1141 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1142 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1143 │                                       Very       S3a.     Male  │  805│   12%│
1144 │                                       likely     GENDER:  Female│ 1029│   15%│
1145 │                                                           Total │ 1834│   27%│
1146 │                                      ╶──────────────────────────┼─────┼──────┤
1147 │                                       Somewhat   S3a.     Male  │  975│   14%│
1148 │                                       likely     GENDER:  Female│ 1332│   19%│
1149 │                                                           Total │ 2307│   34%│
1150 │                                      ╶──────────────────────────┼─────┼──────┤
1151 │                                       Somewhat   S3a.     Male  │  535│    8%│
1152 │                                       unlikely   GENDER:  Female│  560│    8%│
1153 │                                                           Total │ 1095│   16%│
1154 │                                      ╶──────────────────────────┼─────┼──────┤
1155 │                                       Very       S3a.     Male  │  270│    4%│
1156 │                                       unlikely   GENDER:  Female│  279│    4%│
1157 │                                                           Total │  549│    8%│
1158 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1159
1160                                   Custom Tables
1161 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1162 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1163 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1164 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1165 │                                 │        │ Table│         │         │        │
1166 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1167 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1168 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1169 │GENDER:        is it that drivers│        │      │         │         │        │
1170 │               who have had too  │        │      │         │         │        │
1171 │               much to drink to  │        │      │         │         │        │
1172 │               drive safely will │        │      │         │         │        │
1173 │               A. Get stopped by │        │      │         │         │        │
1174 │               the police?       │        │      │         │         │        │
1175 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1176 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1177 │               is it that drivers│        │      │         │         │        │
1178 │               who have had too  │        │      │         │         │        │
1179 │               much to drink to  │        │      │         │         │        │
1180 │               drive safely will │        │      │         │         │        │
1181 │               A. Get stopped by │        │      │         │         │        │
1182 │               the police?       │        │      │         │         │        │
1183 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1184 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1185 │               is it that drivers│        │      │         │         │        │
1186 │               who have had too  │        │      │         │         │        │
1187 │               much to drink to  │        │      │         │         │        │
1188 │               drive safely will │        │      │         │         │        │
1189 │               A. Get stopped by │        │      │         │         │        │
1190 │               the police?       │        │      │         │         │        │
1191 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1192 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1193 │GENDER:        is it that drivers│        │      │         │         │        │
1194 │               who have had too  │        │      │         │         │        │
1195 │               much to drink to  │        │      │         │         │        │
1196 │               drive safely will │        │      │         │         │        │
1197 │               B. Have an        │        │      │         │         │        │
1198 │               accident?         │        │      │         │         │        │
1199 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1200 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1201 │               is it that drivers│        │      │         │         │        │
1202 │               who have had too  │        │      │         │         │        │
1203 │               much to drink to  │        │      │         │         │        │
1204 │               drive safely will │        │      │         │         │        │
1205 │               B. Have an        │        │      │         │         │        │
1206 │               accident?         │        │      │         │         │        │
1207 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1208 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1209 │               is it that drivers│        │      │         │         │        │
1210 │               who have had too  │        │      │         │         │        │
1211 │               much to drink to  │        │      │         │         │        │
1212 │               drive safely will │        │      │         │         │        │
1213 │               B. Have an        │        │      │         │         │        │
1214 │               accident?         │        │      │         │         │        │
1215 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1216 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1217 │GENDER:        is it that drivers│        │      │         │         │        │
1218 │               who have had too  │        │      │         │         │        │
1219 │               much to drink to  │        │      │         │         │        │
1220 │               drive safely will │        │      │         │         │        │
1221 │               C. Be convicted   │        │      │         │         │        │
1222 │               for drunk driving?│        │      │         │         │        │
1223 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1224 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1225 │               is it that drivers│        │      │         │         │        │
1226 │               who have had too  │        │      │         │         │        │
1227 │               much to drink to  │        │      │         │         │        │
1228 │               drive safely will │        │      │         │         │        │
1229 │               C. Be convicted   │        │      │         │         │        │
1230 │               for drunk driving?│        │      │         │         │        │
1231 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1232 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1233 │               is it that drivers│        │      │         │         │        │
1234 │               who have had too  │        │      │         │         │        │
1235 │               much to drink to  │        │      │         │         │        │
1236 │               drive safely will │        │      │         │         │        │
1237 │               C. Be convicted   │        │      │         │         │        │
1238 │               for drunk driving?│        │      │         │         │        │
1239 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1240 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1241 │GENDER:        is it that drivers│        │      │         │         │        │
1242 │               who have had too  │        │      │         │         │        │
1243 │               much to drink to  │        │      │         │         │        │
1244 │               drive safely will │        │      │         │         │        │
1245 │               D. Be arrested for│        │      │         │         │        │
1246 │               drunk driving?    │        │      │         │         │        │
1247 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1248 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1249 │               is it that drivers│        │      │         │         │        │
1250 │               who have had too  │        │      │         │         │        │
1251 │               much to drink to  │        │      │         │         │        │
1252 │               drive safely will │        │      │         │         │        │
1253 │               D. Be arrested for│        │      │         │         │        │
1254 │               drunk driving?    │        │      │         │         │        │
1255 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1256 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1257 │               is it that drivers│        │      │         │         │        │
1258 │               who have had too  │        │      │         │         │        │
1259 │               much to drink to  │        │      │         │         │        │
1260 │               drive safely will │        │      │         │         │        │
1261 │               D. Be arrested for│        │      │         │         │        │
1262 │               drunk driving?    │        │      │         │         │        │
1263 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1264 ])
1265 AT_CLEANUP
1266
1267 AT_SETUP([CTABLES nesting and scale variables])
1268 AT_KEYWORDS([nest nested])
1269 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1270 AT_DATA([ctables.sps],
1271 [[GET 'nhtsa.sav'.
1272 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1273 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1274 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1275   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1276 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1277 ]])
1278 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1279                                   Custom Tables
1280 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1281 │                                                                 │S3a. GENDER:│
1282 │                                                                 ├─────┬──────┤
1283 │                                                                 │ Male│Female│
1284 │                                                                 ├─────┼──────┤
1285 │                                                                 │ Mean│ Mean │
1286 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1287 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1288 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1289 │                                                  week           │     │      │
1290 │                                                  Once a week or │   44│    54│
1291 │                                                  less           │     │      │
1292 │                                                  Only certain   │   34│    41│
1293 │                                                  times a year   │     │      │
1294 │                                                  Never          │   39│    55│
1295 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1296
1297                                   Custom Tables
1298 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1299 │                                                         │Minimum│Maximum│Mean│
1300 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1301 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1302 │What is  GENDER:         months, has there been a        │       │       │    │
1303 │your                     time when you felt you          │       │       │    │
1304 │age?                     should cut down on your      No │     16│     86│  46│
1305 │                         drinking?                       │       │       │    │
1306 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1307 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1308 │                         months, has there been a        │       │       │    │
1309 │                         time when you felt you          │       │       │    │
1310 │                         should cut down on your      No │     16│     86│  48│
1311 │                         drinking?                       │       │       │    │
1312 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1313 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1314 │What is  GENDER:         months, has there been a        │       │       │    │
1315 │your                     time when people criticized  No │     16│     86│  46│
1316 │age?                     your drinking?                  │       │       │    │
1317 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1318 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1319 │                         months, has there been a        │       │       │    │
1320 │                         time when people criticized  No │     16│     86│  48│
1321 │                         your drinking?                  │       │       │    │
1322 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1323
1324                                   Custom Tables
1325 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1326 │                             │S1. Including yourself, how many members of this│
1327 │                             │         household are age 16 or older?         │
1328 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1329 │                             │      │      │      │      │      │      │ 6 or │
1330 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1331 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1332 │                             │Column│Column│Column│Column│Column│Column│Column│
1333 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1334 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1335 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1336 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1337 │SOURCE:     likely           │      │      │      │      │      │      │      │
1338 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1339 │            that     likely  │      │      │      │      │      │      │      │
1340 │            drivers          │      │      │      │      │      │      │      │
1341 │            who have         │      │      │      │      │      │      │      │
1342 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1343 │            much to  likely  │      │      │      │      │      │      │      │
1344 │            drink to         │      │      │      │      │      │      │      │
1345 │            drive            │      │      │      │      │      │      │      │
1346 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1347 │            will A.  unlikely│      │      │      │      │      │      │      │
1348 │            Get              │      │      │      │      │      │      │      │
1349 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1350 │            by the   unlikely│      │      │      │      │      │      │      │
1351 │            police?          │      │      │      │      │      │      │      │
1352 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1353
1354                                   Custom Tables
1355 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1356 │                                                              │    │    Std   │
1357 │                                                              │Mean│ Deviation│
1358 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1359 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1360 │group           typical month did you have one or more        │    │          │
1361 │                alcoholic beverages to drink?                 │    │          │
1362 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1363 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1364 │                typical month did you have one or more        │    │          │
1365 │                alcoholic beverages to drink?                 │    │          │
1366 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1367 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1368 │                typical month did you have one or more        │    │          │
1369 │                alcoholic beverages to drink?                 │    │          │
1370 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1371 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1372 │                typical month did you have one or more        │    │          │
1373 │                alcoholic beverages to drink?                 │    │          │
1374 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1375 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1376 │                typical month did you have one or more        │    │          │
1377 │                alcoholic beverages to drink?                 │    │          │
1378 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1379 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1380 │       older    typical month did you have one or more        │    │          │
1381 │                alcoholic beverages to drink?                 │    │          │
1382 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1383 ])
1384 AT_CLEANUP
1385
1386
1387 AT_SETUP([CTABLES SLABELS])
1388 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1389 AT_DATA([ctables.sps],
1390 [[GET 'nhtsa.sav'.
1391 CTABLES /TABLE qn1 [COUNT COLPCT].
1392 CTABLES /TABLE qn1 [COUNT COLPCT]
1393     /SLABELS POSITION=ROW.
1394 CTABLES /TABLE qn1 [COUNT COLPCT]
1395     /SLABELS POSITION=ROW VISIBLE=NO.
1396 ]])
1397 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1398                                   Custom Tables
1399 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1400 │                                                                │     │ Column│
1401 │                                                                │Count│   %   │
1402 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1403 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1404 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1405 │                                             Once a week or less│  361│   5.2%│
1406 │                                             Only certain times │  130│   1.9%│
1407 │                                             a year             │     │       │
1408 │                                             Never              │  540│   7.7%│
1409 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1410
1411                                   Custom Tables
1412 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1413 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1414 │other motor vehicle?                                             Column │66.9%│
1415 │                                                                 %      │     │
1416 │                                            ╶───────────────────────────┼─────┤
1417 │                                             Several days a week Count  │ 1274│
1418 │                                                                 Column │18.3%│
1419 │                                                                 %      │     │
1420 │                                            ╶───────────────────────────┼─────┤
1421 │                                             Once a week or less Count  │  361│
1422 │                                                                 Column │ 5.2%│
1423 │                                                                 %      │     │
1424 │                                            ╶───────────────────────────┼─────┤
1425 │                                             Only certain times  Count  │  130│
1426 │                                             a year              Column │ 1.9%│
1427 │                                                                 %      │     │
1428 │                                            ╶───────────────────────────┼─────┤
1429 │                                             Never               Count  │  540│
1430 │                                                                 Column │ 7.7%│
1431 │                                                                 %      │     │
1432 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1433
1434                                   Custom Tables
1435 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1436 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1437 │motor vehicle?                                                          │66.9%│
1438 │                                                   Several days a week  │ 1274│
1439 │                                                                        │18.3%│
1440 │                                                   Once a week or less  │  361│
1441 │                                                                        │ 5.2%│
1442 │                                                   Only certain times a │  130│
1443 │                                                   year                 │ 1.9%│
1444 │                                                   Never                │  540│
1445 │                                                                        │ 7.7%│
1446 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1447 ])
1448 AT_CLEANUP
1449
1450 AT_SETUP([CTABLES simple totals])
1451 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1452 AT_DATA([ctables.sps],
1453 [[GET 'nhtsa.sav'.
1454 CTABLES /TABLE=qn17
1455     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1456 DESCRIPTIVES qn18/STATISTICS=MEAN.
1457 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1458     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1459 ]])
1460 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1461                                   Custom Tables
1462 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1463 │                                                                        │Count│
1464 ├────────────────────────────────────────────────────────────────────────┼─────┤
1465 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1466 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1467 │                                                      Light beer        │  620│
1468 │                                                      Wine              │ 1418│
1469 │                                                      Wine coolers      │  137│
1470 │                                                      Hard liquor or    │  888│
1471 │                                                      mixed drinks      │     │
1472 │                                                      Flavored malt     │   83│
1473 │                                                      drinks            │     │
1474 │                                                      Number responding │ 4221│
1475 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1476
1477                              Descriptive Statistics
1478 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1479 │                                                                    │  N │Mean│
1480 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1481 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1482 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1483 │Valid N (listwise)                                                  │6999│    │
1484 │Missing N (listwise)                                                │2781│    │
1485 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1486
1487                                   Custom Tables
1488 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1489 │                                                      │    │     │ Valid│Total│
1490 │                                                      │Mean│Count│   N  │  N  │
1491 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1492 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1493 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1494 │                you usually drink per sitting?        │    │     │      │     │
1495 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1496 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1497 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1498 │                you usually drink per sitting?        │    │     │      │     │
1499 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1500 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1501 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1502 │                you usually drink per sitting?        │    │     │      │     │
1503 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1504 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1505 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1506 │                you usually drink per sitting?        │    │     │      │     │
1507 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1508 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1509 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1510 │                you usually drink per sitting?        │    │     │      │     │
1511 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1512 ])
1513 AT_CLEANUP
1514
1515 AT_SETUP([CTABLES subtotals])
1516 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1517 AT_DATA([ctables.sps],
1518 [[GET 'nhtsa.sav'.
1519 CTABLES /TABLE=qn105ba BY qns1
1520     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1521 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1522     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1523 CTABLES /TABLE=qn105ba BY qns1
1524     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1525     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1526 ]])
1527 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1528                                                       Custom Tables
1529 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1530 │                                                         │ S1. Including yourself, how many members of this household │
1531 │                                                         │                    are age 16 or older?                    │
1532 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1533 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1534 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1535 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1536 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1537 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1538 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1539 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1540 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1541 │                                              likely     │       │       │         │       │        │      │          │
1542 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1543 │                                              unlikely   │       │       │         │       │        │      │          │
1544 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1545 │                                              unlikely   │       │       │         │       │        │      │          │
1546 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1547
1548                                                       Custom Tables
1549 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1550 │                                                        │  S1. Including yourself, how many members of this household │
1551 │                                                        │                     are age 16 or older?                    │
1552 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1553 │                                                        │        │        │        │        │       │        │  6 or  │
1554 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1555 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1556 │                                                        │        │        │        │        │ Column│        │        │
1557 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1558 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1559 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1560 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1561 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1562 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1563 │                                             likely     │        │        │        │        │       │        │        │
1564 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1565 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1566 │                                             unlikely   │        │        │        │        │       │        │        │
1567 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1568 │                                             unlikely   │        │        │        │        │       │        │        │
1569 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1570 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1571
1572                                                       Custom Tables
1573 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1574 │                                                         │ S1. Including yourself, how many members of this household │
1575 │                                                         │                    are age 16 or older?                    │
1576 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1577 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1578 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1579 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1580 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1581 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1582 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1583 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1584 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1585 │                                              likely     │       │       │         │       │        │      │          │
1586 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1587 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1588 │                                              unlikely   │       │       │         │       │        │      │          │
1589 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1590 │                                              unlikely   │       │       │         │       │        │      │          │
1591 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1592 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1593 ])
1594 AT_CLEANUP
1595
1596 AT_SETUP([CTABLES PCOMPUTE])
1597 AT_KEYWORDS([postcompute])
1598 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1599 AT_DATA([ctables.sps],
1600 [[GET 'nhtsa.sav'.
1601 CTABLES
1602     /PCOMPUTE &x=EXPR([3] + [4])
1603     /PCOMPUTE &y=EXPR([4] + [5])
1604     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1605     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1606     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1607     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1608
1609 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1610 CTABLES
1611     /PCOMPUTE &x=EXPR([3] + [4])
1612     /PCOMPUTE &y=EXPR([4] + [5])
1613     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1614     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1615     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1616     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1617 ]])
1618 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1619                                                                 Custom Tables
1620 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1621 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1622 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1623 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1624 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1625 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1626 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1627 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1628 │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%│
1629 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1630 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1631 │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%│
1632 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1633 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1634 │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%│
1635 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1636 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1637 │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%│
1638 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1639 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1640 │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%│
1641 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1642 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1643 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1644
1645                                                                 Custom Tables
1646 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1647 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1648 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1649 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1650 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1651 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1652 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1653 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1654 │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%│
1655 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1656 │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%│
1657 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1658 │                               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%│
1659 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1660 │                               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%│
1661 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1662 │                               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%│
1663 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1664 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1665 ])
1666 AT_CLEANUP
1667
1668 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1669 AT_KEYWORDS([postcompute])
1670 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1671 AT_DATA([ctables.sps],
1672 [[GET 'nhtsa.sav'.
1673 CTABLES
1674     /PCOMPUTE &x=EXPR(OTHERNM)
1675     /PCOMPUTE &y=EXPR(MISSING)
1676     /PPROPERTIES &x LABEL='Drivers'
1677     /PPROPERTIES &y LABEL='Missing Values 2'
1678     /TABLE=qn1 BY qns3a
1679     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1680 ]])
1681 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1682                                               Custom Tables
1683 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1684 │                                                                                          │S3a. GENDER:│
1685 │                                                                                          ├─────┬──────┤
1686 │                                                                                          │ Male│Female│
1687 │                                                                                          ├─────┼──────┤
1688 │                                                                                          │Count│ Count│
1689 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1690 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1691 │                                                                 Several days a week      │  440│   834│
1692 │                                                                 Once a week or less      │  125│   236│
1693 │                                                                 Only certain times a year│   58│    72│
1694 │                                                                 Never                    │  192│   348│
1695 │                                                                 Drivers                  │ 2928│  3504│
1696 │                                                                 Valid Values             │ 3120│  3852│
1697 │                                                                 Don't know               │    3│     5│
1698 │                                                                 Refused                  │    9│    10│
1699 │                                                                 Missing Values           │   12│    15│
1700 │                                                                 Missing Values 2         │   12│    15│
1701 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1702 ])
1703 AT_CLEANUP
1704
1705 AT_SETUP([CTABLES PCOMPUTE - THRU])
1706 AT_KEYWORDS([postcompute])
1707 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1708 AT_DATA([ctables.sps],
1709 [[GET 'nhtsa.sav'.
1710 CTABLES
1711     /PCOMPUTE &x=EXPR([1 THRU 2])
1712     /PCOMPUTE &y=EXPR([3 THRU 4])
1713     /PCOMPUTE &z=EXPR([5] + MISSING)
1714     /PPROPERTIES &x LABEL='Frequent Drivers'
1715     /PPROPERTIES &y LABEL='Infrequent Drivers'
1716     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1717     /TABLE=qn1 BY qns3a
1718     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1719 ]])
1720 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1721                                               Custom Tables
1722 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1723 │                                                                                          │S3a. GENDER:│
1724 │                                                                                          ├─────┬──────┤
1725 │                                                                                          │ Male│Female│
1726 │                                                                                          ├─────┼──────┤
1727 │                                                                                          │Count│ Count│
1728 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1729 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1730 │                                                                 Several days a week      │  440│   834│
1731 │                                                                 Frequent Drivers         │ 2745│  3196│
1732 │                                                                 Once a week or less      │  125│   236│
1733 │                                                                 Only certain times a year│   58│    72│
1734 │                                                                 Infrequent Drivers       │  183│   308│
1735 │                                                                 Drivers                  │ 2928│  3504│
1736 │                                                                 Never                    │  192│   348│
1737 │                                                                 Don't know               │    3│     5│
1738 │                                                                 Refused                  │    9│    10│
1739 │                                                                 Not Drivers or Missing   │  204│   363│
1740 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1741 ])
1742 AT_CLEANUP
1743
1744 dnl I'm not sure that this is the correct behavior (see
1745 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1746 dnl but at least this test will notify us if the behavior changes.
1747 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1748 AT_KEYWORDS([PCOMPUTE postcompute])
1749 AT_DATA([ctables.sps],
1750 [[DATA LIST LIST NOTABLE/x y z.
1751 WEIGHT by z.
1752 FORMATS ALL (F1.0).
1753 VARIABLE LEVEL x y (NOMINAL).
1754 BEGIN DATA.
1755 1 4 5
1756 1 5 2
1757 1 6 9
1758 2 4 2
1759 2 5 3
1760 2 6 4
1761 3 4 1
1762 3 5 6
1763 3 6 1
1764 END DATA.
1765
1766 CTABLES
1767     /PCOMPUTE &a = EXPR([1] + [2])
1768     /PCOMPUTE &b = EXPR([2] + [3])
1769     /PCOMPUTE &c = EXPR([4] * [5])
1770     /PCOMPUTE &d = EXPR([5] * [6])
1771     /TABLE x BY y
1772     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1773     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1774 ]])
1775 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1776 [[                   Custom Tables
1777 ╭───────────┬─────────────────────────────────────╮
1778 │           │                  y                  │
1779 │           ├─────┬─────────┬─────┬─────────┬─────┤
1780 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
1781 │           ├─────┼─────────┼─────┼─────────┼─────┤
1782 │           │Count│  Count  │Count│  Count  │Count│
1783 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1784 │x 1        │    5│       10│    2│       18│    9│
1785 │  [1] + [2]│    7│        .│    5│        .│   13│
1786 │  2        │    2│        6│    3│       12│    4│
1787 │  [2] + [3]│    3│        .│    9│        .│    5│
1788 │  3        │    1│        6│    6│        6│    1│
1789 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1790 ]])
1791 AT_CLEANUP
1792
1793 AT_SETUP([CTABLES string and date and time])
1794
1795 weight=1
1796 for gender in F M; do
1797     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1798         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1799             printf "$weight $gender $month $wkday\n"
1800             weight=$(expr \( $weight + 3 \) % 7 + 2)
1801         done
1802     done
1803 done > ctables.txt
1804
1805 AT_DATA([ctables.sps],
1806 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1807     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1808 WEIGHT by w.
1809 VARIABLE LEVEL w (SCALE).
1810 VARIABLE LEVEL gender fmon fday (NOMINAL).
1811 VARIABLE LABEL
1812   gender 'Gender'
1813   fmon 'Favorite month'
1814   fday 'Favorite day of the week'.
1815 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1816 CTABLES
1817     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1818     /PPROPERTIES &q2 LABEL='Q2'
1819     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1820     /PPROPERTIES &weekend LABEL='Weekend'
1821     /TABLE fmon BY gender > fday
1822     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1823                                 4 THRU 6, &q2,
1824                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
1825                                 OTHERNM, SUBTOTAL='Q4']
1826     /CATEGORIES VARIABLES=gender ['M', 'F']
1827     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1828     /SLABELS VISIBLE=NO.
1829 ]])
1830 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1831                                               Custom Tables
1832 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1833 │                  │                                       Gender                                      │
1834 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1835 │                  │                   Male                  │                  Female                 │
1836 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1837 │                  │         Favorite day of the week        │         Favorite day of the week        │
1838 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1839 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1840 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1841 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
1842 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1843 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1844 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
1845 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1846 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1847 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
1848 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
1849 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
1850 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
1851 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1852 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
1853 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1854 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1855 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1856 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
1857 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1858 ])
1859 AT_CLEANUP
1860
1861 AT_SETUP([CTABLES CLABELS])
1862 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1863 AT_DATA([ctables.sps],
1864 [[GET 'nhtsa.sav'.
1865 CTABLES /TABLE AgeGroup BY qns3a.
1866 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1867 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1868 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1869 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1870 ]])
1871 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1872              Custom Tables
1873 ╭───────────────────────┬────────────╮
1874 │                       │S3a. GENDER:│
1875 │                       ├─────┬──────┤
1876 │                       │ Male│Female│
1877 │                       ├─────┼──────┤
1878 │                       │Count│ Count│
1879 ├───────────────────────┼─────┼──────┤
1880 │Age group 15 or younger│    0│     0│
1881 │          16 to 25     │  594│   505│
1882 │          26 to 35     │  476│   491│
1883 │          36 to 45     │  489│   548│
1884 │          46 to 55     │  526│   649│
1885 │          56 to 65     │  516│   731│
1886 │          66 or older  │  531│   943│
1887 ╰───────────────────────┴─────┴──────╯
1888
1889                                                       Custom Tables
1890 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1891 │       │                                                 S3a. GENDER:                                                 │
1892 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1893 │       │                         Male                         │                         Female                        │
1894 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1895 │       │  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 │
1896 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1897 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1898 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1899 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1900 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1901 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1902 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1903
1904                 Custom Tables
1905 ╭──────────────────────────────┬────────────╮
1906 │                              │S3a. GENDER:│
1907 │                              ├────────────┤
1908 │                              │    Count   │
1909 ├──────────────────────────────┼────────────┤
1910 │Age group 15 or younger Male  │           0│
1911 │                        Female│           0│
1912 │         ╶────────────────────┼────────────┤
1913 │          16 to 25      Male  │         594│
1914 │                        Female│         505│
1915 │         ╶────────────────────┼────────────┤
1916 │          26 to 35      Male  │         476│
1917 │                        Female│         491│
1918 │         ╶────────────────────┼────────────┤
1919 │          36 to 45      Male  │         489│
1920 │                        Female│         548│
1921 │         ╶────────────────────┼────────────┤
1922 │          46 to 55      Male  │         526│
1923 │                        Female│         649│
1924 │         ╶────────────────────┼────────────┤
1925 │          56 to 65      Male  │         516│
1926 │                        Female│         731│
1927 │         ╶────────────────────┼────────────┤
1928 │          66 or older   Male  │         531│
1929 │                        Female│         943│
1930 ╰──────────────────────────────┴────────────╯
1931
1932       Custom Tables
1933 15 or younger
1934 ╭─────────┬────────────╮
1935 │         │S3a. GENDER:│
1936 │         ├─────┬──────┤
1937 │         │ Male│Female│
1938 │         ├─────┼──────┤
1939 │         │Count│ Count│
1940 ├─────────┼─────┼──────┤
1941 │Age group│    0│     0│
1942 ╰─────────┴─────┴──────╯
1943
1944       Custom Tables
1945 16 to 25
1946 ╭─────────┬────────────╮
1947 │         │S3a. GENDER:│
1948 │         ├─────┬──────┤
1949 │         │ Male│Female│
1950 │         ├─────┼──────┤
1951 │         │Count│ Count│
1952 ├─────────┼─────┼──────┤
1953 │Age group│  594│   505│
1954 ╰─────────┴─────┴──────╯
1955
1956       Custom Tables
1957 26 to 35
1958 ╭─────────┬────────────╮
1959 │         │S3a. GENDER:│
1960 │         ├─────┬──────┤
1961 │         │ Male│Female│
1962 │         ├─────┼──────┤
1963 │         │Count│ Count│
1964 ├─────────┼─────┼──────┤
1965 │Age group│  476│   491│
1966 ╰─────────┴─────┴──────╯
1967
1968       Custom Tables
1969 36 to 45
1970 ╭─────────┬────────────╮
1971 │         │S3a. GENDER:│
1972 │         ├─────┬──────┤
1973 │         │ Male│Female│
1974 │         ├─────┼──────┤
1975 │         │Count│ Count│
1976 ├─────────┼─────┼──────┤
1977 │Age group│  489│   548│
1978 ╰─────────┴─────┴──────╯
1979
1980       Custom Tables
1981 46 to 55
1982 ╭─────────┬────────────╮
1983 │         │S3a. GENDER:│
1984 │         ├─────┬──────┤
1985 │         │ Male│Female│
1986 │         ├─────┼──────┤
1987 │         │Count│ Count│
1988 ├─────────┼─────┼──────┤
1989 │Age group│  526│   649│
1990 ╰─────────┴─────┴──────╯
1991
1992       Custom Tables
1993 56 to 65
1994 ╭─────────┬────────────╮
1995 │         │S3a. GENDER:│
1996 │         ├─────┬──────┤
1997 │         │ Male│Female│
1998 │         ├─────┼──────┤
1999 │         │Count│ Count│
2000 ├─────────┼─────┼──────┤
2001 │Age group│  516│   731│
2002 ╰─────────┴─────┴──────╯
2003
2004       Custom Tables
2005 66 or older
2006 ╭─────────┬────────────╮
2007 │         │S3a. GENDER:│
2008 │         ├─────┬──────┤
2009 │         │ Male│Female│
2010 │         ├─────┼──────┤
2011 │         │Count│ Count│
2012 ├─────────┼─────┼──────┤
2013 │Age group│  531│   943│
2014 ╰─────────┴─────┴──────╯
2015
2016              Custom Tables
2017 Male
2018 ╭───────────────────────┬────────────╮
2019 │                       │S3a. GENDER:│
2020 │                       ├────────────┤
2021 │                       │    Count   │
2022 ├───────────────────────┼────────────┤
2023 │Age group 15 or younger│           0│
2024 │          16 to 25     │         594│
2025 │          26 to 35     │         476│
2026 │          36 to 45     │         489│
2027 │          46 to 55     │         526│
2028 │          56 to 65     │         516│
2029 │          66 or older  │         531│
2030 ╰───────────────────────┴────────────╯
2031
2032              Custom Tables
2033 Female
2034 ╭───────────────────────┬────────────╮
2035 │                       │S3a. GENDER:│
2036 │                       ├────────────┤
2037 │                       │    Count   │
2038 ├───────────────────────┼────────────┤
2039 │Age group 15 or younger│           0│
2040 │          16 to 25     │         505│
2041 │          26 to 35     │         491│
2042 │          36 to 45     │         548│
2043 │          46 to 55     │         649│
2044 │          56 to 65     │         731│
2045 │          66 or older  │         943│
2046 ╰───────────────────────┴────────────╯
2047 ])
2048 AT_CLEANUP
2049
2050 AT_SETUP([CTABLES missing values])
2051 AT_DATA([ctables.sps],
2052 [[DATA LIST LIST NOTABLE/x y.
2053 BEGIN DATA.
2054 1 1
2055 1 2
2056 1 3
2057 1 4
2058 1 5
2059 1 .
2060 2 1
2061 2 2
2062 2 3
2063 2 4
2064 2 5
2065 2 .
2066 3 1
2067 3 2
2068 3 3
2069 3 4
2070 3 5
2071 3 .
2072 4 1
2073 4 2
2074 4 3
2075 4 4
2076 4 5
2077 4 .
2078 5 1
2079 5 2
2080 5 3
2081 5 4
2082 5 5
2083 5 .
2084 . 1
2085 . 2
2086 . 3
2087 . 4
2088 . 5
2089 . .
2090 END DATA.
2091 MISSING VALUES x (1, 2) y (2, 3).
2092 VARIABLE LEVEL ALL (NOMINAL).
2093
2094 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2095                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2096     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2097 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2098                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2099     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2100 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2101                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2102     /CATEGORIES VARIABLES=ALL TOTAL=YES
2103     /SLABELS POSITION=ROW.
2104 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2105                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2106     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2107     /SLABELS POSITION=ROW.
2108 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2109                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2110     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2111     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2112     /SLABELS POSITION=ROW.
2113 ]])
2114 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2115                                Custom Tables
2116 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2117 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2118 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2119 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2120 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2121 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2122 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2123 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2124 dnl Note that Column Total N % doesn't add up to 100 because missing
2125 dnl values are included in the total but not shown as a category and this
2126 dnl is expected behavior.
2127
2128                                Custom Tables
2129 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2130 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2131 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2132 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2133 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2134 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2135 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2136 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2137 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2138 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2139 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2140 dnl values are included in the total but not shown as a category and this
2141 dnl is expected behavior.
2142
2143                      Custom Tables
2144 ╭────────────────────────┬───────────────────────────╮
2145 │                        │             y             │
2146 │                        ├──────┬──────┬──────┬──────┤
2147 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2148 ├────────────────────────┼──────┼──────┼──────┼──────┤
2149 │x 3.00  Count           │     1│     1│     1│     3│
2150 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2151 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2152 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2153 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2154 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2155 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2156 │        Valid N         │      │      │      │     3│
2157 │        Total N         │      │      │      │     6│
2158 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2159 │  4.00  Count           │     1│     1│     1│     3│
2160 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2161 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2162 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2163 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2164 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2165 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2166 │        Valid N         │      │      │      │     3│
2167 │        Total N         │      │      │      │     6│
2168 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2169 │  5.00  Count           │     1│     1│     1│     3│
2170 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2171 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2172 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2173 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2174 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2175 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2176 │        Valid N         │      │      │      │     3│
2177 │        Total N         │      │      │      │     6│
2178 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2179 │  Total Count           │     3│     3│     3│     9│
2180 │        Column %        │100.0%│100.0%│100.0%│     .│
2181 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2182 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2183 │        Row %           │     .│     .│     .│     .│
2184 │        Row Valid N %   │     .│     .│     .│     .│
2185 │        Row Total N %   │     .│     .│     .│     .│
2186 │        Valid N         │     3│     3│     3│     9│
2187 │        Total N         │     6│     6│     6│    36│
2188 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2189
2190                             Custom Tables
2191 ╭────────────────────────┬─────────────────────────────────────────╮
2192 │                        │                    y                    │
2193 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2194 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2195 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2196 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2197 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2198 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2199 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2200 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2201 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2202 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2203 │        Valid N         │      │      │      │      │      │     0│
2204 │        Total N         │      │      │      │      │      │     6│
2205 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2206 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2207 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2208 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2209 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2210 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2211 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2212 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2213 │        Valid N         │      │      │      │      │      │     0│
2214 │        Total N         │      │      │      │      │      │     6│
2215 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2216 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2217 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2218 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2219 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2220 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2221 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2222 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2223 │        Valid N         │      │      │      │      │      │     3│
2224 │        Total N         │      │      │      │      │      │     6│
2225 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2226 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2227 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2228 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2229 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2230 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2231 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2232 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2233 │        Valid N         │      │      │      │      │      │     3│
2234 │        Total N         │      │      │      │      │      │     6│
2235 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2236 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2237 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2238 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2239 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2240 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2241 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2242 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2243 │        Valid N         │      │      │      │      │      │     3│
2244 │        Total N         │      │      │      │      │      │     6│
2245 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2246 │  Total Count           │     5│     5│     5│     5│     5│    25│
2247 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2248 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2249 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2250 │        Row %           │     .│     .│     .│     .│     .│     .│
2251 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2252 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2253 │        Valid N         │     3│     0│     0│     3│     3│     9│
2254 │        Total N         │     6│     6│     6│     6│     6│    36│
2255 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2256
2257                         Custom Tables
2258 ╭────────────────────────┬──────────────────────────────────╮
2259 │                        │                 y                │
2260 │                        ├──────┬──────┬──────┬──────┬──────┤
2261 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2262 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2263 │x 1.00  Count           │     1│     1│     1│     1│     4│
2264 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2265 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2266 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2267 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2268 │        Row Valid N %   │     .│     .│     .│     .│     .│
2269 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2270 │        Valid N         │      │      │      │      │     0│
2271 │        Total N         │      │      │      │      │     6│
2272 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2273 │  2.00  Count           │     1│     1│     1│     1│     4│
2274 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2275 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2276 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2277 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2278 │        Row Valid N %   │     .│     .│     .│     .│     .│
2279 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2280 │        Valid N         │      │      │      │      │     0│
2281 │        Total N         │      │      │      │      │     6│
2282 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2283 │  3.00  Count           │     1│     1│     1│     1│     4│
2284 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2285 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2286 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2287 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2288 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2289 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2290 │        Valid N         │      │      │      │      │     3│
2291 │        Total N         │      │      │      │      │     6│
2292 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2293 │  4.00  Count           │     1│     1│     1│     1│     4│
2294 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2295 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2296 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2297 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2298 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2299 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2300 │        Valid N         │      │      │      │      │     3│
2301 │        Total N         │      │      │      │      │     6│
2302 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2303 │  Total Count           │     4│     4│     4│     4│    16│
2304 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2305 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2306 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2307 │        Row %           │     .│     .│     .│     .│     .│
2308 │        Row Valid N %   │     .│     .│     .│     .│     .│
2309 │        Row Total N %   │     .│     .│     .│     .│     .│
2310 │        Valid N         │     2│     0│     2│     2│     6│
2311 │        Total N         │     5│     5│     5│     5│    30│
2312 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2313 ])
2314 AT_CLEANUP
2315
2316 AT_SETUP([CTABLES SMISSING=LISTWISE])
2317 AT_KEYWORDS([SMISSING LISTWISE])
2318 AT_DATA([ctables.sps],
2319 [[DATA LIST LIST NOTABLE/x y z.
2320 BEGIN DATA.
2321 1  . 40
2322 1 10 50
2323 1 20 60
2324 1  .  .
2325 1 30  .
2326 END DATA.
2327 VARIABLE LEVEL x (NOMINAL).
2328
2329 CTABLES /TABLE (y + z) > x.
2330 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2331
2332 * The following doesn't come out as listwise because the tables are
2333 separate, not linked by an > operator.
2334 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2335 ]])
2336 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2337   Custom Tables
2338 ╭────────┬─────╮
2339 │        │ Mean│
2340 ├────────┼─────┤
2341 │y x 1.00│20.00│
2342 ├────────┼─────┤
2343 │z x 1.00│50.00│
2344 ╰────────┴─────╯
2345
2346   Custom Tables
2347 ╭────────┬─────╮
2348 │        │ Mean│
2349 ├────────┼─────┤
2350 │y x 1.00│15.00│
2351 ├────────┼─────┤
2352 │z x 1.00│55.00│
2353 ╰────────┴─────╯
2354
2355   Custom Tables
2356 ╭────────┬─────╮
2357 │        │ Mean│
2358 ├────────┼─────┤
2359 │y x 1.00│20.00│
2360 ├────────┼─────┤
2361 │z x 1.00│50.00│
2362 ╰────────┴─────╯
2363 ])
2364 AT_CLEANUP
2365
2366 AT_SETUP([CTABLES VLABELS - variables on different axes])
2367 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2368 AT_DATA([ctables.sps],
2369 [[GET 'nhtsa.sav'.
2370 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2371 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2372 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2373 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2374 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2375 ]])
2376 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2377                                  Custom Tables
2378 ╭────────────────────────────────────────────────────────────────┬────────────╮
2379 │                                                                │S3a. GENDER:│
2380 │                                                                ├─────┬──────┤
2381 │                                                                │ Male│Female│
2382 │                                                                ├─────┼──────┤
2383 │                                                                │Count│ Count│
2384 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2385 │D5a. What would you say is your primary    Cuban                │   13│     7│
2386 │ethnic background?                         Mexican              │  175│   136│
2387 │                                           Spanish              │   20│    28│
2388 │                                           South American       │   21│    13│
2389 │                                           Central American     │   27│    25│
2390 │                                           Puerto Rican, OR     │   37│    41│
2391 │                                           Something else       │   35│    33│
2392 │                                           Multiple - cannot    │    2│     5│
2393 │                                           choose one           │     │      │
2394 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2395
2396                   Custom Tables
2397 ╭──────────────────────────────────┬────────────╮
2398 │                                  │    QNS3A   │
2399 │                                  ├─────┬──────┤
2400 │                                  │ Male│Female│
2401 │                                  ├─────┼──────┤
2402 │                                  │Count│ Count│
2403 ├──────────────────────────────────┼─────┼──────┤
2404 │QND5A Cuban                       │   13│     7│
2405 │      Mexican                     │  175│   136│
2406 │      Spanish                     │   20│    28│
2407 │      South American              │   21│    13│
2408 │      Central American            │   27│    25│
2409 │      Puerto Rican, OR            │   37│    41│
2410 │      Something else              │   35│    33│
2411 │      Multiple - cannot choose one│    2│     5│
2412 ╰──────────────────────────────────┴─────┴──────╯
2413
2414                                  Custom Tables
2415 ╭────────────────────────────────────────────────────────────────┬────────────╮
2416 │                                                                │S3a. GENDER:│
2417 │                                                                ├─────┬──────┤
2418 │                                                                │ Male│Female│
2419 │                                                                ├─────┼──────┤
2420 │                                                                │Count│ Count│
2421 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2422 │D5a. What would you say is your primary    Cuban                │   13│     7│
2423 │ethnic background?                         Mexican              │  175│   136│
2424 │                                           Spanish              │   20│    28│
2425 │                                           South American       │   21│    13│
2426 │                                           Central American     │   27│    25│
2427 │                                           Puerto Rican, OR     │   37│    41│
2428 │                                           Something else       │   35│    33│
2429 │                                           Multiple - cannot    │    2│     5│
2430 │                                           choose one           │     │      │
2431 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2432
2433                                  Custom Tables
2434 ╭────────────────────────────────────────────────────────────┬────────────────╮
2435 │                                                            │   QNS3A S3a.   │
2436 │                                                            │     GENDER:    │
2437 │                                                            ├───────┬────────┤
2438 │                                                            │  Male │ Female │
2439 │                                                            ├───────┼────────┤
2440 │                                                            │ Count │  Count │
2441 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2442 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2443 │primary ethnic background?               Mexican            │    175│     136│
2444 │                                         Spanish            │     20│      28│
2445 │                                         South American     │     21│      13│
2446 │                                         Central American   │     27│      25│
2447 │                                         Puerto Rican, OR   │     37│      41│
2448 │                                         Something else     │     35│      33│
2449 │                                         Multiple - cannot  │      2│       5│
2450 │                                         choose one         │       │        │
2451 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2452
2453                Custom Tables
2454 ╭────────────────────────────┬─────┬──────╮
2455 │                            │ Male│Female│
2456 │                            ├─────┼──────┤
2457 │                            │Count│ Count│
2458 ├────────────────────────────┼─────┼──────┤
2459 │Cuban                       │   13│     7│
2460 │Mexican                     │  175│   136│
2461 │Spanish                     │   20│    28│
2462 │South American              │   21│    13│
2463 │Central American            │   27│    25│
2464 │Puerto Rican, OR            │   37│    41│
2465 │Something else              │   35│    33│
2466 │Multiple - cannot choose one│    2│     5│
2467 ╰────────────────────────────┴─────┴──────╯
2468 ])
2469 AT_CLEANUP
2470
2471 AT_SETUP([CTABLES VLABELS - stacked variables])
2472 AT_KEYWORDS([stack stacking])
2473 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2474 AT_DATA([ctables.sps],
2475 [[GET 'nhtsa.sav'.
2476 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2477 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2478 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2479 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2480 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2481 ]])
2482 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2483                                  Custom Tables
2484 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2485 │                                                                       │Count│
2486 ├───────────────────────────────────────────────────────────────────────┼─────┤
2487 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2488 │background?                                     Mexican                │  311│
2489 │                                                Spanish                │   48│
2490 │                                                South American         │   34│
2491 │                                                Central American       │   52│
2492 │                                                Puerto Rican, OR       │   78│
2493 │                                                Something else         │   68│
2494 │                                                Multiple - cannot      │    7│
2495 │                                                choose one             │     │
2496 ├───────────────────────────────────────────────────────────────────────┼─────┤
2497 │QNS3A                                           Male                   │ 3132│
2498 │                                                Female                 │ 3867│
2499 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2500
2501                   Custom Tables
2502 ╭─────────────────────────────────────────┬─────╮
2503 │                                         │Count│
2504 ├─────────────────────────────────────────┼─────┤
2505 │QND5A        Cuban                       │   20│
2506 │             Mexican                     │  311│
2507 │             Spanish                     │   48│
2508 │             South American              │   34│
2509 │             Central American            │   52│
2510 │             Puerto Rican, OR            │   78│
2511 │             Something else              │   68│
2512 │             Multiple - cannot choose one│    7│
2513 ├─────────────────────────────────────────┼─────┤
2514 │S3a. GENDER: Male                        │ 3132│
2515 │             Female                      │ 3867│
2516 ╰─────────────────────────────────────────┴─────╯
2517
2518                                  Custom Tables
2519 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2520 │                                                                       │Count│
2521 ├───────────────────────────────────────────────────────────────────────┼─────┤
2522 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2523 │background?                                     Mexican                │  311│
2524 │                                                Spanish                │   48│
2525 │                                                South American         │   34│
2526 │                                                Central American       │   52│
2527 │                                                Puerto Rican, OR       │   78│
2528 │                                                Something else         │   68│
2529 │                                                Multiple - cannot      │    7│
2530 │                                                choose one             │     │
2531 ├───────────────────────────────────────────────────────────────────────┼─────┤
2532 │Male                                                                   │ 3132│
2533 ├───────────────────────────────────────────────────────────────────────┼─────┤
2534 │Female                                                                 │ 3867│
2535 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2536
2537             Custom Tables
2538 ╭─────────────────────────────┬─────╮
2539 │                             │Count│
2540 ├─────────────────────────────┼─────┤
2541 │Cuban                        │   20│
2542 ├─────────────────────────────┼─────┤
2543 │Mexican                      │  311│
2544 ├─────────────────────────────┼─────┤
2545 │Spanish                      │   48│
2546 ├─────────────────────────────┼─────┤
2547 │South American               │   34│
2548 ├─────────────────────────────┼─────┤
2549 │Central American             │   52│
2550 ├─────────────────────────────┼─────┤
2551 │Puerto Rican, OR             │   78│
2552 ├─────────────────────────────┼─────┤
2553 │Something else               │   68│
2554 ├─────────────────────────────┼─────┤
2555 │Multiple - cannot choose one │    7│
2556 ├─────────────────────────────┼─────┤
2557 │S3a. GENDER:     Male        │ 3132│
2558 │                 Female      │ 3867│
2559 ╰─────────────────────────────┴─────╯
2560
2561             Custom Tables
2562 ╭────────────────────────────┬─────╮
2563 │                            │Count│
2564 ├────────────────────────────┼─────┤
2565 │Cuban                       │   20│
2566 │Mexican                     │  311│
2567 │Spanish                     │   48│
2568 │South American              │   34│
2569 │Central American            │   52│
2570 │Puerto Rican, OR            │   78│
2571 │Something else              │   68│
2572 │Multiple - cannot choose one│    7│
2573 │Male                        │ 3132│
2574 │Female                      │ 3867│
2575 ╰────────────────────────────┴─────╯
2576 ])
2577 AT_CLEANUP
2578
2579 AT_SETUP([CTABLES VLABELS - nested variables])
2580 AT_KEYWORDS([nest nesting])
2581 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2582 AT_DATA([ctables.sps],
2583 [[GET 'nhtsa.sav'.
2584 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2585 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2586 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2587 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2588 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2589 ]])
2590 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2591                                  Custom Tables
2592 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2593 │                                                                       │Count│
2594 ├───────────────────────────────────────────────────────────────────────┼─────┤
2595 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2596 │primary ethnic background?                                       Female│    7│
2597 │                                     ╶─────────────────────────────────┼─────┤
2598 │                                      Mexican              QNS3A Male  │  175│
2599 │                                                                 Female│  136│
2600 │                                     ╶─────────────────────────────────┼─────┤
2601 │                                      Spanish              QNS3A Male  │   20│
2602 │                                                                 Female│   28│
2603 │                                     ╶─────────────────────────────────┼─────┤
2604 │                                      South American       QNS3A Male  │   21│
2605 │                                                                 Female│   13│
2606 │                                     ╶─────────────────────────────────┼─────┤
2607 │                                      Central American     QNS3A Male  │   27│
2608 │                                                                 Female│   25│
2609 │                                     ╶─────────────────────────────────┼─────┤
2610 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2611 │                                                                 Female│   41│
2612 │                                     ╶─────────────────────────────────┼─────┤
2613 │                                      Something else       QNS3A Male  │   35│
2614 │                                                                 Female│   33│
2615 │                                     ╶─────────────────────────────────┼─────┤
2616 │                                      Multiple - cannot    QNS3A Male  │    2│
2617 │                                      choose one                 Female│    5│
2618 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2619
2620                          Custom Tables
2621 ╭──────────────────────────────────────────────────────┬─────╮
2622 │                                                      │Count│
2623 ├──────────────────────────────────────────────────────┼─────┤
2624 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2625 │                                                Female│    7│
2626 │     ╶────────────────────────────────────────────────┼─────┤
2627 │      Mexican                      S3a. GENDER: Male  │  175│
2628 │                                                Female│  136│
2629 │     ╶────────────────────────────────────────────────┼─────┤
2630 │      Spanish                      S3a. GENDER: Male  │   20│
2631 │                                                Female│   28│
2632 │     ╶────────────────────────────────────────────────┼─────┤
2633 │      South American               S3a. GENDER: Male  │   21│
2634 │                                                Female│   13│
2635 │     ╶────────────────────────────────────────────────┼─────┤
2636 │      Central American             S3a. GENDER: Male  │   27│
2637 │                                                Female│   25│
2638 │     ╶────────────────────────────────────────────────┼─────┤
2639 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2640 │                                                Female│   41│
2641 │     ╶────────────────────────────────────────────────┼─────┤
2642 │      Something else               S3a. GENDER: Male  │   35│
2643 │                                                Female│   33│
2644 │     ╶────────────────────────────────────────────────┼─────┤
2645 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2646 │                                                Female│    5│
2647 ╰──────────────────────────────────────────────────────┴─────╯
2648
2649                                  Custom Tables
2650 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2651 │                                                                       │Count│
2652 ├───────────────────────────────────────────────────────────────────────┼─────┤
2653 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2654 │ethnic background?                                               Female│    7│
2655 │                                          ╶────────────────────────────┼─────┤
2656 │                                           Mexican               Male  │  175│
2657 │                                                                 Female│  136│
2658 │                                          ╶────────────────────────────┼─────┤
2659 │                                           Spanish               Male  │   20│
2660 │                                                                 Female│   28│
2661 │                                          ╶────────────────────────────┼─────┤
2662 │                                           South American        Male  │   21│
2663 │                                                                 Female│   13│
2664 │                                          ╶────────────────────────────┼─────┤
2665 │                                           Central American      Male  │   27│
2666 │                                                                 Female│   25│
2667 │                                          ╶────────────────────────────┼─────┤
2668 │                                           Puerto Rican, OR      Male  │   37│
2669 │                                                                 Female│   41│
2670 │                                          ╶────────────────────────────┼─────┤
2671 │                                           Something else        Male  │   35│
2672 │                                                                 Female│   33│
2673 │                                          ╶────────────────────────────┼─────┤
2674 │                                           Multiple - cannot     Male  │    2│
2675 │                                           choose one            Female│    5│
2676 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2677
2678                       Custom Tables
2679 ╭────────────────────────────────────────────────┬─────╮
2680 │                                                │Count│
2681 ├────────────────────────────────────────────────┼─────┤
2682 │Cuban                        S3a. GENDER: Male  │   13│
2683 │                                          Female│    7│
2684 ├────────────────────────────────────────────────┼─────┤
2685 │Mexican                      S3a. GENDER: Male  │  175│
2686 │                                          Female│  136│
2687 ├────────────────────────────────────────────────┼─────┤
2688 │Spanish                      S3a. GENDER: Male  │   20│
2689 │                                          Female│   28│
2690 ├────────────────────────────────────────────────┼─────┤
2691 │South American               S3a. GENDER: Male  │   21│
2692 │                                          Female│   13│
2693 ├────────────────────────────────────────────────┼─────┤
2694 │Central American             S3a. GENDER: Male  │   27│
2695 │                                          Female│   25│
2696 ├────────────────────────────────────────────────┼─────┤
2697 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2698 │                                          Female│   41│
2699 ├────────────────────────────────────────────────┼─────┤
2700 │Something else               S3a. GENDER: Male  │   35│
2701 │                                          Female│   33│
2702 ├────────────────────────────────────────────────┼─────┤
2703 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2704 │                                          Female│    5│
2705 ╰────────────────────────────────────────────────┴─────╯
2706
2707                Custom Tables
2708 ╭───────────────────────────────────┬─────╮
2709 │                                   │Count│
2710 ├───────────────────────────────────┼─────┤
2711 │Cuban                        Male  │   13│
2712 │                             Female│    7│
2713 ├───────────────────────────────────┼─────┤
2714 │Mexican                      Male  │  175│
2715 │                             Female│  136│
2716 ├───────────────────────────────────┼─────┤
2717 │Spanish                      Male  │   20│
2718 │                             Female│   28│
2719 ├───────────────────────────────────┼─────┤
2720 │South American               Male  │   21│
2721 │                             Female│   13│
2722 ├───────────────────────────────────┼─────┤
2723 │Central American             Male  │   27│
2724 │                             Female│   25│
2725 ├───────────────────────────────────┼─────┤
2726 │Puerto Rican, OR             Male  │   37│
2727 │                             Female│   41│
2728 ├───────────────────────────────────┼─────┤
2729 │Something else               Male  │   35│
2730 │                             Female│   33│
2731 ├───────────────────────────────────┼─────┤
2732 │Multiple - cannot choose one Male  │    2│
2733 │                             Female│    5│
2734 ╰───────────────────────────────────┴─────╯
2735 ])
2736 AT_CLEANUP
2737
2738 AT_SETUP([CTABLES FORMAT EMPTY])
2739 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2740 AT_DATA([ctables.sps],
2741 [[GET 'nhtsa.sav'.
2742 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2743 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2744 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2745 ]])
2746 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2747                                  Custom Tables
2748 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2749 │                                             │   D5. ETHNICITY: Are you of   │
2750 │                                             │  Hispanic or Latino origin or │
2751 │                                             │            descent?           │
2752 │                                             ├───────────────┬───────────────┤
2753 │                                             │      Yes      │       No      │
2754 │                                             ├───────────────┼───────────────┤
2755 │                                             │     Count     │     Count     │
2756 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2757 │D5a. What would you say is   Cuban           │             20│              0│
2758 │your primary ethnic          Mexican         │            311│              0│
2759 │background?                  Spanish         │             48│              0│
2760 │                             South American  │             34│              0│
2761 │                             Central American│             52│              0│
2762 │                             Puerto Rican, OR│             78│              0│
2763 │                             Something else  │             68│              0│
2764 │                             Multiple -      │              7│              0│
2765 │                             cannot choose   │               │               │
2766 │                             one             │               │               │
2767 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2768
2769                                  Custom Tables
2770 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2771 │                                             │   D5. ETHNICITY: Are you of   │
2772 │                                             │  Hispanic or Latino origin or │
2773 │                                             │            descent?           │
2774 │                                             ├───────────────┬───────────────┤
2775 │                                             │      Yes      │       No      │
2776 │                                             ├───────────────┼───────────────┤
2777 │                                             │     Count     │     Count     │
2778 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2779 │D5a. What would you say is   Cuban           │             20│               │
2780 │your primary ethnic          Mexican         │            311│               │
2781 │background?                  Spanish         │             48│               │
2782 │                             South American  │             34│               │
2783 │                             Central American│             52│               │
2784 │                             Puerto Rican, OR│             78│               │
2785 │                             Something else  │             68│               │
2786 │                             Multiple -      │              7│               │
2787 │                             cannot choose   │               │               │
2788 │                             one             │               │               │
2789 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2790
2791                                  Custom Tables
2792 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2793 │                                             │   D5. ETHNICITY: Are you of   │
2794 │                                             │  Hispanic or Latino origin or │
2795 │                                             │            descent?           │
2796 │                                             ├───────────────┬───────────────┤
2797 │                                             │      Yes      │       No      │
2798 │                                             ├───────────────┼───────────────┤
2799 │                                             │     Count     │     Count     │
2800 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2801 │D5a. What would you say is   Cuban           │             20│n/a            │
2802 │your primary ethnic          Mexican         │            311│n/a            │
2803 │background?                  Spanish         │             48│n/a            │
2804 │                             South American  │             34│n/a            │
2805 │                             Central American│             52│n/a            │
2806 │                             Puerto Rican, OR│             78│n/a            │
2807 │                             Something else  │             68│n/a            │
2808 │                             Multiple -      │              7│n/a            │
2809 │                             cannot choose   │               │               │
2810 │                             one             │               │               │
2811 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2812 ])
2813 AT_CLEANUP
2814
2815 AT_SETUP([CTABLES FORMAT MISSING])
2816 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2817 AT_DATA([ctables.sps],
2818 [[GET 'nhtsa.sav'.
2819 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2820 ]])
2821 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2822                                  Custom Tables
2823 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2824 │                                             │   D5. ETHNICITY: Are you of   │
2825 │                                             │  Hispanic or Latino origin or │
2826 │                                             │            descent?           │
2827 │                                             ├───────────────┬───────────────┤
2828 │                                             │      Yes      │       No      │
2829 │                                             ├───────────────┼───────────────┤
2830 │                                             │    Column %   │    Column %   │
2831 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2832 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2833 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2834 │background?                  Spanish         │           7.8%│(no data)      │
2835 │                             South American  │           5.5%│(no data)      │
2836 │                             Central American│           8.4%│(no data)      │
2837 │                             Puerto Rican, OR│          12.6%│(no data)      │
2838 │                             Something else  │          11.0%│(no data)      │
2839 │                             Multiple -      │           1.1%│(no data)      │
2840 │                             cannot choose   │               │               │
2841 │                             one             │               │               │
2842 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2843 ])
2844 AT_CLEANUP
2845
2846 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2847 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2848 AT_DATA([ctables.sps],
2849 [[GET 'nhtsa.sav'.
2850 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2851 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2852 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2853 ]])
2854 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2855                                  Custom Tables
2856 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2857 │                                                              │Count│Column %│
2858 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2859 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2860 │occasion?                                        1            │  491│   34.9%│
2861 │                                                 2            │  462│   32.9%│
2862 │                                                 3            │  229│   16.3%│
2863 │                                                 4            │   82│    5.8%│
2864 │                                                 5            │   56│    4.0%│
2865 │                                                 6            │   32│    2.3%│
2866 │                                                 7            │    9│     .6%│
2867 │                                                 8            │    8│     .6%│
2868 │                                                 9            │    4│     .3%│
2869 │                                                 10           │    6│     .4%│
2870 │                                                 11           │    2│     .1%│
2871 │                                                 12           │    5│     .4%│
2872 │                                                 14           │    1│     .1%│
2873 │                                                 15           │    1│     .1%│
2874 │                                                 18           │    1│     .1%│
2875 │                                                 20           │    4│     .3%│
2876 │                                                 25           │    1│     .1%│
2877 │                                                 30           │    3│     .2%│
2878 │                                                 60           │    1│     .1%│
2879 │                                                 99+          │    0│     .0%│
2880 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2881
2882                                  Custom Tables
2883 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2884 │                                                              │Count│Column %│
2885 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2886 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2887 │occasion?                                        1            │  491│   34.9%│
2888 │                                                 2            │  462│   32.9%│
2889 │                                                 3            │  229│   16.3%│
2890 │                                                 4            │   82│    5.8%│
2891 │                                                 5            │   56│    4.0%│
2892 │                                                 6            │   32│    2.3%│
2893 │                                                 7            │    9│     .6%│
2894 │                                                 8            │    8│     .6%│
2895 │                                                 9            │<5   │     .3%│
2896 │                                                 10           │    6│     .4%│
2897 │                                                 11           │<5   │     .1%│
2898 │                                                 12           │    5│     .4%│
2899 │                                                 14           │<5   │     .1%│
2900 │                                                 15           │<5   │     .1%│
2901 │                                                 18           │<5   │     .1%│
2902 │                                                 20           │<5   │     .3%│
2903 │                                                 25           │<5   │     .1%│
2904 │                                                 30           │<5   │     .2%│
2905 │                                                 60           │<5   │     .1%│
2906 │                                                 99+          │<5   │     .0%│
2907 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2908
2909                                  Custom Tables
2910 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2911 │                                                              │Count│Column %│
2912 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2913 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2914 │occasion?                                        1            │  491│   34.9%│
2915 │                                                 2            │  462│   32.9%│
2916 │                                                 3            │  229│   16.3%│
2917 │                                                 4            │   82│    5.8%│
2918 │                                                 5            │   56│    4.0%│
2919 │                                                 6            │   32│    2.3%│
2920 │                                                 7            │<10  │     .6%│
2921 │                                                 8            │<10  │     .6%│
2922 │                                                 9            │<10  │     .3%│
2923 │                                                 10           │<10  │     .4%│
2924 │                                                 11           │<10  │     .1%│
2925 │                                                 12           │<10  │     .4%│
2926 │                                                 14           │<10  │     .1%│
2927 │                                                 15           │<10  │     .1%│
2928 │                                                 18           │<10  │     .1%│
2929 │                                                 20           │<10  │     .3%│
2930 │                                                 25           │<10  │     .1%│
2931 │                                                 30           │<10  │     .2%│
2932 │                                                 60           │<10  │     .1%│
2933 │                                                 99+          │<10  │     .0%│
2934 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2935 ])
2936 AT_CLEANUP
2937
2938 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2939 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2940 AT_DATA([ctables.sps],
2941 [[GET 'nhtsa.sav'.
2942 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2943 ]])
2944 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2945  Custom Tables
2946 ╭────────────╮
2947 │S3a. GENDER:│
2948 ├─────┬──────┤
2949 │ Male│Female│
2950 ├─────┼──────┤
2951 │Count│ Count│
2952 ├─────┼──────┤
2953 │ 3132│  3867│
2954 ╰─────┴──────╯
2955 ])
2956 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2957 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2958 maximumColumnWidth="192"
2959 minimumColumnWidth="96"
2960 ])
2961 AT_CLEANUP
2962
2963 AT_SETUP([CTABLES special formats])
2964 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2965 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2966 AT_DATA([ctables.sps],
2967 [[GET 'nhtsa.sav'.
2968 COMPUTE x = qnd3 - 4.
2969 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].
2970 ]])
2971 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2972                            Custom Tables
2973 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2974 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2975 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2976 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
2977 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2978 ])
2979 AT_CLEANUP
2980
2981 AT_SETUP([CTABLES TITLES])
2982 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2983 AT_DATA([ctables.sps],
2984 [[GET 'nhtsa.sav'.
2985 CTABLES
2986     /VLABELS VARIABLES=qn1 DISPLAY=NONE
2987     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
2988     /TITLES TITLE='How often do you drive?'
2989             CAPTION='Generated )TIME on )DATE'
2990             CORNER=')TABLE'.
2991 ]])
2992 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
2993 s&../../..&MM/DD/YY&'], [0], [dnl
2994                             How often do you drive?
2995 ╭───────────────────────────────────┬─────────────────────────────────────────╮
2996 │                                   │               S3a. GENDER:              │
2997 │                                   ├────────────────────┬────────────────────┤
2998 │                                   │        Male        │       Female       │
2999 │                                   ├────────────────────┼────────────────────┤
3000 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3001 │                                   │ you of Hispanic or │ you of Hispanic or │
3002 │                                   │  Latino origin or  │  Latino origin or  │
3003 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3004 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3005 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3006 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3007 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3008 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3009 │Every day                          │      218│      2066│      166│      2175│
3010 │Several days a week                │       44│       391│       45│       782│
3011 │Once a week or less                │       16│       109│       12│       223│
3012 │Only certain times a year          │       15│        41│       11│        61│
3013 │Never                              │       39│       150│       56│       278│
3014 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3015 Generated HH:MM:SS on MM/DD/YY
3016 ])
3017 AT_CLEANUP
3018
3019 AT_SETUP([CTABLES area definitions])
3020 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3021 AT_DATA([ctables.sps],
3022 [[GET 'nhtsa.sav'.
3023 CTABLES
3024     /VLABELS VARIABLES=ALL DISPLAY=NAME
3025     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3026     /SLABELS POSITION=ROW
3027     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3028     /SLABELS POSITION=ROW
3029     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3030     /SLABELS POSITION=ROW.
3031 ]])
3032 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3033                     Custom Tables
3034 Male
3035 ╭─────────────────────────────┬─────────────┬──────╮
3036 │                             │    QND7A    │ QN64B│
3037 │                             ├──────┬──────┼───┬──┤
3038 │                             │  Yes │  No  │   │  │
3039 │                             ├──────┼──────┤   │  │
3040 │                             │ QN86 │ QN86 │   │  │
3041 │                             ├───┬──┼───┬──┤   │  │
3042 │                             │Yes│No│Yes│No│Yes│No│
3043 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3044 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3045 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3046 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3047 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3048 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3049 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3050 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3051 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3052 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3053 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3054 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3055 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3056 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3057 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3058 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3059 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3060
3061                     Custom Tables
3062 Female
3063 ╭─────────────────────────────┬─────────────┬──────╮
3064 │                             │    QND7A    │ QN64B│
3065 │                             ├──────┬──────┼───┬──┤
3066 │                             │  Yes │  No  │   │  │
3067 │                             ├──────┼──────┤   │  │
3068 │                             │ QN86 │ QN86 │   │  │
3069 │                             ├───┬──┼───┬──┤   │  │
3070 │                             │Yes│No│Yes│No│Yes│No│
3071 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3072 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3073 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3074 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3075 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3076 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3077 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3078 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3079 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3080 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3081 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3082 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3083 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3084 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3085 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3086 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3087 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3088
3089                     Custom Tables
3090 Male
3091 ╭──────────────────────────────┬─────────────┬──────╮
3092 │                              │    QND7A    │ QN64B│
3093 │                              ├──────┬──────┼───┬──┤
3094 │                              │  Yes │  No  │   │  │
3095 │                              ├──────┼──────┤   │  │
3096 │                              │ QN86 │ QN86 │   │  │
3097 │                              ├───┬──┼───┬──┤   │  │
3098 │                              │Yes│No│Yes│No│Yes│No│
3099 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3100 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3101 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3102 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3103 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3104 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3105 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3106 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3107 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3108 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3109 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3110 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3111 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3112
3113                     Custom Tables
3114 Female
3115 ╭──────────────────────────────┬─────────────┬──────╮
3116 │                              │    QND7A    │ QN64B│
3117 │                              ├──────┬──────┼───┬──┤
3118 │                              │  Yes │  No  │   │  │
3119 │                              ├──────┼──────┤   │  │
3120 │                              │ QN86 │ QN86 │   │  │
3121 │                              ├───┬──┼───┬──┤   │  │
3122 │                              │Yes│No│Yes│No│Yes│No│
3123 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3124 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3125 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3126 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3127 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3128 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3129 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3130 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3131 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3132 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3133 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3134 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3135 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3136
3137                       Custom Tables
3138 Male
3139 ╭─────────────────────────────────┬─────────────┬──────╮
3140 │                                 │    QND7A    │ QN64B│
3141 │                                 ├──────┬──────┼───┬──┤
3142 │                                 │  Yes │  No  │   │  │
3143 │                                 ├──────┼──────┤   │  │
3144 │                                 │ QN86 │ QN86 │   │  │
3145 │                                 ├───┬──┼───┬──┤   │  │
3146 │                                 │Yes│No│Yes│No│Yes│No│
3147 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3148 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3149 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3150 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3151 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3152 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3153 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3154 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3155 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3156 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3157 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3158 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3159 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3160
3161                       Custom Tables
3162 Female
3163 ╭─────────────────────────────────┬─────────────┬──────╮
3164 │                                 │    QND7A    │ QN64B│
3165 │                                 ├──────┬──────┼───┬──┤
3166 │                                 │  Yes │  No  │   │  │
3167 │                                 ├──────┼──────┤   │  │
3168 │                                 │ QN86 │ QN86 │   │  │
3169 │                                 ├───┬──┼───┬──┤   │  │
3170 │                                 │Yes│No│Yes│No│Yes│No│
3171 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3172 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3173 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3174 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3175 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3176 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3177 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3178 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3179 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3180 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3181 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3182 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3183 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3184 ])
3185 AT_CLEANUP
3186
3187 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3188 AT_KEYWORDS([ROWLABELS OPPOSITE])
3189 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3190 AT_DATA([ctables.sps],
3191 [[GET 'nhtsa.sav'.
3192 CTABLES
3193     /VLABELS VARIABLES=ALL DISPLAY=NAME
3194     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3195     /SLABELS POSITION=ROW
3196     /CLABELS ROWLABELS=OPPOSITE
3197     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3198     /SLABELS POSITION=ROW
3199     /CLABELS ROWLABELS=OPPOSITE
3200     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3201     /SLABELS POSITION=ROW
3202     /CLABELS ROWLABELS=OPPOSITE.
3203 ]])
3204 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3205                                         Custom Tables
3206 Male
3207 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3208 │                                  │                          QN27                         │
3209 │                                  ├───────────────────────────┬───────────────────────────┤
3210 │                                  │            Yes            │             No            │
3211 │                                  ├───────────────────────────┼───────────────────────────┤
3212 │                                  │           QND7A           │           QND7A           │
3213 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3214 │                                  │     Yes     │      No     │     Yes     │      No     │
3215 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3216 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3217 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3218 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3219 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3220 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3221 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3222 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3223 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3224 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3225 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3226 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3227 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3228 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3229 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3230 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3231 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3232 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3233 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3234 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3235 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3236 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3237 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3238
3239                                         Custom Tables
3240 Female
3241 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3242 │                                  │                          QN27                         │
3243 │                                  ├───────────────────────────┬───────────────────────────┤
3244 │                                  │            Yes            │             No            │
3245 │                                  ├───────────────────────────┼───────────────────────────┤
3246 │                                  │           QND7A           │           QND7A           │
3247 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3248 │                                  │     Yes     │      No     │     Yes     │      No     │
3249 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3250 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3251 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3252 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3253 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3254 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3255 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3256 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3257 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3258 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3259 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3260 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3261 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3262 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3263 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3264 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3265 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3266 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3267 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3268 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3269 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3270 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3271 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3272
3273                                         Custom Tables
3274 Male
3275 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3276 │                                   │                          QN27                         │
3277 │                                   ├───────────────────────────┬───────────────────────────┤
3278 │                                   │            Yes            │             No            │
3279 │                                   ├───────────────────────────┼───────────────────────────┤
3280 │                                   │           QND7A           │           QND7A           │
3281 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3282 │                                   │     Yes     │      No     │     Yes     │      No     │
3283 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3284 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3285 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3286 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3287 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3288 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3289 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3290 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3291 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3292 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3293 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3294 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3295 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3296 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3297 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3298 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3299 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3300 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3301 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3302
3303                                         Custom Tables
3304 Female
3305 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3306 │                                   │                          QN27                         │
3307 │                                   ├───────────────────────────┬───────────────────────────┤
3308 │                                   │            Yes            │             No            │
3309 │                                   ├───────────────────────────┼───────────────────────────┤
3310 │                                   │           QND7A           │           QND7A           │
3311 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3312 │                                   │     Yes     │      No     │     Yes     │      No     │
3313 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3314 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3315 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3316 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3317 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3318 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3319 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3320 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3321 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3322 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3323 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3324 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3325 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3326 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3327 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3328 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3329 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3330 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3331 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3332
3333                                           Custom Tables
3334 Male
3335 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3336 │                                      │                          QN27                         │
3337 │                                      ├───────────────────────────┬───────────────────────────┤
3338 │                                      │            Yes            │             No            │
3339 │                                      ├───────────────────────────┼───────────────────────────┤
3340 │                                      │           QND7A           │           QND7A           │
3341 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3342 │                                      │     Yes     │      No     │     Yes     │      No     │
3343 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3344 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3345 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3346 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3347 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3348 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3349 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3350 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3351 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3352 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3353 │              No  QN57 Column ID      │  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3354 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3355 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3356 │     No  QN61 Yes QN57 Column ID      │ 18│17│ 19│20│ 22│21│ 23│24│ 25│26│ 27│28│ 29│30│ 32│31│
3357 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3358 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3359 │              No  QN57 Column ID      │ 18│17│ 19│20│ 22│21│ 23│24│ 25│26│ 27│28│ 29│30│ 32│31│
3360 │                       Layer Column ID│  1│ 2│  4│ 3│  6│ 5│  8│ 7│  9│10│ 11│12│ 14│13│ 15│16│
3361 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3362
3363                                           Custom Tables
3364 Female
3365 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3366 │                                      │                          QN27                         │
3367 │                                      ├───────────────────────────┬───────────────────────────┤
3368 │                                      │            Yes            │             No            │
3369 │                                      ├───────────────────────────┼───────────────────────────┤
3370 │                                      │           QND7A           │           QND7A           │
3371 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3372 │                                      │     Yes     │      No     │     Yes     │      No     │
3373 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3374 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3375 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3376 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3377 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3378 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3379 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3380 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│34│ 36│35│ 37│38│ 39│40│ 42│41│ 44│43│ 45│46│ 47│48│
3381 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3382 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3383 │              No  QN57 Column ID      │ 33│34│ 36│35│ 37│38│ 39│40│ 42│41│ 44│43│ 45│46│ 47│48│
3384 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3385 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3386 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 54│53│ 56│55│ 57│58│ 60│59│ 62│61│ 64│63│
3387 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3388 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3389 │              No  QN57 Column ID      │ 49│50│ 51│52│ 54│53│ 56│55│ 57│58│ 60│59│ 62│61│ 64│63│
3390 │                       Layer Column ID│ 17│18│ 20│19│ 21│22│ 23│24│ 26│25│ 28│27│ 29│30│ 31│32│
3391 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3392 ])
3393 AT_CLEANUP
3394
3395 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3396 AT_KEYWORDS([COLLABELS OPPOSITE])
3397 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3398 AT_DATA([ctables.sps],
3399 [[GET 'nhtsa.sav'.
3400 CTABLES
3401     /VLABELS VARIABLES=ALL DISPLAY=NAME
3402     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3403     /SLABELS POSITION=ROW
3404     /CLABELS COLLABELS=OPPOSITE
3405     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3406     /SLABELS POSITION=ROW
3407     /CLABELS COLLABELS=OPPOSITE
3408     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3409     /SLABELS POSITION=ROW
3410     /CLABELS COLLABELS=OPPOSITE.
3411 ]])
3412 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3413                           Custom Tables
3414 Male
3415 ╭──────────────────────────────────────────┬───────────────────╮
3416 │                                          │        QN27       │
3417 │                                          ├─────────┬─────────┤
3418 │                                          │   Yes   │    No   │
3419 │                                          ├─────────┼─────────┤
3420 │                                          │  QND7A  │  QND7A  │
3421 │                                          ├────┬────┼────┬────┤
3422 │                                          │ Yes│ No │ Yes│ No │
3423 │                                          ├────┼────┼────┼────┤
3424 │                                          │QN86│QN86│QN86│QN86│
3425 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3426 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3427 │                               Layer ID   │   1│   1│   1│   1│
3428 │                               Subtable ID│   1│   1│   2│   2│
3429 │                          ╶───────────────┼────┼────┼────┼────┤
3430 │                           No  Table ID   │   1│   1│   1│   1│
3431 │                               Layer ID   │   1│   1│   1│   1│
3432 │                               Subtable ID│   1│   1│   2│   2│
3433 │                      ╶───────────────────┼────┼────┼────┼────┤
3434 │                       No  Yes Table ID   │   1│   1│   1│   1│
3435 │                               Layer ID   │   1│   1│   1│   1│
3436 │                               Subtable ID│   3│   3│   4│   4│
3437 │                          ╶───────────────┼────┼────┼────┼────┤
3438 │                           No  Table ID   │   1│   1│   1│   1│
3439 │                               Layer ID   │   1│   1│   1│   1│
3440 │                               Subtable ID│   3│   3│   4│   4│
3441 │             ╶────────────────────────────┼────┼────┼────┼────┤
3442 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3443 │                               Layer ID   │   1│   1│   1│   1│
3444 │                               Subtable ID│   5│   5│   6│   6│
3445 │                          ╶───────────────┼────┼────┼────┼────┤
3446 │                           No  Table ID   │   1│   1│   1│   1│
3447 │                               Layer ID   │   1│   1│   1│   1│
3448 │                               Subtable ID│   5│   5│   6│   6│
3449 │                      ╶───────────────────┼────┼────┼────┼────┤
3450 │                       No  Yes Table ID   │   1│   1│   1│   1│
3451 │                               Layer ID   │   1│   1│   1│   1│
3452 │                               Subtable ID│   7│   7│   8│   8│
3453 │                          ╶───────────────┼────┼────┼────┼────┤
3454 │                           No  Table ID   │   1│   1│   1│   1│
3455 │                               Layer ID   │   1│   1│   1│   1│
3456 │                               Subtable ID│   7│   7│   8│   8│
3457 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3458 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3459 │                               Layer ID   │   1│   1│   1│   1│
3460 │                               Subtable ID│   9│   9│  10│  10│
3461 │                          ╶───────────────┼────┼────┼────┼────┤
3462 │                           No  Table ID   │   1│   1│   1│   1│
3463 │                               Layer ID   │   1│   1│   1│   1│
3464 │                               Subtable ID│   9│   9│  10│  10│
3465 │                      ╶───────────────────┼────┼────┼────┼────┤
3466 │                       No  Yes Table ID   │   1│   1│   1│   1│
3467 │                               Layer ID   │   1│   1│   1│   1│
3468 │                               Subtable ID│  11│  11│  12│  12│
3469 │                          ╶───────────────┼────┼────┼────┼────┤
3470 │                           No  Table ID   │   1│   1│   1│   1│
3471 │                               Layer ID   │   1│   1│   1│   1│
3472 │                               Subtable ID│  11│  11│  12│  12│
3473 │             ╶────────────────────────────┼────┼────┼────┼────┤
3474 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3475 │                               Layer ID   │   1│   1│   1│   1│
3476 │                               Subtable ID│  13│  13│  14│  14│
3477 │                          ╶───────────────┼────┼────┼────┼────┤
3478 │                           No  Table ID   │   1│   1│   1│   1│
3479 │                               Layer ID   │   1│   1│   1│   1│
3480 │                               Subtable ID│  13│  13│  14│  14│
3481 │                      ╶───────────────────┼────┼────┼────┼────┤
3482 │                       No  Yes Table ID   │   1│   1│   1│   1│
3483 │                               Layer ID   │   1│   1│   1│   1│
3484 │                               Subtable ID│  15│  15│  16│  16│
3485 │                          ╶───────────────┼────┼────┼────┼────┤
3486 │                           No  Table ID   │   1│   1│   1│   1│
3487 │                               Layer ID   │   1│   1│   1│   1│
3488 │                               Subtable ID│  15│  15│  16│  16│
3489 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3490
3491                           Custom Tables
3492 Female
3493 ╭──────────────────────────────────────────┬───────────────────╮
3494 │                                          │        QN27       │
3495 │                                          ├─────────┬─────────┤
3496 │                                          │   Yes   │    No   │
3497 │                                          ├─────────┼─────────┤
3498 │                                          │  QND7A  │  QND7A  │
3499 │                                          ├────┬────┼────┬────┤
3500 │                                          │ Yes│ No │ Yes│ No │
3501 │                                          ├────┼────┼────┼────┤
3502 │                                          │QN86│QN86│QN86│QN86│
3503 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3504 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3505 │                               Layer ID   │   2│   2│   2│   2│
3506 │                               Subtable ID│  17│  17│  18│  18│
3507 │                          ╶───────────────┼────┼────┼────┼────┤
3508 │                           No  Table ID   │   1│   1│   1│   1│
3509 │                               Layer ID   │   2│   2│   2│   2│
3510 │                               Subtable ID│  17│  17│  18│  18│
3511 │                      ╶───────────────────┼────┼────┼────┼────┤
3512 │                       No  Yes Table ID   │   1│   1│   1│   1│
3513 │                               Layer ID   │   2│   2│   2│   2│
3514 │                               Subtable ID│  19│  19│  20│  20│
3515 │                          ╶───────────────┼────┼────┼────┼────┤
3516 │                           No  Table ID   │   1│   1│   1│   1│
3517 │                               Layer ID   │   2│   2│   2│   2│
3518 │                               Subtable ID│  19│  19│  20│  20│
3519 │             ╶────────────────────────────┼────┼────┼────┼────┤
3520 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3521 │                               Layer ID   │   2│   2│   2│   2│
3522 │                               Subtable ID│  21│  21│  22│  22│
3523 │                          ╶───────────────┼────┼────┼────┼────┤
3524 │                           No  Table ID   │   1│   1│   1│   1│
3525 │                               Layer ID   │   2│   2│   2│   2│
3526 │                               Subtable ID│  21│  21│  22│  22│
3527 │                      ╶───────────────────┼────┼────┼────┼────┤
3528 │                       No  Yes Table ID   │   1│   1│   1│   1│
3529 │                               Layer ID   │   2│   2│   2│   2│
3530 │                               Subtable ID│  23│  23│  24│  24│
3531 │                          ╶───────────────┼────┼────┼────┼────┤
3532 │                           No  Table ID   │   1│   1│   1│   1│
3533 │                               Layer ID   │   2│   2│   2│   2│
3534 │                               Subtable ID│  23│  23│  24│  24│
3535 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3536 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3537 │                               Layer ID   │   2│   2│   2│   2│
3538 │                               Subtable ID│  25│  25│  26│  26│
3539 │                          ╶───────────────┼────┼────┼────┼────┤
3540 │                           No  Table ID   │   1│   1│   1│   1│
3541 │                               Layer ID   │   2│   2│   2│   2│
3542 │                               Subtable ID│  25│  25│  26│  26│
3543 │                      ╶───────────────────┼────┼────┼────┼────┤
3544 │                       No  Yes Table ID   │   1│   1│   1│   1│
3545 │                               Layer ID   │   2│   2│   2│   2│
3546 │                               Subtable ID│  27│  27│  28│  28│
3547 │                          ╶───────────────┼────┼────┼────┼────┤
3548 │                           No  Table ID   │   1│   1│   1│   1│
3549 │                               Layer ID   │   2│   2│   2│   2│
3550 │                               Subtable ID│  27│  27│  28│  28│
3551 │             ╶────────────────────────────┼────┼────┼────┼────┤
3552 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3553 │                               Layer ID   │   2│   2│   2│   2│
3554 │                               Subtable ID│  29│  29│  30│  30│
3555 │                          ╶───────────────┼────┼────┼────┼────┤
3556 │                           No  Table ID   │   1│   1│   1│   1│
3557 │                               Layer ID   │   2│   2│   2│   2│
3558 │                               Subtable ID│  29│  29│  30│  30│
3559 │                      ╶───────────────────┼────┼────┼────┼────┤
3560 │                       No  Yes Table ID   │   1│   1│   1│   1│
3561 │                               Layer ID   │   2│   2│   2│   2│
3562 │                               Subtable ID│  31│  31│  32│  32│
3563 │                          ╶───────────────┼────┼────┼────┼────┤
3564 │                           No  Table ID   │   1│   1│   1│   1│
3565 │                               Layer ID   │   2│   2│   2│   2│
3566 │                               Subtable ID│  31│  31│  32│  32│
3567 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3568
3569                           Custom Tables
3570 Male
3571 ╭───────────────────────────────────────────┬───────────────────╮
3572 │                                           │        QN27       │
3573 │                                           ├─────────┬─────────┤
3574 │                                           │   Yes   │    No   │
3575 │                                           ├─────────┼─────────┤
3576 │                                           │  QND7A  │  QND7A  │
3577 │                                           ├────┬────┼────┬────┤
3578 │                                           │ Yes│ No │ Yes│ No │
3579 │                                           ├────┼────┼────┼────┤
3580 │                                           │QN86│QN86│QN86│QN86│
3581 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3582 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   1│   1│   3│   3│
3583 │                               Layer Row ID│   1│   1│   1│   1│
3584 │                          ╶────────────────┼────┼────┼────┼────┤
3585 │                           No  Row ID      │   2│   2│   4│   4│
3586 │                               Layer Row ID│   2│   2│   2│   2│
3587 │                      ╶────────────────────┼────┼────┼────┼────┤
3588 │                       No  Yes Row ID      │   6│   6│   7│   7│
3589 │                               Layer Row ID│   4│   4│   4│   4│
3590 │                          ╶────────────────┼────┼────┼────┼────┤
3591 │                           No  Row ID      │   5│   5│   8│   8│
3592 │                               Layer Row ID│   3│   3│   3│   3│
3593 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3594 │              No  QN57 Yes Yes Row ID      │  10│  10│  11│  11│
3595 │                               Layer Row ID│   6│   6│   6│   6│
3596 │                          ╶────────────────┼────┼────┼────┼────┤
3597 │                           No  Row ID      │   9│   9│  12│  12│
3598 │                               Layer Row ID│   5│   5│   5│   5│
3599 │                      ╶────────────────────┼────┼────┼────┼────┤
3600 │                       No  Yes Row ID      │  13│  13│  15│  15│
3601 │                               Layer Row ID│   7│   7│   7│   7│
3602 │                          ╶────────────────┼────┼────┼────┼────┤
3603 │                           No  Row ID      │  14│  14│  16│  16│
3604 │                               Layer Row ID│   8│   8│   8│   8│
3605 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3606 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  20│  20│
3607 │                               Layer Row ID│   9│   9│   9│   9│
3608 │                          ╶────────────────┼────┼────┼────┼────┤
3609 │                           No  Row ID      │  18│  18│  19│  19│
3610 │                               Layer Row ID│  10│  10│  10│  10│
3611 │                      ╶────────────────────┼────┼────┼────┼────┤
3612 │                       No  Yes Row ID      │  21│  21│  24│  24│
3613 │                               Layer Row ID│  11│  11│  11│  11│
3614 │                          ╶────────────────┼────┼────┼────┼────┤
3615 │                           No  Row ID      │  22│  22│  23│  23│
3616 │                               Layer Row ID│  12│  12│  12│  12│
3617 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3618 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
3619 │                               Layer Row ID│  13│  13│  13│  13│
3620 │                          ╶────────────────┼────┼────┼────┼────┤
3621 │                           No  Row ID      │  26│  26│  28│  28│
3622 │                               Layer Row ID│  14│  14│  14│  14│
3623 │                      ╶────────────────────┼────┼────┼────┼────┤
3624 │                       No  Yes Row ID      │  30│  30│  32│  32│
3625 │                               Layer Row ID│  16│  16│  16│  16│
3626 │                          ╶────────────────┼────┼────┼────┼────┤
3627 │                           No  Row ID      │  29│  29│  31│  31│
3628 │                               Layer Row ID│  15│  15│  15│  15│
3629 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3630
3631                           Custom Tables
3632 Female
3633 ╭───────────────────────────────────────────┬───────────────────╮
3634 │                                           │        QN27       │
3635 │                                           ├─────────┬─────────┤
3636 │                                           │   Yes   │    No   │
3637 │                                           ├─────────┼─────────┤
3638 │                                           │  QND7A  │  QND7A  │
3639 │                                           ├────┬────┼────┬────┤
3640 │                                           │ Yes│ No │ Yes│ No │
3641 │                                           ├────┼────┼────┼────┤
3642 │                                           │QN86│QN86│QN86│QN86│
3643 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3644 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  34│  34│  35│  35│
3645 │                               Layer Row ID│  18│  18│  18│  18│
3646 │                          ╶────────────────┼────┼────┼────┼────┤
3647 │                           No  Row ID      │  33│  33│  36│  36│
3648 │                               Layer Row ID│  17│  17│  17│  17│
3649 │                      ╶────────────────────┼────┼────┼────┼────┤
3650 │                       No  Yes Row ID      │  38│  38│  39│  39│
3651 │                               Layer Row ID│  20│  20│  20│  20│
3652 │                          ╶────────────────┼────┼────┼────┼────┤
3653 │                           No  Row ID      │  37│  37│  40│  40│
3654 │                               Layer Row ID│  19│  19│  19│  19│
3655 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3656 │              No  QN57 Yes Yes Row ID      │  42│  42│  43│  43│
3657 │                               Layer Row ID│  22│  22│  22│  22│
3658 │                          ╶────────────────┼────┼────┼────┼────┤
3659 │                           No  Row ID      │  41│  41│  44│  44│
3660 │                               Layer Row ID│  21│  21│  21│  21│
3661 │                      ╶────────────────────┼────┼────┼────┼────┤
3662 │                       No  Yes Row ID      │  45│  45│  47│  47│
3663 │                               Layer Row ID│  23│  23│  23│  23│
3664 │                          ╶────────────────┼────┼────┼────┼────┤
3665 │                           No  Row ID      │  46│  46│  48│  48│
3666 │                               Layer Row ID│  24│  24│  24│  24│
3667 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3668 │     No  QN61 Yes QN57 Yes Yes Row ID      │  50│  50│  51│  51│
3669 │                               Layer Row ID│  26│  26│  26│  26│
3670 │                          ╶────────────────┼────┼────┼────┼────┤
3671 │                           No  Row ID      │  49│  49│  52│  52│
3672 │                               Layer Row ID│  25│  25│  25│  25│
3673 │                      ╶────────────────────┼────┼────┼────┼────┤
3674 │                       No  Yes Row ID      │  53│  53│  55│  55│
3675 │                               Layer Row ID│  27│  27│  27│  27│
3676 │                          ╶────────────────┼────┼────┼────┼────┤
3677 │                           No  Row ID      │  54│  54│  56│  56│
3678 │                               Layer Row ID│  28│  28│  28│  28│
3679 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3680 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
3681 │                               Layer Row ID│  29│  29│  29│  29│
3682 │                          ╶────────────────┼────┼────┼────┼────┤
3683 │                           No  Row ID      │  58│  58│  60│  60│
3684 │                               Layer Row ID│  30│  30│  30│  30│
3685 │                      ╶────────────────────┼────┼────┼────┼────┤
3686 │                       No  Yes Row ID      │  62│  62│  64│  64│
3687 │                               Layer Row ID│  32│  32│  32│  32│
3688 │                          ╶────────────────┼────┼────┼────┼────┤
3689 │                           No  Row ID      │  61│  61│  63│  63│
3690 │                               Layer Row ID│  31│  31│  31│  31│
3691 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3692
3693                             Custom Tables
3694 Male
3695 ╭──────────────────────────────────────────────┬───────────────────╮
3696 │                                              │        QN27       │
3697 │                                              ├─────────┬─────────┤
3698 │                                              │   Yes   │    No   │
3699 │                                              ├─────────┼─────────┤
3700 │                                              │  QND7A  │  QND7A  │
3701 │                                              ├────┬────┼────┬────┤
3702 │                                              │ Yes│ No │ Yes│ No │
3703 │                                              ├────┼────┼────┼────┤
3704 │                                              │QN86│QN86│QN86│QN86│
3705 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3706 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
3707 │                               Layer Column ID│   1│   2│   3│   4│
3708 │                          ╶───────────────────┼────┼────┼────┼────┤
3709 │                           No  Column ID      │   1│   2│   3│   4│
3710 │                               Layer Column ID│   1│   2│   3│   4│
3711 │                      ╶───────────────────────┼────┼────┼────┼────┤
3712 │                       No  Yes Column ID      │   5│   6│   7│   8│
3713 │                               Layer Column ID│   1│   2│   3│   4│
3714 │                          ╶───────────────────┼────┼────┼────┼────┤
3715 │                           No  Column ID      │   5│   6│   7│   8│
3716 │                               Layer Column ID│   1│   2│   3│   4│
3717 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3718 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
3719 │                               Layer Column ID│   1│   2│   3│   4│
3720 │                          ╶───────────────────┼────┼────┼────┼────┤
3721 │                           No  Column ID      │   9│  10│  11│  12│
3722 │                               Layer Column ID│   1│   2│   3│   4│
3723 │                      ╶───────────────────────┼────┼────┼────┼────┤
3724 │                       No  Yes Column ID      │  13│  14│  15│  16│
3725 │                               Layer Column ID│   1│   2│   3│   4│
3726 │                          ╶───────────────────┼────┼────┼────┼────┤
3727 │                           No  Column ID      │  13│  14│  15│  16│
3728 │                               Layer Column ID│   1│   2│   3│   4│
3729 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3730 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
3731 │                               Layer Column ID│   1│   2│   3│   4│
3732 │                          ╶───────────────────┼────┼────┼────┼────┤
3733 │                           No  Column ID      │  17│  18│  19│  20│
3734 │                               Layer Column ID│   1│   2│   3│   4│
3735 │                      ╶───────────────────────┼────┼────┼────┼────┤
3736 │                       No  Yes Column ID      │  21│  22│  23│  24│
3737 │                               Layer Column ID│   1│   2│   3│   4│
3738 │                          ╶───────────────────┼────┼────┼────┼────┤
3739 │                           No  Column ID      │  21│  22│  23│  24│
3740 │                               Layer Column ID│   1│   2│   3│   4│
3741 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3742 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
3743 │                               Layer Column ID│   1│   2│   3│   4│
3744 │                          ╶───────────────────┼────┼────┼────┼────┤
3745 │                           No  Column ID      │  25│  26│  27│  28│
3746 │                               Layer Column ID│   1│   2│   3│   4│
3747 │                      ╶───────────────────────┼────┼────┼────┼────┤
3748 │                       No  Yes Column ID      │  29│  30│  31│  32│
3749 │                               Layer Column ID│   1│   2│   3│   4│
3750 │                          ╶───────────────────┼────┼────┼────┼────┤
3751 │                           No  Column ID      │  29│  30│  31│  32│
3752 │                               Layer Column ID│   1│   2│   3│   4│
3753 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3754
3755                             Custom Tables
3756 Female
3757 ╭──────────────────────────────────────────────┬───────────────────╮
3758 │                                              │        QN27       │
3759 │                                              ├─────────┬─────────┤
3760 │                                              │   Yes   │    No   │
3761 │                                              ├─────────┼─────────┤
3762 │                                              │  QND7A  │  QND7A  │
3763 │                                              ├────┬────┼────┬────┤
3764 │                                              │ Yes│ No │ Yes│ No │
3765 │                                              ├────┼────┼────┼────┤
3766 │                                              │QN86│QN86│QN86│QN86│
3767 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3768 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
3769 │                               Layer Column ID│   5│   6│   7│   8│
3770 │                          ╶───────────────────┼────┼────┼────┼────┤
3771 │                           No  Column ID      │  33│  34│  35│  36│
3772 │                               Layer Column ID│   5│   6│   7│   8│
3773 │                      ╶───────────────────────┼────┼────┼────┼────┤
3774 │                       No  Yes Column ID      │  37│  38│  39│  40│
3775 │                               Layer Column ID│   5│   6│   7│   8│
3776 │                          ╶───────────────────┼────┼────┼────┼────┤
3777 │                           No  Column ID      │  37│  38│  39│  40│
3778 │                               Layer Column ID│   5│   6│   7│   8│
3779 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3780 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
3781 │                               Layer Column ID│   5│   6│   7│   8│
3782 │                          ╶───────────────────┼────┼────┼────┼────┤
3783 │                           No  Column ID      │  41│  42│  43│  44│
3784 │                               Layer Column ID│   5│   6│   7│   8│
3785 │                      ╶───────────────────────┼────┼────┼────┼────┤
3786 │                       No  Yes Column ID      │  45│  46│  47│  48│
3787 │                               Layer Column ID│   5│   6│   7│   8│
3788 │                          ╶───────────────────┼────┼────┼────┼────┤
3789 │                           No  Column ID      │  45│  46│  47│  48│
3790 │                               Layer Column ID│   5│   6│   7│   8│
3791 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3792 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
3793 │                               Layer Column ID│   5│   6│   7│   8│
3794 │                          ╶───────────────────┼────┼────┼────┼────┤
3795 │                           No  Column ID      │  49│  50│  51│  52│
3796 │                               Layer Column ID│   5│   6│   7│   8│
3797 │                      ╶───────────────────────┼────┼────┼────┼────┤
3798 │                       No  Yes Column ID      │  53│  54│  55│  56│
3799 │                               Layer Column ID│   5│   6│   7│   8│
3800 │                          ╶───────────────────┼────┼────┼────┼────┤
3801 │                           No  Column ID      │  53│  54│  55│  56│
3802 │                               Layer Column ID│   5│   6│   7│   8│
3803 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3804 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
3805 │                               Layer Column ID│   5│   6│   7│   8│
3806 │                          ╶───────────────────┼────┼────┼────┼────┤
3807 │                           No  Column ID      │  57│  58│  59│  60│
3808 │                               Layer Column ID│   5│   6│   7│   8│
3809 │                      ╶───────────────────────┼────┼────┼────┼────┤
3810 │                       No  Yes Column ID      │  61│  62│  63│  64│
3811 │                               Layer Column ID│   5│   6│   7│   8│
3812 │                          ╶───────────────────┼────┼────┼────┼────┤
3813 │                           No  Column ID      │  61│  62│  63│  64│
3814 │                               Layer Column ID│   5│   6│   7│   8│
3815 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3816 ])
3817 AT_CLEANUP
3818
3819 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
3820 AT_KEYWORDS([ROWLABELS LAYER])
3821 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3822 AT_DATA([ctables.sps],
3823 [[GET 'nhtsa.sav'.
3824 CTABLES
3825     /VLABELS VARIABLES=ALL DISPLAY=NAME
3826     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3827     /SLABELS POSITION=ROW
3828     /CLABELS ROWLABELS=LAYER
3829     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3830     /SLABELS POSITION=ROW
3831     /CLABELS ROWLABELS=LAYER
3832     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3833     /SLABELS POSITION=ROW
3834     /CLABELS ROWLABELS=LAYER.
3835 ]])
3836 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3837                           Custom Tables
3838 Male
3839 Yes
3840 ╭──────────────────────────────────┬───────────────────────────╮
3841 │                                  │            QN27           │
3842 │                                  ├─────────────┬─────────────┤
3843 │                                  │     Yes     │      No     │
3844 │                                  ├─────────────┼─────────────┤
3845 │                                  │    QND7A    │    QND7A    │
3846 │                                  ├──────┬──────┼──────┬──────┤
3847 │                                  │  Yes │  No  │  Yes │  No  │
3848 │                                  ├──────┼──────┼──────┼──────┤
3849 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3850 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3851 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3852 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3853 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3854 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3855 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  7│ 7│
3856 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3857 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3858 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3859 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  7│ 7│
3860 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3861 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3862 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3863 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 15│15│
3864 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3865 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3866 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3867 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 15│15│
3868 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3869
3870                           Custom Tables
3871 Male
3872 No
3873 ╭──────────────────────────────────┬───────────────────────────╮
3874 │                                  │            QN27           │
3875 │                                  ├─────────────┬─────────────┤
3876 │                                  │     Yes     │      No     │
3877 │                                  ├─────────────┼─────────────┤
3878 │                                  │    QND7A    │    QND7A    │
3879 │                                  ├──────┬──────┼──────┬──────┤
3880 │                                  │  Yes │  No  │  Yes │  No  │
3881 │                                  ├──────┼──────┼──────┼──────┤
3882 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3883 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3884 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3885 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3886 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3887 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3888 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  8│ 8│
3889 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3890 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3891 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3892 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  8│ 8│
3893 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3894 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3895 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3896 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 16│16│
3897 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3898 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3899 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3900 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 16│16│
3901 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3902
3903                           Custom Tables
3904 Female
3905 Yes
3906 ╭──────────────────────────────────┬───────────────────────────╮
3907 │                                  │            QN27           │
3908 │                                  ├─────────────┬─────────────┤
3909 │                                  │     Yes     │      No     │
3910 │                                  ├─────────────┼─────────────┤
3911 │                                  │    QND7A    │    QND7A    │
3912 │                                  ├──────┬──────┼──────┬──────┤
3913 │                                  │  Yes │  No  │  Yes │  No  │
3914 │                                  ├──────┼──────┼──────┼──────┤
3915 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3916 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3917 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3918 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3919 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3920 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3921 │                       Subtable ID│ 18│18│ 20│20│ 21│21│ 23│23│
3922 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3923 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3924 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3925 │                       Subtable ID│ 18│18│ 20│20│ 21│21│ 23│23│
3926 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3927 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3928 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3929 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3930 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3931 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3932 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3933 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3934 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3935
3936                           Custom Tables
3937 Female
3938 No
3939 ╭──────────────────────────────────┬───────────────────────────╮
3940 │                                  │            QN27           │
3941 │                                  ├─────────────┬─────────────┤
3942 │                                  │     Yes     │      No     │
3943 │                                  ├─────────────┼─────────────┤
3944 │                                  │    QND7A    │    QND7A    │
3945 │                                  ├──────┬──────┼──────┬──────┤
3946 │                                  │  Yes │  No  │  Yes │  No  │
3947 │                                  ├──────┼──────┼──────┼──────┤
3948 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3949 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3950 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3951 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3952 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3953 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3954 │                       Subtable ID│ 17│17│ 19│19│ 22│22│ 24│24│
3955 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3956 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3957 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3958 │                       Subtable ID│ 17│17│ 19│19│ 22│22│ 24│24│
3959 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3960 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3961 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3962 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3963 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3964 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3965 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3966 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3967 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3968
3969                           Custom Tables
3970 Male
3971 Yes
3972 ╭───────────────────────────────────┬───────────────────────────╮
3973 │                                   │            QN27           │
3974 │                                   ├─────────────┬─────────────┤
3975 │                                   │     Yes     │      No     │
3976 │                                   ├─────────────┼─────────────┤
3977 │                                   │    QND7A    │    QND7A    │
3978 │                                   ├──────┬──────┼──────┬──────┤
3979 │                                   │  Yes │  No  │  Yes │  No  │
3980 │                                   ├──────┼──────┼──────┼──────┤
3981 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
3982 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
3983 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
3984 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3985 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  6│ 6│  7│ 7│
3986 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3987 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3988 │              No  QN57 Row ID      │ 10│10│ 11│11│ 13│13│ 15│15│
3989 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3990 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3991 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 20│20│ 21│21│ 24│24│
3992 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3993 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3994 │              No  QN57 Row ID      │ 25│25│ 28│28│ 30│30│ 31│31│
3995 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3996 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3997
3998                           Custom Tables
3999 Male
4000 No
4001 ╭───────────────────────────────────┬───────────────────────────╮
4002 │                                   │            QN27           │
4003 │                                   ├─────────────┬─────────────┤
4004 │                                   │     Yes     │      No     │
4005 │                                   ├─────────────┼─────────────┤
4006 │                                   │    QND7A    │    QND7A    │
4007 │                                   ├──────┬──────┼──────┬──────┤
4008 │                                   │  Yes │  No  │  Yes │  No  │
4009 │                                   ├──────┼──────┼──────┼──────┤
4010 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4011 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4012 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4013 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4014 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  5│ 5│  8│ 8│
4015 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4016 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4017 │              No  QN57 Row ID      │  9│ 9│ 12│12│ 14│14│ 16│16│
4018 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4019 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4020 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 19│19│ 22│22│ 23│23│
4021 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4022 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4023 │              No  QN57 Row ID      │ 26│26│ 27│27│ 29│29│ 32│32│
4024 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4025 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4026
4027                           Custom Tables
4028 Female
4029 Yes
4030 ╭───────────────────────────────────┬───────────────────────────╮
4031 │                                   │            QN27           │
4032 │                                   ├─────────────┬─────────────┤
4033 │                                   │     Yes     │      No     │
4034 │                                   ├─────────────┼─────────────┤
4035 │                                   │    QND7A    │    QND7A    │
4036 │                                   ├──────┬──────┼──────┬──────┤
4037 │                                   │  Yes │  No  │  Yes │  No  │
4038 │                                   ├──────┼──────┼──────┼──────┤
4039 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4040 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4041 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4042 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4043 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 39│39│
4044 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4045 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4046 │              No  QN57 Row ID      │ 41│41│ 43│43│ 46│46│ 47│47│
4047 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4048 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4049 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 51│51│ 53│53│ 56│56│
4050 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4051 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4052 │              No  QN57 Row ID      │ 58│58│ 59│59│ 62│62│ 63│63│
4053 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4054 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4055
4056                           Custom Tables
4057 Female
4058 No
4059 ╭───────────────────────────────────┬───────────────────────────╮
4060 │                                   │            QN27           │
4061 │                                   ├─────────────┬─────────────┤
4062 │                                   │     Yes     │      No     │
4063 │                                   ├─────────────┼─────────────┤
4064 │                                   │    QND7A    │    QND7A    │
4065 │                                   ├──────┬──────┼──────┬──────┤
4066 │                                   │  Yes │  No  │  Yes │  No  │
4067 │                                   ├──────┼──────┼──────┼──────┤
4068 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4069 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4070 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4071 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4072 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 40│40│
4073 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4074 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4075 │              No  QN57 Row ID      │ 42│42│ 44│44│ 45│45│ 48│48│
4076 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4077 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4078 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 52│52│ 54│54│ 55│55│
4079 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4080 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4081 │              No  QN57 Row ID      │ 57│57│ 60│60│ 61│61│ 64│64│
4082 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4083 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4084
4085                             Custom Tables
4086 Male
4087 Yes
4088 ╭──────────────────────────────────────┬───────────────────────────╮
4089 │                                      │            QN27           │
4090 │                                      ├─────────────┬─────────────┤
4091 │                                      │     Yes     │      No     │
4092 │                                      ├─────────────┼─────────────┤
4093 │                                      │    QND7A    │    QND7A    │
4094 │                                      ├──────┬──────┼──────┬──────┤
4095 │                                      │  Yes │  No  │  Yes │  No  │
4096 │                                      ├──────┼──────┼──────┼──────┤
4097 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4098 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4099 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4100 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4101 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 4│  6│ 8│  9│11│ 14│15│
4102 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4103 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4104 │              No  QN57 Column ID      │  1│ 4│  6│ 8│  9│11│ 14│15│
4105 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4106 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4107 │     No  QN61 Yes QN57 Column ID      │ 18│19│ 22│23│ 25│27│ 29│32│
4108 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4109 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4110 │              No  QN57 Column ID      │ 18│19│ 22│23│ 25│27│ 29│32│
4111 │                       Layer Column ID│  1│ 4│  6│ 8│  9│11│ 14│15│
4112 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4113
4114                             Custom Tables
4115 Male
4116 No
4117 ╭──────────────────────────────────────┬───────────────────────────╮
4118 │                                      │            QN27           │
4119 │                                      ├─────────────┬─────────────┤
4120 │                                      │     Yes     │      No     │
4121 │                                      ├─────────────┼─────────────┤
4122 │                                      │    QND7A    │    QND7A    │
4123 │                                      ├──────┬──────┼──────┬──────┤
4124 │                                      │  Yes │  No  │  Yes │  No  │
4125 │                                      ├──────┼──────┼──────┼──────┤
4126 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4127 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4128 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4129 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4130 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 3│  5│ 7│ 10│12│ 13│16│
4131 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4132 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4133 │              No  QN57 Column ID      │  2│ 3│  5│ 7│ 10│12│ 13│16│
4134 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4135 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4136 │     No  QN61 Yes QN57 Column ID      │ 17│20│ 21│24│ 26│28│ 30│31│
4137 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4138 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4139 │              No  QN57 Column ID      │ 17│20│ 21│24│ 26│28│ 30│31│
4140 │                       Layer Column ID│  2│ 3│  5│ 7│ 10│12│ 13│16│
4141 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4142
4143                             Custom Tables
4144 Female
4145 Yes
4146 ╭──────────────────────────────────────┬───────────────────────────╮
4147 │                                      │            QN27           │
4148 │                                      ├─────────────┬─────────────┤
4149 │                                      │     Yes     │      No     │
4150 │                                      ├─────────────┼─────────────┤
4151 │                                      │    QND7A    │    QND7A    │
4152 │                                      ├──────┬──────┼──────┬──────┤
4153 │                                      │  Yes │  No  │  Yes │  No  │
4154 │                                      ├──────┼──────┼──────┼──────┤
4155 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4156 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4157 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4158 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4159 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│36│ 37│39│ 42│44│ 45│47│
4160 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4161 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4162 │              No  QN57 Column ID      │ 33│36│ 37│39│ 42│44│ 45│47│
4163 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4164 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4165 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 54│56│ 57│60│ 62│64│
4166 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4167 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4168 │              No  QN57 Column ID      │ 49│51│ 54│56│ 57│60│ 62│64│
4169 │                       Layer Column ID│ 17│20│ 21│23│ 26│28│ 29│31│
4170 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4171
4172                             Custom Tables
4173 Female
4174 No
4175 ╭──────────────────────────────────────┬───────────────────────────╮
4176 │                                      │            QN27           │
4177 │                                      ├─────────────┬─────────────┤
4178 │                                      │     Yes     │      No     │
4179 │                                      ├─────────────┼─────────────┤
4180 │                                      │    QND7A    │    QND7A    │
4181 │                                      ├──────┬──────┼──────┬──────┤
4182 │                                      │  Yes │  No  │  Yes │  No  │
4183 │                                      ├──────┼──────┼──────┼──────┤
4184 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4185 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4186 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4187 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4188 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│35│ 38│40│ 41│43│ 46│48│
4189 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4190 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4191 │              No  QN57 Column ID      │ 34│35│ 38│40│ 41│43│ 46│48│
4192 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4193 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4194 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 53│55│ 58│59│ 61│63│
4195 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4196 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4197 │              No  QN57 Column ID      │ 50│52│ 53│55│ 58│59│ 61│63│
4198 │                       Layer Column ID│ 18│19│ 22│24│ 25│27│ 30│32│
4199 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4200 ])
4201 AT_CLEANUP
4202
4203 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4204 AT_KEYWORDS([COLLABELS LAYER])
4205 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4206 AT_DATA([ctables.sps],
4207 [[GET 'nhtsa.sav'.
4208 CTABLES
4209     /VLABELS VARIABLES=ALL DISPLAY=NAME
4210     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4211     /SLABELS POSITION=ROW
4212     /CLABELS COLLABELS=LAYER
4213     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4214     /SLABELS POSITION=ROW
4215     /CLABELS COLLABELS=LAYER
4216     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4217     /SLABELS POSITION=ROW
4218     /CLABELS COLLABELS=LAYER.
4219 ]])
4220 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4221                         Custom Tables
4222 Male
4223 Yes
4224 ╭──────────────────────────────────────┬───────────────────╮
4225 │                                      │        QN27       │
4226 │                                      ├─────────┬─────────┤
4227 │                                      │   Yes   │    No   │
4228 │                                      ├─────────┼─────────┤
4229 │                                      │  QND7A  │  QND7A  │
4230 │                                      ├────┬────┼────┬────┤
4231 │                                      │ Yes│ No │ Yes│ No │
4232 │                                      ├────┼────┼────┼────┤
4233 │                                      │QN86│QN86│QN86│QN86│
4234 ├──────────────────────────────────────┼────┼────┼────┼────┤
4235 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4236 │                           Layer ID   │   2│   2│   2│   2│
4237 │                           Subtable ID│   2│   2│   4│   4│
4238 │                      ╶───────────────┼────┼────┼────┼────┤
4239 │                       No  Table ID   │   1│   1│   1│   1│
4240 │                           Layer ID   │   2│   2│   2│   2│
4241 │                           Subtable ID│   2│   2│   4│   4│
4242 │             ╶────────────────────────┼────┼────┼────┼────┤
4243 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4244 │                           Layer ID   │   2│   2│   2│   2│
4245 │                           Subtable ID│   5│   5│   8│   8│
4246 │                      ╶───────────────┼────┼────┼────┼────┤
4247 │                       No  Table ID   │   1│   1│   1│   1│
4248 │                           Layer ID   │   2│   2│   2│   2│
4249 │                           Subtable ID│   5│   5│   8│   8│
4250 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4251 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4252 │                           Layer ID   │   2│   2│   2│   2│
4253 │                           Subtable ID│   9│   9│  12│  12│
4254 │                      ╶───────────────┼────┼────┼────┼────┤
4255 │                       No  Table ID   │   1│   1│   1│   1│
4256 │                           Layer ID   │   2│   2│   2│   2│
4257 │                           Subtable ID│   9│   9│  12│  12│
4258 │             ╶────────────────────────┼────┼────┼────┼────┤
4259 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4260 │                           Layer ID   │   2│   2│   2│   2│
4261 │                           Subtable ID│  14│  14│  15│  15│
4262 │                      ╶───────────────┼────┼────┼────┼────┤
4263 │                       No  Table ID   │   1│   1│   1│   1│
4264 │                           Layer ID   │   2│   2│   2│   2│
4265 │                           Subtable ID│  14│  14│  15│  15│
4266 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4267
4268                         Custom Tables
4269 Male
4270 No
4271 ╭──────────────────────────────────────┬───────────────────╮
4272 │                                      │        QN27       │
4273 │                                      ├─────────┬─────────┤
4274 │                                      │   Yes   │    No   │
4275 │                                      ├─────────┼─────────┤
4276 │                                      │  QND7A  │  QND7A  │
4277 │                                      ├────┬────┼────┬────┤
4278 │                                      │ Yes│ No │ Yes│ No │
4279 │                                      ├────┼────┼────┼────┤
4280 │                                      │QN86│QN86│QN86│QN86│
4281 ├──────────────────────────────────────┼────┼────┼────┼────┤
4282 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4283 │                           Layer ID   │   1│   1│   1│   1│
4284 │                           Subtable ID│   1│   1│   3│   3│
4285 │                      ╶───────────────┼────┼────┼────┼────┤
4286 │                       No  Table ID   │   1│   1│   1│   1│
4287 │                           Layer ID   │   1│   1│   1│   1│
4288 │                           Subtable ID│   1│   1│   3│   3│
4289 │             ╶────────────────────────┼────┼────┼────┼────┤
4290 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4291 │                           Layer ID   │   1│   1│   1│   1│
4292 │                           Subtable ID│   6│   6│   7│   7│
4293 │                      ╶───────────────┼────┼────┼────┼────┤
4294 │                       No  Table ID   │   1│   1│   1│   1│
4295 │                           Layer ID   │   1│   1│   1│   1│
4296 │                           Subtable ID│   6│   6│   7│   7│
4297 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4298 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4299 │                           Layer ID   │   1│   1│   1│   1│
4300 │                           Subtable ID│  10│  10│  11│  11│
4301 │                      ╶───────────────┼────┼────┼────┼────┤
4302 │                       No  Table ID   │   1│   1│   1│   1│
4303 │                           Layer ID   │   1│   1│   1│   1│
4304 │                           Subtable ID│  10│  10│  11│  11│
4305 │             ╶────────────────────────┼────┼────┼────┼────┤
4306 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4307 │                           Layer ID   │   1│   1│   1│   1│
4308 │                           Subtable ID│  13│  13│  16│  16│
4309 │                      ╶───────────────┼────┼────┼────┼────┤
4310 │                       No  Table ID   │   1│   1│   1│   1│
4311 │                           Layer ID   │   1│   1│   1│   1│
4312 │                           Subtable ID│  13│  13│  16│  16│
4313 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4314
4315                         Custom Tables
4316 Female
4317 Yes
4318 ╭──────────────────────────────────────┬───────────────────╮
4319 │                                      │        QN27       │
4320 │                                      ├─────────┬─────────┤
4321 │                                      │   Yes   │    No   │
4322 │                                      ├─────────┼─────────┤
4323 │                                      │  QND7A  │  QND7A  │
4324 │                                      ├────┬────┼────┬────┤
4325 │                                      │ Yes│ No │ Yes│ No │
4326 │                                      ├────┼────┼────┼────┤
4327 │                                      │QN86│QN86│QN86│QN86│
4328 ├──────────────────────────────────────┼────┼────┼────┼────┤
4329 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4330 │                           Layer ID   │   4│   4│   4│   4│
4331 │                           Subtable ID│  18│  18│  20│  20│
4332 │                      ╶───────────────┼────┼────┼────┼────┤
4333 │                       No  Table ID   │   1│   1│   1│   1│
4334 │                           Layer ID   │   4│   4│   4│   4│
4335 │                           Subtable ID│  18│  18│  20│  20│
4336 │             ╶────────────────────────┼────┼────┼────┼────┤
4337 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4338 │                           Layer ID   │   4│   4│   4│   4│
4339 │                           Subtable ID│  21│  21│  23│  23│
4340 │                      ╶───────────────┼────┼────┼────┼────┤
4341 │                       No  Table ID   │   1│   1│   1│   1│
4342 │                           Layer ID   │   4│   4│   4│   4│
4343 │                           Subtable ID│  21│  21│  23│  23│
4344 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4345 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4346 │                           Layer ID   │   4│   4│   4│   4│
4347 │                           Subtable ID│  25│  25│  28│  28│
4348 │                      ╶───────────────┼────┼────┼────┼────┤
4349 │                       No  Table ID   │   1│   1│   1│   1│
4350 │                           Layer ID   │   4│   4│   4│   4│
4351 │                           Subtable ID│  25│  25│  28│  28│
4352 │             ╶────────────────────────┼────┼────┼────┼────┤
4353 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4354 │                           Layer ID   │   4│   4│   4│   4│
4355 │                           Subtable ID│  30│  30│  32│  32│
4356 │                      ╶───────────────┼────┼────┼────┼────┤
4357 │                       No  Table ID   │   1│   1│   1│   1│
4358 │                           Layer ID   │   4│   4│   4│   4│
4359 │                           Subtable ID│  30│  30│  32│  32│
4360 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4361
4362                         Custom Tables
4363 Female
4364 No
4365 ╭──────────────────────────────────────┬───────────────────╮
4366 │                                      │        QN27       │
4367 │                                      ├─────────┬─────────┤
4368 │                                      │   Yes   │    No   │
4369 │                                      ├─────────┼─────────┤
4370 │                                      │  QND7A  │  QND7A  │
4371 │                                      ├────┬────┼────┬────┤
4372 │                                      │ Yes│ No │ Yes│ No │
4373 │                                      ├────┼────┼────┼────┤
4374 │                                      │QN86│QN86│QN86│QN86│
4375 ├──────────────────────────────────────┼────┼────┼────┼────┤
4376 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4377 │                           Layer ID   │   3│   3│   3│   3│
4378 │                           Subtable ID│  17│  17│  19│  19│
4379 │                      ╶───────────────┼────┼────┼────┼────┤
4380 │                       No  Table ID   │   1│   1│   1│   1│
4381 │                           Layer ID   │   3│   3│   3│   3│
4382 │                           Subtable ID│  17│  17│  19│  19│
4383 │             ╶────────────────────────┼────┼────┼────┼────┤
4384 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4385 │                           Layer ID   │   3│   3│   3│   3│
4386 │                           Subtable ID│  22│  22│  24│  24│
4387 │                      ╶───────────────┼────┼────┼────┼────┤
4388 │                       No  Table ID   │   1│   1│   1│   1│
4389 │                           Layer ID   │   3│   3│   3│   3│
4390 │                           Subtable ID│  22│  22│  24│  24│
4391 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4392 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4393 │                           Layer ID   │   3│   3│   3│   3│
4394 │                           Subtable ID│  26│  26│  27│  27│
4395 │                      ╶───────────────┼────┼────┼────┼────┤
4396 │                       No  Table ID   │   1│   1│   1│   1│
4397 │                           Layer ID   │   3│   3│   3│   3│
4398 │                           Subtable ID│  26│  26│  27│  27│
4399 │             ╶────────────────────────┼────┼────┼────┼────┤
4400 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4401 │                           Layer ID   │   3│   3│   3│   3│
4402 │                           Subtable ID│  29│  29│  31│  31│
4403 │                      ╶───────────────┼────┼────┼────┼────┤
4404 │                       No  Table ID   │   1│   1│   1│   1│
4405 │                           Layer ID   │   3│   3│   3│   3│
4406 │                           Subtable ID│  29│  29│  31│  31│
4407 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4408
4409                         Custom Tables
4410 Male
4411 Yes
4412 ╭───────────────────────────────────────┬───────────────────╮
4413 │                                       │        QN27       │
4414 │                                       ├─────────┬─────────┤
4415 │                                       │   Yes   │    No   │
4416 │                                       ├─────────┼─────────┤
4417 │                                       │  QND7A  │  QND7A  │
4418 │                                       ├────┬────┼────┬────┤
4419 │                                       │ Yes│ No │ Yes│ No │
4420 │                                       ├────┼────┼────┼────┤
4421 │                                       │QN86│QN86│QN86│QN86│
4422 ├───────────────────────────────────────┼────┼────┼────┼────┤
4423 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4424 │                           Layer Row ID│   1│   1│   1│   1│
4425 │                      ╶────────────────┼────┼────┼────┼────┤
4426 │                       No  Row ID      │   6│   6│   7│   7│
4427 │                           Layer Row ID│   4│   4│   4│   4│
4428 │             ╶─────────────────────────┼────┼────┼────┼────┤
4429 │              No  QN57 Yes Row ID      │  10│  10│  11│  11│
4430 │                           Layer Row ID│   6│   6│   6│   6│
4431 │                      ╶────────────────┼────┼────┼────┼────┤
4432 │                       No  Row ID      │  13│  13│  15│  15│
4433 │                           Layer Row ID│   7│   7│   7│   7│
4434 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4435 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  20│  20│
4436 │                           Layer Row ID│   9│   9│   9│   9│
4437 │                      ╶────────────────┼────┼────┼────┼────┤
4438 │                       No  Row ID      │  21│  21│  24│  24│
4439 │                           Layer Row ID│  11│  11│  11│  11│
4440 │             ╶─────────────────────────┼────┼────┼────┼────┤
4441 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4442 │                           Layer Row ID│  13│  13│  13│  13│
4443 │                      ╶────────────────┼────┼────┼────┼────┤
4444 │                       No  Row ID      │  30│  30│  32│  32│
4445 │                           Layer Row ID│  16│  16│  16│  16│
4446 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4447
4448                         Custom Tables
4449 Male
4450 No
4451 ╭───────────────────────────────────────┬───────────────────╮
4452 │                                       │        QN27       │
4453 │                                       ├─────────┬─────────┤
4454 │                                       │   Yes   │    No   │
4455 │                                       ├─────────┼─────────┤
4456 │                                       │  QND7A  │  QND7A  │
4457 │                                       ├────┬────┼────┬────┤
4458 │                                       │ Yes│ No │ Yes│ No │
4459 │                                       ├────┼────┼────┼────┤
4460 │                                       │QN86│QN86│QN86│QN86│
4461 ├───────────────────────────────────────┼────┼────┼────┼────┤
4462 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4463 │                           Layer Row ID│   2│   2│   2│   2│
4464 │                      ╶────────────────┼────┼────┼────┼────┤
4465 │                       No  Row ID      │   5│   5│   8│   8│
4466 │                           Layer Row ID│   3│   3│   3│   3│
4467 │             ╶─────────────────────────┼────┼────┼────┼────┤
4468 │              No  QN57 Yes Row ID      │   9│   9│  12│  12│
4469 │                           Layer Row ID│   5│   5│   5│   5│
4470 │                      ╶────────────────┼────┼────┼────┼────┤
4471 │                       No  Row ID      │  14│  14│  16│  16│
4472 │                           Layer Row ID│   8│   8│   8│   8│
4473 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4474 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  19│  19│
4475 │                           Layer Row ID│  10│  10│  10│  10│
4476 │                      ╶────────────────┼────┼────┼────┼────┤
4477 │                       No  Row ID      │  22│  22│  23│  23│
4478 │                           Layer Row ID│  12│  12│  12│  12│
4479 │             ╶─────────────────────────┼────┼────┼────┼────┤
4480 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4481 │                           Layer Row ID│  14│  14│  14│  14│
4482 │                      ╶────────────────┼────┼────┼────┼────┤
4483 │                       No  Row ID      │  29│  29│  31│  31│
4484 │                           Layer Row ID│  15│  15│  15│  15│
4485 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4486
4487                         Custom Tables
4488 Female
4489 Yes
4490 ╭───────────────────────────────────────┬───────────────────╮
4491 │                                       │        QN27       │
4492 │                                       ├─────────┬─────────┤
4493 │                                       │   Yes   │    No   │
4494 │                                       ├─────────┼─────────┤
4495 │                                       │  QND7A  │  QND7A  │
4496 │                                       ├────┬────┼────┬────┤
4497 │                                       │ Yes│ No │ Yes│ No │
4498 │                                       ├────┼────┼────┼────┤
4499 │                                       │QN86│QN86│QN86│QN86│
4500 ├───────────────────────────────────────┼────┼────┼────┼────┤
4501 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  35│  35│
4502 │                           Layer Row ID│  18│  18│  18│  18│
4503 │                      ╶────────────────┼────┼────┼────┼────┤
4504 │                       No  Row ID      │  38│  38│  39│  39│
4505 │                           Layer Row ID│  20│  20│  20│  20│
4506 │             ╶─────────────────────────┼────┼────┼────┼────┤
4507 │              No  QN57 Yes Row ID      │  42│  42│  43│  43│
4508 │                           Layer Row ID│  22│  22│  22│  22│
4509 │                      ╶────────────────┼────┼────┼────┼────┤
4510 │                       No  Row ID      │  45│  45│  47│  47│
4511 │                           Layer Row ID│  23│  23│  23│  23│
4512 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4513 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  51│  51│
4514 │                           Layer Row ID│  26│  26│  26│  26│
4515 │                      ╶────────────────┼────┼────┼────┼────┤
4516 │                       No  Row ID      │  53│  53│  55│  55│
4517 │                           Layer Row ID│  27│  27│  27│  27│
4518 │             ╶─────────────────────────┼────┼────┼────┼────┤
4519 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4520 │                           Layer Row ID│  29│  29│  29│  29│
4521 │                      ╶────────────────┼────┼────┼────┼────┤
4522 │                       No  Row ID      │  62│  62│  64│  64│
4523 │                           Layer Row ID│  32│  32│  32│  32│
4524 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4525
4526                         Custom Tables
4527 Female
4528 No
4529 ╭───────────────────────────────────────┬───────────────────╮
4530 │                                       │        QN27       │
4531 │                                       ├─────────┬─────────┤
4532 │                                       │   Yes   │    No   │
4533 │                                       ├─────────┼─────────┤
4534 │                                       │  QND7A  │  QND7A  │
4535 │                                       ├────┬────┼────┬────┤
4536 │                                       │ Yes│ No │ Yes│ No │
4537 │                                       ├────┼────┼────┼────┤
4538 │                                       │QN86│QN86│QN86│QN86│
4539 ├───────────────────────────────────────┼────┼────┼────┼────┤
4540 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  36│  36│
4541 │                           Layer Row ID│  17│  17│  17│  17│
4542 │                      ╶────────────────┼────┼────┼────┼────┤
4543 │                       No  Row ID      │  37│  37│  40│  40│
4544 │                           Layer Row ID│  19│  19│  19│  19│
4545 │             ╶─────────────────────────┼────┼────┼────┼────┤
4546 │              No  QN57 Yes Row ID      │  41│  41│  44│  44│
4547 │                           Layer Row ID│  21│  21│  21│  21│
4548 │                      ╶────────────────┼────┼────┼────┼────┤
4549 │                       No  Row ID      │  46│  46│  48│  48│
4550 │                           Layer Row ID│  24│  24│  24│  24│
4551 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4552 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  52│  52│
4553 │                           Layer Row ID│  25│  25│  25│  25│
4554 │                      ╶────────────────┼────┼────┼────┼────┤
4555 │                       No  Row ID      │  54│  54│  56│  56│
4556 │                           Layer Row ID│  28│  28│  28│  28│
4557 │             ╶─────────────────────────┼────┼────┼────┼────┤
4558 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
4559 │                           Layer Row ID│  30│  30│  30│  30│
4560 │                      ╶────────────────┼────┼────┼────┼────┤
4561 │                       No  Row ID      │  61│  61│  63│  63│
4562 │                           Layer Row ID│  31│  31│  31│  31│
4563 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4564
4565                           Custom Tables
4566 Male
4567 Yes
4568 ╭──────────────────────────────────────────┬───────────────────╮
4569 │                                          │        QN27       │
4570 │                                          ├─────────┬─────────┤
4571 │                                          │   Yes   │    No   │
4572 │                                          ├─────────┼─────────┤
4573 │                                          │  QND7A  │  QND7A  │
4574 │                                          ├────┬────┼────┬────┤
4575 │                                          │ Yes│ No │ Yes│ No │
4576 │                                          ├────┼────┼────┼────┤
4577 │                                          │QN86│QN86│QN86│QN86│
4578 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4579 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   7│
4580 │                           Layer Column ID│   2│   4│   6│   7│
4581 │                      ╶───────────────────┼────┼────┼────┼────┤
4582 │                       No  Column ID      │   2│   4│   6│   7│
4583 │                           Layer Column ID│   2│   4│   6│   7│
4584 │             ╶────────────────────────────┼────┼────┼────┼────┤
4585 │              No  QN57 Yes Column ID      │   9│  12│  13│  16│
4586 │                           Layer Column ID│   2│   4│   6│   7│
4587 │                      ╶───────────────────┼────┼────┼────┼────┤
4588 │                       No  Column ID      │   9│  12│  13│  16│
4589 │                           Layer Column ID│   2│   4│   6│   7│
4590 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4591 │     No  QN61 Yes QN57 Yes Column ID      │  18│  19│  22│  24│
4592 │                           Layer Column ID│   2│   4│   6│   7│
4593 │                      ╶───────────────────┼────┼────┼────┼────┤
4594 │                       No  Column ID      │  18│  19│  22│  24│
4595 │                           Layer Column ID│   2│   4│   6│   7│
4596 │             ╶────────────────────────────┼────┼────┼────┼────┤
4597 │              No  QN57 Yes Column ID      │  25│  27│  29│  32│
4598 │                           Layer Column ID│   2│   4│   6│   7│
4599 │                      ╶───────────────────┼────┼────┼────┼────┤
4600 │                       No  Column ID      │  25│  27│  29│  32│
4601 │                           Layer Column ID│   2│   4│   6│   7│
4602 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4603
4604                           Custom Tables
4605 Male
4606 No
4607 ╭──────────────────────────────────────────┬───────────────────╮
4608 │                                          │        QN27       │
4609 │                                          ├─────────┬─────────┤
4610 │                                          │   Yes   │    No   │
4611 │                                          ├─────────┼─────────┤
4612 │                                          │  QND7A  │  QND7A  │
4613 │                                          ├────┬────┼────┬────┤
4614 │                                          │ Yes│ No │ Yes│ No │
4615 │                                          ├────┼────┼────┼────┤
4616 │                                          │QN86│QN86│QN86│QN86│
4617 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4618 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   8│
4619 │                           Layer Column ID│   1│   3│   5│   8│
4620 │                      ╶───────────────────┼────┼────┼────┼────┤
4621 │                       No  Column ID      │   1│   3│   5│   8│
4622 │                           Layer Column ID│   1│   3│   5│   8│
4623 │             ╶────────────────────────────┼────┼────┼────┼────┤
4624 │              No  QN57 Yes Column ID      │  10│  11│  14│  15│
4625 │                           Layer Column ID│   1│   3│   5│   8│
4626 │                      ╶───────────────────┼────┼────┼────┼────┤
4627 │                       No  Column ID      │  10│  11│  14│  15│
4628 │                           Layer Column ID│   1│   3│   5│   8│
4629 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4630 │     No  QN61 Yes QN57 Yes Column ID      │  17│  20│  21│  23│
4631 │                           Layer Column ID│   1│   3│   5│   8│
4632 │                      ╶───────────────────┼────┼────┼────┼────┤
4633 │                       No  Column ID      │  17│  20│  21│  23│
4634 │                           Layer Column ID│   1│   3│   5│   8│
4635 │             ╶────────────────────────────┼────┼────┼────┼────┤
4636 │              No  QN57 Yes Column ID      │  26│  28│  30│  31│
4637 │                           Layer Column ID│   1│   3│   5│   8│
4638 │                      ╶───────────────────┼────┼────┼────┼────┤
4639 │                       No  Column ID      │  26│  28│  30│  31│
4640 │                           Layer Column ID│   1│   3│   5│   8│
4641 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4642
4643                           Custom Tables
4644 Female
4645 Yes
4646 ╭──────────────────────────────────────────┬───────────────────╮
4647 │                                          │        QN27       │
4648 │                                          ├─────────┬─────────┤
4649 │                                          │   Yes   │    No   │
4650 │                                          ├─────────┼─────────┤
4651 │                                          │  QND7A  │  QND7A  │
4652 │                                          ├────┬────┼────┬────┤
4653 │                                          │ Yes│ No │ Yes│ No │
4654 │                                          ├────┼────┼────┼────┤
4655 │                                          │QN86│QN86│QN86│QN86│
4656 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4657 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  37│  40│
4658 │                           Layer Column ID│  10│  12│  13│  16│
4659 │                      ╶───────────────────┼────┼────┼────┼────┤
4660 │                       No  Column ID      │  34│  36│  37│  40│
4661 │                           Layer Column ID│  10│  12│  13│  16│
4662 │             ╶────────────────────────────┼────┼────┼────┼────┤
4663 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
4664 │                           Layer Column ID│  10│  12│  13│  16│
4665 │                      ╶───────────────────┼────┼────┼────┼────┤
4666 │                       No  Column ID      │  41│  43│  45│  47│
4667 │                           Layer Column ID│  10│  12│  13│  16│
4668 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4669 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  54│  55│
4670 │                           Layer Column ID│  10│  12│  13│  16│
4671 │                      ╶───────────────────┼────┼────┼────┼────┤
4672 │                       No  Column ID      │  49│  51│  54│  55│
4673 │                           Layer Column ID│  10│  12│  13│  16│
4674 │             ╶────────────────────────────┼────┼────┼────┼────┤
4675 │              No  QN57 Yes Column ID      │  58│  60│  62│  63│
4676 │                           Layer Column ID│  10│  12│  13│  16│
4677 │                      ╶───────────────────┼────┼────┼────┼────┤
4678 │                       No  Column ID      │  58│  60│  62│  63│
4679 │                           Layer Column ID│  10│  12│  13│  16│
4680 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4681
4682                           Custom Tables
4683 Female
4684 No
4685 ╭──────────────────────────────────────────┬───────────────────╮
4686 │                                          │        QN27       │
4687 │                                          ├─────────┬─────────┤
4688 │                                          │   Yes   │    No   │
4689 │                                          ├─────────┼─────────┤
4690 │                                          │  QND7A  │  QND7A  │
4691 │                                          ├────┬────┼────┬────┤
4692 │                                          │ Yes│ No │ Yes│ No │
4693 │                                          ├────┼────┼────┼────┤
4694 │                                          │QN86│QN86│QN86│QN86│
4695 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4696 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  38│  39│
4697 │                           Layer Column ID│   9│  11│  14│  15│
4698 │                      ╶───────────────────┼────┼────┼────┼────┤
4699 │                       No  Column ID      │  33│  35│  38│  39│
4700 │                           Layer Column ID│   9│  11│  14│  15│
4701 │             ╶────────────────────────────┼────┼────┼────┼────┤
4702 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
4703 │                           Layer Column ID│   9│  11│  14│  15│
4704 │                      ╶───────────────────┼────┼────┼────┼────┤
4705 │                       No  Column ID      │  42│  44│  46│  48│
4706 │                           Layer Column ID│   9│  11│  14│  15│
4707 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4708 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  53│  56│
4709 │                           Layer Column ID│   9│  11│  14│  15│
4710 │                      ╶───────────────────┼────┼────┼────┼────┤
4711 │                       No  Column ID      │  50│  52│  53│  56│
4712 │                           Layer Column ID│   9│  11│  14│  15│
4713 │             ╶────────────────────────────┼────┼────┼────┼────┤
4714 │              No  QN57 Yes Column ID      │  57│  59│  61│  64│
4715 │                           Layer Column ID│   9│  11│  14│  15│
4716 │                      ╶───────────────────┼────┼────┼────┼────┤
4717 │                       No  Column ID      │  57│  59│  61│  64│
4718 │                           Layer Column ID│   9│  11│  14│  15│
4719 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4720 ])
4721 AT_CLEANUP
4722
4723 AT_SETUP([CTABLES categorical summary functions])
4724 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4725 AT_DATA([ctables.sps],
4726 [[GET 'nhtsa.sav'.
4727 CTABLES
4728     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
4729     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
4730     /SLABELS POSITION=ROW.
4731 ]])
4732 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4733                                                       Custom Tables
4734 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
4735 │                 │                     D5a. What would you say is your primary ethnic background?                     │
4736 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
4737 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
4738 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
4739 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
4740 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4741 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
4742 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
4743 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
4744 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4745 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4746 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
4747 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4748 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4749 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
4750 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
4751 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4752 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
4753 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
4754 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
4755 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4756 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4757 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
4758 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4759 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4760 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
4761 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
4762 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4763 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
4764 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
4765 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
4766 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4767 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4768 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
4769 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4770 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4771 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
4772 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
4773 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4774 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
4775 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
4776 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
4777 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4778 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4779 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
4780 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4781 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4782 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
4783 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
4784 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
4785 ])
4786 AT_CLEANUP
4787
4788 AT_SETUP([CTABLES scale summary functions])
4789 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4790 AT_DATA([ctables.sps],
4791 [[GET 'nhtsa.sav'.
4792 SET TVAR=NAME.
4793
4794 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4795   CTABLES later, to make the results easier to verify.
4796 SPLIT FILE BY REGION.
4797 FREQUENCIES
4798     qn19a
4799     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4800     /FORMAT NOTABLE /MISSING=INCLUDE.
4801 SPLIT FILE OFF.
4802
4803 CTABLES
4804     /VLABELS VARIABLE=qn19a DISPLAY=NONE
4805     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
4806     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
4807     /SLABELS POSITION=ROW
4808     /CLABELS ROWLABELS=OPPOSITE.
4809 ]])
4810 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4811                    Statistics
4812 ╭─────────┬───────────────────────────────────╮
4813 │         │               REGION              │
4814 │         ├────────┬────────┬────────┬────────┤
4815 │         │   NE   │   MW   │    S   │    W   │
4816 │         ├────────┼────────┼────────┼────────┤
4817 │         │  QN19A │  QN19A │  QN19A │  QN19A │
4818 ├─────────┼────────┼────────┼────────┼────────┤
4819 │N Valid  │     936│    1019│    1276│     950│
4820 │  Missing│     473│     635│    1114│     596│
4821 ├─────────┼────────┼────────┼────────┼────────┤
4822 │Mean     │   19.33│   19.83│   20.29│   19.87│
4823 ├─────────┼────────┼────────┼────────┼────────┤
4824 │S.E. Mean│     .14│     .16│     .18│     .17│
4825 ├─────────┼────────┼────────┼────────┼────────┤
4826 │Median   │   18.00│   19.00│   19.00│   19.00│
4827 ├─────────┼────────┼────────┼────────┼────────┤
4828 │Mode     │   18.00│   18.00│   18.00│   18.00│
4829 ├─────────┼────────┼────────┼────────┼────────┤
4830 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
4831 ├─────────┼────────┼────────┼────────┼────────┤
4832 │Variance │   19.41│   26.47│   41.43│   27.59│
4833 ├─────────┼────────┼────────┼────────┼────────┤
4834 │Range    │   59.00│   71.00│   75.00│   61.00│
4835 ├─────────┼────────┼────────┼────────┼────────┤
4836 │Minimum  │     .00│    4.00│    4.00│    4.00│
4837 ├─────────┼────────┼────────┼────────┼────────┤
4838 │Maximum  │   59.00│   75.00│   79.00│   65.00│
4839 ├─────────┼────────┼────────┼────────┼────────┤
4840 │Sum      │18092.00│20206.00│25886.00│18877.00│
4841 ╰─────────┴────────┴────────┴────────┴────────╯
4842
4843                          Custom Tables
4844 ╭────────────────────────┬────────┬────────┬────────┬────────╮
4845 │                        │   NE   │   MW   │    S   │    W   │
4846 ├────────────────────────┼────────┼────────┼────────┼────────┤
4847 │REGION Valid N          │     936│    1019│    1276│     950│
4848 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
4849 │       Mean             │   19.33│   19.83│   20.29│   19.87│
4850 │       Std Error of Mean│     .14│     .16│     .18│     .17│
4851 │       Median           │   18.00│   19.00│   19.00│   19.00│
4852 │       Mode             │   18.00│   18.00│   18.00│   18.00│
4853 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
4854 │       Variance         │   19.41│   26.47│   41.43│   27.59│
4855 │       Range            │   59.00│   71.00│   75.00│   61.00│
4856 │       Minimum          │     .00│    4.00│    4.00│    4.00│
4857 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
4858 │       Sum              │18092.00│20206.00│25886.00│18877.00│
4859 │       Count            │    1409│    1654│    2390│    1546│
4860 │       Total N          │    1409│    1654│    2390│    1546│
4861 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
4862 ╰────────────────────────┴────────┴────────┴────────┴────────╯
4863 ])
4864 AT_CLEANUP
4865
4866 AT_SETUP([CTABLES scale summary functions - weighting])
4867 weight=1
4868 c=10
4869 for a in 1 2 9; do
4870     for b in 3 4 9; do
4871         for n in 1 2 3 4 5 6 7 8 9 10; do
4872             if test $c -lt 15; then
4873                 cval=.
4874             else
4875                 cval=$c
4876             fi
4877             printf "$weight $a $b $cval\n"
4878             weight=$(expr \( $weight + 3 \) % 7 + 2)
4879             c=$(expr \( $c + 13 \) % 29 + 7)
4880         done
4881     done
4882 done > ctables.txt
4883
4884 AT_DATA([analysis.sps],
4885 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4886   CTABLES later, to make the results easier to verify.
4887 SPLIT FILE BY a b.
4888 FREQUENCIES
4889     c
4890     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4891     /FORMAT NOTABLE /MISSING=INCLUDE.
4892 SPLIT FILE OFF.
4893
4894 CTABLES
4895     /TABLE c[VALIDN, MISSING, MEAN F8.2, SEMEAN F8.2, MEDIAN F8.2, MODE, STDDEV F8.2, VARIANCE F8.2, RANGE F8.2, MINIMUM, MAXIMUM, SUM F8.2, COUNT, TOTALN, LAYERROWPCT.SUM] BY a>b
4896     /SLABELS POSITION=ROW
4897     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
4898 ]])
4899
4900 AT_DATA([ctables.sps],
4901 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
4902     /w (F5.0) a b c (f2.0).
4903 VAR LEVEL w c (SCALE) a b (NOMINAL).
4904 MISSING VALUES a b (9).
4905
4906 INCLUDE 'analysis.sps'.
4907
4908 WEIGHT BY w.
4909 INCLUDE 'analysis.sps'.
4910
4911 * Same as original analysis using unweighted versions of summaries.
4912 CTABLES
4913     /TABLE c[UVALIDN, UMISSING, UMEAN F8.2, USEMEAN F8.2, UMEDIAN F8.2, UMODE, USTDDEV F8.2, UVARIANCE F8.2, USUM F8.2, UCOUNT, UTOTALN, ULAYERROWPCT.SUM] BY a>b
4914     /SLABELS POSITION=ROW
4915     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
4916 ]])
4917 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4918                                 Statistics
4919 ╭─────────┬──────────────────────────────────────────────────────────────╮
4920 │         │                               a                              │
4921 │         ├────────────────────┬────────────────────┬────────────────────┤
4922 │         │          1         │          2         │          9         │
4923 │         ├────────────────────┼────────────────────┼────────────────────┤
4924 │         │          b         │          b         │          b         │
4925 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
4926 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
4927 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4928 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
4929 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4930 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
4931 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
4932 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4933 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
4934 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4935 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
4936 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4937 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
4938 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4939 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
4940 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4941 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
4942 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4943 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
4944 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4945 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
4946 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4947 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
4948 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4949 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
4950 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4951 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
4952 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
4953
4954                                     Custom Tables
4955 ╭───────────────────┬──────────────────────────────────────────────────────────────╮
4956 │                   │                               a                              │
4957 │                   ├────────────────────┬────────────────────┬────────────────────┤
4958 │                   │          1         │          2         │          9         │
4959 │                   ├────────────────────┼────────────────────┼────────────────────┤
4960 │                   │          b         │          b         │          b         │
4961 │                   ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
4962 │                   │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
4963 ├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4964 │c Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
4965 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
4966 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
4967 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
4968 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
4969 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
4970 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
4971 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
4972 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
4973 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
4974 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
4975 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
4976 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
4977 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
4978 │  Layer Row Sum %  │ 26.3%│ 21.3%│     .│ 26.3%│ 26.1%│     .│     .│     .│     .│
4979 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
4980
4981                                   Statistics
4982 ╭─────────┬─────────────────────────────────────────────────────────────────╮
4983 │         │                                a                                │
4984 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
4985 │         │          1          │          2          │          9          │
4986 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
4987 │         │          b          │          b          │          b          │
4988 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
4989 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
4990 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
4991 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
4992 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
4993 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
4994 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
4995 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
4996 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
4997 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
4998 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
4999 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5000 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5001 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5002 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5003 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5004 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5005 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5006 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5007 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5008 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5009 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5010 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5011 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5012 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5013 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5014 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5015 ╰─────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5016
5017                                      Custom Tables
5018 ╭───────────────────┬─────────────────────────────────────────────────────────────────╮
5019 │                   │                                a                                │
5020 │                   ├─────────────────────┬─────────────────────┬─────────────────────┤
5021 │                   │          1          │          2          │          9          │
5022 │                   ├─────────────────────┼─────────────────────┼─────────────────────┤
5023 │                   │          b          │          b          │          b          │
5024 │                   ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5025 │                   │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5026 ├───────────────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5027 │c Valid N          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5028 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5029 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5030 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5031 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5032 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5033 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5034 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5035 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5036 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5037 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5038 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5039 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5040 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5041 │  Layer Row Sum %  │  29.5%│ 22.9%│     .│ 19.7%│  28.0%│     .│     .│     .│      .│
5042 ╰───────────────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5043
5044                                         Custom Tables
5045 ╭────────────────────────────┬──────────────────────────────────────────────────────────────╮
5046 │                            │                               a                              │
5047 │                            ├────────────────────┬────────────────────┬────────────────────┤
5048 │                            │          1         │          2         │          9         │
5049 │                            ├────────────────────┼────────────────────┼────────────────────┤
5050 │                            │          b         │          b         │          b         │
5051 │                            ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5052 │                            │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5053 ├────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5054 │c Valid N                   │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5055 │  Missing                   │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5056 │  Unweighted Mean           │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5057 │  Std Error of Mean         │  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5058 │  Median                    │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5059 │  Mode                      │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5060 │  Std Deviation             │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5061 │  Variance                  │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5062 │  Sum                       │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5063 │  Unweighted Count          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5064 │  Total N                   │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5065 │  Unweighted Layer Row Sum %│ 26.3%│ 21.3%│     .│ 26.3%│ 26.1%│     .│     .│     .│     .│
5066 ╰────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5067 ])
5068 AT_CLEANUP
5069
5070 AT_SETUP([CTABLES hidden scale VLABELS])
5071 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5072 AT_DATA([ctables.sps],
5073 [[GET 'nhtsa.sav'.
5074 CTABLES
5075     /TABLE region BY qn19a + qn35
5076     /SLABELS POSITION=ROW.
5077 CTABLES
5078     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5079     /TABLE region BY qn19a + qn35
5080     /SLABELS POSITION=ROW.
5081 CTABLES
5082     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5083     /TABLE region BY qn19a + qn35
5084     /SLABELS POSITION=ROW.
5085
5086 * This one in particular caused a crash because no categories were
5087   created on the column axis, so passing in 0 for the index was still
5088   too big for that number of categories.  It was fixed by creating a
5089   name-only category for each variable despite the "NONE" request,
5090   then hiding the entire dimension's labels if all its labels were
5091   set to "NONE".
5092 CTABLES
5093     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5094     /TABLE region BY qn19a + qn35
5095     /SLABELS POSITION=ROW.
5096 ]])
5097 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5098                                  Custom Tables
5099 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5100 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5101 │              │   when you first starting  │   many times have you driven a  │
5102 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5103 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5104 │              │      sips of alcohol.      │            beverages?           │
5105 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5106 │Region NE Mean│                       19.33│                                2│
5107 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5108 │       MW Mean│                       19.83│                                2│
5109 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5110 │       S  Mean│                       20.29│                                2│
5111 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5112 │       W  Mean│                       19.87│                                2│
5113 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5114
5115                                  Custom Tables
5116 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5117 │              │     │  35. In the past thirty days, how many times have you  │
5118 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5119 │              │QN19A│                  alcoholic beverages?                  │
5120 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5121 │Region NE Mean│19.33│                                                       2│
5122 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5123 │       MW Mean│19.83│                                                       2│
5124 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5125 │       S  Mean│20.29│                                                       2│
5126 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5127 │       W  Mean│19.87│                                                       2│
5128 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5129
5130                                  Custom Tables
5131 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5132 │              │   19a. About how old were you when you first starting   │    │
5133 │              │  drinking alcohol, not counting small tastes or sips of │    │
5134 │              │                         alcohol.                        │qn35│
5135 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5136 │Region NE Mean│                                                    19.33│   2│
5137 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5138 │       MW Mean│                                                    19.83│   2│
5139 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5140 │       S  Mean│                                                    20.29│   2│
5141 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5142 │       W  Mean│                                                    19.87│   2│
5143 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5144
5145       Custom Tables
5146 ╭──────────────┬───────╮
5147 │Region NE Mean│19.33 2│
5148 │      ╶───────┼───────┤
5149 │       MW Mean│19.83 2│
5150 │      ╶───────┼───────┤
5151 │       S  Mean│20.29 2│
5152 │      ╶───────┼───────┤
5153 │       W  Mean│19.87 2│
5154 ╰──────────────┴───────╯
5155 ])
5156 AT_CLEANUP
5157
5158 AT_SETUP([CTABLES with SPLIT FILE])
5159 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5160 AT_DATA([ctables.sps],
5161 [[GET 'nhtsa.sav'.
5162
5163 SORT CASES BY qns3a.
5164
5165 CTABLES /TABLE qn105ba.
5166
5167 * Layered split has no effect on output.
5168 SPLIT FILE BY qns3a.
5169 CTABLES /TABLE qn105ba.
5170
5171 * Add column variable qns3a to compare against separate splits.
5172 CTABLES /TABLE qn105ba BY qns3a.
5173
5174 * Separate splits are truly output separately.
5175 SPLIT FILE SEPARATE BY qns3a.
5176 CTABLES /TABLE qn105ba.
5177 ]])
5178 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5179                                   Custom Tables
5180 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5181 │                                                                        │Count│
5182 ├────────────────────────────────────────────────────────────────────────┼─────┤
5183 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5184 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5185 │                                                            Very likely │ 1502│
5186 │                                                            Somewhat    │ 2763│
5187 │                                                            likely      │     │
5188 │                                                            Somewhat    │ 1307│
5189 │                                                            unlikely    │     │
5190 │                                                            Very        │  609│
5191 │                                                            unlikely    │     │
5192 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5193
5194                                   Custom Tables
5195 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5196 │                                                                        │Count│
5197 ├────────────────────────────────────────────────────────────────────────┼─────┤
5198 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5199 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5200 │                                                            Very likely │ 1502│
5201 │                                                            Somewhat    │ 2763│
5202 │                                                            likely      │     │
5203 │                                                            Somewhat    │ 1307│
5204 │                                                            unlikely    │     │
5205 │                                                            Very        │  609│
5206 │                                                            unlikely    │     │
5207 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5208
5209                                   Custom Tables
5210 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5211 │                                                                 │S3a. GENDER:│
5212 │                                                                 ├─────┬──────┤
5213 │                                                                 │ Male│Female│
5214 │                                                                 ├─────┼──────┤
5215 │                                                                 │Count│ Count│
5216 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5217 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5218 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5219 │the police?                                          Very likely │  660│   842│
5220 │                                                     Somewhat    │ 1174│  1589│
5221 │                                                     likely      │     │      │
5222 │                                                     Somewhat    │  640│   667│
5223 │                                                     unlikely    │     │      │
5224 │                                                     Very        │  311│   298│
5225 │                                                     unlikely    │     │      │
5226 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5227
5228     Split Values
5229 ╭────────────┬─────╮
5230 │Variable    │Value│
5231 ├────────────┼─────┤
5232 │S3a. GENDER:│Male │
5233 ╰────────────┴─────╯
5234
5235                                   Custom Tables
5236 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5237 │                                                                        │Count│
5238 ├────────────────────────────────────────────────────────────────────────┼─────┤
5239 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5240 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5241 │                                                            Very likely │  660│
5242 │                                                            Somewhat    │ 1174│
5243 │                                                            likely      │     │
5244 │                                                            Somewhat    │  640│
5245 │                                                            unlikely    │     │
5246 │                                                            Very        │  311│
5247 │                                                            unlikely    │     │
5248 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5249
5250      Split Values
5251 ╭────────────┬──────╮
5252 │Variable    │ Value│
5253 ├────────────┼──────┤
5254 │S3a. GENDER:│Female│
5255 ╰────────────┴──────╯
5256
5257                                   Custom Tables
5258 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5259 │                                                                        │Count│
5260 ├────────────────────────────────────────────────────────────────────────┼─────┤
5261 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5262 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5263 │                                                            Very likely │  842│
5264 │                                                            Somewhat    │ 1589│
5265 │                                                            likely      │     │
5266 │                                                            Somewhat    │  667│
5267 │                                                            unlikely    │     │
5268 │                                                            Very        │  298│
5269 │                                                            unlikely    │     │
5270 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5271 ])
5272 AT_CLEANUP
5273
5274 AT_SETUP([CTABLES variable level inference])
5275 AT_DATA([data.txt], [dnl
5276 dnl n1 has 10 unique small values -> nominal.
5277 dnl n2 has 23 unique small values -> nominal.
5278 dnl n3 is all missing -> nominal.
5279 dnl s1 has 24 unique small values -> scale.
5280 dnl s2 has one negative value -> scale.
5281 dnl s3 has one non-integer value -> scale.
5282 dnl s4 has no valid values less than 10 -> scale.
5283 dnl s5 has no valid values less than 10,000 -> scale.
5284 1  1  . 1  1  1    10 10001
5285 2  2  . 2  2  2    11 10002
5286 3  3  . 3  3  3    12 10003
5287 4  4  . 4  4  4    13 10004
5288 5  5  . 5  5  5    14 10005
5289 6  6  . 6  6  6    15 10006
5290 7  7  . 7  7  7    16 10007
5291 8  8  . 8  8  8    17 10008
5292 9  9  . 9  9  9    18 10009
5293 10 10 . 10 10 10.5 19 110000
5294 1  11 . 11 -1 1    11 10001
5295 2  12 . 12 2  2    12 10002
5296 3  13 . 13 3  3    13 10003
5297 4  14 . 14 4  4    14 10004
5298 5  15 . 15 5  5    15 10005
5299 6  16 . 16 6  6    16 10006
5300 7  17 . 17 7  7    17 10007
5301 8  18 . 18 8  8    18 10008
5302 9  19 . 19 9  9    19 10009
5303 1  20 . 20 1  1    20 10001
5304 2  21 . 21 2  2    21 10002
5305 3  22 . 22 3  3    22 10003
5306 4  23 . 23 4  4    23 10004
5307 5  23 . 24 5  5    24 10005
5308 6  23 . 24 6  6    25 10006
5309 ])
5310
5311 AT_DATA([ctables.sps], [dnl
5312 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5313
5314 * Nominal formats (copied from data that will default to scale).
5315 COMPUTE n4=s1.
5316 COMPUTE n5=s1.
5317 FORMATS n4(WKDAY5) n5(MONTH5).
5318
5319 * Scale formats (copied from data that will default to nominal).
5320 COMPUTE s6=n1.
5321 COMPUTE s7=n1.
5322 COMPUTE s8=n1.
5323 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5324
5325 STRING string(A8).
5326
5327 DISPLAY DICTIONARY.
5328 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5329 DISPLAY DICTIONARY.
5330 ])
5331
5332 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5333                                     Variables
5334 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5335 │      │        │  Measurement │     │     │         │            │            │
5336 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5337 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5338 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5339 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5340 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5341 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5342 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5343 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5344 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5345 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5346 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5347 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5348 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5349 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5350 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5351 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5352 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5353
5354         Custom Tables
5355 ╭────────────┬─────┬────────╮
5356 │            │Count│  Mean  │
5357 ├────────────┼─────┼────────┤
5358 │n1     1.00 │    3│        │
5359 │       2.00 │    3│        │
5360 │       3.00 │    3│        │
5361 │       4.00 │    3│        │
5362 │       5.00 │    3│        │
5363 │       6.00 │    3│        │
5364 │       7.00 │    2│        │
5365 │       8.00 │    2│        │
5366 │       9.00 │    2│        │
5367 │       10.00│    1│        │
5368 ├────────────┼─────┼────────┤
5369 │n2     1.00 │    1│        │
5370 │       2.00 │    1│        │
5371 │       3.00 │    1│        │
5372 │       4.00 │    1│        │
5373 │       5.00 │    1│        │
5374 │       6.00 │    1│        │
5375 │       7.00 │    1│        │
5376 │       8.00 │    1│        │
5377 │       9.00 │    1│        │
5378 │       10.00│    1│        │
5379 │       11.00│    1│        │
5380 │       12.00│    1│        │
5381 │       13.00│    1│        │
5382 │       14.00│    1│        │
5383 │       15.00│    1│        │
5384 │       16.00│    1│        │
5385 │       17.00│    1│        │
5386 │       18.00│    1│        │
5387 │       19.00│    1│        │
5388 │       20.00│    1│        │
5389 │       21.00│    1│        │
5390 │       22.00│    1│        │
5391 │       23.00│    3│        │
5392 ├────────────┼─────┼────────┤
5393 │string      │   25│        │
5394 ├────────────┼─────┼────────┤
5395 │s1          │     │   12.96│
5396 ├────────────┼─────┼────────┤
5397 │s2          │     │    4.76│
5398 ├────────────┼─────┼────────┤
5399 │s3          │     │    4.86│
5400 ├────────────┼─────┼────────┤
5401 │s4          │     │   16.60│
5402 ├────────────┼─────┼────────┤
5403 │s5          │     │14004.44│
5404 ╰────────────┴─────┴────────╯
5405
5406                                     Variables
5407 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5408 │      │        │  Measurement │     │     │         │            │            │
5409 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5410 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5411 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5412 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5413 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5414 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5415 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5416 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5417 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5418 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5419 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5420 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5421 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5422 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5423 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5424 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5425 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5426 ])
5427 AT_CLEANUP