add errors for unimplemented features
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet implemented:
4 dnl - Multiple response sets
5 dnl - MRSETS subcommand.
6 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
7 dnl - SIGTEST
8 dnl - COMPARETEST
9 dnl - Summary functions:
10 dnl   * .LCL and .UCL suffixes.
11 dnl   * .SE suffixes.
12 dnl - CATEGORIES:
13 dnl   * Data-dependent sorting.
14
15 AT_SETUP([CTABLES parsing])
16 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
17 AT_DATA([ctables.sps],
18 [[GET 'nhtsa.sav'.
19 CTABLES
20     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
21     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
22     /FORMAT UNITS=CM EMPTY="(-)"
23     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
24     /VLABELS VARIABLES=qn17 DISPLAY=NAME
25     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
26     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
27     /VLABELS VARIABLES=qn20 DISPLAY=NONE
28     /MRSETS COUNTDUPLICATES=NO
29     /MRSETS COUNTDUPLICATES=YES
30     /SMISSING VARIABLE
31     /SMISSING LISTWISE
32     /WEIGHT VARIABLE=qns3a
33     /HIDESMALLCOUNTS
34     /HIDESMALLCOUNTS COUNT=10
35     /TABLE qnsa1
36     /SLABELS POSITION=COLUMN VISIBLE=YES
37     /SLABELS VISIBLE=NO POSITION=ROW
38     /SLABELS POSITION=LAYER
39     /CLABELS AUTO
40     /CLABELS ROWLABELS=OPPOSITE
41     /CRITERIA CILEVEL=50
42     /CATEGORIES VARIABLES=qn1 qn17
43                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
44                 POSITION=BEFORE EMPTY=INCLUDE.
45 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
46 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
47 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
48 ]])
49 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
50          Custom Tables
51 Count
52 ╭───────────────────┬────┬────╮
53 │                   │ RDD│CELL│
54 ├───────────────────┼────┼────┤
55 │Sa1. SAMPLE SOURCE:│5392│1607│
56 ╰───────────────────┴────┴────╯
57
58        Custom Tables
59 RDD
60 ╭───────────────────┬─────╮
61 │                   │Count│
62 ├───────────────────┼─────┤
63 │Sa1. SAMPLE SOURCE:│ 5392│
64 ╰───────────────────┴─────╯
65
66           Custom Tables
67 ╭────────────────────────┬─────╮
68 │                        │Count│
69 ├────────────────────────┼─────┤
70 │Sa1. SAMPLE SOURCE: RDD │ 5392│
71 │                    CELL│ 1607│
72 ╰────────────────────────┴─────╯
73
74           Custom Tables
75 ╭────────────────────────┬─────╮
76 │                        │Count│
77 ├────────────────────────┼─────┤
78 │Sa1. SAMPLE SOURCE: RDD │ 5392│
79 │                    CELL│ 1607│
80 ╰────────────────────────┴─────╯
81 ])
82 AT_CLEANUP
83
84 AT_SETUP([CTABLES parsing - negative])
85 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
86 AT_DATA([ctables.sps],
87 [[GET 'nhtsa.sav'.
88 CTABLES.
89 CTABLES /FORMAT MINCOLWIDTH='foo'.
90 CTABLES /TABLE qn1 [**].
91 CTABLES /TABLE qn1 [NOTAFUNCTION].
92 CTABLES /TABLE (qn1.
93 CTABLES /TABLE **.
94 CTABLES /TABLE NOTAVAR.
95 STRING string(A8).
96 CTABLES /TABLE string[S].
97 CTABLES /TABLE qn1 [PTILE 101].
98 CTABLES /TABLE qn1 [MEAN F0.1].
99 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
100 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
101 CTABLES /TABLE qn1 [MEAN TOTALS].
102 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
103 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
104 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
105 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
106 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
107 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
108 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
109 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
110 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
111 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
112 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
113 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
114 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
115 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
116 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
117 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
118 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
119 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
120 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
121 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
122 CTABLES /PCOMPUTE &k=EXPR([LO **]).
123 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
124 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
125 CTABLES /PCOMPUTE &k=EXPR([1**]).
126 CTABLES /PCOMPUTE &k=EXPR((1x)).
127 CTABLES /PCOMPUTE **k.
128 CTABLES /PCOMPUTE &1.
129 CTABLES /PCOMPUTE &k**.
130 CTABLES /PCOMPUTE &k=**.
131 CTABLES /PCOMPUTE &k=EXPR**.
132 CTABLES /PCOMPUTE &k=EXPR(1x).
133 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
134 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
135 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
136 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
137 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
138 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
139 CTABLES /FORMAT EMPTY=**.
140 CTABLES /FORMAT MISSING=**.
141 CTABLES /FORMAT **.
142 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
143 CTABLES /VLABELS **.
144 CTABLES /VLABELS VARIABLES=NOTAVAR.
145 CTABLES /VLABELS VARIABLES=qn1 **.
146 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
147 CTABLES /MRSETS **.
148 CTABLES /MRSETS COUNTDUPLICATES=**.
149 CTABLES /SMISSING **.
150 CTABLES /WEIGHT **.
151 CTABLES /WEIGHT VARIABLE=NOTAVAR.
152 CTABLES /HIDESMALLCOUNTS COUNT=1.
153 CTABLES /QUUX.
154 CTABLES /HIDESMALLCOUNTS COUNT=2.
155 CTABLES /TABLE qn1**.
156 CTABLES /TABLE qn1 /SLABELS POSITION=**.
157 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
158 CTABLES /TABLE qn1 /SLABELS **.
159 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
160 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
161 CTABLES /TABLE qn1 /CLABELS **.
162 CTABLES /TABLE qn1 /CRITERIA **.
163 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
164 CTABLES /TABLE qn1 /TITLES **.
165 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
166 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
167 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
168 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
169 CTABLES /TABLE qn1 /SIGTEST **.
170 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
171 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
172 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
173 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
174 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
175 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
176 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
177 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
178 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
179 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
180 CTABLES /TABLE qn1 /COMPARETEST **.
181 CTABLES /TABLE qn1 / **.
182 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
183 CTABLES /TABLE qn20 > qnd1.
184 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
185 NUMERIC datetime (DATETIME17.0).
186 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
187 ]])
188 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
189 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
190
191 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
192 negative number for MINCOLWIDTH.
193
194 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
195 identifier.
196
197 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
198 summary function name.
199
200 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
201
202 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
203 identifier.
204
205 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
206
207 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
208 scale variable.
209    10 | CTABLES /TABLE string[S].
210       |                ^~~~~~~~~
211
212 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
213 between 0 and 100 for PTILE.
214
215 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
216 requires a width between 1 and 40.
217
218 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
219 format NEGPAREN requires width 2 or greater.
220
221 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
222 format NEGPAREN requires width greater than decimals.
223
224 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
225 scale variables.
226    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
227       |                     ^~~~
228
229 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
230    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
231       |                ^~~
232
233 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
234
235 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
236 scale variables.
237    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
238       |                     ^~~~
239
240 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
241    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
242       |                ^~~
243
244 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
245
246 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
247
248 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
249
250 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
251
252 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
253
254 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
255
256 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
257 identifier.
258
259 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
260    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
261       |                                               ^~
262
263 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
264 between 0 and 100 for PTILE.
265
266 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
267 `@:}@'.
268
269 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
270 `@{:@'.
271
272 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
273 or EXCLUDE.
274
275 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
276 NO.
277
278 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
279
280 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
281 or AFTER.
282
283 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
284 or EXCLUDE.
285
286 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
287 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
288
289 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
290 LABEL, POSITION, or EMPTY.
291
292 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
293 integer for SUBTOTAL.
294
295 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
296
297 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
298
299 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
300
301 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
302
303 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
304
305 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
306
307 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
308
309 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
310
311 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
312
313 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
314
315 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
316
317 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
318
319 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
320 the previous definition.
321    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
322       |                               ^~~~~~~~~~~~~~~~~~~
323
324 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
325    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
326       |          ^~~~~~~~~~~~~~~~~~~
327
328 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
329 `/'.
330
331 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
332 Expecting summary function name.
333
334 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
335 between 0 and 100 for PTILE.
336
337 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
338
339 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
340 NO.
341
342 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
343 FORMAT, or HIDESOURCECATS.
344
345 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
346
347 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
348
349 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
350 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
351
352 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
353 MAXCOLWIDTH.
354
355 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
356 VARIABLES.
357
358 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
359
360 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
361 DISPLAY.
362
363 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
364 DEFAULT, NAME, LABEL, BOTH, or NONE.
365
366 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
367 COUNTDUPLICATES.
368
369 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
370 NO.
371
372 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
373 VARIABLE or LISTWISE.
374
375 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
376 VARIABLE.
377
378 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
379
380 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
381 greater for HIDESMALLCOUNTS COUNT.
382
383 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
384 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
385 HIDESMALLCOUNTS, or TABLE.
386
387 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
388 `/'.
389
390 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
391
392 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
393 ROW, or LAYER.
394
395 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
396 NO.
397
398 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
399 POSITION or VISIBLE.
400
401 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
402 OPPOSITE or LAYER.
403
404 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
405 OPPOSITE or LAYER.
406
407 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
408 ROWLABELS, or COLLABELS.
409
410 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
411 CILEVEL.
412
413 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
414 in @<:@0,100@:}@ for CILEVEL.
415
416 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
417 CAPTION, CORNER, or TITLE.
418
419 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
420 CHISQUARE.
421
422 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
423 in @<:@0,1@:}@ for ALPHA.
424
425 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
426 NO.
427
428 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
429 ALLVISIBLE or SUBTOTALS.
430
431 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
432 ALPHA, INCLUDEMRSETS, or CATEGORIES.
433
434 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
435 MEAN.
436
437 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
438 in (0,1) for ALPHA.
439
440 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
441 for ALPHA.
442
443 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
444 BONFERRONI, BH, or NONE.
445
446 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
447 NO.
448
449 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
450 or TESTEDCATS.
451
452 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
453 ALLVISIBLE or SUBTOTALS.
454
455 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
456 NO.
457
458 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
459 SIMPLE.
460
461 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
462 NO.
463
464 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
465 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
466 SHOWSIG.
467
468 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
469 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
470
471 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
472 specified.
473
474 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
475    97 | CTABLES /TABLE qn20 > qnd1.
476       |                ^~~~~~~~~~~
477
478 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
479    97 | CTABLES /TABLE qn20 > qnd1.
480       |                ^~~~
481
482 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
483    97 | CTABLES /TABLE qn20 > qnd1.
484       |                       ^~~~
485
486 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
487 categorical variables at the innermost nesting level.
488    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
489       |                ^~~~~~~~~~~~~~~~~~~~
490
491 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
492 summary.
493    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
494       |                ^~~
495
496 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
497 specification as format DATETIME: Day (123) must be between 1 and 31..
498   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
499       |                                                    ^~~~~
500 ]])
501 AT_CLEANUP
502
503 AT_SETUP([CTABLES parsing - more negative])
504 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
505 AT_DATA([ctables.sps],
506 [[GET 'nhtsa.sav'.
507 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
508 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
509 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
510
511 STRING string(A8).
512 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
513 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
514
515 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
516
517 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
518 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
519 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
520 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
521
522 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
523 CTABLES /PCOMPUTE &x=EXPR([**]).
524 CTABLES /PCOMPUTE &x=EXPR(**).
525
526 CTABLES /TABLE.
527
528 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
529
530 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
531
532 CTABLES /TABLE $mrset.
533
534 CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
535 CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
536
537 CTABLES /TABLE qn113 [COUNT.UCL].
538 ]])
539 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
540 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
541 category not included in the category list.
542     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
543 VARIABLES=qn1 [&pc].
544       |
545 ^~~
546
547 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
548     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
549 VARIABLES=qn1 [&pc].
550       |                            ^~~~~~~~
551
552 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
553 list of categories here.
554     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
555 VARIABLES=qn1 [&pc].
556       |
557 ^~~~
558
559 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
560 category not included in the category list.
561     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
562 [&pc].
563       |
564 ^~~
565
566 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
567     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
568 [&pc].
569       |                            ^~~~~
570
571 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
572 variable's CATEGORIES specification.
573
574 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
575 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
576 subtotals by position, e.g. SUBTOTAL[1].
577     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
578 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
579       |
580 ^~~~~~~~~~~~~~~~~~~~~~~~
581
582 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
583 position.
584     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
585 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
586       |                            ^~~~~~~~
587
588 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
589 applied only to string variables, but this subcommand tries to apply it to
590 numeric variable QN1.
591     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
592       |                                               ^~~~~~~~
593
594 ctables.sps:8.53: error: CTABLES: This category specification may be applied
595 only to numeric variables, but this subcommand tries to apply it to string
596 variable string.
597     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
598       |                                                     ^
599
600 ctables.sps:10.74-10.86: error: CTABLES: Syntax error at `KEY=MEAN(qn1)': Data-
601 dependent sorting is not implemented.
602
603 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
604 moved to be categorical, but qnd1 is a scale variable.
605
606 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
607 moved to have the same width, but QN1 has width 0 and string has width 8.
608
609 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
610 moved to have the same value labels, but QN1 and QNSA1 have different value
611 labels.
612
613 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
614 moved to have the same category specifications, but QN105BA and QN105BB have
615 different category specifications.
616
617 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
618 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
619 this warning, insert parentheses.
620    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
621       |                           ^~~~~~~
622
623 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
624 `/'.
625
626 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
627
628 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
629
630 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
631 variable must be specified.
632
633 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
634
635 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
636 summary.
637    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
638       |                                                  ^~~~~
639
640 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
641 summary.
642    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
643       |                ^~~~~
644
645 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
646 summary.
647    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
648       |                                 ^~~~~
649
650 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
651 has a summary even if the syntax does not explicitly specify one.
652    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
653       |                                 ^~~~~
654
655 ctables.sps:25.46-25.63: error: CTABLES: Syntax error at `KEY=PTILE(qn1, 50)':
656 Data-dependent sorting is not implemented.
657
658 ctables.sps:27.16-27.21: error: CTABLES: Syntax error at `$mrset': Multiple
659 response set support not implemented.
660
661 ctables.sps:29.23-29.44: error: CTABLES: Syntax error at `SIGTEST
662 TYPE=CHISQUARE': Support for SIGTEST not yet implemented.
663
664 ctables.sps:30.35-30.43: error: CTABLES: Syntax error at `TYPE=PROP': Support
665 for COMPARETEST not yet implemented.
666
667 ctables.sps:32.23-32.31: error: CTABLES: Syntax error at `COUNT.UCL': Support
668 for LCL, UCL, and SE summary functions is not yet implemented.
669 ]])
670 AT_CLEANUP
671
672 AT_SETUP([CTABLES one categorical variable])
673 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
674 AT_DATA([ctables.sps],
675 [[GET 'nhtsa.sav'.
676 CTABLES /TABLE qn1.
677 CTABLES /TABLE BY qn1.
678 CTABLES /TABLE BY BY qn1.
679 ]])
680 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
681                                   Custom Tables
682 ╭────────────────────────────────────────────────────────────────────────┬─────╮
683 │                                                                        │Count│
684 ├────────────────────────────────────────────────────────────────────────┼─────┤
685 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
686 │motor vehicle?                                     Several days a week  │ 1274│
687 │                                                   Once a week or less  │  361│
688 │                                                   Only certain times a │  130│
689 │                                                   year                 │     │
690 │                                                   Never                │  540│
691 ╰────────────────────────────────────────────────────────────────────────┴─────╯
692
693                                   Custom Tables
694 ╭──────────────────────────────────────────────────────────────────────────────╮
695 │        1. How often do you usually drive a car or other motor vehicle?       │
696 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
697 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
698 │Every day│       week       │       less       │          year          │Never│
699 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
700 │  Count  │       Count      │       Count      │          Count         │Count│
701 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
702 │     4667│              1274│               361│                     130│  540│
703 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
704
705 Custom Tables
706 Every day
707 ╭─────╮
708 │Count│
709 ├─────┤
710 │ 4667│
711 ╰─────╯
712 ])
713 AT_CLEANUP
714
715 AT_SETUP([CTABLES one string variable])
716 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
717 AT_DATA([ctables.sps],
718 [[GET 'nhtsa.sav'.
719 STRING licensed(A8).
720 MISSING VALUES licensed('DontKnow', 'Refused').
721 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
722 CTABLES /TABLE licensed.
723 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
724 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
725 * Notice that the string matching is case-sensitive.
726 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
727 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
728 CTABLES
729     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
730     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
731     /TABLE licensed
732     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
733 CTABLES
734     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
735     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
736     /TABLE licensed
737     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
738 ]])
739 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
740     Custom Tables
741 ╭────────────┬─────╮
742 │            │Count│
743 ├────────────┼─────┤
744 │licensed No │  572│
745 │         Yes│ 6379│
746 ╰────────────┴─────╯
747
748           Custom Tables
749 ╭─────────────────┬─────┬───────╮
750 │                 │Count│Valid N│
751 ├─────────────────┼─────┼───────┤
752 │licensed DontKnow│    4│       │
753 │         No      │  572│       │
754 │         Refused │   44│       │
755 │         Yes     │ 6379│       │
756 │         Total   │ 6999│   6951│
757 ╰─────────────────┴─────┴───────╯
758
759      Custom Tables
760 ╭──────────────┬─────╮
761 │              │Count│
762 ├──────────────┼─────┤
763 │licensed Yes  │ 6379│
764 │         No   │  572│
765 │         Total│ 6951│
766 ╰──────────────┴─────╯
767
768      Custom Tables
769 ╭──────────────┬─────╮
770 │              │Count│
771 ├──────────────┼─────┤
772 │licensed Yes  │ 6379│
773 │         no   │    0│
774 │         Total│ 6379│
775 ╰──────────────┴─────╯
776
777       Custom Tables
778 ╭────────────────┬─────╮
779 │                │Count│
780 ├────────────────┼─────┤
781 │licensed No     │  572│
782 │         Refused│   44│
783 │         Yes    │ 6379│
784 │         Total  │ 6995│
785 ╰────────────────┴─────╯
786
787       Custom Tables
788 ╭────────────────┬─────╮
789 │                │Count│
790 ├────────────────┼─────┤
791 │licensed Yes    │ 6379│
792 │         Not Yes│  620│
793 ╰────────────────┴─────╯
794
795       Custom Tables
796 ╭────────────────┬─────╮
797 │                │Count│
798 ├────────────────┼─────┤
799 │licensed Yes    │ 6379│
800 │         Not Yes│  620│
801 ╰────────────────┴─────╯
802 ])
803 AT_CLEANUP
804
805 AT_SETUP([CTABLES one scale variable])
806 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
807 AT_DATA([ctables.sps],
808 [[GET 'nhtsa.sav'.
809 DESCRIPTIVES qnd1.
810 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
811 CTABLES /TABLE BY qnd1.
812 CTABLES /TABLE BY BY qnd1.
813 ]])
814 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
815                        Descriptive Statistics
816 ╭──────────────────────────┬────┬─────┬───────┬───────┬───────────╮
817 │                          │  N │ Mean│Std Dev│Minimum│  Maximum  │
818 ├──────────────────────────┼────┼─────┼───────┼───────┼───────────┤
819 │D1. AGE: What is your age?│6930│48.26│  19.01│     16│86 or older│
820 │Valid N (listwise)        │6999│     │       │       │           │
821 │Missing N (listwise)      │  69│     │       │       │           │
822 ╰──────────────────────────┴────┴─────┴───────┴───────┴───────────╯
823
824                                   Custom Tables
825 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
826 │                      │     │       │       │    │     Std    │       │       │
827 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
828 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
829 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
830 │age?                  │     │       │       │    │            │       │       │
831 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
832
833         Custom Tables
834 ╭──────────────────────────╮
835 │D1. AGE: What is your age?│
836 ├──────────────────────────┤
837 │           Mean           │
838 ├──────────────────────────┤
839 │                        48│
840 ╰──────────────────────────╯
841
842 Custom Tables
843 D1. AGE: What is your age?
844 ╭────╮
845 │Mean│
846 ├────┤
847 │  48│
848 ╰────╯
849 ])
850 AT_CLEANUP
851
852 AT_SETUP([CTABLES simple stacking])
853 AT_KEYWORDS([stack stacked])
854 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
855 AT_DATA([ctables.sps],
856 [[GET 'nhtsa.sav'.
857 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
858 ]])
859 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
860                                   Custom Tables
861 ╭───────────────────────────────────────────────────────────────┬──────────────╮
862 │                                                               │ S3a. GENDER: │
863 │                                                               ├──────┬───────┤
864 │                                                               │ Male │ Female│
865 │                                                               ├──────┼───────┤
866 │                                                               │Column│ Column│
867 │                                                               │   %  │   %   │
868 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
869 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
870 │too much to drink to drive safely will A. Get      certain     │      │       │
871 │stopped by the police?                             Very likely │   21%│    22%│
872 │                                                   Somewhat    │   38%│    42%│
873 │                                                   likely      │      │       │
874 │                                                   Somewhat    │   21%│    18%│
875 │                                                   unlikely    │      │       │
876 │                                                   Very        │   10%│     8%│
877 │                                                   unlikely    │      │       │
878 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
879 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
880 │too much to drink to drive safely will B. Have an  certain     │      │       │
881 │accident?                                          Very likely │   36%│    45%│
882 │                                                   Somewhat    │   39%│    32%│
883 │                                                   likely      │      │       │
884 │                                                   Somewhat    │    9%│     4%│
885 │                                                   unlikely    │      │       │
886 │                                                   Very        │    3%│     2%│
887 │                                                   unlikely    │      │       │
888 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
889 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
890 │too much to drink to drive safely will C. Be       certain     │      │       │
891 │convicted for drunk driving?                       Very likely │   32%│    28%│
892 │                                                   Somewhat    │   27%│    32%│
893 │                                                   likely      │      │       │
894 │                                                   Somewhat    │   15%│    15%│
895 │                                                   unlikely    │      │       │
896 │                                                   Very        │    9%│     9%│
897 │                                                   unlikely    │      │       │
898 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
899 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
900 │too much to drink to drive safely will D. Be       certain     │      │       │
901 │arrested for drunk driving?                        Very likely │   26%│    27%│
902 │                                                   Somewhat    │   32%│    35%│
903 │                                                   likely      │      │       │
904 │                                                   Somewhat    │   17%│    15%│
905 │                                                   unlikely    │      │       │
906 │                                                   Very        │    9%│     7%│
907 │                                                   unlikely    │      │       │
908 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
909 ])
910 AT_CLEANUP
911
912 AT_SETUP([CTABLES show or hide empty categories])
913 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
914 AT_DATA([ctables.sps],
915 [[GET 'nhtsa.sav'.
916 IF (qn105ba = 2) qn105ba = 1.
917 IF (qns3a = 1) qns3a = 2.
918 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
919 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
920     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
921 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
922     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
923 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
924     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
925 ]])
926 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
927                                   Custom Tables
928 ╭──────────────────────────────────────────────────────────────┬───────────────╮
929 │                                                              │  S3a. GENDER: │
930 │                                                              ├───────┬───────┤
931 │                                                              │  Male │ Female│
932 │                                                              ├───────┼───────┤
933 │                                                              │ Column│ Column│
934 │                                                              │   %   │   %   │
935 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
936 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
937 │too much to drink to drive safely will A. Get      certain    │       │       │
938 │stopped by the police?                             Very likely│      .│     0%│
939 │                                                   Somewhat   │      .│    40%│
940 │                                                   likely     │       │       │
941 │                                                   Somewhat   │      .│    19%│
942 │                                                   unlikely   │       │       │
943 │                                                   Very       │      .│     9%│
944 │                                                   unlikely   │       │       │
945 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
946
947                                   Custom Tables
948 ╭──────────────────────────────────────────────────────────────┬───────────────╮
949 │                                                              │  S3a. GENDER: │
950 │                                                              ├───────┬───────┤
951 │                                                              │  Male │ Female│
952 │                                                              ├───────┼───────┤
953 │                                                              │ Column│ Column│
954 │                                                              │   %   │   %   │
955 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
956 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
957 │too much to drink to drive safely will A. Get      certain    │       │       │
958 │stopped by the police?                             Somewhat   │      .│    40%│
959 │                                                   likely     │       │       │
960 │                                                   Somewhat   │      .│    19%│
961 │                                                   unlikely   │       │       │
962 │                                                   Very       │      .│     9%│
963 │                                                   unlikely   │       │       │
964 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
965
966                                   Custom Tables
967 ╭────────────────────────────────────────────────────────────────────┬─────────╮
968 │                                                                    │   S3a.  │
969 │                                                                    │ GENDER: │
970 │                                                                    ├─────────┤
971 │                                                                    │  Female │
972 │                                                                    ├─────────┤
973 │                                                                    │ Column %│
974 ├────────────────────────────────────────────────────────────────────┼─────────┤
975 │105b. How likely is it that drivers who have had too    Almost      │      32%│
976 │much to drink to drive safely will A. Get stopped by    certain     │         │
977 │the police?                                             Very likely │       0%│
978 │                                                        Somewhat    │      40%│
979 │                                                        likely      │         │
980 │                                                        Somewhat    │      19%│
981 │                                                        unlikely    │         │
982 │                                                        Very        │       9%│
983 │                                                        unlikely    │         │
984 ╰────────────────────────────────────────────────────────────────────┴─────────╯
985
986                                   Custom Tables
987 ╭────────────────────────────────────────────────────────────────────┬─────────╮
988 │                                                                    │   S3a.  │
989 │                                                                    │ GENDER: │
990 │                                                                    ├─────────┤
991 │                                                                    │  Female │
992 │                                                                    ├─────────┤
993 │                                                                    │ Column %│
994 ├────────────────────────────────────────────────────────────────────┼─────────┤
995 │105b. How likely is it that drivers who have had too    Almost      │      32%│
996 │much to drink to drive safely will A. Get stopped by    certain     │         │
997 │the police?                                             Somewhat    │      40%│
998 │                                                        likely      │         │
999 │                                                        Somewhat    │      19%│
1000 │                                                        unlikely    │         │
1001 │                                                        Very        │       9%│
1002 │                                                        unlikely    │         │
1003 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1004 ])
1005 AT_CLEANUP
1006
1007 AT_SETUP([CTABLES sorting categories])
1008 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1009 AT_DATA([ctables.sps],
1010 [[GET 'nhtsa.sav'.
1011 IF (QND5A=6) QND5A=-1.
1012 IF (QND5A=5) QND5A=-2.
1013 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1014         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1015         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1016         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1017 ]])
1018 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1019                                   Custom Tables
1020 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1021 │                                                                        │Count│
1022 ├────────────────────────────────────────────────────────────────────────┼─────┤
1023 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1024 │background?                                     -1.00                   │   78│
1025 │                                                Cuban                   │   20│
1026 │                                                Mexican                 │  311│
1027 │                                                Spanish                 │   48│
1028 │                                                South American          │   34│
1029 │                                                Central American        │    0│
1030 │                                                Puerto Rican, OR        │    0│
1031 │                                                Something else          │   68│
1032 │                                                Multiple - cannot choose│    7│
1033 │                                                one                     │     │
1034 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1035
1036                                   Custom Tables
1037 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1038 │                                                                        │Count│
1039 ├────────────────────────────────────────────────────────────────────────┼─────┤
1040 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1041 │background?                                     one                     │     │
1042 │                                                Something else          │   68│
1043 │                                                Puerto Rican, OR        │    0│
1044 │                                                Central American        │    0│
1045 │                                                South American          │   34│
1046 │                                                Spanish                 │   48│
1047 │                                                Mexican                 │  311│
1048 │                                                Cuban                   │   20│
1049 │                                                -1.00                   │   78│
1050 │                                                -2.00                   │   52│
1051 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1052
1053                                   Custom Tables
1054 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1055 │                                                                        │Count│
1056 ├────────────────────────────────────────────────────────────────────────┼─────┤
1057 │D5a. What would you say is your primary ethnic  Central American        │    0│
1058 │background?                                     Cuban                   │   20│
1059 │                                                Mexican                 │  311│
1060 │                                                Multiple - cannot choose│    7│
1061 │                                                one                     │     │
1062 │                                                Puerto Rican, OR        │    0│
1063 │                                                Something else          │   68│
1064 │                                                South American          │   34│
1065 │                                                Spanish                 │   48│
1066 │                                                -2.00                   │   52│
1067 │                                                -1.00                   │   78│
1068 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1069
1070                                   Custom Tables
1071 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1072 │                                                                        │Count│
1073 ├────────────────────────────────────────────────────────────────────────┼─────┤
1074 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1075 │background?                                     South American          │   34│
1076 │                                                Something else          │   68│
1077 │                                                Puerto Rican, OR        │    0│
1078 │                                                Multiple - cannot choose│    7│
1079 │                                                one                     │     │
1080 │                                                Mexican                 │  311│
1081 │                                                Cuban                   │   20│
1082 │                                                Central American        │    0│
1083 │                                                -1.00                   │   78│
1084 │                                                -2.00                   │   52│
1085 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1086 ])
1087 AT_CLEANUP
1088
1089 AT_SETUP([CTABLES simple nesting])
1090 AT_KEYWORDS([nest nested])
1091 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1092 AT_DATA([ctables.sps],
1093 [[GET 'nhtsa.sav'.
1094 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1095   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1096 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1097   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1098   /CLABELS ROW=OPPOSITE.
1099 ]])
1100 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1101                                   Custom Tables
1102 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1103 │                                                                 │     │ Table│
1104 │                                                                 │Count│   %  │
1105 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1106 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1107 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1108 │drive safely will A. Get stopped by                        Total │  700│   10%│
1109 │the police?                           ╶──────────────────────────┼─────┼──────┤
1110 │                                       Very       S3a.     Male  │  660│   10%│
1111 │                                       likely     GENDER:  Female│  842│   12%│
1112 │                                                           Total │ 1502│   22%│
1113 │                                      ╶──────────────────────────┼─────┼──────┤
1114 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1115 │                                       likely     GENDER:  Female│ 1589│   23%│
1116 │                                                           Total │ 2763│   40%│
1117 │                                      ╶──────────────────────────┼─────┼──────┤
1118 │                                       Somewhat   S3a.     Male  │  640│    9%│
1119 │                                       unlikely   GENDER:  Female│  667│   10%│
1120 │                                                           Total │ 1307│   19%│
1121 │                                      ╶──────────────────────────┼─────┼──────┤
1122 │                                       Very       S3a.     Male  │  311│    5%│
1123 │                                       unlikely   GENDER:  Female│  298│    4%│
1124 │                                                           Total │  609│    9%│
1125 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1126 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1127 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1128 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1129 │                                      ╶──────────────────────────┼─────┼──────┤
1130 │                                       Very       S3a.     Male  │ 1104│   16%│
1131 │                                       likely     GENDER:  Female│ 1715│   25%│
1132 │                                                           Total │ 2819│   41%│
1133 │                                      ╶──────────────────────────┼─────┼──────┤
1134 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1135 │                                       likely     GENDER:  Female│ 1214│   18%│
1136 │                                                           Total │ 2417│   35%│
1137 │                                      ╶──────────────────────────┼─────┼──────┤
1138 │                                       Somewhat   S3a.     Male  │  262│    4%│
1139 │                                       unlikely   GENDER:  Female│  168│    2%│
1140 │                                                           Total │  430│    6%│
1141 │                                      ╶──────────────────────────┼─────┼──────┤
1142 │                                       Very       S3a.     Male  │   81│    1%│
1143 │                                       unlikely   GENDER:  Female│   59│    1%│
1144 │                                                           Total │  140│    2%│
1145 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1146 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1147 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1148 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1149 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1150 │                                       Very       S3a.     Male  │  988│   14%│
1151 │                                       likely     GENDER:  Female│ 1049│   15%│
1152 │                                                           Total │ 2037│   30%│
1153 │                                      ╶──────────────────────────┼─────┼──────┤
1154 │                                       Somewhat   S3a.     Male  │  822│   12%│
1155 │                                       likely     GENDER:  Female│ 1210│   18%│
1156 │                                                           Total │ 2032│   30%│
1157 │                                      ╶──────────────────────────┼─────┼──────┤
1158 │                                       Somewhat   S3a.     Male  │  446│    7%│
1159 │                                       unlikely   GENDER:  Female│  548│    8%│
1160 │                                                           Total │  994│   15%│
1161 │                                      ╶──────────────────────────┼─────┼──────┤
1162 │                                       Very       S3a.     Male  │  268│    4%│
1163 │                                       unlikely   GENDER:  Female│  354│    5%│
1164 │                                                           Total │  622│    9%│
1165 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1166 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1167 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1168 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1169 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1170 │                                       Very       S3a.     Male  │  805│   12%│
1171 │                                       likely     GENDER:  Female│ 1029│   15%│
1172 │                                                           Total │ 1834│   27%│
1173 │                                      ╶──────────────────────────┼─────┼──────┤
1174 │                                       Somewhat   S3a.     Male  │  975│   14%│
1175 │                                       likely     GENDER:  Female│ 1332│   19%│
1176 │                                                           Total │ 2307│   34%│
1177 │                                      ╶──────────────────────────┼─────┼──────┤
1178 │                                       Somewhat   S3a.     Male  │  535│    8%│
1179 │                                       unlikely   GENDER:  Female│  560│    8%│
1180 │                                                           Total │ 1095│   16%│
1181 │                                      ╶──────────────────────────┼─────┼──────┤
1182 │                                       Very       S3a.     Male  │  270│    4%│
1183 │                                       unlikely   GENDER:  Female│  279│    4%│
1184 │                                                           Total │  549│    8%│
1185 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1186
1187                                   Custom Tables
1188 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1189 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1190 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1191 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1192 │                                 │        │ Table│         │         │        │
1193 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1194 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1195 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1196 │GENDER:        is it that drivers│        │      │         │         │        │
1197 │               who have had too  │        │      │         │         │        │
1198 │               much to drink to  │        │      │         │         │        │
1199 │               drive safely will │        │      │         │         │        │
1200 │               A. Get stopped by │        │      │         │         │        │
1201 │               the police?       │        │      │         │         │        │
1202 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1203 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1204 │               is it that drivers│        │      │         │         │        │
1205 │               who have had too  │        │      │         │         │        │
1206 │               much to drink to  │        │      │         │         │        │
1207 │               drive safely will │        │      │         │         │        │
1208 │               A. Get stopped by │        │      │         │         │        │
1209 │               the police?       │        │      │         │         │        │
1210 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1211 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1212 │               is it that drivers│        │      │         │         │        │
1213 │               who have had too  │        │      │         │         │        │
1214 │               much to drink to  │        │      │         │         │        │
1215 │               drive safely will │        │      │         │         │        │
1216 │               A. Get stopped by │        │      │         │         │        │
1217 │               the police?       │        │      │         │         │        │
1218 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1219 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1220 │GENDER:        is it that drivers│        │      │         │         │        │
1221 │               who have had too  │        │      │         │         │        │
1222 │               much to drink to  │        │      │         │         │        │
1223 │               drive safely will │        │      │         │         │        │
1224 │               B. Have an        │        │      │         │         │        │
1225 │               accident?         │        │      │         │         │        │
1226 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1227 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1228 │               is it that drivers│        │      │         │         │        │
1229 │               who have had too  │        │      │         │         │        │
1230 │               much to drink to  │        │      │         │         │        │
1231 │               drive safely will │        │      │         │         │        │
1232 │               B. Have an        │        │      │         │         │        │
1233 │               accident?         │        │      │         │         │        │
1234 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1235 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1236 │               is it that drivers│        │      │         │         │        │
1237 │               who have had too  │        │      │         │         │        │
1238 │               much to drink to  │        │      │         │         │        │
1239 │               drive safely will │        │      │         │         │        │
1240 │               B. Have an        │        │      │         │         │        │
1241 │               accident?         │        │      │         │         │        │
1242 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1243 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1244 │GENDER:        is it that drivers│        │      │         │         │        │
1245 │               who have had too  │        │      │         │         │        │
1246 │               much to drink to  │        │      │         │         │        │
1247 │               drive safely will │        │      │         │         │        │
1248 │               C. Be convicted   │        │      │         │         │        │
1249 │               for drunk driving?│        │      │         │         │        │
1250 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1251 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1252 │               is it that drivers│        │      │         │         │        │
1253 │               who have had too  │        │      │         │         │        │
1254 │               much to drink to  │        │      │         │         │        │
1255 │               drive safely will │        │      │         │         │        │
1256 │               C. Be convicted   │        │      │         │         │        │
1257 │               for drunk driving?│        │      │         │         │        │
1258 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1259 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1260 │               is it that drivers│        │      │         │         │        │
1261 │               who have had too  │        │      │         │         │        │
1262 │               much to drink to  │        │      │         │         │        │
1263 │               drive safely will │        │      │         │         │        │
1264 │               C. Be convicted   │        │      │         │         │        │
1265 │               for drunk driving?│        │      │         │         │        │
1266 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1267 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1268 │GENDER:        is it that drivers│        │      │         │         │        │
1269 │               who have had too  │        │      │         │         │        │
1270 │               much to drink to  │        │      │         │         │        │
1271 │               drive safely will │        │      │         │         │        │
1272 │               D. Be arrested for│        │      │         │         │        │
1273 │               drunk driving?    │        │      │         │         │        │
1274 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1275 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1276 │               is it that drivers│        │      │         │         │        │
1277 │               who have had too  │        │      │         │         │        │
1278 │               much to drink to  │        │      │         │         │        │
1279 │               drive safely will │        │      │         │         │        │
1280 │               D. Be arrested for│        │      │         │         │        │
1281 │               drunk driving?    │        │      │         │         │        │
1282 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1283 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1284 │               is it that drivers│        │      │         │         │        │
1285 │               who have had too  │        │      │         │         │        │
1286 │               much to drink to  │        │      │         │         │        │
1287 │               drive safely will │        │      │         │         │        │
1288 │               D. Be arrested for│        │      │         │         │        │
1289 │               drunk driving?    │        │      │         │         │        │
1290 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1291 ])
1292 AT_CLEANUP
1293
1294 AT_SETUP([CTABLES nesting and scale variables])
1295 AT_KEYWORDS([nest nested])
1296 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1297 AT_DATA([ctables.sps],
1298 [[GET 'nhtsa.sav'.
1299 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1300 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1301 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1302   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1303 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1304 ]])
1305 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1306                                   Custom Tables
1307 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1308 │                                                                 │S3a. GENDER:│
1309 │                                                                 ├─────┬──────┤
1310 │                                                                 │ Male│Female│
1311 │                                                                 ├─────┼──────┤
1312 │                                                                 │ Mean│ Mean │
1313 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1314 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1315 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1316 │                                                  week           │     │      │
1317 │                                                  Once a week or │   44│    54│
1318 │                                                  less           │     │      │
1319 │                                                  Only certain   │   34│    41│
1320 │                                                  times a year   │     │      │
1321 │                                                  Never          │   39│    55│
1322 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1323
1324                                   Custom Tables
1325 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1326 │                                                         │Minimum│Maximum│Mean│
1327 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1328 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1329 │What is  GENDER:         months, has there been a        │       │       │    │
1330 │your                     time when you felt you          │       │       │    │
1331 │age?                     should cut down on your      No │     16│     86│  46│
1332 │                         drinking?                       │       │       │    │
1333 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1334 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1335 │                         months, has there been a        │       │       │    │
1336 │                         time when you felt you          │       │       │    │
1337 │                         should cut down on your      No │     16│     86│  48│
1338 │                         drinking?                       │       │       │    │
1339 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1340 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1341 │What is  GENDER:         months, has there been a        │       │       │    │
1342 │your                     time when people criticized  No │     16│     86│  46│
1343 │age?                     your drinking?                  │       │       │    │
1344 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1345 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1346 │                         months, has there been a        │       │       │    │
1347 │                         time when people criticized  No │     16│     86│  48│
1348 │                         your drinking?                  │       │       │    │
1349 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1350
1351                                   Custom Tables
1352 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1353 │                             │S1. Including yourself, how many members of this│
1354 │                             │         household are age 16 or older?         │
1355 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1356 │                             │      │      │      │      │      │      │ 6 or │
1357 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1358 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1359 │                             │Column│Column│Column│Column│Column│Column│Column│
1360 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1361 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1362 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1363 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1364 │SOURCE:     likely           │      │      │      │      │      │      │      │
1365 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1366 │            that     likely  │      │      │      │      │      │      │      │
1367 │            drivers          │      │      │      │      │      │      │      │
1368 │            who have         │      │      │      │      │      │      │      │
1369 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1370 │            much to  likely  │      │      │      │      │      │      │      │
1371 │            drink to         │      │      │      │      │      │      │      │
1372 │            drive            │      │      │      │      │      │      │      │
1373 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1374 │            will A.  unlikely│      │      │      │      │      │      │      │
1375 │            Get              │      │      │      │      │      │      │      │
1376 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1377 │            by the   unlikely│      │      │      │      │      │      │      │
1378 │            police?          │      │      │      │      │      │      │      │
1379 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1380
1381                                   Custom Tables
1382 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1383 │                                                              │    │    Std   │
1384 │                                                              │Mean│ Deviation│
1385 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1386 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1387 │group           typical month did you have one or more        │    │          │
1388 │                alcoholic beverages to drink?                 │    │          │
1389 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1390 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1391 │                typical month did you have one or more        │    │          │
1392 │                alcoholic beverages to drink?                 │    │          │
1393 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1394 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1395 │                typical month did you have one or more        │    │          │
1396 │                alcoholic beverages to drink?                 │    │          │
1397 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1398 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1399 │                typical month did you have one or more        │    │          │
1400 │                alcoholic beverages to drink?                 │    │          │
1401 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1402 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1403 │                typical month did you have one or more        │    │          │
1404 │                alcoholic beverages to drink?                 │    │          │
1405 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1406 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1407 │       older    typical month did you have one or more        │    │          │
1408 │                alcoholic beverages to drink?                 │    │          │
1409 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1410 ])
1411 AT_CLEANUP
1412
1413
1414 AT_SETUP([CTABLES SLABELS])
1415 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1416 AT_DATA([ctables.sps],
1417 [[GET 'nhtsa.sav'.
1418 CTABLES /TABLE qn1 [COUNT COLPCT].
1419 CTABLES /TABLE qn1 [COUNT COLPCT]
1420     /SLABELS POSITION=ROW.
1421 CTABLES /TABLE qn1 [COUNT COLPCT]
1422     /SLABELS POSITION=ROW VISIBLE=NO.
1423 ]])
1424 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1425                                   Custom Tables
1426 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1427 │                                                                │     │ Column│
1428 │                                                                │Count│   %   │
1429 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1430 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1431 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1432 │                                             Once a week or less│  361│   5.2%│
1433 │                                             Only certain times │  130│   1.9%│
1434 │                                             a year             │     │       │
1435 │                                             Never              │  540│   7.7%│
1436 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1437
1438                                   Custom Tables
1439 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1440 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1441 │other motor vehicle?                                             Column │66.9%│
1442 │                                                                 %      │     │
1443 │                                            ╶───────────────────────────┼─────┤
1444 │                                             Several days a week Count  │ 1274│
1445 │                                                                 Column │18.3%│
1446 │                                                                 %      │     │
1447 │                                            ╶───────────────────────────┼─────┤
1448 │                                             Once a week or less Count  │  361│
1449 │                                                                 Column │ 5.2%│
1450 │                                                                 %      │     │
1451 │                                            ╶───────────────────────────┼─────┤
1452 │                                             Only certain times  Count  │  130│
1453 │                                             a year              Column │ 1.9%│
1454 │                                                                 %      │     │
1455 │                                            ╶───────────────────────────┼─────┤
1456 │                                             Never               Count  │  540│
1457 │                                                                 Column │ 7.7%│
1458 │                                                                 %      │     │
1459 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1460
1461                                   Custom Tables
1462 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1463 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1464 │motor vehicle?                                                          │66.9%│
1465 │                                                   Several days a week  │ 1274│
1466 │                                                                        │18.3%│
1467 │                                                   Once a week or less  │  361│
1468 │                                                                        │ 5.2%│
1469 │                                                   Only certain times a │  130│
1470 │                                                   year                 │ 1.9%│
1471 │                                                   Never                │  540│
1472 │                                                                        │ 7.7%│
1473 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1474 ])
1475 AT_CLEANUP
1476
1477 AT_SETUP([CTABLES simple totals])
1478 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1479 AT_DATA([ctables.sps],
1480 [[GET 'nhtsa.sav'.
1481 CTABLES /TABLE=qn17
1482     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1483 DESCRIPTIVES qn18/STATISTICS=MEAN.
1484 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1485     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1486 ]])
1487 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1488                                   Custom Tables
1489 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1490 │                                                                        │Count│
1491 ├────────────────────────────────────────────────────────────────────────┼─────┤
1492 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1493 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1494 │                                                      Light beer        │  620│
1495 │                                                      Wine              │ 1418│
1496 │                                                      Wine coolers      │  137│
1497 │                                                      Hard liquor or    │  888│
1498 │                                                      mixed drinks      │     │
1499 │                                                      Flavored malt     │   83│
1500 │                                                      drinks            │     │
1501 │                                                      Number responding │ 4221│
1502 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1503
1504                              Descriptive Statistics
1505 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1506 │                                                                    │  N │Mean│
1507 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1508 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1509 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1510 │Valid N (listwise)                                                  │6999│    │
1511 │Missing N (listwise)                                                │2781│    │
1512 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1513
1514                                   Custom Tables
1515 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1516 │                                                      │    │     │ Valid│Total│
1517 │                                                      │Mean│Count│   N  │  N  │
1518 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1519 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1520 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1521 │                you usually drink per sitting?        │    │     │      │     │
1522 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1523 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1524 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1525 │                you usually drink per sitting?        │    │     │      │     │
1526 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1527 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1528 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1529 │                you usually drink per sitting?        │    │     │      │     │
1530 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1531 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1532 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1533 │                you usually drink per sitting?        │    │     │      │     │
1534 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1535 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1536 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1537 │                you usually drink per sitting?        │    │     │      │     │
1538 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1539 ])
1540 AT_CLEANUP
1541
1542 AT_SETUP([CTABLES subtotals])
1543 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1544 AT_DATA([ctables.sps],
1545 [[GET 'nhtsa.sav'.
1546 CTABLES /TABLE=qn105ba BY qns1
1547     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1548 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1549     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1550 CTABLES /TABLE=qn105ba BY qns1
1551     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1552     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1553 ]])
1554 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1555                                                       Custom Tables
1556 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1557 │                                                         │ S1. Including yourself, how many members of this household │
1558 │                                                         │                    are age 16 or older?                    │
1559 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1560 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1561 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1562 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1563 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1564 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1565 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1566 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1567 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1568 │                                              likely     │       │       │         │       │        │      │          │
1569 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1570 │                                              unlikely   │       │       │         │       │        │      │          │
1571 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1572 │                                              unlikely   │       │       │         │       │        │      │          │
1573 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1574
1575                                                       Custom Tables
1576 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1577 │                                                        │  S1. Including yourself, how many members of this household │
1578 │                                                        │                     are age 16 or older?                    │
1579 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1580 │                                                        │        │        │        │        │       │        │  6 or  │
1581 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1582 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1583 │                                                        │        │        │        │        │ Column│        │        │
1584 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1585 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1586 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1587 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1588 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1589 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1590 │                                             likely     │        │        │        │        │       │        │        │
1591 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1592 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1593 │                                             unlikely   │        │        │        │        │       │        │        │
1594 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1595 │                                             unlikely   │        │        │        │        │       │        │        │
1596 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1597 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1598
1599                                                       Custom Tables
1600 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1601 │                                                         │ S1. Including yourself, how many members of this household │
1602 │                                                         │                    are age 16 or older?                    │
1603 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1604 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1605 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1606 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1607 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1608 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1609 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1610 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1611 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1612 │                                              likely     │       │       │         │       │        │      │          │
1613 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1614 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1615 │                                              unlikely   │       │       │         │       │        │      │          │
1616 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1617 │                                              unlikely   │       │       │         │       │        │      │          │
1618 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1619 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1620 ])
1621 AT_CLEANUP
1622
1623 AT_SETUP([CTABLES PCOMPUTE])
1624 AT_KEYWORDS([postcompute])
1625 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1626 AT_DATA([ctables.sps],
1627 [[GET 'nhtsa.sav'.
1628 CTABLES
1629     /PCOMPUTE &x=EXPR([3] + [4])
1630     /PCOMPUTE &y=EXPR([4] + [5])
1631     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1632     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1633     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1634     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1635
1636 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1637 CTABLES
1638     /PCOMPUTE &x=EXPR([3] + [4])
1639     /PCOMPUTE &y=EXPR([4] + [5])
1640     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1641     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1642     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1643     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1644 ]])
1645 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1646                                                                 Custom Tables
1647 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1648 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1649 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1650 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1651 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1652 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1653 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1654 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1655 │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%│
1656 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1657 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1658 │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%│
1659 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1660 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1661 │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%│
1662 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1663 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1664 │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%│
1665 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1666 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1667 │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%│
1668 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1669 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1670 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1671
1672                                                                 Custom Tables
1673 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1674 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1675 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1676 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1677 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1678 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1679 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1680 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1681 │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%│
1682 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1683 │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%│
1684 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1685 │                               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%│
1686 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1687 │                               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%│
1688 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1689 │                               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%│
1690 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1691 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1692 ])
1693 AT_CLEANUP
1694
1695 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1696 AT_KEYWORDS([postcompute])
1697 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1698 AT_DATA([ctables.sps],
1699 [[GET 'nhtsa.sav'.
1700 CTABLES
1701     /PCOMPUTE &x=EXPR(OTHERNM)
1702     /PCOMPUTE &y=EXPR(MISSING)
1703     /PPROPERTIES &x LABEL='Drivers'
1704     /PPROPERTIES &y LABEL='Missing Values 2'
1705     /TABLE=qn1 BY qns3a
1706     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1707 ]])
1708 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1709                                               Custom Tables
1710 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1711 │                                                                                          │S3a. GENDER:│
1712 │                                                                                          ├─────┬──────┤
1713 │                                                                                          │ Male│Female│
1714 │                                                                                          ├─────┼──────┤
1715 │                                                                                          │Count│ Count│
1716 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1717 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1718 │                                                                 Several days a week      │  440│   834│
1719 │                                                                 Once a week or less      │  125│   236│
1720 │                                                                 Only certain times a year│   58│    72│
1721 │                                                                 Never                    │  192│   348│
1722 │                                                                 Drivers                  │ 2928│  3504│
1723 │                                                                 Valid Values             │ 3120│  3852│
1724 │                                                                 Don't know               │    3│     5│
1725 │                                                                 Refused                  │    9│    10│
1726 │                                                                 Missing Values           │   12│    15│
1727 │                                                                 Missing Values 2         │   12│    15│
1728 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1729 ])
1730 AT_CLEANUP
1731
1732 AT_SETUP([CTABLES PCOMPUTE - THRU])
1733 AT_KEYWORDS([postcompute])
1734 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1735 AT_DATA([ctables.sps],
1736 [[GET 'nhtsa.sav'.
1737 CTABLES
1738     /PCOMPUTE &x=EXPR([1 THRU 2])
1739     /PCOMPUTE &y=EXPR([3 THRU 4])
1740     /PCOMPUTE &z=EXPR([5] + MISSING)
1741     /PPROPERTIES &x LABEL='Frequent Drivers'
1742     /PPROPERTIES &y LABEL='Infrequent Drivers'
1743     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1744     /TABLE=qn1 BY qns3a
1745     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1746 ]])
1747 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1748                                               Custom Tables
1749 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1750 │                                                                                          │S3a. GENDER:│
1751 │                                                                                          ├─────┬──────┤
1752 │                                                                                          │ Male│Female│
1753 │                                                                                          ├─────┼──────┤
1754 │                                                                                          │Count│ Count│
1755 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1756 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1757 │                                                                 Several days a week      │  440│   834│
1758 │                                                                 Frequent Drivers         │ 2745│  3196│
1759 │                                                                 Once a week or less      │  125│   236│
1760 │                                                                 Only certain times a year│   58│    72│
1761 │                                                                 Infrequent Drivers       │  183│   308│
1762 │                                                                 Drivers                  │ 2928│  3504│
1763 │                                                                 Never                    │  192│   348│
1764 │                                                                 Don't know               │    3│     5│
1765 │                                                                 Refused                  │    9│    10│
1766 │                                                                 Not Drivers or Missing   │  204│   363│
1767 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1768 ])
1769 AT_CLEANUP
1770
1771 dnl I'm not sure that this is the correct behavior (see
1772 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1773 dnl but at least this test will notify us if the behavior changes.
1774 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1775 AT_KEYWORDS([PCOMPUTE postcompute])
1776 AT_DATA([ctables.sps],
1777 [[DATA LIST LIST NOTABLE/x y z.
1778 WEIGHT by z.
1779 FORMATS ALL (F1.0).
1780 VARIABLE LEVEL x y (NOMINAL).
1781 BEGIN DATA.
1782 1 4 5
1783 1 5 2
1784 1 6 9
1785 2 4 2
1786 2 5 3
1787 2 6 4
1788 3 4 1
1789 3 5 6
1790 3 6 1
1791 END DATA.
1792
1793 CTABLES
1794     /PCOMPUTE &a = EXPR([1] + [2])
1795     /PCOMPUTE &b = EXPR([2] + [3])
1796     /PCOMPUTE &c = EXPR([4] * [5])
1797     /PCOMPUTE &d = EXPR([5] * [6])
1798     /TABLE x BY y
1799     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1800     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1801 ]])
1802 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1803 [[                   Custom Tables
1804 ╭───────────┬─────────────────────────────────────╮
1805 │           │                  y                  │
1806 │           ├─────┬─────────┬─────┬─────────┬─────┤
1807 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
1808 │           ├─────┼─────────┼─────┼─────────┼─────┤
1809 │           │Count│  Count  │Count│  Count  │Count│
1810 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1811 │x 1        │    5│       10│    2│       18│    9│
1812 │  [1] + [2]│    7│        .│    5│        .│   13│
1813 │  2        │    2│        6│    3│       12│    4│
1814 │  [2] + [3]│    3│        .│    9│        .│    5│
1815 │  3        │    1│        6│    6│        6│    1│
1816 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1817 ]])
1818 AT_CLEANUP
1819
1820 AT_SETUP([CTABLES string and date and time])
1821
1822 weight=1
1823 for gender in F M; do
1824     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1825         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1826             printf "$weight $gender $month $wkday\n"
1827             weight=$(expr \( $weight + 3 \) % 7 + 2)
1828         done
1829     done
1830 done > ctables.txt
1831
1832 AT_DATA([ctables.sps],
1833 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1834     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1835 WEIGHT by w.
1836 VARIABLE LEVEL w (SCALE).
1837 VARIABLE LEVEL gender fmon fday (NOMINAL).
1838 VARIABLE LABEL
1839   gender 'Gender'
1840   fmon 'Favorite month'
1841   fday 'Favorite day of the week'.
1842 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1843 CTABLES
1844     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1845     /PPROPERTIES &q2 LABEL='Q2'
1846     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1847     /PPROPERTIES &weekend LABEL='Weekend'
1848     /TABLE fmon BY gender > fday
1849     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1850                                 4 THRU 6, &q2,
1851                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
1852                                 OTHERNM, SUBTOTAL='Q4']
1853     /CATEGORIES VARIABLES=gender ['M', 'F']
1854     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1855     /SLABELS VISIBLE=NO.
1856 ]])
1857 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1858                                               Custom Tables
1859 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1860 │                  │                                       Gender                                      │
1861 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1862 │                  │                   Male                  │                  Female                 │
1863 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1864 │                  │         Favorite day of the week        │         Favorite day of the week        │
1865 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1866 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1867 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1868 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
1869 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1870 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1871 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
1872 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1873 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1874 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
1875 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
1876 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
1877 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
1878 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1879 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
1880 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1881 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1882 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1883 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
1884 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1885 ])
1886 AT_CLEANUP
1887
1888 AT_SETUP([CTABLES CLABELS])
1889 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1890 AT_DATA([ctables.sps],
1891 [[GET 'nhtsa.sav'.
1892 CTABLES /TABLE AgeGroup BY qns3a.
1893 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1894 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1895 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1896 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1897 ]])
1898 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1899              Custom Tables
1900 ╭───────────────────────┬────────────╮
1901 │                       │S3a. GENDER:│
1902 │                       ├─────┬──────┤
1903 │                       │ Male│Female│
1904 │                       ├─────┼──────┤
1905 │                       │Count│ Count│
1906 ├───────────────────────┼─────┼──────┤
1907 │Age group 15 or younger│    0│     0│
1908 │          16 to 25     │  594│   505│
1909 │          26 to 35     │  476│   491│
1910 │          36 to 45     │  489│   548│
1911 │          46 to 55     │  526│   649│
1912 │          56 to 65     │  516│   731│
1913 │          66 or older  │  531│   943│
1914 ╰───────────────────────┴─────┴──────╯
1915
1916                                                       Custom Tables
1917 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1918 │       │                                                 S3a. GENDER:                                                 │
1919 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1920 │       │                         Male                         │                         Female                        │
1921 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1922 │       │  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 │
1923 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1924 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1925 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1926 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1927 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1928 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1929 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1930
1931                 Custom Tables
1932 ╭──────────────────────────────┬────────────╮
1933 │                              │S3a. GENDER:│
1934 │                              ├────────────┤
1935 │                              │    Count   │
1936 ├──────────────────────────────┼────────────┤
1937 │Age group 15 or younger Male  │           0│
1938 │                        Female│           0│
1939 │         ╶────────────────────┼────────────┤
1940 │          16 to 25      Male  │         594│
1941 │                        Female│         505│
1942 │         ╶────────────────────┼────────────┤
1943 │          26 to 35      Male  │         476│
1944 │                        Female│         491│
1945 │         ╶────────────────────┼────────────┤
1946 │          36 to 45      Male  │         489│
1947 │                        Female│         548│
1948 │         ╶────────────────────┼────────────┤
1949 │          46 to 55      Male  │         526│
1950 │                        Female│         649│
1951 │         ╶────────────────────┼────────────┤
1952 │          56 to 65      Male  │         516│
1953 │                        Female│         731│
1954 │         ╶────────────────────┼────────────┤
1955 │          66 or older   Male  │         531│
1956 │                        Female│         943│
1957 ╰──────────────────────────────┴────────────╯
1958
1959       Custom Tables
1960 15 or younger
1961 ╭─────────┬────────────╮
1962 │         │S3a. GENDER:│
1963 │         ├─────┬──────┤
1964 │         │ Male│Female│
1965 │         ├─────┼──────┤
1966 │         │Count│ Count│
1967 ├─────────┼─────┼──────┤
1968 │Age group│    0│     0│
1969 ╰─────────┴─────┴──────╯
1970
1971       Custom Tables
1972 16 to 25
1973 ╭─────────┬────────────╮
1974 │         │S3a. GENDER:│
1975 │         ├─────┬──────┤
1976 │         │ Male│Female│
1977 │         ├─────┼──────┤
1978 │         │Count│ Count│
1979 ├─────────┼─────┼──────┤
1980 │Age group│  594│   505│
1981 ╰─────────┴─────┴──────╯
1982
1983       Custom Tables
1984 26 to 35
1985 ╭─────────┬────────────╮
1986 │         │S3a. GENDER:│
1987 │         ├─────┬──────┤
1988 │         │ Male│Female│
1989 │         ├─────┼──────┤
1990 │         │Count│ Count│
1991 ├─────────┼─────┼──────┤
1992 │Age group│  476│   491│
1993 ╰─────────┴─────┴──────╯
1994
1995       Custom Tables
1996 36 to 45
1997 ╭─────────┬────────────╮
1998 │         │S3a. GENDER:│
1999 │         ├─────┬──────┤
2000 │         │ Male│Female│
2001 │         ├─────┼──────┤
2002 │         │Count│ Count│
2003 ├─────────┼─────┼──────┤
2004 │Age group│  489│   548│
2005 ╰─────────┴─────┴──────╯
2006
2007       Custom Tables
2008 46 to 55
2009 ╭─────────┬────────────╮
2010 │         │S3a. GENDER:│
2011 │         ├─────┬──────┤
2012 │         │ Male│Female│
2013 │         ├─────┼──────┤
2014 │         │Count│ Count│
2015 ├─────────┼─────┼──────┤
2016 │Age group│  526│   649│
2017 ╰─────────┴─────┴──────╯
2018
2019       Custom Tables
2020 56 to 65
2021 ╭─────────┬────────────╮
2022 │         │S3a. GENDER:│
2023 │         ├─────┬──────┤
2024 │         │ Male│Female│
2025 │         ├─────┼──────┤
2026 │         │Count│ Count│
2027 ├─────────┼─────┼──────┤
2028 │Age group│  516│   731│
2029 ╰─────────┴─────┴──────╯
2030
2031       Custom Tables
2032 66 or older
2033 ╭─────────┬────────────╮
2034 │         │S3a. GENDER:│
2035 │         ├─────┬──────┤
2036 │         │ Male│Female│
2037 │         ├─────┼──────┤
2038 │         │Count│ Count│
2039 ├─────────┼─────┼──────┤
2040 │Age group│  531│   943│
2041 ╰─────────┴─────┴──────╯
2042
2043              Custom Tables
2044 Male
2045 ╭───────────────────────┬────────────╮
2046 │                       │S3a. GENDER:│
2047 │                       ├────────────┤
2048 │                       │    Count   │
2049 ├───────────────────────┼────────────┤
2050 │Age group 15 or younger│           0│
2051 │          16 to 25     │         594│
2052 │          26 to 35     │         476│
2053 │          36 to 45     │         489│
2054 │          46 to 55     │         526│
2055 │          56 to 65     │         516│
2056 │          66 or older  │         531│
2057 ╰───────────────────────┴────────────╯
2058
2059              Custom Tables
2060 Female
2061 ╭───────────────────────┬────────────╮
2062 │                       │S3a. GENDER:│
2063 │                       ├────────────┤
2064 │                       │    Count   │
2065 ├───────────────────────┼────────────┤
2066 │Age group 15 or younger│           0│
2067 │          16 to 25     │         505│
2068 │          26 to 35     │         491│
2069 │          36 to 45     │         548│
2070 │          46 to 55     │         649│
2071 │          56 to 65     │         731│
2072 │          66 or older  │         943│
2073 ╰───────────────────────┴────────────╯
2074 ])
2075 AT_CLEANUP
2076
2077 AT_SETUP([CTABLES missing values])
2078 AT_DATA([ctables.sps],
2079 [[DATA LIST LIST NOTABLE/x y.
2080 BEGIN DATA.
2081 1 1
2082 1 2
2083 1 3
2084 1 4
2085 1 5
2086 1 .
2087 2 1
2088 2 2
2089 2 3
2090 2 4
2091 2 5
2092 2 .
2093 3 1
2094 3 2
2095 3 3
2096 3 4
2097 3 5
2098 3 .
2099 4 1
2100 4 2
2101 4 3
2102 4 4
2103 4 5
2104 4 .
2105 5 1
2106 5 2
2107 5 3
2108 5 4
2109 5 5
2110 5 .
2111 . 1
2112 . 2
2113 . 3
2114 . 4
2115 . 5
2116 . .
2117 END DATA.
2118 MISSING VALUES x (1, 2) y (2, 3).
2119 VARIABLE LEVEL ALL (NOMINAL).
2120
2121 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2122                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2123     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2124 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2125                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2126     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2127 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2128                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2129     /CATEGORIES VARIABLES=ALL TOTAL=YES
2130     /SLABELS POSITION=ROW.
2131 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2132                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2133     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2134     /SLABELS POSITION=ROW.
2135 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2136                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2137     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2138     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2139     /SLABELS POSITION=ROW.
2140 ]])
2141 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2142                                Custom Tables
2143 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2144 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2145 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2146 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2147 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2148 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2149 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2150 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2151 dnl Note that Column Total N % doesn't add up to 100 because missing
2152 dnl values are included in the total but not shown as a category and this
2153 dnl is expected behavior.
2154
2155                                Custom Tables
2156 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2157 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2158 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2159 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2160 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2161 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2162 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2163 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2164 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2165 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2166 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2167 dnl values are included in the total but not shown as a category and this
2168 dnl is expected behavior.
2169
2170                      Custom Tables
2171 ╭────────────────────────┬───────────────────────────╮
2172 │                        │             y             │
2173 │                        ├──────┬──────┬──────┬──────┤
2174 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2175 ├────────────────────────┼──────┼──────┼──────┼──────┤
2176 │x 3.00  Count           │     1│     1│     1│     3│
2177 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2178 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2179 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2180 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2181 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2182 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2183 │        Valid N         │      │      │      │     3│
2184 │        Total N         │      │      │      │     6│
2185 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2186 │  4.00  Count           │     1│     1│     1│     3│
2187 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2188 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2189 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2190 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2191 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2192 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2193 │        Valid N         │      │      │      │     3│
2194 │        Total N         │      │      │      │     6│
2195 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2196 │  5.00  Count           │     1│     1│     1│     3│
2197 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2198 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2199 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2200 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2201 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2202 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2203 │        Valid N         │      │      │      │     3│
2204 │        Total N         │      │      │      │     6│
2205 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2206 │  Total Count           │     3│     3│     3│     9│
2207 │        Column %        │100.0%│100.0%│100.0%│     .│
2208 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2209 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2210 │        Row %           │     .│     .│     .│     .│
2211 │        Row Valid N %   │     .│     .│     .│     .│
2212 │        Row Total N %   │     .│     .│     .│     .│
2213 │        Valid N         │     3│     3│     3│     9│
2214 │        Total N         │     3│     3│     3│    18│
2215 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2216
2217                             Custom Tables
2218 ╭────────────────────────┬─────────────────────────────────────────╮
2219 │                        │                    y                    │
2220 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2221 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2222 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2223 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2224 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2225 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2226 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2227 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2228 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2229 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2230 │        Valid N         │      │      │      │      │      │     3│
2231 │        Total N         │      │      │      │      │      │     6│
2232 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2233 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2234 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2235 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2236 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2237 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2238 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2239 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2240 │        Valid N         │      │      │      │      │      │     3│
2241 │        Total N         │      │      │      │      │      │     6│
2242 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2243 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2244 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2245 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2246 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2247 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2248 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2249 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2250 │        Valid N         │      │      │      │      │      │     3│
2251 │        Total N         │      │      │      │      │      │     6│
2252 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2253 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2254 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2255 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2256 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2257 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2258 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2259 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2260 │        Valid N         │      │      │      │      │      │     3│
2261 │        Total N         │      │      │      │      │      │     6│
2262 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2263 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2264 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2265 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2266 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2267 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2268 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2269 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2270 │        Valid N         │      │      │      │      │      │     3│
2271 │        Total N         │      │      │      │      │      │     6│
2272 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2273 │  Total Count           │     5│     5│     5│     5│     5│    25│
2274 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2275 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2276 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2277 │        Row %           │     .│     .│     .│     .│     .│     .│
2278 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2279 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2280 │        Valid N         │     5│     0│     0│     5│     5│    15│
2281 │        Total N         │     5│     5│     5│     5│     5│    30│
2282 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2283
2284                         Custom Tables
2285 ╭────────────────────────┬──────────────────────────────────╮
2286 │                        │                 y                │
2287 │                        ├──────┬──────┬──────┬──────┬──────┤
2288 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2289 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2290 │x 1.00  Count           │     1│     1│     1│     1│     4│
2291 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2292 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2293 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2294 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2295 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2296 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2297 │        Valid N         │      │      │      │      │     3│
2298 │        Total N         │      │      │      │      │     6│
2299 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2300 │  2.00  Count           │     1│     1│     1│     1│     4│
2301 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2302 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2303 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2304 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2305 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2306 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2307 │        Valid N         │      │      │      │      │     3│
2308 │        Total N         │      │      │      │      │     6│
2309 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2310 │  3.00  Count           │     1│     1│     1│     1│     4│
2311 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2312 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2313 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2314 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2315 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2316 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2317 │        Valid N         │      │      │      │      │     3│
2318 │        Total N         │      │      │      │      │     6│
2319 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2320 │  4.00  Count           │     1│     1│     1│     1│     4│
2321 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2322 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2323 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2324 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2325 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2326 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2327 │        Valid N         │      │      │      │      │     3│
2328 │        Total N         │      │      │      │      │     6│
2329 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2330 │  Total Count           │     4│     4│     4│     4│    16│
2331 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2332 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2333 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2334 │        Row %           │     .│     .│     .│     .│     .│
2335 │        Row Valid N %   │     .│     .│     .│     .│     .│
2336 │        Row Total N %   │     .│     .│     .│     .│     .│
2337 │        Valid N         │     4│     0│     4│     4│    12│
2338 │        Total N         │     4│     4│     4│     4│    24│
2339 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2340 ])
2341 AT_CLEANUP
2342
2343 AT_SETUP([CTABLES SMISSING=LISTWISE])
2344 AT_KEYWORDS([SMISSING LISTWISE])
2345 AT_DATA([ctables.sps],
2346 [[DATA LIST LIST NOTABLE/x y z.
2347 BEGIN DATA.
2348 1  . 40
2349 1 10 50
2350 1 20 60
2351 1  .  .
2352 1 30  .
2353 END DATA.
2354 VARIABLE LEVEL x (NOMINAL).
2355
2356 CTABLES /TABLE (y + z) > x.
2357 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2358
2359 * The following doesn't come out as listwise because the tables are
2360 separate, not linked by an > operator.
2361 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2362 ]])
2363 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2364   Custom Tables
2365 ╭────────┬─────╮
2366 │        │ Mean│
2367 ├────────┼─────┤
2368 │y x 1.00│20.00│
2369 ├────────┼─────┤
2370 │z x 1.00│50.00│
2371 ╰────────┴─────╯
2372
2373   Custom Tables
2374 ╭────────┬─────╮
2375 │        │ Mean│
2376 ├────────┼─────┤
2377 │y x 1.00│15.00│
2378 ├────────┼─────┤
2379 │z x 1.00│55.00│
2380 ╰────────┴─────╯
2381
2382   Custom Tables
2383 ╭────────┬─────╮
2384 │        │ Mean│
2385 ├────────┼─────┤
2386 │y x 1.00│20.00│
2387 ├────────┼─────┤
2388 │z x 1.00│50.00│
2389 ╰────────┴─────╯
2390 ])
2391 AT_CLEANUP
2392
2393 AT_SETUP([CTABLES VLABELS - variables on different axes])
2394 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2395 AT_DATA([ctables.sps],
2396 [[GET 'nhtsa.sav'.
2397 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2398 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2399 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2400 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2401 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2402 ]])
2403 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2404                                  Custom Tables
2405 ╭────────────────────────────────────────────────────────────────┬────────────╮
2406 │                                                                │S3a. GENDER:│
2407 │                                                                ├─────┬──────┤
2408 │                                                                │ Male│Female│
2409 │                                                                ├─────┼──────┤
2410 │                                                                │Count│ Count│
2411 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2412 │D5a. What would you say is your primary    Cuban                │   13│     7│
2413 │ethnic background?                         Mexican              │  175│   136│
2414 │                                           Spanish              │   20│    28│
2415 │                                           South American       │   21│    13│
2416 │                                           Central American     │   27│    25│
2417 │                                           Puerto Rican, OR     │   37│    41│
2418 │                                           Something else       │   35│    33│
2419 │                                           Multiple - cannot    │    2│     5│
2420 │                                           choose one           │     │      │
2421 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2422
2423                   Custom Tables
2424 ╭──────────────────────────────────┬────────────╮
2425 │                                  │    QNS3A   │
2426 │                                  ├─────┬──────┤
2427 │                                  │ Male│Female│
2428 │                                  ├─────┼──────┤
2429 │                                  │Count│ Count│
2430 ├──────────────────────────────────┼─────┼──────┤
2431 │QND5A Cuban                       │   13│     7│
2432 │      Mexican                     │  175│   136│
2433 │      Spanish                     │   20│    28│
2434 │      South American              │   21│    13│
2435 │      Central American            │   27│    25│
2436 │      Puerto Rican, OR            │   37│    41│
2437 │      Something else              │   35│    33│
2438 │      Multiple - cannot choose one│    2│     5│
2439 ╰──────────────────────────────────┴─────┴──────╯
2440
2441                                  Custom Tables
2442 ╭────────────────────────────────────────────────────────────────┬────────────╮
2443 │                                                                │S3a. GENDER:│
2444 │                                                                ├─────┬──────┤
2445 │                                                                │ Male│Female│
2446 │                                                                ├─────┼──────┤
2447 │                                                                │Count│ Count│
2448 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2449 │D5a. What would you say is your primary    Cuban                │   13│     7│
2450 │ethnic background?                         Mexican              │  175│   136│
2451 │                                           Spanish              │   20│    28│
2452 │                                           South American       │   21│    13│
2453 │                                           Central American     │   27│    25│
2454 │                                           Puerto Rican, OR     │   37│    41│
2455 │                                           Something else       │   35│    33│
2456 │                                           Multiple - cannot    │    2│     5│
2457 │                                           choose one           │     │      │
2458 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2459
2460                                  Custom Tables
2461 ╭────────────────────────────────────────────────────────────┬────────────────╮
2462 │                                                            │   QNS3A S3a.   │
2463 │                                                            │     GENDER:    │
2464 │                                                            ├───────┬────────┤
2465 │                                                            │  Male │ Female │
2466 │                                                            ├───────┼────────┤
2467 │                                                            │ Count │  Count │
2468 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2469 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2470 │primary ethnic background?               Mexican            │    175│     136│
2471 │                                         Spanish            │     20│      28│
2472 │                                         South American     │     21│      13│
2473 │                                         Central American   │     27│      25│
2474 │                                         Puerto Rican, OR   │     37│      41│
2475 │                                         Something else     │     35│      33│
2476 │                                         Multiple - cannot  │      2│       5│
2477 │                                         choose one         │       │        │
2478 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2479
2480                Custom Tables
2481 ╭────────────────────────────┬─────┬──────╮
2482 │                            │ Male│Female│
2483 │                            ├─────┼──────┤
2484 │                            │Count│ Count│
2485 ├────────────────────────────┼─────┼──────┤
2486 │Cuban                       │   13│     7│
2487 │Mexican                     │  175│   136│
2488 │Spanish                     │   20│    28│
2489 │South American              │   21│    13│
2490 │Central American            │   27│    25│
2491 │Puerto Rican, OR            │   37│    41│
2492 │Something else              │   35│    33│
2493 │Multiple - cannot choose one│    2│     5│
2494 ╰────────────────────────────┴─────┴──────╯
2495 ])
2496 AT_CLEANUP
2497
2498 AT_SETUP([CTABLES VLABELS - stacked variables])
2499 AT_KEYWORDS([stack stacking])
2500 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2501 AT_DATA([ctables.sps],
2502 [[GET 'nhtsa.sav'.
2503 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2504 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2505 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2506 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2507 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2508 ]])
2509 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2510                                  Custom Tables
2511 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2512 │                                                                       │Count│
2513 ├───────────────────────────────────────────────────────────────────────┼─────┤
2514 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2515 │background?                                     Mexican                │  311│
2516 │                                                Spanish                │   48│
2517 │                                                South American         │   34│
2518 │                                                Central American       │   52│
2519 │                                                Puerto Rican, OR       │   78│
2520 │                                                Something else         │   68│
2521 │                                                Multiple - cannot      │    7│
2522 │                                                choose one             │     │
2523 ├───────────────────────────────────────────────────────────────────────┼─────┤
2524 │QNS3A                                           Male                   │ 3132│
2525 │                                                Female                 │ 3867│
2526 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2527
2528                   Custom Tables
2529 ╭─────────────────────────────────────────┬─────╮
2530 │                                         │Count│
2531 ├─────────────────────────────────────────┼─────┤
2532 │QND5A        Cuban                       │   20│
2533 │             Mexican                     │  311│
2534 │             Spanish                     │   48│
2535 │             South American              │   34│
2536 │             Central American            │   52│
2537 │             Puerto Rican, OR            │   78│
2538 │             Something else              │   68│
2539 │             Multiple - cannot choose one│    7│
2540 ├─────────────────────────────────────────┼─────┤
2541 │S3a. GENDER: Male                        │ 3132│
2542 │             Female                      │ 3867│
2543 ╰─────────────────────────────────────────┴─────╯
2544
2545                                  Custom Tables
2546 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2547 │                                                                       │Count│
2548 ├───────────────────────────────────────────────────────────────────────┼─────┤
2549 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2550 │background?                                     Mexican                │  311│
2551 │                                                Spanish                │   48│
2552 │                                                South American         │   34│
2553 │                                                Central American       │   52│
2554 │                                                Puerto Rican, OR       │   78│
2555 │                                                Something else         │   68│
2556 │                                                Multiple - cannot      │    7│
2557 │                                                choose one             │     │
2558 ├───────────────────────────────────────────────────────────────────────┼─────┤
2559 │Male                                                                   │ 3132│
2560 ├───────────────────────────────────────────────────────────────────────┼─────┤
2561 │Female                                                                 │ 3867│
2562 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2563
2564             Custom Tables
2565 ╭─────────────────────────────┬─────╮
2566 │                             │Count│
2567 ├─────────────────────────────┼─────┤
2568 │Cuban                        │   20│
2569 ├─────────────────────────────┼─────┤
2570 │Mexican                      │  311│
2571 ├─────────────────────────────┼─────┤
2572 │Spanish                      │   48│
2573 ├─────────────────────────────┼─────┤
2574 │South American               │   34│
2575 ├─────────────────────────────┼─────┤
2576 │Central American             │   52│
2577 ├─────────────────────────────┼─────┤
2578 │Puerto Rican, OR             │   78│
2579 ├─────────────────────────────┼─────┤
2580 │Something else               │   68│
2581 ├─────────────────────────────┼─────┤
2582 │Multiple - cannot choose one │    7│
2583 ├─────────────────────────────┼─────┤
2584 │S3a. GENDER:     Male        │ 3132│
2585 │                 Female      │ 3867│
2586 ╰─────────────────────────────┴─────╯
2587
2588             Custom Tables
2589 ╭────────────────────────────┬─────╮
2590 │                            │Count│
2591 ├────────────────────────────┼─────┤
2592 │Cuban                       │   20│
2593 │Mexican                     │  311│
2594 │Spanish                     │   48│
2595 │South American              │   34│
2596 │Central American            │   52│
2597 │Puerto Rican, OR            │   78│
2598 │Something else              │   68│
2599 │Multiple - cannot choose one│    7│
2600 │Male                        │ 3132│
2601 │Female                      │ 3867│
2602 ╰────────────────────────────┴─────╯
2603 ])
2604 AT_CLEANUP
2605
2606 AT_SETUP([CTABLES VLABELS - nested variables])
2607 AT_KEYWORDS([nest nesting])
2608 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2609 AT_DATA([ctables.sps],
2610 [[GET 'nhtsa.sav'.
2611 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2612 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2613 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2614 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2615 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2616 ]])
2617 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2618                                  Custom Tables
2619 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2620 │                                                                       │Count│
2621 ├───────────────────────────────────────────────────────────────────────┼─────┤
2622 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2623 │primary ethnic background?                                       Female│    7│
2624 │                                     ╶─────────────────────────────────┼─────┤
2625 │                                      Mexican              QNS3A Male  │  175│
2626 │                                                                 Female│  136│
2627 │                                     ╶─────────────────────────────────┼─────┤
2628 │                                      Spanish              QNS3A Male  │   20│
2629 │                                                                 Female│   28│
2630 │                                     ╶─────────────────────────────────┼─────┤
2631 │                                      South American       QNS3A Male  │   21│
2632 │                                                                 Female│   13│
2633 │                                     ╶─────────────────────────────────┼─────┤
2634 │                                      Central American     QNS3A Male  │   27│
2635 │                                                                 Female│   25│
2636 │                                     ╶─────────────────────────────────┼─────┤
2637 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2638 │                                                                 Female│   41│
2639 │                                     ╶─────────────────────────────────┼─────┤
2640 │                                      Something else       QNS3A Male  │   35│
2641 │                                                                 Female│   33│
2642 │                                     ╶─────────────────────────────────┼─────┤
2643 │                                      Multiple - cannot    QNS3A Male  │    2│
2644 │                                      choose one                 Female│    5│
2645 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2646
2647                          Custom Tables
2648 ╭──────────────────────────────────────────────────────┬─────╮
2649 │                                                      │Count│
2650 ├──────────────────────────────────────────────────────┼─────┤
2651 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2652 │                                                Female│    7│
2653 │     ╶────────────────────────────────────────────────┼─────┤
2654 │      Mexican                      S3a. GENDER: Male  │  175│
2655 │                                                Female│  136│
2656 │     ╶────────────────────────────────────────────────┼─────┤
2657 │      Spanish                      S3a. GENDER: Male  │   20│
2658 │                                                Female│   28│
2659 │     ╶────────────────────────────────────────────────┼─────┤
2660 │      South American               S3a. GENDER: Male  │   21│
2661 │                                                Female│   13│
2662 │     ╶────────────────────────────────────────────────┼─────┤
2663 │      Central American             S3a. GENDER: Male  │   27│
2664 │                                                Female│   25│
2665 │     ╶────────────────────────────────────────────────┼─────┤
2666 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2667 │                                                Female│   41│
2668 │     ╶────────────────────────────────────────────────┼─────┤
2669 │      Something else               S3a. GENDER: Male  │   35│
2670 │                                                Female│   33│
2671 │     ╶────────────────────────────────────────────────┼─────┤
2672 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2673 │                                                Female│    5│
2674 ╰──────────────────────────────────────────────────────┴─────╯
2675
2676                                  Custom Tables
2677 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2678 │                                                                       │Count│
2679 ├───────────────────────────────────────────────────────────────────────┼─────┤
2680 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2681 │ethnic background?                                               Female│    7│
2682 │                                          ╶────────────────────────────┼─────┤
2683 │                                           Mexican               Male  │  175│
2684 │                                                                 Female│  136│
2685 │                                          ╶────────────────────────────┼─────┤
2686 │                                           Spanish               Male  │   20│
2687 │                                                                 Female│   28│
2688 │                                          ╶────────────────────────────┼─────┤
2689 │                                           South American        Male  │   21│
2690 │                                                                 Female│   13│
2691 │                                          ╶────────────────────────────┼─────┤
2692 │                                           Central American      Male  │   27│
2693 │                                                                 Female│   25│
2694 │                                          ╶────────────────────────────┼─────┤
2695 │                                           Puerto Rican, OR      Male  │   37│
2696 │                                                                 Female│   41│
2697 │                                          ╶────────────────────────────┼─────┤
2698 │                                           Something else        Male  │   35│
2699 │                                                                 Female│   33│
2700 │                                          ╶────────────────────────────┼─────┤
2701 │                                           Multiple - cannot     Male  │    2│
2702 │                                           choose one            Female│    5│
2703 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2704
2705                       Custom Tables
2706 ╭────────────────────────────────────────────────┬─────╮
2707 │                                                │Count│
2708 ├────────────────────────────────────────────────┼─────┤
2709 │Cuban                        S3a. GENDER: Male  │   13│
2710 │                                          Female│    7│
2711 ├────────────────────────────────────────────────┼─────┤
2712 │Mexican                      S3a. GENDER: Male  │  175│
2713 │                                          Female│  136│
2714 ├────────────────────────────────────────────────┼─────┤
2715 │Spanish                      S3a. GENDER: Male  │   20│
2716 │                                          Female│   28│
2717 ├────────────────────────────────────────────────┼─────┤
2718 │South American               S3a. GENDER: Male  │   21│
2719 │                                          Female│   13│
2720 ├────────────────────────────────────────────────┼─────┤
2721 │Central American             S3a. GENDER: Male  │   27│
2722 │                                          Female│   25│
2723 ├────────────────────────────────────────────────┼─────┤
2724 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2725 │                                          Female│   41│
2726 ├────────────────────────────────────────────────┼─────┤
2727 │Something else               S3a. GENDER: Male  │   35│
2728 │                                          Female│   33│
2729 ├────────────────────────────────────────────────┼─────┤
2730 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2731 │                                          Female│    5│
2732 ╰────────────────────────────────────────────────┴─────╯
2733
2734                Custom Tables
2735 ╭───────────────────────────────────┬─────╮
2736 │                                   │Count│
2737 ├───────────────────────────────────┼─────┤
2738 │Cuban                        Male  │   13│
2739 │                             Female│    7│
2740 ├───────────────────────────────────┼─────┤
2741 │Mexican                      Male  │  175│
2742 │                             Female│  136│
2743 ├───────────────────────────────────┼─────┤
2744 │Spanish                      Male  │   20│
2745 │                             Female│   28│
2746 ├───────────────────────────────────┼─────┤
2747 │South American               Male  │   21│
2748 │                             Female│   13│
2749 ├───────────────────────────────────┼─────┤
2750 │Central American             Male  │   27│
2751 │                             Female│   25│
2752 ├───────────────────────────────────┼─────┤
2753 │Puerto Rican, OR             Male  │   37│
2754 │                             Female│   41│
2755 ├───────────────────────────────────┼─────┤
2756 │Something else               Male  │   35│
2757 │                             Female│   33│
2758 ├───────────────────────────────────┼─────┤
2759 │Multiple - cannot choose one Male  │    2│
2760 │                             Female│    5│
2761 ╰───────────────────────────────────┴─────╯
2762 ])
2763 AT_CLEANUP
2764
2765 AT_SETUP([CTABLES FORMAT EMPTY])
2766 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2767 AT_DATA([ctables.sps],
2768 [[GET 'nhtsa.sav'.
2769 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2770 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2771 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2772 ]])
2773 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2774                                  Custom Tables
2775 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2776 │                                             │   D5. ETHNICITY: Are you of   │
2777 │                                             │  Hispanic or Latino origin or │
2778 │                                             │            descent?           │
2779 │                                             ├───────────────┬───────────────┤
2780 │                                             │      Yes      │       No      │
2781 │                                             ├───────────────┼───────────────┤
2782 │                                             │     Count     │     Count     │
2783 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2784 │D5a. What would you say is   Cuban           │             20│              0│
2785 │your primary ethnic          Mexican         │            311│              0│
2786 │background?                  Spanish         │             48│              0│
2787 │                             South American  │             34│              0│
2788 │                             Central American│             52│              0│
2789 │                             Puerto Rican, OR│             78│              0│
2790 │                             Something else  │             68│              0│
2791 │                             Multiple -      │              7│              0│
2792 │                             cannot choose   │               │               │
2793 │                             one             │               │               │
2794 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2795
2796                                  Custom Tables
2797 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2798 │                                             │   D5. ETHNICITY: Are you of   │
2799 │                                             │  Hispanic or Latino origin or │
2800 │                                             │            descent?           │
2801 │                                             ├───────────────┬───────────────┤
2802 │                                             │      Yes      │       No      │
2803 │                                             ├───────────────┼───────────────┤
2804 │                                             │     Count     │     Count     │
2805 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2806 │D5a. What would you say is   Cuban           │             20│               │
2807 │your primary ethnic          Mexican         │            311│               │
2808 │background?                  Spanish         │             48│               │
2809 │                             South American  │             34│               │
2810 │                             Central American│             52│               │
2811 │                             Puerto Rican, OR│             78│               │
2812 │                             Something else  │             68│               │
2813 │                             Multiple -      │              7│               │
2814 │                             cannot choose   │               │               │
2815 │                             one             │               │               │
2816 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2817
2818                                  Custom Tables
2819 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2820 │                                             │   D5. ETHNICITY: Are you of   │
2821 │                                             │  Hispanic or Latino origin or │
2822 │                                             │            descent?           │
2823 │                                             ├───────────────┬───────────────┤
2824 │                                             │      Yes      │       No      │
2825 │                                             ├───────────────┼───────────────┤
2826 │                                             │     Count     │     Count     │
2827 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2828 │D5a. What would you say is   Cuban           │             20│n/a            │
2829 │your primary ethnic          Mexican         │            311│n/a            │
2830 │background?                  Spanish         │             48│n/a            │
2831 │                             South American  │             34│n/a            │
2832 │                             Central American│             52│n/a            │
2833 │                             Puerto Rican, OR│             78│n/a            │
2834 │                             Something else  │             68│n/a            │
2835 │                             Multiple -      │              7│n/a            │
2836 │                             cannot choose   │               │               │
2837 │                             one             │               │               │
2838 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2839 ])
2840 AT_CLEANUP
2841
2842 AT_SETUP([CTABLES FORMAT MISSING])
2843 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2844 AT_DATA([ctables.sps],
2845 [[GET 'nhtsa.sav'.
2846 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2847 ]])
2848 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2849                                  Custom Tables
2850 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2851 │                                             │   D5. ETHNICITY: Are you of   │
2852 │                                             │  Hispanic or Latino origin or │
2853 │                                             │            descent?           │
2854 │                                             ├───────────────┬───────────────┤
2855 │                                             │      Yes      │       No      │
2856 │                                             ├───────────────┼───────────────┤
2857 │                                             │    Column %   │    Column %   │
2858 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2859 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2860 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2861 │background?                  Spanish         │           7.8%│(no data)      │
2862 │                             South American  │           5.5%│(no data)      │
2863 │                             Central American│           8.4%│(no data)      │
2864 │                             Puerto Rican, OR│          12.6%│(no data)      │
2865 │                             Something else  │          11.0%│(no data)      │
2866 │                             Multiple -      │           1.1%│(no data)      │
2867 │                             cannot choose   │               │               │
2868 │                             one             │               │               │
2869 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2870 ])
2871 AT_CLEANUP
2872
2873 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2874 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2875 AT_DATA([ctables.sps],
2876 [[GET 'nhtsa.sav'.
2877 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2878 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2879 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2880 ]])
2881 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
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            │    4│     .3%│
2896 │                                                 10           │    6│     .4%│
2897 │                                                 11           │    2│     .1%│
2898 │                                                 12           │    5│     .4%│
2899 │                                                 14           │    1│     .1%│
2900 │                                                 15           │    1│     .1%│
2901 │                                                 18           │    1│     .1%│
2902 │                                                 20           │    4│     .3%│
2903 │                                                 25           │    1│     .1%│
2904 │                                                 30           │    3│     .2%│
2905 │                                                 60           │    1│     .1%│
2906 │                                                 99+          │    0│     .0%│
2907 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2908
2909                                  Custom Tables
2910 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2911 │                                                              │Count│Column %│
2912 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2913 │38. How many drinks did you have on that         Less than one│    7│     .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            │    9│     .6%│
2921 │                                                 8            │    8│     .6%│
2922 │                                                 9            │<5   │     .3%│
2923 │                                                 10           │    6│     .4%│
2924 │                                                 11           │<5   │     .1%│
2925 │                                                 12           │    5│     .4%│
2926 │                                                 14           │<5   │     .1%│
2927 │                                                 15           │<5   │     .1%│
2928 │                                                 18           │<5   │     .1%│
2929 │                                                 20           │<5   │     .3%│
2930 │                                                 25           │<5   │     .1%│
2931 │                                                 30           │<5   │     .2%│
2932 │                                                 60           │<5   │     .1%│
2933 │                                                 99+          │<5   │     .0%│
2934 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2935
2936                                  Custom Tables
2937 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2938 │                                                              │Count│Column %│
2939 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2940 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2941 │occasion?                                        1            │  491│   34.9%│
2942 │                                                 2            │  462│   32.9%│
2943 │                                                 3            │  229│   16.3%│
2944 │                                                 4            │   82│    5.8%│
2945 │                                                 5            │   56│    4.0%│
2946 │                                                 6            │   32│    2.3%│
2947 │                                                 7            │<10  │     .6%│
2948 │                                                 8            │<10  │     .6%│
2949 │                                                 9            │<10  │     .3%│
2950 │                                                 10           │<10  │     .4%│
2951 │                                                 11           │<10  │     .1%│
2952 │                                                 12           │<10  │     .4%│
2953 │                                                 14           │<10  │     .1%│
2954 │                                                 15           │<10  │     .1%│
2955 │                                                 18           │<10  │     .1%│
2956 │                                                 20           │<10  │     .3%│
2957 │                                                 25           │<10  │     .1%│
2958 │                                                 30           │<10  │     .2%│
2959 │                                                 60           │<10  │     .1%│
2960 │                                                 99+          │<10  │     .0%│
2961 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2962 ])
2963 AT_CLEANUP
2964
2965 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2966 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2967 AT_DATA([ctables.sps],
2968 [[GET 'nhtsa.sav'.
2969 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2970 ]])
2971 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2972  Custom Tables
2973 ╭────────────╮
2974 │S3a. GENDER:│
2975 ├─────┬──────┤
2976 │ Male│Female│
2977 ├─────┼──────┤
2978 │Count│ Count│
2979 ├─────┼──────┤
2980 │ 3132│  3867│
2981 ╰─────┴──────╯
2982 ])
2983 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2984 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2985 maximumColumnWidth="192"
2986 minimumColumnWidth="96"
2987 ])
2988 AT_CLEANUP
2989
2990 AT_SETUP([CTABLES special formats])
2991 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2992 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2993 AT_DATA([ctables.sps],
2994 [[GET 'nhtsa.sav'.
2995 COMPUTE x = qnd3 - 4.
2996 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].
2997 ]])
2998 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2999                            Custom Tables
3000 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
3001 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
3002 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
3003 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
3004 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
3005 ])
3006 AT_CLEANUP
3007
3008 AT_SETUP([CTABLES TITLES])
3009 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3010 AT_DATA([ctables.sps],
3011 [[GET 'nhtsa.sav'.
3012 CTABLES
3013     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3014     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3015     /TITLES TITLE='How often do you drive?'
3016             CAPTION='Generated )TIME on )DATE'
3017             CORNER=')TABLE'.
3018 ]])
3019 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3020 s&../../..&MM/DD/YY&'], [0], [dnl
3021                             How often do you drive?
3022 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3023 │                                   │               S3a. GENDER:              │
3024 │                                   ├────────────────────┬────────────────────┤
3025 │                                   │        Male        │       Female       │
3026 │                                   ├────────────────────┼────────────────────┤
3027 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3028 │                                   │ you of Hispanic or │ you of Hispanic or │
3029 │                                   │  Latino origin or  │  Latino origin or  │
3030 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3031 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3032 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3033 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3034 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3035 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3036 │Every day                          │      218│      2066│      166│      2175│
3037 │Several days a week                │       44│       391│       45│       782│
3038 │Once a week or less                │       16│       109│       12│       223│
3039 │Only certain times a year          │       15│        41│       11│        61│
3040 │Never                              │       39│       150│       56│       278│
3041 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3042 Generated HH:MM:SS on MM/DD/YY
3043 ])
3044 AT_CLEANUP
3045
3046 AT_SETUP([CTABLES area definitions])
3047 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3048 AT_DATA([ctables.sps],
3049 [[GET 'nhtsa.sav'.
3050 CTABLES
3051     /VLABELS VARIABLES=ALL DISPLAY=NAME
3052     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3053     /SLABELS POSITION=ROW
3054     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3055     /SLABELS POSITION=ROW
3056     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3057     /SLABELS POSITION=ROW.
3058 ]])
3059 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3060                     Custom Tables
3061 Male
3062 ╭─────────────────────────────┬─────────────┬──────╮
3063 │                             │    QND7A    │ QN64B│
3064 │                             ├──────┬──────┼───┬──┤
3065 │                             │  Yes │  No  │   │  │
3066 │                             ├──────┼──────┤   │  │
3067 │                             │ QN86 │ QN86 │   │  │
3068 │                             ├───┬──┼───┬──┤   │  │
3069 │                             │Yes│No│Yes│No│Yes│No│
3070 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3071 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3072 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3073 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3074 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3075 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3076 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3077 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3078 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3079 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3080 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3081 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3082 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3083 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3084 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3085 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3086 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3087
3088                     Custom Tables
3089 Female
3090 ╭─────────────────────────────┬─────────────┬──────╮
3091 │                             │    QND7A    │ QN64B│
3092 │                             ├──────┬──────┼───┬──┤
3093 │                             │  Yes │  No  │   │  │
3094 │                             ├──────┼──────┤   │  │
3095 │                             │ QN86 │ QN86 │   │  │
3096 │                             ├───┬──┼───┬──┤   │  │
3097 │                             │Yes│No│Yes│No│Yes│No│
3098 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3099 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3100 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3101 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3102 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3103 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3104 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3105 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3106 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3107 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3108 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3109 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3110 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3111 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3112 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3113 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3114 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3115
3116                     Custom Tables
3117 Male
3118 ╭──────────────────────────────┬─────────────┬──────╮
3119 │                              │    QND7A    │ QN64B│
3120 │                              ├──────┬──────┼───┬──┤
3121 │                              │  Yes │  No  │   │  │
3122 │                              ├──────┼──────┤   │  │
3123 │                              │ QN86 │ QN86 │   │  │
3124 │                              ├───┬──┼───┬──┤   │  │
3125 │                              │Yes│No│Yes│No│Yes│No│
3126 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3127 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3128 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3129 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3130 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3131 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3132 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3133 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3134 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3135 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3136 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3137 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3138 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3139
3140                     Custom Tables
3141 Female
3142 ╭──────────────────────────────┬─────────────┬──────╮
3143 │                              │    QND7A    │ QN64B│
3144 │                              ├──────┬──────┼───┬──┤
3145 │                              │  Yes │  No  │   │  │
3146 │                              ├──────┼──────┤   │  │
3147 │                              │ QN86 │ QN86 │   │  │
3148 │                              ├───┬──┼───┬──┤   │  │
3149 │                              │Yes│No│Yes│No│Yes│No│
3150 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3151 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3152 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3153 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3154 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3155 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3156 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3157 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3158 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3159 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3160 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3161 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3162 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3163
3164                       Custom Tables
3165 Male
3166 ╭─────────────────────────────────┬─────────────┬──────╮
3167 │                                 │    QND7A    │ QN64B│
3168 │                                 ├──────┬──────┼───┬──┤
3169 │                                 │  Yes │  No  │   │  │
3170 │                                 ├──────┼──────┤   │  │
3171 │                                 │ QN86 │ QN86 │   │  │
3172 │                                 ├───┬──┼───┬──┤   │  │
3173 │                                 │Yes│No│Yes│No│Yes│No│
3174 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3175 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3176 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3177 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3178 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3179 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3180 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3181 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3182 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3183 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3184 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3185 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3186 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3187
3188                       Custom Tables
3189 Female
3190 ╭─────────────────────────────────┬─────────────┬──────╮
3191 │                                 │    QND7A    │ QN64B│
3192 │                                 ├──────┬──────┼───┬──┤
3193 │                                 │  Yes │  No  │   │  │
3194 │                                 ├──────┼──────┤   │  │
3195 │                                 │ QN86 │ QN86 │   │  │
3196 │                                 ├───┬──┼───┬──┤   │  │
3197 │                                 │Yes│No│Yes│No│Yes│No│
3198 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3199 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3200 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3201 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3202 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3203 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3204 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3205 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3206 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3207 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3208 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3209 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3210 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3211 ])
3212 AT_CLEANUP
3213
3214 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3215 AT_KEYWORDS([ROWLABELS OPPOSITE])
3216 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3217 AT_DATA([ctables.sps],
3218 [[GET 'nhtsa.sav'.
3219 CTABLES
3220     /VLABELS VARIABLES=ALL DISPLAY=NAME
3221     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3222     /SLABELS POSITION=ROW
3223     /CLABELS ROWLABELS=OPPOSITE
3224     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3225     /SLABELS POSITION=ROW
3226     /CLABELS ROWLABELS=OPPOSITE
3227     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3228     /SLABELS POSITION=ROW
3229     /CLABELS ROWLABELS=OPPOSITE.
3230 ]])
3231 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3232                                         Custom Tables
3233 Male
3234 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3235 │                                  │                          QN27                         │
3236 │                                  ├───────────────────────────┬───────────────────────────┤
3237 │                                  │            Yes            │             No            │
3238 │                                  ├───────────────────────────┼───────────────────────────┤
3239 │                                  │           QND7A           │           QND7A           │
3240 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3241 │                                  │     Yes     │      No     │     Yes     │      No     │
3242 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3243 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3244 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3245 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3246 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3247 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3248 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3249 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3250 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3251 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3252 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3253 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3254 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3255 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3256 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3257 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3258 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3259 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3260 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3261 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3262 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3263 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3264 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3265
3266                                         Custom Tables
3267 Female
3268 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3269 │                                  │                          QN27                         │
3270 │                                  ├───────────────────────────┬───────────────────────────┤
3271 │                                  │            Yes            │             No            │
3272 │                                  ├───────────────────────────┼───────────────────────────┤
3273 │                                  │           QND7A           │           QND7A           │
3274 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3275 │                                  │     Yes     │      No     │     Yes     │      No     │
3276 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3277 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3278 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3279 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3280 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3281 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3282 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3283 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3284 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3285 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3286 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3287 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3288 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3289 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3290 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3291 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3292 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3293 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3294 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3295 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3296 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3297 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3298 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3299
3300                                         Custom Tables
3301 Male
3302 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3303 │                                   │                          QN27                         │
3304 │                                   ├───────────────────────────┬───────────────────────────┤
3305 │                                   │            Yes            │             No            │
3306 │                                   ├───────────────────────────┼───────────────────────────┤
3307 │                                   │           QND7A           │           QND7A           │
3308 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3309 │                                   │     Yes     │      No     │     Yes     │      No     │
3310 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3311 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3312 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3313 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3314 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3315 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3316 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3317 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3318 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3319 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3320 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3321 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3322 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3323 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3324 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3325 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3326 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3327 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3328 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3329
3330                                         Custom Tables
3331 Female
3332 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3333 │                                   │                          QN27                         │
3334 │                                   ├───────────────────────────┬───────────────────────────┤
3335 │                                   │            Yes            │             No            │
3336 │                                   ├───────────────────────────┼───────────────────────────┤
3337 │                                   │           QND7A           │           QND7A           │
3338 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3339 │                                   │     Yes     │      No     │     Yes     │      No     │
3340 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3341 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3342 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3343 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3344 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3345 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3346 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3347 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3348 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3349 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3350 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3351 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3352 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3353 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3354 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3355 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3356 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3357 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3358 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3359
3360                                           Custom Tables
3361 Male
3362 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3363 │                                      │                          QN27                         │
3364 │                                      ├───────────────────────────┬───────────────────────────┤
3365 │                                      │            Yes            │             No            │
3366 │                                      ├───────────────────────────┼───────────────────────────┤
3367 │                                      │           QND7A           │           QND7A           │
3368 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3369 │                                      │     Yes     │      No     │     Yes     │      No     │
3370 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3371 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3372 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3373 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3374 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3375 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3376 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3377 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3378 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3379 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3380 │              No  QN57 Column ID      │  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3381 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3382 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3383 │     No  QN61 Yes QN57 Column ID      │ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 32│31│
3384 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3385 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3386 │              No  QN57 Column ID      │ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 32│31│
3387 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3388 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3389
3390                                           Custom Tables
3391 Female
3392 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3393 │                                      │                          QN27                         │
3394 │                                      ├───────────────────────────┬───────────────────────────┤
3395 │                                      │            Yes            │             No            │
3396 │                                      ├───────────────────────────┼───────────────────────────┤
3397 │                                      │           QND7A           │           QND7A           │
3398 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3399 │                                      │     Yes     │      No     │     Yes     │      No     │
3400 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3401 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3402 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3403 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3404 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3405 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3406 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3407 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│33│ 35│36│ 37│38│ 39│40│ 41│42│ 44│43│ 45│46│ 47│48│
3408 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3409 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3410 │              No  QN57 Column ID      │ 34│33│ 35│36│ 37│38│ 39│40│ 41│42│ 44│43│ 45│46│ 47│48│
3411 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3412 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3413 │     No  QN61 Yes QN57 Column ID      │ 50│49│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 62│61│ 64│63│
3414 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3415 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3416 │              No  QN57 Column ID      │ 50│49│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 62│61│ 64│63│
3417 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3418 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3419 ])
3420 AT_CLEANUP
3421
3422 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3423 AT_KEYWORDS([COLLABELS OPPOSITE])
3424 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3425 AT_DATA([ctables.sps],
3426 [[GET 'nhtsa.sav'.
3427 CTABLES
3428     /VLABELS VARIABLES=ALL DISPLAY=NAME
3429     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3430     /SLABELS POSITION=ROW
3431     /CLABELS COLLABELS=OPPOSITE
3432     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3433     /SLABELS POSITION=ROW
3434     /CLABELS COLLABELS=OPPOSITE
3435     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3436     /SLABELS POSITION=ROW
3437     /CLABELS COLLABELS=OPPOSITE.
3438 ]])
3439 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3440                           Custom Tables
3441 Male
3442 ╭──────────────────────────────────────────┬───────────────────╮
3443 │                                          │        QN27       │
3444 │                                          ├─────────┬─────────┤
3445 │                                          │   Yes   │    No   │
3446 │                                          ├─────────┼─────────┤
3447 │                                          │  QND7A  │  QND7A  │
3448 │                                          ├────┬────┼────┬────┤
3449 │                                          │ Yes│ No │ Yes│ No │
3450 │                                          ├────┼────┼────┼────┤
3451 │                                          │QN86│QN86│QN86│QN86│
3452 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3453 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3454 │                               Layer ID   │   1│   1│   1│   1│
3455 │                               Subtable ID│   1│   1│   2│   2│
3456 │                          ╶───────────────┼────┼────┼────┼────┤
3457 │                           No  Table ID   │   1│   1│   1│   1│
3458 │                               Layer ID   │   1│   1│   1│   1│
3459 │                               Subtable ID│   1│   1│   2│   2│
3460 │                      ╶───────────────────┼────┼────┼────┼────┤
3461 │                       No  Yes Table ID   │   1│   1│   1│   1│
3462 │                               Layer ID   │   1│   1│   1│   1│
3463 │                               Subtable ID│   3│   3│   4│   4│
3464 │                          ╶───────────────┼────┼────┼────┼────┤
3465 │                           No  Table ID   │   1│   1│   1│   1│
3466 │                               Layer ID   │   1│   1│   1│   1│
3467 │                               Subtable ID│   3│   3│   4│   4│
3468 │             ╶────────────────────────────┼────┼────┼────┼────┤
3469 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3470 │                               Layer ID   │   1│   1│   1│   1│
3471 │                               Subtable ID│   5│   5│   6│   6│
3472 │                          ╶───────────────┼────┼────┼────┼────┤
3473 │                           No  Table ID   │   1│   1│   1│   1│
3474 │                               Layer ID   │   1│   1│   1│   1│
3475 │                               Subtable ID│   5│   5│   6│   6│
3476 │                      ╶───────────────────┼────┼────┼────┼────┤
3477 │                       No  Yes Table ID   │   1│   1│   1│   1│
3478 │                               Layer ID   │   1│   1│   1│   1│
3479 │                               Subtable ID│   7│   7│   8│   8│
3480 │                          ╶───────────────┼────┼────┼────┼────┤
3481 │                           No  Table ID   │   1│   1│   1│   1│
3482 │                               Layer ID   │   1│   1│   1│   1│
3483 │                               Subtable ID│   7│   7│   8│   8│
3484 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3485 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3486 │                               Layer ID   │   1│   1│   1│   1│
3487 │                               Subtable ID│   9│   9│  10│  10│
3488 │                          ╶───────────────┼────┼────┼────┼────┤
3489 │                           No  Table ID   │   1│   1│   1│   1│
3490 │                               Layer ID   │   1│   1│   1│   1│
3491 │                               Subtable ID│   9│   9│  10│  10│
3492 │                      ╶───────────────────┼────┼────┼────┼────┤
3493 │                       No  Yes Table ID   │   1│   1│   1│   1│
3494 │                               Layer ID   │   1│   1│   1│   1│
3495 │                               Subtable ID│  11│  11│  12│  12│
3496 │                          ╶───────────────┼────┼────┼────┼────┤
3497 │                           No  Table ID   │   1│   1│   1│   1│
3498 │                               Layer ID   │   1│   1│   1│   1│
3499 │                               Subtable ID│  11│  11│  12│  12│
3500 │             ╶────────────────────────────┼────┼────┼────┼────┤
3501 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3502 │                               Layer ID   │   1│   1│   1│   1│
3503 │                               Subtable ID│  13│  13│  14│  14│
3504 │                          ╶───────────────┼────┼────┼────┼────┤
3505 │                           No  Table ID   │   1│   1│   1│   1│
3506 │                               Layer ID   │   1│   1│   1│   1│
3507 │                               Subtable ID│  13│  13│  14│  14│
3508 │                      ╶───────────────────┼────┼────┼────┼────┤
3509 │                       No  Yes Table ID   │   1│   1│   1│   1│
3510 │                               Layer ID   │   1│   1│   1│   1│
3511 │                               Subtable ID│  15│  15│  16│  16│
3512 │                          ╶───────────────┼────┼────┼────┼────┤
3513 │                           No  Table ID   │   1│   1│   1│   1│
3514 │                               Layer ID   │   1│   1│   1│   1│
3515 │                               Subtable ID│  15│  15│  16│  16│
3516 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3517
3518                           Custom Tables
3519 Female
3520 ╭──────────────────────────────────────────┬───────────────────╮
3521 │                                          │        QN27       │
3522 │                                          ├─────────┬─────────┤
3523 │                                          │   Yes   │    No   │
3524 │                                          ├─────────┼─────────┤
3525 │                                          │  QND7A  │  QND7A  │
3526 │                                          ├────┬────┼────┬────┤
3527 │                                          │ Yes│ No │ Yes│ No │
3528 │                                          ├────┼────┼────┼────┤
3529 │                                          │QN86│QN86│QN86│QN86│
3530 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3531 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3532 │                               Layer ID   │   2│   2│   2│   2│
3533 │                               Subtable ID│  17│  17│  18│  18│
3534 │                          ╶───────────────┼────┼────┼────┼────┤
3535 │                           No  Table ID   │   1│   1│   1│   1│
3536 │                               Layer ID   │   2│   2│   2│   2│
3537 │                               Subtable ID│  17│  17│  18│  18│
3538 │                      ╶───────────────────┼────┼────┼────┼────┤
3539 │                       No  Yes Table ID   │   1│   1│   1│   1│
3540 │                               Layer ID   │   2│   2│   2│   2│
3541 │                               Subtable ID│  19│  19│  20│  20│
3542 │                          ╶───────────────┼────┼────┼────┼────┤
3543 │                           No  Table ID   │   1│   1│   1│   1│
3544 │                               Layer ID   │   2│   2│   2│   2│
3545 │                               Subtable ID│  19│  19│  20│  20│
3546 │             ╶────────────────────────────┼────┼────┼────┼────┤
3547 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3548 │                               Layer ID   │   2│   2│   2│   2│
3549 │                               Subtable ID│  21│  21│  22│  22│
3550 │                          ╶───────────────┼────┼────┼────┼────┤
3551 │                           No  Table ID   │   1│   1│   1│   1│
3552 │                               Layer ID   │   2│   2│   2│   2│
3553 │                               Subtable ID│  21│  21│  22│  22│
3554 │                      ╶───────────────────┼────┼────┼────┼────┤
3555 │                       No  Yes Table ID   │   1│   1│   1│   1│
3556 │                               Layer ID   │   2│   2│   2│   2│
3557 │                               Subtable ID│  23│  23│  24│  24│
3558 │                          ╶───────────────┼────┼────┼────┼────┤
3559 │                           No  Table ID   │   1│   1│   1│   1│
3560 │                               Layer ID   │   2│   2│   2│   2│
3561 │                               Subtable ID│  23│  23│  24│  24│
3562 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3563 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3564 │                               Layer ID   │   2│   2│   2│   2│
3565 │                               Subtable ID│  25│  25│  26│  26│
3566 │                          ╶───────────────┼────┼────┼────┼────┤
3567 │                           No  Table ID   │   1│   1│   1│   1│
3568 │                               Layer ID   │   2│   2│   2│   2│
3569 │                               Subtable ID│  25│  25│  26│  26│
3570 │                      ╶───────────────────┼────┼────┼────┼────┤
3571 │                       No  Yes Table ID   │   1│   1│   1│   1│
3572 │                               Layer ID   │   2│   2│   2│   2│
3573 │                               Subtable ID│  27│  27│  28│  28│
3574 │                          ╶───────────────┼────┼────┼────┼────┤
3575 │                           No  Table ID   │   1│   1│   1│   1│
3576 │                               Layer ID   │   2│   2│   2│   2│
3577 │                               Subtable ID│  27│  27│  28│  28│
3578 │             ╶────────────────────────────┼────┼────┼────┼────┤
3579 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3580 │                               Layer ID   │   2│   2│   2│   2│
3581 │                               Subtable ID│  29│  29│  30│  30│
3582 │                          ╶───────────────┼────┼────┼────┼────┤
3583 │                           No  Table ID   │   1│   1│   1│   1│
3584 │                               Layer ID   │   2│   2│   2│   2│
3585 │                               Subtable ID│  29│  29│  30│  30│
3586 │                      ╶───────────────────┼────┼────┼────┼────┤
3587 │                       No  Yes Table ID   │   1│   1│   1│   1│
3588 │                               Layer ID   │   2│   2│   2│   2│
3589 │                               Subtable ID│  31│  31│  32│  32│
3590 │                          ╶───────────────┼────┼────┼────┼────┤
3591 │                           No  Table ID   │   1│   1│   1│   1│
3592 │                               Layer ID   │   2│   2│   2│   2│
3593 │                               Subtable ID│  31│  31│  32│  32│
3594 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3595
3596                           Custom Tables
3597 Male
3598 ╭───────────────────────────────────────────┬───────────────────╮
3599 │                                           │        QN27       │
3600 │                                           ├─────────┬─────────┤
3601 │                                           │   Yes   │    No   │
3602 │                                           ├─────────┼─────────┤
3603 │                                           │  QND7A  │  QND7A  │
3604 │                                           ├────┬────┼────┬────┤
3605 │                                           │ Yes│ No │ Yes│ No │
3606 │                                           ├────┼────┼────┼────┤
3607 │                                           │QN86│QN86│QN86│QN86│
3608 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3609 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   2│   2│   3│   3│
3610 │                               Layer Row ID│   2│   2│   2│   2│
3611 │                          ╶────────────────┼────┼────┼────┼────┤
3612 │                           No  Row ID      │   1│   1│   4│   4│
3613 │                               Layer Row ID│   1│   1│   1│   1│
3614 │                      ╶────────────────────┼────┼────┼────┼────┤
3615 │                       No  Yes Row ID      │   5│   5│   7│   7│
3616 │                               Layer Row ID│   3│   3│   3│   3│
3617 │                          ╶────────────────┼────┼────┼────┼────┤
3618 │                           No  Row ID      │   6│   6│   8│   8│
3619 │                               Layer Row ID│   4│   4│   4│   4│
3620 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3621 │              No  QN57 Yes Yes Row ID      │  10│  10│  11│  11│
3622 │                               Layer Row ID│   6│   6│   6│   6│
3623 │                          ╶────────────────┼────┼────┼────┼────┤
3624 │                           No  Row ID      │   9│   9│  12│  12│
3625 │                               Layer Row ID│   5│   5│   5│   5│
3626 │                      ╶────────────────────┼────┼────┼────┼────┤
3627 │                       No  Yes Row ID      │  14│  14│  16│  16│
3628 │                               Layer Row ID│   8│   8│   8│   8│
3629 │                          ╶────────────────┼────┼────┼────┼────┤
3630 │                           No  Row ID      │  13│  13│  15│  15│
3631 │                               Layer Row ID│   7│   7│   7│   7│
3632 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3633 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  19│  19│
3634 │                               Layer Row ID│   9│   9│   9│   9│
3635 │                          ╶────────────────┼────┼────┼────┼────┤
3636 │                           No  Row ID      │  18│  18│  20│  20│
3637 │                               Layer Row ID│  10│  10│  10│  10│
3638 │                      ╶────────────────────┼────┼────┼────┼────┤
3639 │                       No  Yes Row ID      │  21│  21│  23│  23│
3640 │                               Layer Row ID│  11│  11│  11│  11│
3641 │                          ╶────────────────┼────┼────┼────┼────┤
3642 │                           No  Row ID      │  22│  22│  24│  24│
3643 │                               Layer Row ID│  12│  12│  12│  12│
3644 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3645 │              No  QN57 Yes Yes Row ID      │  26│  26│  28│  28│
3646 │                               Layer Row ID│  14│  14│  14│  14│
3647 │                          ╶────────────────┼────┼────┼────┼────┤
3648 │                           No  Row ID      │  25│  25│  27│  27│
3649 │                               Layer Row ID│  13│  13│  13│  13│
3650 │                      ╶────────────────────┼────┼────┼────┼────┤
3651 │                       No  Yes Row ID      │  30│  30│  32│  32│
3652 │                               Layer Row ID│  16│  16│  16│  16│
3653 │                          ╶────────────────┼────┼────┼────┼────┤
3654 │                           No  Row ID      │  29│  29│  31│  31│
3655 │                               Layer Row ID│  15│  15│  15│  15│
3656 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3657
3658                           Custom Tables
3659 Female
3660 ╭───────────────────────────────────────────┬───────────────────╮
3661 │                                           │        QN27       │
3662 │                                           ├─────────┬─────────┤
3663 │                                           │   Yes   │    No   │
3664 │                                           ├─────────┼─────────┤
3665 │                                           │  QND7A  │  QND7A  │
3666 │                                           ├────┬────┼────┬────┤
3667 │                                           │ Yes│ No │ Yes│ No │
3668 │                                           ├────┼────┼────┼────┤
3669 │                                           │QN86│QN86│QN86│QN86│
3670 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3671 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  33│  33│  36│  36│
3672 │                               Layer Row ID│  17│  17│  17│  17│
3673 │                          ╶────────────────┼────┼────┼────┼────┤
3674 │                           No  Row ID      │  34│  34│  35│  35│
3675 │                               Layer Row ID│  18│  18│  18│  18│
3676 │                      ╶────────────────────┼────┼────┼────┼────┤
3677 │                       No  Yes Row ID      │  37│  37│  39│  39│
3678 │                               Layer Row ID│  19│  19│  19│  19│
3679 │                          ╶────────────────┼────┼────┼────┼────┤
3680 │                           No  Row ID      │  38│  38│  40│  40│
3681 │                               Layer Row ID│  20│  20│  20│  20│
3682 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3683 │              No  QN57 Yes Yes Row ID      │  41│  41│  44│  44│
3684 │                               Layer Row ID│  21│  21│  21│  21│
3685 │                          ╶────────────────┼────┼────┼────┼────┤
3686 │                           No  Row ID      │  42│  42│  43│  43│
3687 │                               Layer Row ID│  22│  22│  22│  22│
3688 │                      ╶────────────────────┼────┼────┼────┼────┤
3689 │                       No  Yes Row ID      │  45│  45│  48│  48│
3690 │                               Layer Row ID│  23│  23│  23│  23│
3691 │                          ╶────────────────┼────┼────┼────┼────┤
3692 │                           No  Row ID      │  46│  46│  47│  47│
3693 │                               Layer Row ID│  24│  24│  24│  24│
3694 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3695 │     No  QN61 Yes QN57 Yes Yes Row ID      │  49│  49│  52│  52│
3696 │                               Layer Row ID│  25│  25│  25│  25│
3697 │                          ╶────────────────┼────┼────┼────┼────┤
3698 │                           No  Row ID      │  50│  50│  51│  51│
3699 │                               Layer Row ID│  26│  26│  26│  26│
3700 │                      ╶────────────────────┼────┼────┼────┼────┤
3701 │                       No  Yes Row ID      │  53│  53│  55│  55│
3702 │                               Layer Row ID│  27│  27│  27│  27│
3703 │                          ╶────────────────┼────┼────┼────┼────┤
3704 │                           No  Row ID      │  54│  54│  56│  56│
3705 │                               Layer Row ID│  28│  28│  28│  28│
3706 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3707 │              No  QN57 Yes Yes Row ID      │  58│  58│  59│  59│
3708 │                               Layer Row ID│  30│  30│  30│  30│
3709 │                          ╶────────────────┼────┼────┼────┼────┤
3710 │                           No  Row ID      │  57│  57│  60│  60│
3711 │                               Layer Row ID│  29│  29│  29│  29│
3712 │                      ╶────────────────────┼────┼────┼────┼────┤
3713 │                       No  Yes Row ID      │  62│  62│  64│  64│
3714 │                               Layer Row ID│  32│  32│  32│  32│
3715 │                          ╶────────────────┼────┼────┼────┼────┤
3716 │                           No  Row ID      │  61│  61│  63│  63│
3717 │                               Layer Row ID│  31│  31│  31│  31│
3718 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3719
3720                             Custom Tables
3721 Male
3722 ╭──────────────────────────────────────────────┬───────────────────╮
3723 │                                              │        QN27       │
3724 │                                              ├─────────┬─────────┤
3725 │                                              │   Yes   │    No   │
3726 │                                              ├─────────┼─────────┤
3727 │                                              │  QND7A  │  QND7A  │
3728 │                                              ├────┬────┼────┬────┤
3729 │                                              │ Yes│ No │ Yes│ No │
3730 │                                              ├────┼────┼────┼────┤
3731 │                                              │QN86│QN86│QN86│QN86│
3732 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3733 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
3734 │                               Layer Column ID│   1│   2│   3│   4│
3735 │                          ╶───────────────────┼────┼────┼────┼────┤
3736 │                           No  Column ID      │   1│   2│   3│   4│
3737 │                               Layer Column ID│   1│   2│   3│   4│
3738 │                      ╶───────────────────────┼────┼────┼────┼────┤
3739 │                       No  Yes Column ID      │   5│   6│   7│   8│
3740 │                               Layer Column ID│   1│   2│   3│   4│
3741 │                          ╶───────────────────┼────┼────┼────┼────┤
3742 │                           No  Column ID      │   5│   6│   7│   8│
3743 │                               Layer Column ID│   1│   2│   3│   4│
3744 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3745 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
3746 │                               Layer Column ID│   1│   2│   3│   4│
3747 │                          ╶───────────────────┼────┼────┼────┼────┤
3748 │                           No  Column ID      │   9│  10│  11│  12│
3749 │                               Layer Column ID│   1│   2│   3│   4│
3750 │                      ╶───────────────────────┼────┼────┼────┼────┤
3751 │                       No  Yes Column ID      │  13│  14│  15│  16│
3752 │                               Layer Column ID│   1│   2│   3│   4│
3753 │                          ╶───────────────────┼────┼────┼────┼────┤
3754 │                           No  Column ID      │  13│  14│  15│  16│
3755 │                               Layer Column ID│   1│   2│   3│   4│
3756 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3757 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
3758 │                               Layer Column ID│   1│   2│   3│   4│
3759 │                          ╶───────────────────┼────┼────┼────┼────┤
3760 │                           No  Column ID      │  17│  18│  19│  20│
3761 │                               Layer Column ID│   1│   2│   3│   4│
3762 │                      ╶───────────────────────┼────┼────┼────┼────┤
3763 │                       No  Yes Column ID      │  21│  22│  23│  24│
3764 │                               Layer Column ID│   1│   2│   3│   4│
3765 │                          ╶───────────────────┼────┼────┼────┼────┤
3766 │                           No  Column ID      │  21│  22│  23│  24│
3767 │                               Layer Column ID│   1│   2│   3│   4│
3768 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3769 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
3770 │                               Layer Column ID│   1│   2│   3│   4│
3771 │                          ╶───────────────────┼────┼────┼────┼────┤
3772 │                           No  Column ID      │  25│  26│  27│  28│
3773 │                               Layer Column ID│   1│   2│   3│   4│
3774 │                      ╶───────────────────────┼────┼────┼────┼────┤
3775 │                       No  Yes Column ID      │  29│  30│  31│  32│
3776 │                               Layer Column ID│   1│   2│   3│   4│
3777 │                          ╶───────────────────┼────┼────┼────┼────┤
3778 │                           No  Column ID      │  29│  30│  31│  32│
3779 │                               Layer Column ID│   1│   2│   3│   4│
3780 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3781
3782                             Custom Tables
3783 Female
3784 ╭──────────────────────────────────────────────┬───────────────────╮
3785 │                                              │        QN27       │
3786 │                                              ├─────────┬─────────┤
3787 │                                              │   Yes   │    No   │
3788 │                                              ├─────────┼─────────┤
3789 │                                              │  QND7A  │  QND7A  │
3790 │                                              ├────┬────┼────┬────┤
3791 │                                              │ Yes│ No │ Yes│ No │
3792 │                                              ├────┼────┼────┼────┤
3793 │                                              │QN86│QN86│QN86│QN86│
3794 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3795 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
3796 │                               Layer Column ID│   5│   6│   7│   8│
3797 │                          ╶───────────────────┼────┼────┼────┼────┤
3798 │                           No  Column ID      │  33│  34│  35│  36│
3799 │                               Layer Column ID│   5│   6│   7│   8│
3800 │                      ╶───────────────────────┼────┼────┼────┼────┤
3801 │                       No  Yes Column ID      │  37│  38│  39│  40│
3802 │                               Layer Column ID│   5│   6│   7│   8│
3803 │                          ╶───────────────────┼────┼────┼────┼────┤
3804 │                           No  Column ID      │  37│  38│  39│  40│
3805 │                               Layer Column ID│   5│   6│   7│   8│
3806 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3807 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
3808 │                               Layer Column ID│   5│   6│   7│   8│
3809 │                          ╶───────────────────┼────┼────┼────┼────┤
3810 │                           No  Column ID      │  41│  42│  43│  44│
3811 │                               Layer Column ID│   5│   6│   7│   8│
3812 │                      ╶───────────────────────┼────┼────┼────┼────┤
3813 │                       No  Yes Column ID      │  45│  46│  47│  48│
3814 │                               Layer Column ID│   5│   6│   7│   8│
3815 │                          ╶───────────────────┼────┼────┼────┼────┤
3816 │                           No  Column ID      │  45│  46│  47│  48│
3817 │                               Layer Column ID│   5│   6│   7│   8│
3818 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3819 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
3820 │                               Layer Column ID│   5│   6│   7│   8│
3821 │                          ╶───────────────────┼────┼────┼────┼────┤
3822 │                           No  Column ID      │  49│  50│  51│  52│
3823 │                               Layer Column ID│   5│   6│   7│   8│
3824 │                      ╶───────────────────────┼────┼────┼────┼────┤
3825 │                       No  Yes Column ID      │  53│  54│  55│  56│
3826 │                               Layer Column ID│   5│   6│   7│   8│
3827 │                          ╶───────────────────┼────┼────┼────┼────┤
3828 │                           No  Column ID      │  53│  54│  55│  56│
3829 │                               Layer Column ID│   5│   6│   7│   8│
3830 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3831 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
3832 │                               Layer Column ID│   5│   6│   7│   8│
3833 │                          ╶───────────────────┼────┼────┼────┼────┤
3834 │                           No  Column ID      │  57│  58│  59│  60│
3835 │                               Layer Column ID│   5│   6│   7│   8│
3836 │                      ╶───────────────────────┼────┼────┼────┼────┤
3837 │                       No  Yes Column ID      │  61│  62│  63│  64│
3838 │                               Layer Column ID│   5│   6│   7│   8│
3839 │                          ╶───────────────────┼────┼────┼────┼────┤
3840 │                           No  Column ID      │  61│  62│  63│  64│
3841 │                               Layer Column ID│   5│   6│   7│   8│
3842 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3843 ])
3844 AT_CLEANUP
3845
3846 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
3847 AT_KEYWORDS([ROWLABELS LAYER])
3848 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3849 AT_DATA([ctables.sps],
3850 [[GET 'nhtsa.sav'.
3851 CTABLES
3852     /VLABELS VARIABLES=ALL DISPLAY=NAME
3853     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3854     /SLABELS POSITION=ROW
3855     /CLABELS ROWLABELS=LAYER
3856     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3857     /SLABELS POSITION=ROW
3858     /CLABELS ROWLABELS=LAYER
3859     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3860     /SLABELS POSITION=ROW
3861     /CLABELS ROWLABELS=LAYER.
3862 ]])
3863 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3864                           Custom Tables
3865 Male
3866 Yes
3867 ╭──────────────────────────────────┬───────────────────────────╮
3868 │                                  │            QN27           │
3869 │                                  ├─────────────┬─────────────┤
3870 │                                  │     Yes     │      No     │
3871 │                                  ├─────────────┼─────────────┤
3872 │                                  │    QND7A    │    QND7A    │
3873 │                                  ├──────┬──────┼──────┬──────┤
3874 │                                  │  Yes │  No  │  Yes │  No  │
3875 │                                  ├──────┼──────┼──────┼──────┤
3876 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3877 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3878 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3879 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3880 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3881 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3882 │                       Subtable ID│  2│ 2│  3│ 3│  5│ 5│  7│ 7│
3883 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3884 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3885 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3886 │                       Subtable ID│  2│ 2│  3│ 3│  5│ 5│  7│ 7│
3887 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3888 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3889 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3890 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 16│16│
3891 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3892 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3893 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3894 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 16│16│
3895 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3896
3897                           Custom Tables
3898 Male
3899 No
3900 ╭──────────────────────────────────┬───────────────────────────╮
3901 │                                  │            QN27           │
3902 │                                  ├─────────────┬─────────────┤
3903 │                                  │     Yes     │      No     │
3904 │                                  ├─────────────┼─────────────┤
3905 │                                  │    QND7A    │    QND7A    │
3906 │                                  ├──────┬──────┼──────┬──────┤
3907 │                                  │  Yes │  No  │  Yes │  No  │
3908 │                                  ├──────┼──────┼──────┼──────┤
3909 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3910 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3911 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3912 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3913 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3914 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3915 │                       Subtable ID│  1│ 1│  4│ 4│  6│ 6│  8│ 8│
3916 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3917 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3918 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3919 │                       Subtable ID│  1│ 1│  4│ 4│  6│ 6│  8│ 8│
3920 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3921 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3922 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3923 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 15│15│
3924 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3925 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3926 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3927 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 15│15│
3928 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3929
3930                           Custom Tables
3931 Female
3932 Yes
3933 ╭──────────────────────────────────┬───────────────────────────╮
3934 │                                  │            QN27           │
3935 │                                  ├─────────────┬─────────────┤
3936 │                                  │     Yes     │      No     │
3937 │                                  ├─────────────┼─────────────┤
3938 │                                  │    QND7A    │    QND7A    │
3939 │                                  ├──────┬──────┼──────┬──────┤
3940 │                                  │  Yes │  No  │  Yes │  No  │
3941 │                                  ├──────┼──────┼──────┼──────┤
3942 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3943 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3944 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3945 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3946 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3947 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3948 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
3949 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3950 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3951 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3952 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
3953 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3954 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3955 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3956 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3957 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3958 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3959 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3960 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3961 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3962
3963                           Custom Tables
3964 Female
3965 No
3966 ╭──────────────────────────────────┬───────────────────────────╮
3967 │                                  │            QN27           │
3968 │                                  ├─────────────┬─────────────┤
3969 │                                  │     Yes     │      No     │
3970 │                                  ├─────────────┼─────────────┤
3971 │                                  │    QND7A    │    QND7A    │
3972 │                                  ├──────┬──────┼──────┬──────┤
3973 │                                  │  Yes │  No  │  Yes │  No  │
3974 │                                  ├──────┼──────┼──────┼──────┤
3975 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3976 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3977 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3978 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3979 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3980 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3981 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
3982 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3983 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3984 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3985 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
3986 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3987 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3988 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3989 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3990 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3991 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3992 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3993 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
3994 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3995
3996                           Custom Tables
3997 Male
3998 Yes
3999 ╭───────────────────────────────────┬───────────────────────────╮
4000 │                                   │            QN27           │
4001 │                                   ├─────────────┬─────────────┤
4002 │                                   │     Yes     │      No     │
4003 │                                   ├─────────────┼─────────────┤
4004 │                                   │    QND7A    │    QND7A    │
4005 │                                   ├──────┬──────┼──────┬──────┤
4006 │                                   │  Yes │  No  │  Yes │  No  │
4007 │                                   ├──────┼──────┼──────┼──────┤
4008 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4009 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4010 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4011 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4012 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  6│ 6│  8│ 8│
4013 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4014 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4015 │              No  QN57 Row ID      │  9│ 9│ 11│11│ 14│14│ 15│15│
4016 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4017 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4018 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 20│20│ 22│22│ 23│23│
4019 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4020 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4021 │              No  QN57 Row ID      │ 26│26│ 28│28│ 29│29│ 32│32│
4022 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4023 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4024
4025                           Custom Tables
4026 Male
4027 No
4028 ╭───────────────────────────────────┬───────────────────────────╮
4029 │                                   │            QN27           │
4030 │                                   ├─────────────┬─────────────┤
4031 │                                   │     Yes     │      No     │
4032 │                                   ├─────────────┼─────────────┤
4033 │                                   │    QND7A    │    QND7A    │
4034 │                                   ├──────┬──────┼──────┬──────┤
4035 │                                   │  Yes │  No  │  Yes │  No  │
4036 │                                   ├──────┼──────┼──────┼──────┤
4037 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4038 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4039 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4040 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4041 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  5│ 5│  7│ 7│
4042 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4043 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4044 │              No  QN57 Row ID      │ 10│10│ 12│12│ 13│13│ 16│16│
4045 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4046 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4047 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 19│19│ 21│21│ 24│24│
4048 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
4049 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4050 │              No  QN57 Row ID      │ 25│25│ 27│27│ 30│30│ 31│31│
4051 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
4052 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4053
4054                           Custom Tables
4055 Female
4056 Yes
4057 ╭───────────────────────────────────┬───────────────────────────╮
4058 │                                   │            QN27           │
4059 │                                   ├─────────────┬─────────────┤
4060 │                                   │     Yes     │      No     │
4061 │                                   ├─────────────┼─────────────┤
4062 │                                   │    QND7A    │    QND7A    │
4063 │                                   ├──────┬──────┼──────┬──────┤
4064 │                                   │  Yes │  No  │  Yes │  No  │
4065 │                                   ├──────┼──────┼──────┼──────┤
4066 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4067 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4068 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4069 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4070 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 36│36│ 38│38│ 40│40│
4071 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4072 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4073 │              No  QN57 Row ID      │ 42│42│ 43│43│ 45│45│ 47│47│
4074 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4075 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4076 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 52│52│ 53│53│ 56│56│
4077 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4078 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4079 │              No  QN57 Row ID      │ 57│57│ 60│60│ 61│61│ 63│63│
4080 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4081 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4082
4083                           Custom Tables
4084 Female
4085 No
4086 ╭───────────────────────────────────┬───────────────────────────╮
4087 │                                   │            QN27           │
4088 │                                   ├─────────────┬─────────────┤
4089 │                                   │     Yes     │      No     │
4090 │                                   ├─────────────┼─────────────┤
4091 │                                   │    QND7A    │    QND7A    │
4092 │                                   ├──────┬──────┼──────┬──────┤
4093 │                                   │  Yes │  No  │  Yes │  No  │
4094 │                                   ├──────┼──────┼──────┼──────┤
4095 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4096 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4097 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4098 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4099 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 35│35│ 37│37│ 39│39│
4100 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4101 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4102 │              No  QN57 Row ID      │ 41│41│ 44│44│ 46│46│ 48│48│
4103 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4104 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4105 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 51│51│ 54│54│ 55│55│
4106 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4107 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4108 │              No  QN57 Row ID      │ 58│58│ 59│59│ 62│62│ 64│64│
4109 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4110 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4111
4112                             Custom Tables
4113 Male
4114 Yes
4115 ╭──────────────────────────────────────┬───────────────────────────╮
4116 │                                      │            QN27           │
4117 │                                      ├─────────────┬─────────────┤
4118 │                                      │     Yes     │      No     │
4119 │                                      ├─────────────┼─────────────┤
4120 │                                      │    QND7A    │    QND7A    │
4121 │                                      ├──────┬──────┼──────┬──────┤
4122 │                                      │  Yes │  No  │  Yes │  No  │
4123 │                                      ├──────┼──────┼──────┼──────┤
4124 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4125 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4126 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4127 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4128 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 4│  6│ 7│ 10│11│ 14│15│
4129 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4130 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4131 │              No  QN57 Column ID      │  2│ 4│  6│ 7│ 10│11│ 14│15│
4132 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4133 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4134 │     No  QN61 Yes QN57 Column ID      │ 18│19│ 21│23│ 25│28│ 29│32│
4135 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4136 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4137 │              No  QN57 Column ID      │ 18│19│ 21│23│ 25│28│ 29│32│
4138 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4139 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4140
4141                             Custom Tables
4142 Male
4143 No
4144 ╭──────────────────────────────────────┬───────────────────────────╮
4145 │                                      │            QN27           │
4146 │                                      ├─────────────┬─────────────┤
4147 │                                      │     Yes     │      No     │
4148 │                                      ├─────────────┼─────────────┤
4149 │                                      │    QND7A    │    QND7A    │
4150 │                                      ├──────┬──────┼──────┬──────┤
4151 │                                      │  Yes │  No  │  Yes │  No  │
4152 │                                      ├──────┼──────┼──────┼──────┤
4153 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4154 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4155 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4156 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4157 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 3│  5│ 8│  9│12│ 13│16│
4158 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4159 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4160 │              No  QN57 Column ID      │  1│ 3│  5│ 8│  9│12│ 13│16│
4161 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4162 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4163 │     No  QN61 Yes QN57 Column ID      │ 17│20│ 22│24│ 26│27│ 30│31│
4164 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4165 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4166 │              No  QN57 Column ID      │ 17│20│ 22│24│ 26│27│ 30│31│
4167 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4168 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4169
4170                             Custom Tables
4171 Female
4172 Yes
4173 ╭──────────────────────────────────────┬───────────────────────────╮
4174 │                                      │            QN27           │
4175 │                                      ├─────────────┬─────────────┤
4176 │                                      │     Yes     │      No     │
4177 │                                      ├─────────────┼─────────────┤
4178 │                                      │    QND7A    │    QND7A    │
4179 │                                      ├──────┬──────┼──────┬──────┤
4180 │                                      │  Yes │  No  │  Yes │  No  │
4181 │                                      ├──────┼──────┼──────┼──────┤
4182 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4183 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4184 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4185 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4186 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│35│ 37│39│ 41│44│ 45│47│
4187 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4188 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4189 │              No  QN57 Column ID      │ 34│35│ 37│39│ 41│44│ 45│47│
4190 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4191 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4192 │     No  QN61 Yes QN57 Column ID      │ 50│51│ 53│55│ 57│59│ 62│64│
4193 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4194 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4195 │              No  QN57 Column ID      │ 50│51│ 53│55│ 57│59│ 62│64│
4196 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4197 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4198
4199                             Custom Tables
4200 Female
4201 No
4202 ╭──────────────────────────────────────┬───────────────────────────╮
4203 │                                      │            QN27           │
4204 │                                      ├─────────────┬─────────────┤
4205 │                                      │     Yes     │      No     │
4206 │                                      ├─────────────┼─────────────┤
4207 │                                      │    QND7A    │    QND7A    │
4208 │                                      ├──────┬──────┼──────┬──────┤
4209 │                                      │  Yes │  No  │  Yes │  No  │
4210 │                                      ├──────┼──────┼──────┼──────┤
4211 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4212 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4213 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4214 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4215 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│36│ 38│40│ 42│43│ 46│48│
4216 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4217 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4218 │              No  QN57 Column ID      │ 33│36│ 38│40│ 42│43│ 46│48│
4219 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4220 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4221 │     No  QN61 Yes QN57 Column ID      │ 49│52│ 54│56│ 58│60│ 61│63│
4222 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4223 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4224 │              No  QN57 Column ID      │ 49│52│ 54│56│ 58│60│ 61│63│
4225 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4226 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4227 ])
4228 AT_CLEANUP
4229
4230 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4231 AT_KEYWORDS([COLLABELS LAYER])
4232 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4233 AT_DATA([ctables.sps],
4234 [[GET 'nhtsa.sav'.
4235 CTABLES
4236     /VLABELS VARIABLES=ALL DISPLAY=NAME
4237     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4238     /SLABELS POSITION=ROW
4239     /CLABELS COLLABELS=LAYER
4240     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4241     /SLABELS POSITION=ROW
4242     /CLABELS COLLABELS=LAYER
4243     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4244     /SLABELS POSITION=ROW
4245     /CLABELS COLLABELS=LAYER.
4246 ]])
4247 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4248                         Custom Tables
4249 Male
4250 Yes
4251 ╭──────────────────────────────────────┬───────────────────╮
4252 │                                      │        QN27       │
4253 │                                      ├─────────┬─────────┤
4254 │                                      │   Yes   │    No   │
4255 │                                      ├─────────┼─────────┤
4256 │                                      │  QND7A  │  QND7A  │
4257 │                                      ├────┬────┼────┬────┤
4258 │                                      │ Yes│ No │ Yes│ No │
4259 │                                      ├────┼────┼────┼────┤
4260 │                                      │QN86│QN86│QN86│QN86│
4261 ├──────────────────────────────────────┼────┼────┼────┼────┤
4262 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4263 │                           Layer ID   │   2│   2│   2│   2│
4264 │                           Subtable ID│   2│   2│   4│   4│
4265 │                      ╶───────────────┼────┼────┼────┼────┤
4266 │                       No  Table ID   │   1│   1│   1│   1│
4267 │                           Layer ID   │   2│   2│   2│   2│
4268 │                           Subtable ID│   2│   2│   4│   4│
4269 │             ╶────────────────────────┼────┼────┼────┼────┤
4270 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4271 │                           Layer ID   │   2│   2│   2│   2│
4272 │                           Subtable ID│   5│   5│   7│   7│
4273 │                      ╶───────────────┼────┼────┼────┼────┤
4274 │                       No  Table ID   │   1│   1│   1│   1│
4275 │                           Layer ID   │   2│   2│   2│   2│
4276 │                           Subtable ID│   5│   5│   7│   7│
4277 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4278 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4279 │                           Layer ID   │   2│   2│   2│   2│
4280 │                           Subtable ID│  10│  10│  12│  12│
4281 │                      ╶───────────────┼────┼────┼────┼────┤
4282 │                       No  Table ID   │   1│   1│   1│   1│
4283 │                           Layer ID   │   2│   2│   2│   2│
4284 │                           Subtable ID│  10│  10│  12│  12│
4285 │             ╶────────────────────────┼────┼────┼────┼────┤
4286 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4287 │                           Layer ID   │   2│   2│   2│   2│
4288 │                           Subtable ID│  13│  13│  15│  15│
4289 │                      ╶───────────────┼────┼────┼────┼────┤
4290 │                       No  Table ID   │   1│   1│   1│   1│
4291 │                           Layer ID   │   2│   2│   2│   2│
4292 │                           Subtable ID│  13│  13│  15│  15│
4293 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4294
4295                         Custom Tables
4296 Male
4297 No
4298 ╭──────────────────────────────────────┬───────────────────╮
4299 │                                      │        QN27       │
4300 │                                      ├─────────┬─────────┤
4301 │                                      │   Yes   │    No   │
4302 │                                      ├─────────┼─────────┤
4303 │                                      │  QND7A  │  QND7A  │
4304 │                                      ├────┬────┼────┬────┤
4305 │                                      │ Yes│ No │ Yes│ No │
4306 │                                      ├────┼────┼────┼────┤
4307 │                                      │QN86│QN86│QN86│QN86│
4308 ├──────────────────────────────────────┼────┼────┼────┼────┤
4309 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4310 │                           Layer ID   │   1│   1│   1│   1│
4311 │                           Subtable ID│   1│   1│   3│   3│
4312 │                      ╶───────────────┼────┼────┼────┼────┤
4313 │                       No  Table ID   │   1│   1│   1│   1│
4314 │                           Layer ID   │   1│   1│   1│   1│
4315 │                           Subtable ID│   1│   1│   3│   3│
4316 │             ╶────────────────────────┼────┼────┼────┼────┤
4317 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4318 │                           Layer ID   │   1│   1│   1│   1│
4319 │                           Subtable ID│   6│   6│   8│   8│
4320 │                      ╶───────────────┼────┼────┼────┼────┤
4321 │                       No  Table ID   │   1│   1│   1│   1│
4322 │                           Layer ID   │   1│   1│   1│   1│
4323 │                           Subtable ID│   6│   6│   8│   8│
4324 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4325 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4326 │                           Layer ID   │   1│   1│   1│   1│
4327 │                           Subtable ID│   9│   9│  11│  11│
4328 │                      ╶───────────────┼────┼────┼────┼────┤
4329 │                       No  Table ID   │   1│   1│   1│   1│
4330 │                           Layer ID   │   1│   1│   1│   1│
4331 │                           Subtable ID│   9│   9│  11│  11│
4332 │             ╶────────────────────────┼────┼────┼────┼────┤
4333 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4334 │                           Layer ID   │   1│   1│   1│   1│
4335 │                           Subtable ID│  14│  14│  16│  16│
4336 │                      ╶───────────────┼────┼────┼────┼────┤
4337 │                       No  Table ID   │   1│   1│   1│   1│
4338 │                           Layer ID   │   1│   1│   1│   1│
4339 │                           Subtable ID│  14│  14│  16│  16│
4340 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4341
4342                         Custom Tables
4343 Female
4344 Yes
4345 ╭──────────────────────────────────────┬───────────────────╮
4346 │                                      │        QN27       │
4347 │                                      ├─────────┬─────────┤
4348 │                                      │   Yes   │    No   │
4349 │                                      ├─────────┼─────────┤
4350 │                                      │  QND7A  │  QND7A  │
4351 │                                      ├────┬────┼────┬────┤
4352 │                                      │ Yes│ No │ Yes│ No │
4353 │                                      ├────┼────┼────┼────┤
4354 │                                      │QN86│QN86│QN86│QN86│
4355 ├──────────────────────────────────────┼────┼────┼────┼────┤
4356 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4357 │                           Layer ID   │   4│   4│   4│   4│
4358 │                           Subtable ID│  18│  18│  19│  19│
4359 │                      ╶───────────────┼────┼────┼────┼────┤
4360 │                       No  Table ID   │   1│   1│   1│   1│
4361 │                           Layer ID   │   4│   4│   4│   4│
4362 │                           Subtable ID│  18│  18│  19│  19│
4363 │             ╶────────────────────────┼────┼────┼────┼────┤
4364 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4365 │                           Layer ID   │   4│   4│   4│   4│
4366 │                           Subtable ID│  22│  22│  23│  23│
4367 │                      ╶───────────────┼────┼────┼────┼────┤
4368 │                       No  Table ID   │   1│   1│   1│   1│
4369 │                           Layer ID   │   4│   4│   4│   4│
4370 │                           Subtable ID│  22│  22│  23│  23│
4371 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4372 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4373 │                           Layer ID   │   4│   4│   4│   4│
4374 │                           Subtable ID│  26│  26│  28│  28│
4375 │                      ╶───────────────┼────┼────┼────┼────┤
4376 │                       No  Table ID   │   1│   1│   1│   1│
4377 │                           Layer ID   │   4│   4│   4│   4│
4378 │                           Subtable ID│  26│  26│  28│  28│
4379 │             ╶────────────────────────┼────┼────┼────┼────┤
4380 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4381 │                           Layer ID   │   4│   4│   4│   4│
4382 │                           Subtable ID│  29│  29│  31│  31│
4383 │                      ╶───────────────┼────┼────┼────┼────┤
4384 │                       No  Table ID   │   1│   1│   1│   1│
4385 │                           Layer ID   │   4│   4│   4│   4│
4386 │                           Subtable ID│  29│  29│  31│  31│
4387 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4388
4389                         Custom Tables
4390 Female
4391 No
4392 ╭──────────────────────────────────────┬───────────────────╮
4393 │                                      │        QN27       │
4394 │                                      ├─────────┬─────────┤
4395 │                                      │   Yes   │    No   │
4396 │                                      ├─────────┼─────────┤
4397 │                                      │  QND7A  │  QND7A  │
4398 │                                      ├────┬────┼────┬────┤
4399 │                                      │ Yes│ No │ Yes│ No │
4400 │                                      ├────┼────┼────┼────┤
4401 │                                      │QN86│QN86│QN86│QN86│
4402 ├──────────────────────────────────────┼────┼────┼────┼────┤
4403 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4404 │                           Layer ID   │   3│   3│   3│   3│
4405 │                           Subtable ID│  17│  17│  20│  20│
4406 │                      ╶───────────────┼────┼────┼────┼────┤
4407 │                       No  Table ID   │   1│   1│   1│   1│
4408 │                           Layer ID   │   3│   3│   3│   3│
4409 │                           Subtable ID│  17│  17│  20│  20│
4410 │             ╶────────────────────────┼────┼────┼────┼────┤
4411 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4412 │                           Layer ID   │   3│   3│   3│   3│
4413 │                           Subtable ID│  21│  21│  24│  24│
4414 │                      ╶───────────────┼────┼────┼────┼────┤
4415 │                       No  Table ID   │   1│   1│   1│   1│
4416 │                           Layer ID   │   3│   3│   3│   3│
4417 │                           Subtable ID│  21│  21│  24│  24│
4418 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4419 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4420 │                           Layer ID   │   3│   3│   3│   3│
4421 │                           Subtable ID│  25│  25│  27│  27│
4422 │                      ╶───────────────┼────┼────┼────┼────┤
4423 │                       No  Table ID   │   1│   1│   1│   1│
4424 │                           Layer ID   │   3│   3│   3│   3│
4425 │                           Subtable ID│  25│  25│  27│  27│
4426 │             ╶────────────────────────┼────┼────┼────┼────┤
4427 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4428 │                           Layer ID   │   3│   3│   3│   3│
4429 │                           Subtable ID│  30│  30│  32│  32│
4430 │                      ╶───────────────┼────┼────┼────┼────┤
4431 │                       No  Table ID   │   1│   1│   1│   1│
4432 │                           Layer ID   │   3│   3│   3│   3│
4433 │                           Subtable ID│  30│  30│  32│  32│
4434 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4435
4436                         Custom Tables
4437 Male
4438 Yes
4439 ╭───────────────────────────────────────┬───────────────────╮
4440 │                                       │        QN27       │
4441 │                                       ├─────────┬─────────┤
4442 │                                       │   Yes   │    No   │
4443 │                                       ├─────────┼─────────┤
4444 │                                       │  QND7A  │  QND7A  │
4445 │                                       ├────┬────┼────┬────┤
4446 │                                       │ Yes│ No │ Yes│ No │
4447 │                                       ├────┼────┼────┼────┤
4448 │                                       │QN86│QN86│QN86│QN86│
4449 ├───────────────────────────────────────┼────┼────┼────┼────┤
4450 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   3│   3│
4451 │                           Layer Row ID│   2│   2│   2│   2│
4452 │                      ╶────────────────┼────┼────┼────┼────┤
4453 │                       No  Row ID      │   5│   5│   7│   7│
4454 │                           Layer Row ID│   3│   3│   3│   3│
4455 │             ╶─────────────────────────┼────┼────┼────┼────┤
4456 │              No  QN57 Yes Row ID      │  10│  10│  11│  11│
4457 │                           Layer Row ID│   6│   6│   6│   6│
4458 │                      ╶────────────────┼────┼────┼────┼────┤
4459 │                       No  Row ID      │  14│  14│  16│  16│
4460 │                           Layer Row ID│   8│   8│   8│   8│
4461 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4462 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  19│  19│
4463 │                           Layer Row ID│   9│   9│   9│   9│
4464 │                      ╶────────────────┼────┼────┼────┼────┤
4465 │                       No  Row ID      │  21│  21│  23│  23│
4466 │                           Layer Row ID│  11│  11│  11│  11│
4467 │             ╶─────────────────────────┼────┼────┼────┼────┤
4468 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4469 │                           Layer Row ID│  14│  14│  14│  14│
4470 │                      ╶────────────────┼────┼────┼────┼────┤
4471 │                       No  Row ID      │  30│  30│  32│  32│
4472 │                           Layer Row ID│  16│  16│  16│  16│
4473 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4474
4475                         Custom Tables
4476 Male
4477 No
4478 ╭───────────────────────────────────────┬───────────────────╮
4479 │                                       │        QN27       │
4480 │                                       ├─────────┬─────────┤
4481 │                                       │   Yes   │    No   │
4482 │                                       ├─────────┼─────────┤
4483 │                                       │  QND7A  │  QND7A  │
4484 │                                       ├────┬────┼────┬────┤
4485 │                                       │ Yes│ No │ Yes│ No │
4486 │                                       ├────┼────┼────┼────┤
4487 │                                       │QN86│QN86│QN86│QN86│
4488 ├───────────────────────────────────────┼────┼────┼────┼────┤
4489 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   4│   4│
4490 │                           Layer Row ID│   1│   1│   1│   1│
4491 │                      ╶────────────────┼────┼────┼────┼────┤
4492 │                       No  Row ID      │   6│   6│   8│   8│
4493 │                           Layer Row ID│   4│   4│   4│   4│
4494 │             ╶─────────────────────────┼────┼────┼────┼────┤
4495 │              No  QN57 Yes Row ID      │   9│   9│  12│  12│
4496 │                           Layer Row ID│   5│   5│   5│   5│
4497 │                      ╶────────────────┼────┼────┼────┼────┤
4498 │                       No  Row ID      │  13│  13│  15│  15│
4499 │                           Layer Row ID│   7│   7│   7│   7│
4500 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4501 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  20│  20│
4502 │                           Layer Row ID│  10│  10│  10│  10│
4503 │                      ╶────────────────┼────┼────┼────┼────┤
4504 │                       No  Row ID      │  22│  22│  24│  24│
4505 │                           Layer Row ID│  12│  12│  12│  12│
4506 │             ╶─────────────────────────┼────┼────┼────┼────┤
4507 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4508 │                           Layer Row ID│  13│  13│  13│  13│
4509 │                      ╶────────────────┼────┼────┼────┼────┤
4510 │                       No  Row ID      │  29│  29│  31│  31│
4511 │                           Layer Row ID│  15│  15│  15│  15│
4512 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4513
4514                         Custom Tables
4515 Female
4516 Yes
4517 ╭───────────────────────────────────────┬───────────────────╮
4518 │                                       │        QN27       │
4519 │                                       ├─────────┬─────────┤
4520 │                                       │   Yes   │    No   │
4521 │                                       ├─────────┼─────────┤
4522 │                                       │  QND7A  │  QND7A  │
4523 │                                       ├────┬────┼────┬────┤
4524 │                                       │ Yes│ No │ Yes│ No │
4525 │                                       ├────┼────┼────┼────┤
4526 │                                       │QN86│QN86│QN86│QN86│
4527 ├───────────────────────────────────────┼────┼────┼────┼────┤
4528 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  36│  36│
4529 │                           Layer Row ID│  17│  17│  17│  17│
4530 │                      ╶────────────────┼────┼────┼────┼────┤
4531 │                       No  Row ID      │  37│  37│  39│  39│
4532 │                           Layer Row ID│  19│  19│  19│  19│
4533 │             ╶─────────────────────────┼────┼────┼────┼────┤
4534 │              No  QN57 Yes Row ID      │  41│  41│  44│  44│
4535 │                           Layer Row ID│  21│  21│  21│  21│
4536 │                      ╶────────────────┼────┼────┼────┼────┤
4537 │                       No  Row ID      │  45│  45│  48│  48│
4538 │                           Layer Row ID│  23│  23│  23│  23│
4539 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4540 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  52│  52│
4541 │                           Layer Row ID│  25│  25│  25│  25│
4542 │                      ╶────────────────┼────┼────┼────┼────┤
4543 │                       No  Row ID      │  53│  53│  55│  55│
4544 │                           Layer Row ID│  27│  27│  27│  27│
4545 │             ╶─────────────────────────┼────┼────┼────┼────┤
4546 │              No  QN57 Yes Row ID      │  58│  58│  59│  59│
4547 │                           Layer Row ID│  30│  30│  30│  30│
4548 │                      ╶────────────────┼────┼────┼────┼────┤
4549 │                       No  Row ID      │  62│  62│  64│  64│
4550 │                           Layer Row ID│  32│  32│  32│  32│
4551 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4552
4553                         Custom Tables
4554 Female
4555 No
4556 ╭───────────────────────────────────────┬───────────────────╮
4557 │                                       │        QN27       │
4558 │                                       ├─────────┬─────────┤
4559 │                                       │   Yes   │    No   │
4560 │                                       ├─────────┼─────────┤
4561 │                                       │  QND7A  │  QND7A  │
4562 │                                       ├────┬────┼────┬────┤
4563 │                                       │ Yes│ No │ Yes│ No │
4564 │                                       ├────┼────┼────┼────┤
4565 │                                       │QN86│QN86│QN86│QN86│
4566 ├───────────────────────────────────────┼────┼────┼────┼────┤
4567 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  35│  35│
4568 │                           Layer Row ID│  18│  18│  18│  18│
4569 │                      ╶────────────────┼────┼────┼────┼────┤
4570 │                       No  Row ID      │  38│  38│  40│  40│
4571 │                           Layer Row ID│  20│  20│  20│  20│
4572 │             ╶─────────────────────────┼────┼────┼────┼────┤
4573 │              No  QN57 Yes Row ID      │  42│  42│  43│  43│
4574 │                           Layer Row ID│  22│  22│  22│  22│
4575 │                      ╶────────────────┼────┼────┼────┼────┤
4576 │                       No  Row ID      │  46│  46│  47│  47│
4577 │                           Layer Row ID│  24│  24│  24│  24│
4578 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4579 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  51│  51│
4580 │                           Layer Row ID│  26│  26│  26│  26│
4581 │                      ╶────────────────┼────┼────┼────┼────┤
4582 │                       No  Row ID      │  54│  54│  56│  56│
4583 │                           Layer Row ID│  28│  28│  28│  28│
4584 │             ╶─────────────────────────┼────┼────┼────┼────┤
4585 │              No  QN57 Yes Row ID      │  57│  57│  60│  60│
4586 │                           Layer Row ID│  29│  29│  29│  29│
4587 │                      ╶────────────────┼────┼────┼────┼────┤
4588 │                       No  Row ID      │  61│  61│  63│  63│
4589 │                           Layer Row ID│  31│  31│  31│  31│
4590 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4591
4592                           Custom Tables
4593 Male
4594 Yes
4595 ╭──────────────────────────────────────────┬───────────────────╮
4596 │                                          │        QN27       │
4597 │                                          ├─────────┬─────────┤
4598 │                                          │   Yes   │    No   │
4599 │                                          ├─────────┼─────────┤
4600 │                                          │  QND7A  │  QND7A  │
4601 │                                          ├────┬────┼────┬────┤
4602 │                                          │ Yes│ No │ Yes│ No │
4603 │                                          ├────┼────┼────┼────┤
4604 │                                          │QN86│QN86│QN86│QN86│
4605 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4606 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   4│   5│   7│
4607 │                           Layer Column ID│   1│   4│   5│   7│
4608 │                      ╶───────────────────┼────┼────┼────┼────┤
4609 │                       No  Column ID      │   1│   4│   5│   7│
4610 │                           Layer Column ID│   1│   4│   5│   7│
4611 │             ╶────────────────────────────┼────┼────┼────┼────┤
4612 │              No  QN57 Yes Column ID      │   9│  12│  14│  15│
4613 │                           Layer Column ID│   1│   4│   5│   7│
4614 │                      ╶───────────────────┼────┼────┼────┼────┤
4615 │                       No  Column ID      │   9│  12│  14│  15│
4616 │                           Layer Column ID│   1│   4│   5│   7│
4617 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4618 │     No  QN61 Yes QN57 Yes Column ID      │  18│  20│  22│  24│
4619 │                           Layer Column ID│   1│   4│   5│   7│
4620 │                      ╶───────────────────┼────┼────┼────┼────┤
4621 │                       No  Column ID      │  18│  20│  22│  24│
4622 │                           Layer Column ID│   1│   4│   5│   7│
4623 │             ╶────────────────────────────┼────┼────┼────┼────┤
4624 │              No  QN57 Yes Column ID      │  26│  27│  30│  31│
4625 │                           Layer Column ID│   1│   4│   5│   7│
4626 │                      ╶───────────────────┼────┼────┼────┼────┤
4627 │                       No  Column ID      │  26│  27│  30│  31│
4628 │                           Layer Column ID│   1│   4│   5│   7│
4629 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4630
4631                           Custom Tables
4632 Male
4633 No
4634 ╭──────────────────────────────────────────┬───────────────────╮
4635 │                                          │        QN27       │
4636 │                                          ├─────────┬─────────┤
4637 │                                          │   Yes   │    No   │
4638 │                                          ├─────────┼─────────┤
4639 │                                          │  QND7A  │  QND7A  │
4640 │                                          ├────┬────┼────┬────┤
4641 │                                          │ Yes│ No │ Yes│ No │
4642 │                                          ├────┼────┼────┼────┤
4643 │                                          │QN86│QN86│QN86│QN86│
4644 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4645 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   3│   6│   8│
4646 │                           Layer Column ID│   2│   3│   6│   8│
4647 │                      ╶───────────────────┼────┼────┼────┼────┤
4648 │                       No  Column ID      │   2│   3│   6│   8│
4649 │                           Layer Column ID│   2│   3│   6│   8│
4650 │             ╶────────────────────────────┼────┼────┼────┼────┤
4651 │              No  QN57 Yes Column ID      │  10│  11│  13│  16│
4652 │                           Layer Column ID│   2│   3│   6│   8│
4653 │                      ╶───────────────────┼────┼────┼────┼────┤
4654 │                       No  Column ID      │  10│  11│  13│  16│
4655 │                           Layer Column ID│   2│   3│   6│   8│
4656 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4657 │     No  QN61 Yes QN57 Yes Column ID      │  17│  19│  21│  23│
4658 │                           Layer Column ID│   2│   3│   6│   8│
4659 │                      ╶───────────────────┼────┼────┼────┼────┤
4660 │                       No  Column ID      │  17│  19│  21│  23│
4661 │                           Layer Column ID│   2│   3│   6│   8│
4662 │             ╶────────────────────────────┼────┼────┼────┼────┤
4663 │              No  QN57 Yes Column ID      │  25│  28│  29│  32│
4664 │                           Layer Column ID│   2│   3│   6│   8│
4665 │                      ╶───────────────────┼────┼────┼────┼────┤
4666 │                       No  Column ID      │  25│  28│  29│  32│
4667 │                           Layer Column ID│   2│   3│   6│   8│
4668 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4669
4670                           Custom Tables
4671 Female
4672 Yes
4673 ╭──────────────────────────────────────────┬───────────────────╮
4674 │                                          │        QN27       │
4675 │                                          ├─────────┬─────────┤
4676 │                                          │   Yes   │    No   │
4677 │                                          ├─────────┼─────────┤
4678 │                                          │  QND7A  │  QND7A  │
4679 │                                          ├────┬────┼────┬────┤
4680 │                                          │ Yes│ No │ Yes│ No │
4681 │                                          ├────┼────┼────┼────┤
4682 │                                          │QN86│QN86│QN86│QN86│
4683 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4684 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  37│  39│
4685 │                           Layer Column ID│  10│  12│  13│  15│
4686 │                      ╶───────────────────┼────┼────┼────┼────┤
4687 │                       No  Column ID      │  34│  36│  37│  39│
4688 │                           Layer Column ID│  10│  12│  13│  15│
4689 │             ╶────────────────────────────┼────┼────┼────┼────┤
4690 │              No  QN57 Yes Column ID      │  41│  43│  46│  48│
4691 │                           Layer Column ID│  10│  12│  13│  15│
4692 │                      ╶───────────────────┼────┼────┼────┼────┤
4693 │                       No  Column ID      │  41│  43│  46│  48│
4694 │                           Layer Column ID│  10│  12│  13│  15│
4695 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4696 │     No  QN61 Yes QN57 Yes Column ID      │  50│  51│  53│  55│
4697 │                           Layer Column ID│  10│  12│  13│  15│
4698 │                      ╶───────────────────┼────┼────┼────┼────┤
4699 │                       No  Column ID      │  50│  51│  53│  55│
4700 │                           Layer Column ID│  10│  12│  13│  15│
4701 │             ╶────────────────────────────┼────┼────┼────┼────┤
4702 │              No  QN57 Yes Column ID      │  58│  60│  62│  64│
4703 │                           Layer Column ID│  10│  12│  13│  15│
4704 │                      ╶───────────────────┼────┼────┼────┼────┤
4705 │                       No  Column ID      │  58│  60│  62│  64│
4706 │                           Layer Column ID│  10│  12│  13│  15│
4707 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4708
4709                           Custom Tables
4710 Female
4711 No
4712 ╭──────────────────────────────────────────┬───────────────────╮
4713 │                                          │        QN27       │
4714 │                                          ├─────────┬─────────┤
4715 │                                          │   Yes   │    No   │
4716 │                                          ├─────────┼─────────┤
4717 │                                          │  QND7A  │  QND7A  │
4718 │                                          ├────┬────┼────┬────┤
4719 │                                          │ Yes│ No │ Yes│ No │
4720 │                                          ├────┼────┼────┼────┤
4721 │                                          │QN86│QN86│QN86│QN86│
4722 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4723 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  38│  40│
4724 │                           Layer Column ID│   9│  11│  14│  16│
4725 │                      ╶───────────────────┼────┼────┼────┼────┤
4726 │                       No  Column ID      │  33│  35│  38│  40│
4727 │                           Layer Column ID│   9│  11│  14│  16│
4728 │             ╶────────────────────────────┼────┼────┼────┼────┤
4729 │              No  QN57 Yes Column ID      │  42│  44│  45│  47│
4730 │                           Layer Column ID│   9│  11│  14│  16│
4731 │                      ╶───────────────────┼────┼────┼────┼────┤
4732 │                       No  Column ID      │  42│  44│  45│  47│
4733 │                           Layer Column ID│   9│  11│  14│  16│
4734 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4735 │     No  QN61 Yes QN57 Yes Column ID      │  49│  52│  54│  56│
4736 │                           Layer Column ID│   9│  11│  14│  16│
4737 │                      ╶───────────────────┼────┼────┼────┼────┤
4738 │                       No  Column ID      │  49│  52│  54│  56│
4739 │                           Layer Column ID│   9│  11│  14│  16│
4740 │             ╶────────────────────────────┼────┼────┼────┼────┤
4741 │              No  QN57 Yes Column ID      │  57│  59│  61│  63│
4742 │                           Layer Column ID│   9│  11│  14│  16│
4743 │                      ╶───────────────────┼────┼────┼────┼────┤
4744 │                       No  Column ID      │  57│  59│  61│  63│
4745 │                           Layer Column ID│   9│  11│  14│  16│
4746 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4747 ])
4748 AT_CLEANUP
4749
4750 AT_SETUP([CTABLES categorical summary functions])
4751 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4752 AT_DATA([ctables.sps],
4753 [[GET 'nhtsa.sav'.
4754 CTABLES
4755     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
4756     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
4757     /SLABELS POSITION=ROW.
4758 ]])
4759 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4760                                                       Custom Tables
4761 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
4762 │                 │                     D5a. What would you say is your primary ethnic background?                     │
4763 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
4764 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
4765 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
4766 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
4767 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4768 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
4769 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
4770 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
4771 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4772 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4773 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
4774 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4775 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4776 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
4777 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
4778 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4779 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
4780 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
4781 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
4782 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4783 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4784 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
4785 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4786 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4787 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
4788 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
4789 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4790 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
4791 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
4792 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
4793 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4794 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4795 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
4796 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4797 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4798 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
4799 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
4800 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4801 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
4802 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
4803 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
4804 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4805 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4806 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
4807 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4808 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4809 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
4810 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
4811 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
4812 ])
4813 AT_CLEANUP
4814
4815 AT_SETUP([CTABLES scale summary functions])
4816 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4817 AT_DATA([ctables.sps],
4818 [[GET 'nhtsa.sav'.
4819 SET TVAR=NAME.
4820
4821 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4822   CTABLES later, to make the results easier to verify.
4823 SPLIT FILE BY REGION.
4824 FREQUENCIES
4825     qn19a
4826     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4827     /FORMAT NOTABLE /MISSING=INCLUDE.
4828 SPLIT FILE OFF.
4829
4830 CTABLES
4831     /VLABELS VARIABLE=qn19a DISPLAY=NONE
4832     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
4833     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
4834     /SLABELS POSITION=ROW
4835     /CLABELS ROWLABELS=OPPOSITE.
4836 ]])
4837 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4838                    Statistics
4839 ╭─────────┬───────────────────────────────────╮
4840 │         │               REGION              │
4841 │         ├────────┬────────┬────────┬────────┤
4842 │         │   NE   │   MW   │    S   │    W   │
4843 │         ├────────┼────────┼────────┼────────┤
4844 │         │  QN19A │  QN19A │  QN19A │  QN19A │
4845 ├─────────┼────────┼────────┼────────┼────────┤
4846 │N Valid  │     936│    1019│    1276│     950│
4847 │  Missing│     473│     635│    1114│     596│
4848 ├─────────┼────────┼────────┼────────┼────────┤
4849 │Mean     │   19.33│   19.83│   20.29│   19.87│
4850 ├─────────┼────────┼────────┼────────┼────────┤
4851 │S.E. Mean│     .14│     .16│     .18│     .17│
4852 ├─────────┼────────┼────────┼────────┼────────┤
4853 │Median   │   18.00│   19.00│   19.00│   19.00│
4854 ├─────────┼────────┼────────┼────────┼────────┤
4855 │Mode     │   18.00│   18.00│   18.00│   18.00│
4856 ├─────────┼────────┼────────┼────────┼────────┤
4857 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
4858 ├─────────┼────────┼────────┼────────┼────────┤
4859 │Variance │   19.41│   26.47│   41.43│   27.59│
4860 ├─────────┼────────┼────────┼────────┼────────┤
4861 │Range    │   59.00│   71.00│   75.00│   61.00│
4862 ├─────────┼────────┼────────┼────────┼────────┤
4863 │Minimum  │     .00│    4.00│    4.00│    4.00│
4864 ├─────────┼────────┼────────┼────────┼────────┤
4865 │Maximum  │   59.00│   75.00│   79.00│   65.00│
4866 ├─────────┼────────┼────────┼────────┼────────┤
4867 │Sum      │18092.00│20206.00│25886.00│18877.00│
4868 ╰─────────┴────────┴────────┴────────┴────────╯
4869
4870                          Custom Tables
4871 ╭────────────────────────┬────────┬────────┬────────┬────────╮
4872 │                        │   NE   │   MW   │    S   │    W   │
4873 ├────────────────────────┼────────┼────────┼────────┼────────┤
4874 │REGION Valid N          │     936│    1019│    1276│     950│
4875 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
4876 │       Mean             │   19.33│   19.83│   20.29│   19.87│
4877 │       Std Error of Mean│     .14│     .16│     .18│     .17│
4878 │       Median           │   18.00│   19.00│   19.00│   19.00│
4879 │       Mode             │   18.00│   18.00│   18.00│   18.00│
4880 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
4881 │       Variance         │   19.41│   26.47│   41.43│   27.59│
4882 │       Range            │   59.00│   71.00│   75.00│   61.00│
4883 │       Minimum          │     .00│    4.00│    4.00│    4.00│
4884 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
4885 │       Sum              │18092.00│20206.00│25886.00│18877.00│
4886 │       Count            │    1409│    1654│    2390│    1546│
4887 │       Total N          │    1409│    1654│    2390│    1546│
4888 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
4889 ╰────────────────────────┴────────┴────────┴────────┴────────╯
4890 ])
4891 AT_CLEANUP
4892
4893 AT_SETUP([CTABLES scale summary functions - weighting])
4894 weight=1
4895 c=10
4896 for a in 1 2 9; do
4897     for b in 3 4 9; do
4898         for n in 1 2 3 4 5 6 7 8 9 10; do
4899             if test $c -lt 15; then
4900                 cval=.
4901             else
4902                 cval=$c
4903             fi
4904             printf "$weight $a $b $cval\n"
4905             weight=$(expr \( $weight + 3 \) % 7 + 2)
4906             c=$(expr \( $c + 13 \) % 29 + 7)
4907         done
4908     done
4909 done > ctables.txt
4910
4911 AT_DATA([analysis.sps],
4912 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4913   CTABLES later, to make the results easier to verify.
4914 SPLIT FILE BY a b.
4915 FREQUENCIES
4916     c
4917     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4918     /FORMAT NOTABLE /MISSING=INCLUDE.
4919 SPLIT FILE OFF.
4920
4921 CTABLES
4922     /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
4923     /SLABELS POSITION=ROW
4924     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
4925 ]])
4926
4927 AT_DATA([ctables.sps],
4928 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
4929     /w (F5.0) a b c (f2.0).
4930 VAR LEVEL w c (SCALE) a b (NOMINAL).
4931 MISSING VALUES a b (9).
4932
4933 INCLUDE 'analysis.sps'.
4934
4935 WEIGHT BY w.
4936 INCLUDE 'analysis.sps'.
4937
4938 * Same as original analysis using unweighted versions of summaries.
4939 CTABLES
4940     /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
4941     /SLABELS POSITION=ROW
4942     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
4943 ]])
4944 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4945                                 Statistics
4946 ╭─────────┬──────────────────────────────────────────────────────────────╮
4947 │         │                               a                              │
4948 │         ├────────────────────┬────────────────────┬────────────────────┤
4949 │         │          1         │          2         │          9         │
4950 │         ├────────────────────┼────────────────────┼────────────────────┤
4951 │         │          b         │          b         │          b         │
4952 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
4953 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
4954 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4955 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
4956 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4957 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
4958 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
4959 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4960 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
4961 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4962 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
4963 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4964 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
4965 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4966 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
4967 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4968 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
4969 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4970 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
4971 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4972 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
4973 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4974 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
4975 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4976 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
4977 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4978 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
4979 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
4980
4981                                     Custom Tables
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 Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
4992 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
4993 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
4994 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
4995 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
4996 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
4997 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
4998 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
4999 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5000 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5001 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5002 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5003 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5004 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5005 │  Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5006 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5007
5008                                   Statistics
5009 ╭─────────┬─────────────────────────────────────────────────────────────────╮
5010 │         │                                a                                │
5011 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
5012 │         │          1          │          2          │          9          │
5013 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
5014 │         │          b          │          b          │          b          │
5015 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5016 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5017 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5018 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
5019 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5020 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5021 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
5022 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5023 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5024 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5025 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5026 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5027 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5028 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5029 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5030 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5031 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5032 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5033 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5034 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5035 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5036 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5037 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5038 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5039 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5040 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5041 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
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          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5055 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5056 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5057 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5058 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5059 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5060 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5061 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5062 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5063 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5064 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5065 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5066 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5067 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5068 │  Layer Row Sum %  │  13.3%│ 10.3%│ 11.3%│  8.9%│  12.6%│ 11.5%│  9.8%│  9.9%│  12.4%│
5069 ╰───────────────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5070
5071                                          Custom Tables
5072 ╭──────────────────────────────┬──────────────────────────────────────────────────────────────╮
5073 │                              │                               a                              │
5074 │                              ├────────────────────┬────────────────────┬────────────────────┤
5075 │                              │          1         │          2         │          9         │
5076 │                              ├────────────────────┼────────────────────┼────────────────────┤
5077 │                              │          b         │          b         │          b         │
5078 │                              ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5079 │                              │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5080 ├──────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5081 │c Unweighted Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5082 │  Unweighted Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5083 │  Unweighted Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5084 │  Unweighted Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5085 │  Unweighted Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5086 │  Unweighted Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5087 │  Unweighted Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5088 │  Unweighted Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5089 │  Unweighted Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5090 │  Unweighted Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5091 │  Unweighted Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5092 │  Unweighted Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5093 ╰──────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5094 ])
5095 AT_CLEANUP
5096
5097 AT_SETUP([CTABLES hidden scale VLABELS])
5098 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5099 AT_DATA([ctables.sps],
5100 [[GET 'nhtsa.sav'.
5101 CTABLES
5102     /TABLE region BY qn19a + qn35
5103     /SLABELS POSITION=ROW.
5104 CTABLES
5105     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5106     /TABLE region BY qn19a + qn35
5107     /SLABELS POSITION=ROW.
5108 CTABLES
5109     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5110     /TABLE region BY qn19a + qn35
5111     /SLABELS POSITION=ROW.
5112
5113 * This one in particular caused a crash because no categories were
5114   created on the column axis, so passing in 0 for the index was still
5115   too big for that number of categories.  It was fixed by creating a
5116   name-only category for each variable despite the "NONE" request,
5117   then hiding the entire dimension's labels if all its labels were
5118   set to "NONE".
5119 CTABLES
5120     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5121     /TABLE region BY qn19a + qn35
5122     /SLABELS POSITION=ROW.
5123 ]])
5124 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5125                                  Custom Tables
5126 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5127 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5128 │              │   when you first starting  │   many times have you driven a  │
5129 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5130 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5131 │              │      sips of alcohol.      │            beverages?           │
5132 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5133 │Region NE Mean│                       19.33│                                2│
5134 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5135 │       MW Mean│                       19.83│                                2│
5136 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5137 │       S  Mean│                       20.29│                                2│
5138 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5139 │       W  Mean│                       19.87│                                2│
5140 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5141
5142                                  Custom Tables
5143 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5144 │              │     │  35. In the past thirty days, how many times have you  │
5145 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5146 │              │QN19A│                  alcoholic beverages?                  │
5147 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5148 │Region NE Mean│19.33│                                                       2│
5149 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5150 │       MW Mean│19.83│                                                       2│
5151 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5152 │       S  Mean│20.29│                                                       2│
5153 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5154 │       W  Mean│19.87│                                                       2│
5155 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5156
5157                                  Custom Tables
5158 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5159 │              │   19a. About how old were you when you first starting   │    │
5160 │              │  drinking alcohol, not counting small tastes or sips of │    │
5161 │              │                         alcohol.                        │qn35│
5162 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5163 │Region NE Mean│                                                    19.33│   2│
5164 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5165 │       MW Mean│                                                    19.83│   2│
5166 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5167 │       S  Mean│                                                    20.29│   2│
5168 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5169 │       W  Mean│                                                    19.87│   2│
5170 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5171
5172       Custom Tables
5173 ╭──────────────┬───────╮
5174 │Region NE Mean│19.33 2│
5175 │      ╶───────┼───────┤
5176 │       MW Mean│19.83 2│
5177 │      ╶───────┼───────┤
5178 │       S  Mean│20.29 2│
5179 │      ╶───────┼───────┤
5180 │       W  Mean│19.87 2│
5181 ╰──────────────┴───────╯
5182 ])
5183 AT_CLEANUP
5184
5185 AT_SETUP([CTABLES with SPLIT FILE])
5186 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5187 AT_DATA([ctables.sps],
5188 [[GET 'nhtsa.sav'.
5189
5190 SORT CASES BY qns3a.
5191
5192 CTABLES /TABLE qn105ba.
5193
5194 * Layered split has no effect on output.
5195 SPLIT FILE BY qns3a.
5196 CTABLES /TABLE qn105ba.
5197
5198 * Add column variable qns3a to compare against separate splits.
5199 CTABLES /TABLE qn105ba BY qns3a.
5200
5201 * Separate splits are truly output separately.
5202 SPLIT FILE SEPARATE BY qns3a.
5203 CTABLES /TABLE qn105ba.
5204 ]])
5205 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5206                                   Custom Tables
5207 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5208 │                                                                        │Count│
5209 ├────────────────────────────────────────────────────────────────────────┼─────┤
5210 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5211 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5212 │                                                            Very likely │ 1502│
5213 │                                                            Somewhat    │ 2763│
5214 │                                                            likely      │     │
5215 │                                                            Somewhat    │ 1307│
5216 │                                                            unlikely    │     │
5217 │                                                            Very        │  609│
5218 │                                                            unlikely    │     │
5219 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5220
5221                                   Custom Tables
5222 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5223 │                                                                        │Count│
5224 ├────────────────────────────────────────────────────────────────────────┼─────┤
5225 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5226 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5227 │                                                            Very likely │ 1502│
5228 │                                                            Somewhat    │ 2763│
5229 │                                                            likely      │     │
5230 │                                                            Somewhat    │ 1307│
5231 │                                                            unlikely    │     │
5232 │                                                            Very        │  609│
5233 │                                                            unlikely    │     │
5234 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5235
5236                                   Custom Tables
5237 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5238 │                                                                 │S3a. GENDER:│
5239 │                                                                 ├─────┬──────┤
5240 │                                                                 │ Male│Female│
5241 │                                                                 ├─────┼──────┤
5242 │                                                                 │Count│ Count│
5243 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5244 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5245 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5246 │the police?                                          Very likely │  660│   842│
5247 │                                                     Somewhat    │ 1174│  1589│
5248 │                                                     likely      │     │      │
5249 │                                                     Somewhat    │  640│   667│
5250 │                                                     unlikely    │     │      │
5251 │                                                     Very        │  311│   298│
5252 │                                                     unlikely    │     │      │
5253 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5254
5255     Split Values
5256 ╭────────────┬─────╮
5257 │Variable    │Value│
5258 ├────────────┼─────┤
5259 │S3a. GENDER:│Male │
5260 ╰────────────┴─────╯
5261
5262                                   Custom Tables
5263 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5264 │                                                                        │Count│
5265 ├────────────────────────────────────────────────────────────────────────┼─────┤
5266 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5267 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5268 │                                                            Very likely │  660│
5269 │                                                            Somewhat    │ 1174│
5270 │                                                            likely      │     │
5271 │                                                            Somewhat    │  640│
5272 │                                                            unlikely    │     │
5273 │                                                            Very        │  311│
5274 │                                                            unlikely    │     │
5275 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5276
5277      Split Values
5278 ╭────────────┬──────╮
5279 │Variable    │ Value│
5280 ├────────────┼──────┤
5281 │S3a. GENDER:│Female│
5282 ╰────────────┴──────╯
5283
5284                                   Custom Tables
5285 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5286 │                                                                        │Count│
5287 ├────────────────────────────────────────────────────────────────────────┼─────┤
5288 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5289 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5290 │                                                            Very likely │  842│
5291 │                                                            Somewhat    │ 1589│
5292 │                                                            likely      │     │
5293 │                                                            Somewhat    │  667│
5294 │                                                            unlikely    │     │
5295 │                                                            Very        │  298│
5296 │                                                            unlikely    │     │
5297 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5298 ])
5299 AT_CLEANUP
5300
5301 AT_SETUP([CTABLES variable level inference])
5302 AT_DATA([data.txt], [dnl
5303 dnl n1 has 10 unique small values -> nominal.
5304 dnl n2 has 23 unique small values -> nominal.
5305 dnl n3 is all missing -> nominal.
5306 dnl s1 has 24 unique small values -> scale.
5307 dnl s2 has one negative value -> scale.
5308 dnl s3 has one non-integer value -> scale.
5309 dnl s4 has no valid values less than 10 -> scale.
5310 dnl s5 has no valid values less than 10,000 -> scale.
5311 1  1  . 1  1  1    10 10001
5312 2  2  . 2  2  2    11 10002
5313 3  3  . 3  3  3    12 10003
5314 4  4  . 4  4  4    13 10004
5315 5  5  . 5  5  5    14 10005
5316 6  6  . 6  6  6    15 10006
5317 7  7  . 7  7  7    16 10007
5318 8  8  . 8  8  8    17 10008
5319 9  9  . 9  9  9    18 10009
5320 10 10 . 10 10 10.5 19 110000
5321 1  11 . 11 -1 1    11 10001
5322 2  12 . 12 2  2    12 10002
5323 3  13 . 13 3  3    13 10003
5324 4  14 . 14 4  4    14 10004
5325 5  15 . 15 5  5    15 10005
5326 6  16 . 16 6  6    16 10006
5327 7  17 . 17 7  7    17 10007
5328 8  18 . 18 8  8    18 10008
5329 9  19 . 19 9  9    19 10009
5330 1  20 . 20 1  1    20 10001
5331 2  21 . 21 2  2    21 10002
5332 3  22 . 22 3  3    22 10003
5333 4  23 . 23 4  4    23 10004
5334 5  23 . 24 5  5    24 10005
5335 6  23 . 24 6  6    25 10006
5336 ])
5337
5338 AT_DATA([ctables.sps], [dnl
5339 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5340
5341 * Nominal formats (copied from data that will default to scale).
5342 COMPUTE n4=s1.
5343 COMPUTE n5=s1.
5344 FORMATS n4(WKDAY5) n5(MONTH5).
5345
5346 * Scale formats (copied from data that will default to nominal).
5347 COMPUTE s6=n1.
5348 COMPUTE s7=n1.
5349 COMPUTE s8=n1.
5350 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5351
5352 STRING string(A8).
5353
5354 DISPLAY DICTIONARY.
5355 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5356 DISPLAY DICTIONARY.
5357 ])
5358
5359 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5360                                     Variables
5361 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5362 │      │        │  Measurement │     │     │         │            │            │
5363 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5364 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5365 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5366 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5367 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5368 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5369 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5370 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5371 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5372 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5373 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5374 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5375 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5376 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5377 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5378 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5379 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5380
5381         Custom Tables
5382 ╭────────────┬─────┬────────╮
5383 │            │Count│  Mean  │
5384 ├────────────┼─────┼────────┤
5385 │n1     1.00 │    3│        │
5386 │       2.00 │    3│        │
5387 │       3.00 │    3│        │
5388 │       4.00 │    3│        │
5389 │       5.00 │    3│        │
5390 │       6.00 │    3│        │
5391 │       7.00 │    2│        │
5392 │       8.00 │    2│        │
5393 │       9.00 │    2│        │
5394 │       10.00│    1│        │
5395 ├────────────┼─────┼────────┤
5396 │n2     1.00 │    1│        │
5397 │       2.00 │    1│        │
5398 │       3.00 │    1│        │
5399 │       4.00 │    1│        │
5400 │       5.00 │    1│        │
5401 │       6.00 │    1│        │
5402 │       7.00 │    1│        │
5403 │       8.00 │    1│        │
5404 │       9.00 │    1│        │
5405 │       10.00│    1│        │
5406 │       11.00│    1│        │
5407 │       12.00│    1│        │
5408 │       13.00│    1│        │
5409 │       14.00│    1│        │
5410 │       15.00│    1│        │
5411 │       16.00│    1│        │
5412 │       17.00│    1│        │
5413 │       18.00│    1│        │
5414 │       19.00│    1│        │
5415 │       20.00│    1│        │
5416 │       21.00│    1│        │
5417 │       22.00│    1│        │
5418 │       23.00│    3│        │
5419 ├────────────┼─────┼────────┤
5420 │string      │   25│        │
5421 ├────────────┼─────┼────────┤
5422 │s1          │     │   12.96│
5423 ├────────────┼─────┼────────┤
5424 │s2          │     │    4.76│
5425 ├────────────┼─────┼────────┤
5426 │s3          │     │    4.86│
5427 ├────────────┼─────┼────────┤
5428 │s4          │     │   16.60│
5429 ├────────────┼─────┼────────┤
5430 │s5          │     │14004.44│
5431 ╰────────────┴─────┴────────╯
5432
5433                                     Variables
5434 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5435 │      │        │  Measurement │     │     │         │            │            │
5436 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5437 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5438 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5439 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5440 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5441 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5442 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5443 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5444 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5445 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5446 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5447 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5448 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5449 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5450 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5451 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5452 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5453 ])
5454 AT_CLEANUP