finish docs?
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Known bugs:
4 dnl TOTAL interaction with PCOMPUTE, e.g. the following
5 dnl CTABLES
6 dnl     /PCOMPUTE &all_drivers=EXPR([1 THRU 2] + [3 THRU 4])
7 dnl     /PPROPERTIES &all_drivers LABEL='All Drivers'
8 dnl     /PCOMPUTE &pct_not_drivers=EXPR([5] / ([1 THRU 2] + [3 THRU 4] + [5]) * 100)
9 dnl     /PPROPERTIES &pct_not_drivers LABEL='% Not Drivers' FORMAT=COUNT PCT40.1
10 dnl     /TABLE=qn1 BY qns3a
11 dnl     /CATEGORIES VARIABLES=qns3a TOTAL=YES
12 dnl     /CATEGORIES VARIABLES=qn1 [1 THRU 2, SUBTOTAL='Frequent Drivers',
13 dnl                                3 THRU 4, SUBTOTAL='Infrequent Drivers',
14 dnl                                &all_drivers, 5, &pct_not_drivers,
15 dnl                                MISSING, SUBTOTAL='Not Drivers or Missing'].
16 dnl yields gaps in the Total column:
17 dnl ╭─────────────────────────────────────────────────────────────────────────┬──────────────────╮
18 dnl │                                                                         │   S3a. GENDER:   │
19 dnl │                                                                         ├─────┬──────┬─────┤
20 dnl │                                                                         │ Male│Female│Total│
21 dnl │                                                                         ├─────┼──────┼─────┤
22 dnl │                                                                         │Count│ Count│Count│
23 dnl ├─────────────────────────────────────────────────────────────────────────┼─────┼──────┼─────┤
24 dnl │ 1. How often do you usually drive a car or other   Every day            │ 2305│  2362│ 4667│
25 dnl │motor vehicle?                                      Several days a week  │  440│   834│ 1274│
26 dnl │                                                    Frequent Drivers     │ 2745│  3196│     │
27 dnl │                                                    Once a week or less  │  125│   236│  361│
28 dnl │                                                    Only certain times a │   58│    72│  130│
29 dnl │                                                    year                 │     │      │     │
30 dnl │                                                    Infrequent Drivers   │  183│   308│     │
31 dnl │                                                    All Drivers          │ 2928│  3504│     │
32 dnl │                                                    Never                │  192│   348│  540│
33 dnl │                                                    % Not Drivers        │ 6.2%│  9.0%│     │
34 dnl │                                                    Don't know           │    3│     5│    8│
35 dnl │                                                    Refused              │    9│    10│   19│
36 dnl │                                                    Not Drivers or       │  204│   363│     │
37 dnl │                                                    Missing              │     │      │     │
38 dnl ╰─────────────────────────────────────────────────────────────────────────┴─────┴──────┴─────╯
39 dnl Features not yet implemented:
40 dnl - Multiple response sets
41 dnl - MRSETS subcommand.
42 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
43 dnl - SIGTEST
44 dnl - COMPARETEST
45 dnl - Summary functions:
46 dnl   * .LCL and .UCL suffixes.
47 dnl   * .SE suffixes.
48 dnl - CATEGORIES:
49 dnl   * Data-dependent sorting.
50
51 AT_SETUP([CTABLES parsing])
52 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
53 AT_DATA([ctables.sps],
54 [[GET 'nhtsa.sav'.
55 CTABLES
56     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
57     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
58     /FORMAT UNITS=CM EMPTY="(-)"
59     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
60     /VLABELS VARIABLES=qn17 DISPLAY=NAME
61     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
62     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
63     /VLABELS VARIABLES=qn20 DISPLAY=NONE
64     /MRSETS COUNTDUPLICATES=NO
65     /MRSETS COUNTDUPLICATES=YES
66     /SMISSING VARIABLE
67     /SMISSING LISTWISE
68     /WEIGHT VARIABLE=qns3a
69     /HIDESMALLCOUNTS
70     /HIDESMALLCOUNTS COUNT=10
71     /TABLE qnsa1
72     /SLABELS POSITION=COLUMN VISIBLE=YES
73     /SLABELS VISIBLE=NO POSITION=ROW
74     /SLABELS POSITION=LAYER
75     /CLABELS AUTO
76     /CLABELS ROWLABELS=OPPOSITE
77     /CRITERIA CILEVEL=50
78     /CATEGORIES VARIABLES=qn1 qn17
79                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
80                 POSITION=BEFORE EMPTY=INCLUDE.
81 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
82 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
83 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
84 ]])
85 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
86          Custom Tables
87 Count
88 ╭───────────────────┬────┬────╮
89 │                   │ RDD│CELL│
90 ├───────────────────┼────┼────┤
91 │Sa1. SAMPLE SOURCE:│5392│1607│
92 ╰───────────────────┴────┴────╯
93
94        Custom Tables
95 RDD
96 ╭───────────────────┬─────╮
97 │                   │Count│
98 ├───────────────────┼─────┤
99 │Sa1. SAMPLE SOURCE:│ 5392│
100 ╰───────────────────┴─────╯
101
102           Custom Tables
103 ╭────────────────────────┬─────╮
104 │                        │Count│
105 ├────────────────────────┼─────┤
106 │Sa1. SAMPLE SOURCE: RDD │ 5392│
107 │                    CELL│ 1607│
108 ╰────────────────────────┴─────╯
109
110           Custom Tables
111 ╭────────────────────────┬─────╮
112 │                        │Count│
113 ├────────────────────────┼─────┤
114 │Sa1. SAMPLE SOURCE: RDD │ 5392│
115 │                    CELL│ 1607│
116 ╰────────────────────────┴─────╯
117 ])
118 AT_CLEANUP
119
120 AT_SETUP([CTABLES parsing - negative])
121 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
122 AT_DATA([ctables.sps],
123 [[GET 'nhtsa.sav'.
124 CTABLES.
125 CTABLES /FORMAT MINCOLWIDTH='foo'.
126 CTABLES /TABLE qn1 [**].
127 CTABLES /TABLE qn1 [NOTAFUNCTION].
128 CTABLES /TABLE (qn1.
129 CTABLES /TABLE **.
130 CTABLES /TABLE NOTAVAR.
131 STRING string(A8).
132 CTABLES /TABLE string[S].
133 CTABLES /TABLE qn1 [PTILE 101].
134 CTABLES /TABLE qn1 [MEAN F0.1].
135 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
136 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
137 CTABLES /TABLE qn1 [MEAN TOTALS].
138 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
142 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
143 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
144 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
145 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
146 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
147 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
148 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
149 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
150 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
151 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
152 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
153 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
154 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
155 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
156 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
157 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
158 CTABLES /PCOMPUTE &k=EXPR([LO **]).
159 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
160 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
161 CTABLES /PCOMPUTE &k=EXPR([1**]).
162 CTABLES /PCOMPUTE &k=EXPR((1x)).
163 CTABLES /PCOMPUTE **k.
164 CTABLES /PCOMPUTE &1.
165 CTABLES /PCOMPUTE &k**.
166 CTABLES /PCOMPUTE &k=**.
167 CTABLES /PCOMPUTE &k=EXPR**.
168 CTABLES /PCOMPUTE &k=EXPR(1x).
169 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
170 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
171 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
172 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
173 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
174 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
175 CTABLES /FORMAT EMPTY=**.
176 CTABLES /FORMAT MISSING=**.
177 CTABLES /FORMAT **.
178 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
179 CTABLES /VLABELS **.
180 CTABLES /VLABELS VARIABLES=NOTAVAR.
181 CTABLES /VLABELS VARIABLES=qn1 **.
182 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
183 CTABLES /MRSETS **.
184 CTABLES /MRSETS COUNTDUPLICATES=**.
185 CTABLES /SMISSING **.
186 CTABLES /WEIGHT **.
187 CTABLES /WEIGHT VARIABLE=NOTAVAR.
188 CTABLES /HIDESMALLCOUNTS COUNT=1.
189 CTABLES /QUUX.
190 CTABLES /HIDESMALLCOUNTS COUNT=2.
191 CTABLES /TABLE qn1**.
192 CTABLES /TABLE qn1 /SLABELS POSITION=**.
193 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
194 CTABLES /TABLE qn1 /SLABELS **.
195 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
196 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
197 CTABLES /TABLE qn1 /CLABELS **.
198 CTABLES /TABLE qn1 /CRITERIA **.
199 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
200 CTABLES /TABLE qn1 /TITLES **.
201 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
202 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
203 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
204 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
205 CTABLES /TABLE qn1 /SIGTEST **.
206 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
207 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
208 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
209 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
210 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
211 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
212 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
213 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
214 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
215 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
216 CTABLES /TABLE qn1 /COMPARETEST **.
217 CTABLES /TABLE qn1 / **.
218 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
219 CTABLES /TABLE qn20 > qnd1.
220 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
221 NUMERIC datetime (DATETIME17.0).
222 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
223 ]])
224 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
225 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
226
227 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
228 negative number for MINCOLWIDTH.
229
230 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
231 identifier.
232
233 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
234 summary function name.
235
236 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
237
238 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
239 identifier.
240
241 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
242
243 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
244 scale variable.
245    10 | CTABLES /TABLE string[S].
246       |                ^~~~~~~~~
247
248 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
249 between 0 and 100 for PTILE.
250
251 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
252 requires a width between 1 and 40.
253
254 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
255 format NEGPAREN requires width 2 or greater.
256
257 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
258 format NEGPAREN requires width greater than decimals.
259
260 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
261 scale variables.
262    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
263       |                     ^~~~
264
265 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
266    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
267       |                ^~~
268
269 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
270
271 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
272 scale variables.
273    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
274       |                     ^~~~
275
276 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
277    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
278       |                ^~~
279
280 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
281
282 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
283
284 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
285
286 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
287
288 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
289
290 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
291
292 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
293 identifier.
294
295 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
296    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
297       |                                               ^~
298
299 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
300 between 0 and 100 for PTILE.
301
302 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
303 `@:}@'.
304
305 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
306 `@{:@'.
307
308 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
309 or EXCLUDE.
310
311 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
312 NO.
313
314 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
315
316 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
317 or AFTER.
318
319 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
320 or EXCLUDE.
321
322 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
323 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
324
325 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
326 LABEL, POSITION, or EMPTY.
327
328 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
329 integer for SUBTOTAL.
330
331 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
332
333 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
334
335 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
336
337 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
338
339 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
340
341 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
342
343 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
344
345 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
346
347 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
348
349 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
350
351 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
352
353 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
354
355 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
356 the previous definition.
357    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
358       |                               ^~~~~~~~~~~~~~~~~~~
359
360 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
361    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
362       |          ^~~~~~~~~~~~~~~~~~~
363
364 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
365 `/'.
366
367 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
368 Expecting summary function name.
369
370 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
371 between 0 and 100 for PTILE.
372
373 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
374
375 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
376 NO.
377
378 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
379 FORMAT, or HIDESOURCECATS.
380
381 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
382
383 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
384
385 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
386 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
387
388 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
389 MAXCOLWIDTH.
390
391 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
392 VARIABLES.
393
394 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
395
396 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
397 DISPLAY.
398
399 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
400 DEFAULT, NAME, LABEL, BOTH, or NONE.
401
402 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
403 COUNTDUPLICATES.
404
405 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
406 NO.
407
408 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
409 VARIABLE or LISTWISE.
410
411 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
412 VARIABLE.
413
414 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
415
416 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
417 greater for HIDESMALLCOUNTS COUNT.
418
419 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
420 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
421 HIDESMALLCOUNTS, or TABLE.
422
423 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
424 `/'.
425
426 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
427
428 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
429 ROW, or LAYER.
430
431 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
432 NO.
433
434 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
435 POSITION or VISIBLE.
436
437 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
438 OPPOSITE or LAYER.
439
440 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
441 OPPOSITE or LAYER.
442
443 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
444 ROWLABELS, or COLLABELS.
445
446 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
447 CILEVEL.
448
449 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
450 in @<:@0,100@:}@ for CILEVEL.
451
452 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
453 CAPTION, CORNER, or TITLE.
454
455 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
456 CHISQUARE.
457
458 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
459 in @<:@0,1@:}@ for ALPHA.
460
461 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
462 NO.
463
464 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
465 ALLVISIBLE or SUBTOTALS.
466
467 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
468 ALPHA, INCLUDEMRSETS, or CATEGORIES.
469
470 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
471 MEAN.
472
473 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
474 in (0,1) for ALPHA.
475
476 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
477 for ALPHA.
478
479 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
480 BONFERRONI, BH, or NONE.
481
482 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
483 NO.
484
485 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
486 or TESTEDCATS.
487
488 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
489 ALLVISIBLE or SUBTOTALS.
490
491 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
492 NO.
493
494 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
495 SIMPLE.
496
497 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
498 NO.
499
500 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
501 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
502 SHOWSIG.
503
504 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
505 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
506
507 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
508 specified.
509
510 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
511    97 | CTABLES /TABLE qn20 > qnd1.
512       |                ^~~~~~~~~~~
513
514 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
515    97 | CTABLES /TABLE qn20 > qnd1.
516       |                ^~~~
517
518 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
519    97 | CTABLES /TABLE qn20 > qnd1.
520       |                       ^~~~
521
522 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
523 categorical variables at the innermost nesting level.
524    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
525       |                ^~~~~~~~~~~~~~~~~~~~
526
527 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
528 summary.
529    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
530       |                ^~~
531
532 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
533 specification as format DATETIME: Day (123) must be between 1 and 31..
534   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
535       |                                                    ^~~~~
536 ]])
537 AT_CLEANUP
538
539 AT_SETUP([CTABLES parsing - more negative])
540 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
541 AT_DATA([ctables.sps],
542 [[GET 'nhtsa.sav'.
543 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
544 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
545 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
546
547 STRING string(A8).
548 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
549 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
550
551 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
552
553 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
554 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
555 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
556 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
557
558 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
559 CTABLES /PCOMPUTE &x=EXPR([**]).
560 CTABLES /PCOMPUTE &x=EXPR(**).
561
562 CTABLES /TABLE.
563
564 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
565
566 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
567
568 CTABLES /TABLE $mrset.
569
570 CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
571 CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
572
573 CTABLES /TABLE qn113 [COUNT.UCL].
574
575 CTABLES /TABLE qn1 /CATEGORIES **.
576 ]])
577 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
578 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
579 category not included in the category list.
580     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
581 VARIABLES=qn1 [&pc].
582       |
583 ^~~
584
585 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
586     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
587 VARIABLES=qn1 [&pc].
588       |                            ^~~~~~~~
589
590 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
591 list of categories here.
592     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
593 VARIABLES=qn1 [&pc].
594       |
595 ^~~~
596
597 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
598 category not included in the category list.
599     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
600 [&pc].
601       |
602 ^~~
603
604 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
605     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
606 [&pc].
607       |                            ^~~~~
608
609 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
610 variable's CATEGORIES specification.
611
612 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
613 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
614 subtotals by position, e.g. SUBTOTAL[1].
615     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
616 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
617       |
618 ^~~~~~~~~~~~~~~~~~~~~~~~
619
620 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
621 position.
622     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
623 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
624       |                            ^~~~~~~~
625
626 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
627 applied only to string variables, but this subcommand tries to apply it to
628 numeric variable QN1.
629     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
630       |                                               ^~~~~~~~
631
632 ctables.sps:8.53: error: CTABLES: This category specification may be applied
633 only to numeric variables, but this subcommand tries to apply it to string
634 variable string.
635     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
636       |                                                     ^
637
638 ctables.sps:10.74-10.86: error: CTABLES: Syntax error at `KEY=MEAN(qn1)': Data-
639 dependent sorting is not implemented.
640
641 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
642 moved to be categorical, but qnd1 is a scale variable.
643
644 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
645 moved to have the same width, but QN1 has width 0 and string has width 8.
646
647 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
648 moved to have the same value labels, but QN1 and QNSA1 have different value
649 labels.
650
651 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
652 moved to have the same category specifications, but QN105BA and QN105BB have
653 different category specifications.
654
655 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
656 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
657 this warning, insert parentheses.
658    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
659       |                           ^~~~~~~
660
661 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
662 `/'.
663
664 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
665
666 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
667
668 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
669 variable must be specified.
670
671 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
672
673 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
674 summary.
675    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
676       |                                                  ^~~~~
677
678 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
679 summary.
680    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
681       |                ^~~~~
682
683 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
684 summary.
685    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
686       |                                 ^~~~~
687
688 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
689 has a summary even if the syntax does not explicitly specify one.
690    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
691       |                                 ^~~~~
692
693 ctables.sps:25.46-25.63: error: CTABLES: Syntax error at `KEY=PTILE(qn1, 50)':
694 Data-dependent sorting is not implemented.
695
696 ctables.sps:27.16-27.21: error: CTABLES: Syntax error at `$mrset': Multiple
697 response set support not implemented.
698
699 ctables.sps:29.23-29.44: error: CTABLES: Syntax error at `SIGTEST
700 TYPE=CHISQUARE': Support for SIGTEST not yet implemented.
701
702 ctables.sps:30.35-30.43: error: CTABLES: Syntax error at `TYPE=PROP': Support
703 for COMPARETEST not yet implemented.
704
705 ctables.sps:32.23-32.31: error: CTABLES: Syntax error at `COUNT.UCL': Support
706 for LCL, UCL, and SE summary functions is not yet implemented.
707
708 ctables.sps:34.32-34.33: error: CTABLES: Syntax error at `**': expecting
709 VARIABLES.
710 ]])
711 AT_CLEANUP
712
713 AT_SETUP([CTABLES one categorical variable])
714 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
715 AT_DATA([ctables.sps],
716 [[GET 'nhtsa.sav'.
717 CTABLES /TABLE qn1.
718 CTABLES /TABLE BY qn1.
719 CTABLES /TABLE BY BY qn1.
720 ]])
721 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
722                                   Custom Tables
723 ╭────────────────────────────────────────────────────────────────────────┬─────╮
724 │                                                                        │Count│
725 ├────────────────────────────────────────────────────────────────────────┼─────┤
726 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
727 │motor vehicle?                                     Several days a week  │ 1274│
728 │                                                   Once a week or less  │  361│
729 │                                                   Only certain times a │  130│
730 │                                                   year                 │     │
731 │                                                   Never                │  540│
732 ╰────────────────────────────────────────────────────────────────────────┴─────╯
733
734                                   Custom Tables
735 ╭──────────────────────────────────────────────────────────────────────────────╮
736 │        1. How often do you usually drive a car or other motor vehicle?       │
737 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
738 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
739 │Every day│       week       │       less       │          year          │Never│
740 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
741 │  Count  │       Count      │       Count      │          Count         │Count│
742 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
743 │     4667│              1274│               361│                     130│  540│
744 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
745
746 Custom Tables
747 Every day
748 ╭─────╮
749 │Count│
750 ├─────┤
751 │ 4667│
752 ╰─────╯
753 ])
754 AT_CLEANUP
755
756 AT_SETUP([CTABLES one string variable])
757 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
758 AT_DATA([ctables.sps],
759 [[GET 'nhtsa.sav'.
760 STRING licensed(A8).
761 MISSING VALUES licensed('DontKnow', 'Refused').
762 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
763 CTABLES /TABLE licensed.
764 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
765 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
766 * Notice that the string matching is case-sensitive.
767 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
768 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
769 CTABLES
770     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
771     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
772     /TABLE licensed
773     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
774 CTABLES
775     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
776     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
777     /TABLE licensed
778     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
779 ]])
780 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
781     Custom Tables
782 ╭────────────┬─────╮
783 │            │Count│
784 ├────────────┼─────┤
785 │licensed No │  572│
786 │         Yes│ 6379│
787 ╰────────────┴─────╯
788
789           Custom Tables
790 ╭─────────────────┬─────┬───────╮
791 │                 │Count│Valid N│
792 ├─────────────────┼─────┼───────┤
793 │licensed DontKnow│    4│       │
794 │         No      │  572│       │
795 │         Refused │   44│       │
796 │         Yes     │ 6379│       │
797 │         Total   │ 6999│   6951│
798 ╰─────────────────┴─────┴───────╯
799
800      Custom Tables
801 ╭──────────────┬─────╮
802 │              │Count│
803 ├──────────────┼─────┤
804 │licensed Yes  │ 6379│
805 │         No   │  572│
806 │         Total│ 6951│
807 ╰──────────────┴─────╯
808
809      Custom Tables
810 ╭──────────────┬─────╮
811 │              │Count│
812 ├──────────────┼─────┤
813 │licensed Yes  │ 6379│
814 │         no   │    0│
815 │         Total│ 6379│
816 ╰──────────────┴─────╯
817
818       Custom Tables
819 ╭────────────────┬─────╮
820 │                │Count│
821 ├────────────────┼─────┤
822 │licensed No     │  572│
823 │         Refused│   44│
824 │         Yes    │ 6379│
825 │         Total  │ 6995│
826 ╰────────────────┴─────╯
827
828       Custom Tables
829 ╭────────────────┬─────╮
830 │                │Count│
831 ├────────────────┼─────┤
832 │licensed Yes    │ 6379│
833 │         Not Yes│  620│
834 ╰────────────────┴─────╯
835
836       Custom Tables
837 ╭────────────────┬─────╮
838 │                │Count│
839 ├────────────────┼─────┤
840 │licensed Yes    │ 6379│
841 │         Not Yes│  620│
842 ╰────────────────┴─────╯
843 ])
844 AT_CLEANUP
845
846 AT_SETUP([CTABLES one scale variable])
847 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
848 AT_DATA([ctables.sps],
849 [[GET 'nhtsa.sav'.
850 DESCRIPTIVES qnd1.
851 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
852 CTABLES /TABLE BY qnd1.
853 CTABLES /TABLE BY BY qnd1.
854 ]])
855 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
856                        Descriptive Statistics
857 ╭──────────────────────────┬────┬─────┬───────┬───────┬───────────╮
858 │                          │  N │ Mean│Std Dev│Minimum│  Maximum  │
859 ├──────────────────────────┼────┼─────┼───────┼───────┼───────────┤
860 │D1. AGE: What is your age?│6930│48.26│  19.01│     16│86 or older│
861 │Valid N (listwise)        │6999│     │       │       │           │
862 │Missing N (listwise)      │  69│     │       │       │           │
863 ╰──────────────────────────┴────┴─────┴───────┴───────┴───────────╯
864
865                                   Custom Tables
866 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
867 │                      │     │       │       │    │     Std    │       │       │
868 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
869 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
870 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
871 │age?                  │     │       │       │    │            │       │       │
872 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
873
874         Custom Tables
875 ╭──────────────────────────╮
876 │D1. AGE: What is your age?│
877 ├──────────────────────────┤
878 │           Mean           │
879 ├──────────────────────────┤
880 │                        48│
881 ╰──────────────────────────╯
882
883 Custom Tables
884 D1. AGE: What is your age?
885 ╭────╮
886 │Mean│
887 ├────┤
888 │  48│
889 ╰────╯
890 ])
891 AT_CLEANUP
892
893 AT_SETUP([CTABLES simple stacking])
894 AT_KEYWORDS([stack stacked])
895 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
896 AT_DATA([ctables.sps],
897 [[GET 'nhtsa.sav'.
898 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
899 ]])
900 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
901                                   Custom Tables
902 ╭───────────────────────────────────────────────────────────────┬──────────────╮
903 │                                                               │ S3a. GENDER: │
904 │                                                               ├──────┬───────┤
905 │                                                               │ Male │ Female│
906 │                                                               ├──────┼───────┤
907 │                                                               │Column│ Column│
908 │                                                               │   %  │   %   │
909 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
910 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
911 │too much to drink to drive safely will A. Get      certain     │      │       │
912 │stopped by the police?                             Very likely │   21%│    22%│
913 │                                                   Somewhat    │   38%│    42%│
914 │                                                   likely      │      │       │
915 │                                                   Somewhat    │   21%│    18%│
916 │                                                   unlikely    │      │       │
917 │                                                   Very        │   10%│     8%│
918 │                                                   unlikely    │      │       │
919 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
920 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
921 │too much to drink to drive safely will B. Have an  certain     │      │       │
922 │accident?                                          Very likely │   36%│    45%│
923 │                                                   Somewhat    │   39%│    32%│
924 │                                                   likely      │      │       │
925 │                                                   Somewhat    │    9%│     4%│
926 │                                                   unlikely    │      │       │
927 │                                                   Very        │    3%│     2%│
928 │                                                   unlikely    │      │       │
929 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
930 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
931 │too much to drink to drive safely will C. Be       certain     │      │       │
932 │convicted for drunk driving?                       Very likely │   32%│    28%│
933 │                                                   Somewhat    │   27%│    32%│
934 │                                                   likely      │      │       │
935 │                                                   Somewhat    │   15%│    15%│
936 │                                                   unlikely    │      │       │
937 │                                                   Very        │    9%│     9%│
938 │                                                   unlikely    │      │       │
939 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
940 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
941 │too much to drink to drive safely will D. Be       certain     │      │       │
942 │arrested for drunk driving?                        Very likely │   26%│    27%│
943 │                                                   Somewhat    │   32%│    35%│
944 │                                                   likely      │      │       │
945 │                                                   Somewhat    │   17%│    15%│
946 │                                                   unlikely    │      │       │
947 │                                                   Very        │    9%│     7%│
948 │                                                   unlikely    │      │       │
949 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
950 ])
951 AT_CLEANUP
952
953 AT_SETUP([CTABLES show or hide empty categories])
954 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
955 AT_DATA([ctables.sps],
956 [[GET 'nhtsa.sav'.
957 IF (qn105ba = 2) qn105ba = 1.
958 IF (qns3a = 1) qns3a = 2.
959 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
960 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
961     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
962 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
963     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
964 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
965     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
966 ]])
967 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
968                                   Custom Tables
969 ╭──────────────────────────────────────────────────────────────┬───────────────╮
970 │                                                              │  S3a. GENDER: │
971 │                                                              ├───────┬───────┤
972 │                                                              │  Male │ Female│
973 │                                                              ├───────┼───────┤
974 │                                                              │ Column│ Column│
975 │                                                              │   %   │   %   │
976 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
977 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
978 │too much to drink to drive safely will A. Get      certain    │       │       │
979 │stopped by the police?                             Very likely│      .│     0%│
980 │                                                   Somewhat   │      .│    40%│
981 │                                                   likely     │       │       │
982 │                                                   Somewhat   │      .│    19%│
983 │                                                   unlikely   │       │       │
984 │                                                   Very       │      .│     9%│
985 │                                                   unlikely   │       │       │
986 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
987
988                                   Custom Tables
989 ╭──────────────────────────────────────────────────────────────┬───────────────╮
990 │                                                              │  S3a. GENDER: │
991 │                                                              ├───────┬───────┤
992 │                                                              │  Male │ Female│
993 │                                                              ├───────┼───────┤
994 │                                                              │ Column│ Column│
995 │                                                              │   %   │   %   │
996 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
997 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
998 │too much to drink to drive safely will A. Get      certain    │       │       │
999 │stopped by the police?                             Somewhat   │      .│    40%│
1000 │                                                   likely     │       │       │
1001 │                                                   Somewhat   │      .│    19%│
1002 │                                                   unlikely   │       │       │
1003 │                                                   Very       │      .│     9%│
1004 │                                                   unlikely   │       │       │
1005 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
1006
1007                                   Custom Tables
1008 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1009 │                                                                    │   S3a.  │
1010 │                                                                    │ GENDER: │
1011 │                                                                    ├─────────┤
1012 │                                                                    │  Female │
1013 │                                                                    ├─────────┤
1014 │                                                                    │ Column %│
1015 ├────────────────────────────────────────────────────────────────────┼─────────┤
1016 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1017 │much to drink to drive safely will A. Get stopped by    certain     │         │
1018 │the police?                                             Very likely │       0%│
1019 │                                                        Somewhat    │      40%│
1020 │                                                        likely      │         │
1021 │                                                        Somewhat    │      19%│
1022 │                                                        unlikely    │         │
1023 │                                                        Very        │       9%│
1024 │                                                        unlikely    │         │
1025 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1026
1027                                   Custom Tables
1028 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1029 │                                                                    │   S3a.  │
1030 │                                                                    │ GENDER: │
1031 │                                                                    ├─────────┤
1032 │                                                                    │  Female │
1033 │                                                                    ├─────────┤
1034 │                                                                    │ Column %│
1035 ├────────────────────────────────────────────────────────────────────┼─────────┤
1036 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1037 │much to drink to drive safely will A. Get stopped by    certain     │         │
1038 │the police?                                             Somewhat    │      40%│
1039 │                                                        likely      │         │
1040 │                                                        Somewhat    │      19%│
1041 │                                                        unlikely    │         │
1042 │                                                        Very        │       9%│
1043 │                                                        unlikely    │         │
1044 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1045 ])
1046 AT_CLEANUP
1047
1048 AT_SETUP([CTABLES sorting categories])
1049 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1050 AT_DATA([ctables.sps],
1051 [[GET 'nhtsa.sav'.
1052 IF (QND5A=6) QND5A=-1.
1053 IF (QND5A=5) QND5A=-2.
1054 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1055         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1056         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1057         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1058 ]])
1059 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1060                                   Custom Tables
1061 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1062 │                                                                        │Count│
1063 ├────────────────────────────────────────────────────────────────────────┼─────┤
1064 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1065 │background?                                     -1.00                   │   78│
1066 │                                                Cuban                   │   20│
1067 │                                                Mexican                 │  311│
1068 │                                                Spanish                 │   48│
1069 │                                                South American          │   34│
1070 │                                                Central American        │    0│
1071 │                                                Puerto Rican, OR        │    0│
1072 │                                                Something else          │   68│
1073 │                                                Multiple - cannot choose│    7│
1074 │                                                one                     │     │
1075 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1076
1077                                   Custom Tables
1078 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1079 │                                                                        │Count│
1080 ├────────────────────────────────────────────────────────────────────────┼─────┤
1081 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1082 │background?                                     one                     │     │
1083 │                                                Something else          │   68│
1084 │                                                Puerto Rican, OR        │    0│
1085 │                                                Central American        │    0│
1086 │                                                South American          │   34│
1087 │                                                Spanish                 │   48│
1088 │                                                Mexican                 │  311│
1089 │                                                Cuban                   │   20│
1090 │                                                -1.00                   │   78│
1091 │                                                -2.00                   │   52│
1092 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1093
1094                                   Custom Tables
1095 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1096 │                                                                        │Count│
1097 ├────────────────────────────────────────────────────────────────────────┼─────┤
1098 │D5a. What would you say is your primary ethnic  Central American        │    0│
1099 │background?                                     Cuban                   │   20│
1100 │                                                Mexican                 │  311│
1101 │                                                Multiple - cannot choose│    7│
1102 │                                                one                     │     │
1103 │                                                Puerto Rican, OR        │    0│
1104 │                                                Something else          │   68│
1105 │                                                South American          │   34│
1106 │                                                Spanish                 │   48│
1107 │                                                -2.00                   │   52│
1108 │                                                -1.00                   │   78│
1109 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1110
1111                                   Custom Tables
1112 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1113 │                                                                        │Count│
1114 ├────────────────────────────────────────────────────────────────────────┼─────┤
1115 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1116 │background?                                     South American          │   34│
1117 │                                                Something else          │   68│
1118 │                                                Puerto Rican, OR        │    0│
1119 │                                                Multiple - cannot choose│    7│
1120 │                                                one                     │     │
1121 │                                                Mexican                 │  311│
1122 │                                                Cuban                   │   20│
1123 │                                                Central American        │    0│
1124 │                                                -1.00                   │   78│
1125 │                                                -2.00                   │   52│
1126 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1127 ])
1128 AT_CLEANUP
1129
1130 AT_SETUP([CTABLES simple nesting])
1131 AT_KEYWORDS([nest nested])
1132 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1133 AT_DATA([ctables.sps],
1134 [[GET 'nhtsa.sav'.
1135 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1136   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1137 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1138   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1139   /CLABELS ROW=OPPOSITE.
1140 ]])
1141 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1142                                   Custom Tables
1143 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1144 │                                                                 │     │ Table│
1145 │                                                                 │Count│   %  │
1146 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1147 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1148 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1149 │drive safely will A. Get stopped by                        Total │  700│   10%│
1150 │the police?                           ╶──────────────────────────┼─────┼──────┤
1151 │                                       Very       S3a.     Male  │  660│   10%│
1152 │                                       likely     GENDER:  Female│  842│   12%│
1153 │                                                           Total │ 1502│   22%│
1154 │                                      ╶──────────────────────────┼─────┼──────┤
1155 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1156 │                                       likely     GENDER:  Female│ 1589│   23%│
1157 │                                                           Total │ 2763│   40%│
1158 │                                      ╶──────────────────────────┼─────┼──────┤
1159 │                                       Somewhat   S3a.     Male  │  640│    9%│
1160 │                                       unlikely   GENDER:  Female│  667│   10%│
1161 │                                                           Total │ 1307│   19%│
1162 │                                      ╶──────────────────────────┼─────┼──────┤
1163 │                                       Very       S3a.     Male  │  311│    5%│
1164 │                                       unlikely   GENDER:  Female│  298│    4%│
1165 │                                                           Total │  609│    9%│
1166 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1167 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1168 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1169 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1170 │                                      ╶──────────────────────────┼─────┼──────┤
1171 │                                       Very       S3a.     Male  │ 1104│   16%│
1172 │                                       likely     GENDER:  Female│ 1715│   25%│
1173 │                                                           Total │ 2819│   41%│
1174 │                                      ╶──────────────────────────┼─────┼──────┤
1175 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1176 │                                       likely     GENDER:  Female│ 1214│   18%│
1177 │                                                           Total │ 2417│   35%│
1178 │                                      ╶──────────────────────────┼─────┼──────┤
1179 │                                       Somewhat   S3a.     Male  │  262│    4%│
1180 │                                       unlikely   GENDER:  Female│  168│    2%│
1181 │                                                           Total │  430│    6%│
1182 │                                      ╶──────────────────────────┼─────┼──────┤
1183 │                                       Very       S3a.     Male  │   81│    1%│
1184 │                                       unlikely   GENDER:  Female│   59│    1%│
1185 │                                                           Total │  140│    2%│
1186 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1187 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1188 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1189 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1190 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1191 │                                       Very       S3a.     Male  │  988│   14%│
1192 │                                       likely     GENDER:  Female│ 1049│   15%│
1193 │                                                           Total │ 2037│   30%│
1194 │                                      ╶──────────────────────────┼─────┼──────┤
1195 │                                       Somewhat   S3a.     Male  │  822│   12%│
1196 │                                       likely     GENDER:  Female│ 1210│   18%│
1197 │                                                           Total │ 2032│   30%│
1198 │                                      ╶──────────────────────────┼─────┼──────┤
1199 │                                       Somewhat   S3a.     Male  │  446│    7%│
1200 │                                       unlikely   GENDER:  Female│  548│    8%│
1201 │                                                           Total │  994│   15%│
1202 │                                      ╶──────────────────────────┼─────┼──────┤
1203 │                                       Very       S3a.     Male  │  268│    4%│
1204 │                                       unlikely   GENDER:  Female│  354│    5%│
1205 │                                                           Total │  622│    9%│
1206 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1207 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1208 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1209 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1210 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1211 │                                       Very       S3a.     Male  │  805│   12%│
1212 │                                       likely     GENDER:  Female│ 1029│   15%│
1213 │                                                           Total │ 1834│   27%│
1214 │                                      ╶──────────────────────────┼─────┼──────┤
1215 │                                       Somewhat   S3a.     Male  │  975│   14%│
1216 │                                       likely     GENDER:  Female│ 1332│   19%│
1217 │                                                           Total │ 2307│   34%│
1218 │                                      ╶──────────────────────────┼─────┼──────┤
1219 │                                       Somewhat   S3a.     Male  │  535│    8%│
1220 │                                       unlikely   GENDER:  Female│  560│    8%│
1221 │                                                           Total │ 1095│   16%│
1222 │                                      ╶──────────────────────────┼─────┼──────┤
1223 │                                       Very       S3a.     Male  │  270│    4%│
1224 │                                       unlikely   GENDER:  Female│  279│    4%│
1225 │                                                           Total │  549│    8%│
1226 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1227
1228                                   Custom Tables
1229 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1230 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1231 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1232 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1233 │                                 │        │ Table│         │         │        │
1234 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1235 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1236 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1237 │GENDER:        is it that drivers│        │      │         │         │        │
1238 │               who have had too  │        │      │         │         │        │
1239 │               much to drink to  │        │      │         │         │        │
1240 │               drive safely will │        │      │         │         │        │
1241 │               A. Get stopped by │        │      │         │         │        │
1242 │               the police?       │        │      │         │         │        │
1243 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1244 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1245 │               is it that drivers│        │      │         │         │        │
1246 │               who have had too  │        │      │         │         │        │
1247 │               much to drink to  │        │      │         │         │        │
1248 │               drive safely will │        │      │         │         │        │
1249 │               A. Get stopped by │        │      │         │         │        │
1250 │               the police?       │        │      │         │         │        │
1251 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1252 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1253 │               is it that drivers│        │      │         │         │        │
1254 │               who have had too  │        │      │         │         │        │
1255 │               much to drink to  │        │      │         │         │        │
1256 │               drive safely will │        │      │         │         │        │
1257 │               A. Get stopped by │        │      │         │         │        │
1258 │               the police?       │        │      │         │         │        │
1259 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1260 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1261 │GENDER:        is it that drivers│        │      │         │         │        │
1262 │               who have had too  │        │      │         │         │        │
1263 │               much to drink to  │        │      │         │         │        │
1264 │               drive safely will │        │      │         │         │        │
1265 │               B. Have an        │        │      │         │         │        │
1266 │               accident?         │        │      │         │         │        │
1267 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1268 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1269 │               is it that drivers│        │      │         │         │        │
1270 │               who have had too  │        │      │         │         │        │
1271 │               much to drink to  │        │      │         │         │        │
1272 │               drive safely will │        │      │         │         │        │
1273 │               B. Have an        │        │      │         │         │        │
1274 │               accident?         │        │      │         │         │        │
1275 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1276 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1277 │               is it that drivers│        │      │         │         │        │
1278 │               who have had too  │        │      │         │         │        │
1279 │               much to drink to  │        │      │         │         │        │
1280 │               drive safely will │        │      │         │         │        │
1281 │               B. Have an        │        │      │         │         │        │
1282 │               accident?         │        │      │         │         │        │
1283 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1284 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1285 │GENDER:        is it that drivers│        │      │         │         │        │
1286 │               who have had too  │        │      │         │         │        │
1287 │               much to drink to  │        │      │         │         │        │
1288 │               drive safely will │        │      │         │         │        │
1289 │               C. Be convicted   │        │      │         │         │        │
1290 │               for drunk driving?│        │      │         │         │        │
1291 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1292 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1293 │               is it that drivers│        │      │         │         │        │
1294 │               who have had too  │        │      │         │         │        │
1295 │               much to drink to  │        │      │         │         │        │
1296 │               drive safely will │        │      │         │         │        │
1297 │               C. Be convicted   │        │      │         │         │        │
1298 │               for drunk driving?│        │      │         │         │        │
1299 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1300 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1301 │               is it that drivers│        │      │         │         │        │
1302 │               who have had too  │        │      │         │         │        │
1303 │               much to drink to  │        │      │         │         │        │
1304 │               drive safely will │        │      │         │         │        │
1305 │               C. Be convicted   │        │      │         │         │        │
1306 │               for drunk driving?│        │      │         │         │        │
1307 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1308 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1309 │GENDER:        is it that drivers│        │      │         │         │        │
1310 │               who have had too  │        │      │         │         │        │
1311 │               much to drink to  │        │      │         │         │        │
1312 │               drive safely will │        │      │         │         │        │
1313 │               D. Be arrested for│        │      │         │         │        │
1314 │               drunk driving?    │        │      │         │         │        │
1315 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1316 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1317 │               is it that drivers│        │      │         │         │        │
1318 │               who have had too  │        │      │         │         │        │
1319 │               much to drink to  │        │      │         │         │        │
1320 │               drive safely will │        │      │         │         │        │
1321 │               D. Be arrested for│        │      │         │         │        │
1322 │               drunk driving?    │        │      │         │         │        │
1323 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1324 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1325 │               is it that drivers│        │      │         │         │        │
1326 │               who have had too  │        │      │         │         │        │
1327 │               much to drink to  │        │      │         │         │        │
1328 │               drive safely will │        │      │         │         │        │
1329 │               D. Be arrested for│        │      │         │         │        │
1330 │               drunk driving?    │        │      │         │         │        │
1331 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1332 ])
1333 AT_CLEANUP
1334
1335 AT_SETUP([CTABLES nesting and scale variables])
1336 AT_KEYWORDS([nest nested])
1337 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1338 AT_DATA([ctables.sps],
1339 [[GET 'nhtsa.sav'.
1340 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1341 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1342 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1343   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1344 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1345 ]])
1346 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1347                                   Custom Tables
1348 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1349 │                                                                 │S3a. GENDER:│
1350 │                                                                 ├─────┬──────┤
1351 │                                                                 │ Male│Female│
1352 │                                                                 ├─────┼──────┤
1353 │                                                                 │ Mean│ Mean │
1354 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1355 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1356 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1357 │                                                  week           │     │      │
1358 │                                                  Once a week or │   44│    54│
1359 │                                                  less           │     │      │
1360 │                                                  Only certain   │   34│    41│
1361 │                                                  times a year   │     │      │
1362 │                                                  Never          │   39│    55│
1363 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1364
1365                                   Custom Tables
1366 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1367 │                                                         │Minimum│Maximum│Mean│
1368 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1369 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1370 │What is  GENDER:         months, has there been a        │       │       │    │
1371 │your                     time when you felt you          │       │       │    │
1372 │age?                     should cut down on your      No │     16│     86│  46│
1373 │                         drinking?                       │       │       │    │
1374 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1375 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1376 │                         months, has there been a        │       │       │    │
1377 │                         time when you felt you          │       │       │    │
1378 │                         should cut down on your      No │     16│     86│  48│
1379 │                         drinking?                       │       │       │    │
1380 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1381 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1382 │What is  GENDER:         months, has there been a        │       │       │    │
1383 │your                     time when people criticized  No │     16│     86│  46│
1384 │age?                     your drinking?                  │       │       │    │
1385 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1386 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1387 │                         months, has there been a        │       │       │    │
1388 │                         time when people criticized  No │     16│     86│  48│
1389 │                         your drinking?                  │       │       │    │
1390 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1391
1392                                   Custom Tables
1393 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1394 │                             │S1. Including yourself, how many members of this│
1395 │                             │         household are age 16 or older?         │
1396 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1397 │                             │      │      │      │      │      │      │ 6 or │
1398 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1399 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1400 │                             │Column│Column│Column│Column│Column│Column│Column│
1401 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1402 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1403 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1404 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1405 │SOURCE:     likely           │      │      │      │      │      │      │      │
1406 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1407 │            that     likely  │      │      │      │      │      │      │      │
1408 │            drivers          │      │      │      │      │      │      │      │
1409 │            who have         │      │      │      │      │      │      │      │
1410 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1411 │            much to  likely  │      │      │      │      │      │      │      │
1412 │            drink to         │      │      │      │      │      │      │      │
1413 │            drive            │      │      │      │      │      │      │      │
1414 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1415 │            will A.  unlikely│      │      │      │      │      │      │      │
1416 │            Get              │      │      │      │      │      │      │      │
1417 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1418 │            by the   unlikely│      │      │      │      │      │      │      │
1419 │            police?          │      │      │      │      │      │      │      │
1420 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1421
1422                                   Custom Tables
1423 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1424 │                                                              │    │    Std   │
1425 │                                                              │Mean│ Deviation│
1426 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1427 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1428 │group           typical month did you have one or more        │    │          │
1429 │                alcoholic beverages to drink?                 │    │          │
1430 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1431 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1432 │                typical month did you have one or more        │    │          │
1433 │                alcoholic beverages to drink?                 │    │          │
1434 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1435 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1436 │                typical month did you have one or more        │    │          │
1437 │                alcoholic beverages to drink?                 │    │          │
1438 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1439 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1440 │                typical month did you have one or more        │    │          │
1441 │                alcoholic beverages to drink?                 │    │          │
1442 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1443 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1444 │                typical month did you have one or more        │    │          │
1445 │                alcoholic beverages to drink?                 │    │          │
1446 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1447 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1448 │       older    typical month did you have one or more        │    │          │
1449 │                alcoholic beverages to drink?                 │    │          │
1450 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1451 ])
1452 AT_CLEANUP
1453
1454
1455 AT_SETUP([CTABLES SLABELS])
1456 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1457 AT_DATA([ctables.sps],
1458 [[GET 'nhtsa.sav'.
1459 CTABLES /TABLE qn1 [COUNT COLPCT].
1460 CTABLES /TABLE qn1 [COUNT COLPCT]
1461     /SLABELS POSITION=ROW.
1462 CTABLES /TABLE qn1 [COUNT COLPCT]
1463     /SLABELS POSITION=ROW VISIBLE=NO.
1464 ]])
1465 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1466                                   Custom Tables
1467 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1468 │                                                                │     │ Column│
1469 │                                                                │Count│   %   │
1470 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1471 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1472 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1473 │                                             Once a week or less│  361│   5.2%│
1474 │                                             Only certain times │  130│   1.9%│
1475 │                                             a year             │     │       │
1476 │                                             Never              │  540│   7.7%│
1477 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1478
1479                                   Custom Tables
1480 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1481 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1482 │other motor vehicle?                                             Column │66.9%│
1483 │                                                                 %      │     │
1484 │                                            ╶───────────────────────────┼─────┤
1485 │                                             Several days a week Count  │ 1274│
1486 │                                                                 Column │18.3%│
1487 │                                                                 %      │     │
1488 │                                            ╶───────────────────────────┼─────┤
1489 │                                             Once a week or less Count  │  361│
1490 │                                                                 Column │ 5.2%│
1491 │                                                                 %      │     │
1492 │                                            ╶───────────────────────────┼─────┤
1493 │                                             Only certain times  Count  │  130│
1494 │                                             a year              Column │ 1.9%│
1495 │                                                                 %      │     │
1496 │                                            ╶───────────────────────────┼─────┤
1497 │                                             Never               Count  │  540│
1498 │                                                                 Column │ 7.7%│
1499 │                                                                 %      │     │
1500 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1501
1502                                   Custom Tables
1503 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1504 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1505 │motor vehicle?                                                          │66.9%│
1506 │                                                   Several days a week  │ 1274│
1507 │                                                                        │18.3%│
1508 │                                                   Once a week or less  │  361│
1509 │                                                                        │ 5.2%│
1510 │                                                   Only certain times a │  130│
1511 │                                                   year                 │ 1.9%│
1512 │                                                   Never                │  540│
1513 │                                                                        │ 7.7%│
1514 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1515 ])
1516 AT_CLEANUP
1517
1518 AT_SETUP([CTABLES simple totals])
1519 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1520 AT_DATA([ctables.sps],
1521 [[GET 'nhtsa.sav'.
1522 CTABLES /TABLE=qn17
1523     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1524 DESCRIPTIVES qn18/STATISTICS=MEAN.
1525 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1526     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1527 ]])
1528 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1529                                   Custom Tables
1530 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1531 │                                                                        │Count│
1532 ├────────────────────────────────────────────────────────────────────────┼─────┤
1533 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1534 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1535 │                                                      Light beer        │  620│
1536 │                                                      Wine              │ 1418│
1537 │                                                      Wine coolers      │  137│
1538 │                                                      Hard liquor or    │  888│
1539 │                                                      mixed drinks      │     │
1540 │                                                      Flavored malt     │   83│
1541 │                                                      drinks            │     │
1542 │                                                      Number responding │ 4221│
1543 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1544
1545                              Descriptive Statistics
1546 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1547 │                                                                    │  N │Mean│
1548 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1549 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1550 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1551 │Valid N (listwise)                                                  │6999│    │
1552 │Missing N (listwise)                                                │2781│    │
1553 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1554
1555                                   Custom Tables
1556 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1557 │                                                      │    │     │ Valid│Total│
1558 │                                                      │Mean│Count│   N  │  N  │
1559 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1560 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1561 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1562 │                you usually drink per sitting?        │    │     │      │     │
1563 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1564 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1565 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1566 │                you usually drink per sitting?        │    │     │      │     │
1567 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1568 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1569 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1570 │                you usually drink per sitting?        │    │     │      │     │
1571 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1572 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1573 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1574 │                you usually drink per sitting?        │    │     │      │     │
1575 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1576 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1577 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1578 │                you usually drink per sitting?        │    │     │      │     │
1579 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1580 ])
1581 AT_CLEANUP
1582
1583 AT_SETUP([CTABLES subtotals])
1584 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1585 AT_DATA([ctables.sps],
1586 [[GET 'nhtsa.sav'.
1587 CTABLES /TABLE=qn105ba BY qns1
1588     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1589 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1590     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1591 CTABLES /TABLE=qn105ba BY qns1
1592     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1593     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1594 ]])
1595 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1596                                                       Custom Tables
1597 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1598 │                                                         │ S1. Including yourself, how many members of this household │
1599 │                                                         │                    are age 16 or older?                    │
1600 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1601 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1602 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1603 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1604 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1605 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1606 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1607 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1608 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1609 │                                              likely     │       │       │         │       │        │      │          │
1610 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1611 │                                              unlikely   │       │       │         │       │        │      │          │
1612 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1613 │                                              unlikely   │       │       │         │       │        │      │          │
1614 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1615
1616                                                       Custom Tables
1617 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1618 │                                                        │  S1. Including yourself, how many members of this household │
1619 │                                                        │                     are age 16 or older?                    │
1620 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1621 │                                                        │        │        │        │        │       │        │  6 or  │
1622 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1623 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1624 │                                                        │        │        │        │        │ Column│        │        │
1625 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1626 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1627 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1628 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1629 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1630 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1631 │                                             likely     │        │        │        │        │       │        │        │
1632 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1633 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1634 │                                             unlikely   │        │        │        │        │       │        │        │
1635 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1636 │                                             unlikely   │        │        │        │        │       │        │        │
1637 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1638 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1639
1640                                                       Custom Tables
1641 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1642 │                                                         │ S1. Including yourself, how many members of this household │
1643 │                                                         │                    are age 16 or older?                    │
1644 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1645 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1646 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1647 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1648 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1649 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1650 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1651 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1652 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1653 │                                              likely     │       │       │         │       │        │      │          │
1654 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1655 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1656 │                                              unlikely   │       │       │         │       │        │      │          │
1657 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1658 │                                              unlikely   │       │       │         │       │        │      │          │
1659 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1660 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1661 ])
1662 AT_CLEANUP
1663
1664 AT_SETUP([CTABLES PCOMPUTE])
1665 AT_KEYWORDS([postcompute])
1666 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1667 AT_DATA([ctables.sps],
1668 [[GET 'nhtsa.sav'.
1669 CTABLES
1670     /PCOMPUTE &x=EXPR([3] + [4])
1671     /PCOMPUTE &y=EXPR([4] + [5])
1672     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1673     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1674     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1675     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1676
1677 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1678 CTABLES
1679     /PCOMPUTE &x=EXPR([3] + [4])
1680     /PCOMPUTE &y=EXPR([4] + [5])
1681     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1682     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1683     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1684     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1685 ]])
1686 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1687                                                                 Custom Tables
1688 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1689 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1690 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1691 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1692 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1693 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1694 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1695 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1696 │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%│
1697 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1698 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1699 │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%│
1700 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1701 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1702 │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%│
1703 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1704 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1705 │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%│
1706 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1707 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1708 │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%│
1709 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1710 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1711 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1712
1713                                                                 Custom Tables
1714 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1715 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1716 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1717 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1718 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1719 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1720 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1721 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1722 │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%│
1723 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1724 │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%│
1725 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1726 │                               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%│
1727 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1728 │                               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%│
1729 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1730 │                               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%│
1731 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1732 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1733 ])
1734 AT_CLEANUP
1735
1736 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1737 AT_KEYWORDS([postcompute])
1738 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1739 AT_DATA([ctables.sps],
1740 [[GET 'nhtsa.sav'.
1741 CTABLES
1742     /PCOMPUTE &x=EXPR(OTHERNM)
1743     /PCOMPUTE &y=EXPR(MISSING)
1744     /PPROPERTIES &x LABEL='Drivers'
1745     /PPROPERTIES &y LABEL='Missing Values 2'
1746     /TABLE=qn1 BY qns3a
1747     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1748 ]])
1749 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1750                                               Custom Tables
1751 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1752 │                                                                                          │S3a. GENDER:│
1753 │                                                                                          ├─────┬──────┤
1754 │                                                                                          │ Male│Female│
1755 │                                                                                          ├─────┼──────┤
1756 │                                                                                          │Count│ Count│
1757 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1758 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1759 │                                                                 Several days a week      │  440│   834│
1760 │                                                                 Once a week or less      │  125│   236│
1761 │                                                                 Only certain times a year│   58│    72│
1762 │                                                                 Never                    │  192│   348│
1763 │                                                                 Drivers                  │ 2928│  3504│
1764 │                                                                 Valid Values             │ 3120│  3852│
1765 │                                                                 Don't know               │    3│     5│
1766 │                                                                 Refused                  │    9│    10│
1767 │                                                                 Missing Values           │   12│    15│
1768 │                                                                 Missing Values 2         │   12│    15│
1769 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1770 ])
1771 AT_CLEANUP
1772
1773 AT_SETUP([CTABLES PCOMPUTE - THRU])
1774 AT_KEYWORDS([postcompute])
1775 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1776 AT_DATA([ctables.sps],
1777 [[GET 'nhtsa.sav'.
1778 CTABLES
1779     /PCOMPUTE &x=EXPR([1 THRU 2])
1780     /PCOMPUTE &y=EXPR([3 THRU 4])
1781     /PCOMPUTE &z=EXPR([5] + MISSING)
1782     /PPROPERTIES &x LABEL='Frequent Drivers'
1783     /PPROPERTIES &y LABEL='Infrequent Drivers'
1784     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1785     /TABLE=qn1 BY qns3a
1786     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1787 ]])
1788 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1789                                               Custom Tables
1790 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1791 │                                                                                          │S3a. GENDER:│
1792 │                                                                                          ├─────┬──────┤
1793 │                                                                                          │ Male│Female│
1794 │                                                                                          ├─────┼──────┤
1795 │                                                                                          │Count│ Count│
1796 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1797 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1798 │                                                                 Several days a week      │  440│   834│
1799 │                                                                 Frequent Drivers         │ 2745│  3196│
1800 │                                                                 Once a week or less      │  125│   236│
1801 │                                                                 Only certain times a year│   58│    72│
1802 │                                                                 Infrequent Drivers       │  183│   308│
1803 │                                                                 Drivers                  │ 2928│  3504│
1804 │                                                                 Never                    │  192│   348│
1805 │                                                                 Don't know               │    3│     5│
1806 │                                                                 Refused                  │    9│    10│
1807 │                                                                 Not Drivers or Missing   │  204│   363│
1808 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1809 ])
1810 AT_CLEANUP
1811
1812 dnl I'm not sure that this is the correct behavior (see
1813 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1814 dnl but at least this test will notify us if the behavior changes.
1815 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1816 AT_KEYWORDS([PCOMPUTE postcompute])
1817 AT_DATA([ctables.sps],
1818 [[DATA LIST LIST NOTABLE/x y z.
1819 WEIGHT by z.
1820 FORMATS ALL (F1.0).
1821 VARIABLE LEVEL x y (NOMINAL).
1822 BEGIN DATA.
1823 1 4 5
1824 1 5 2
1825 1 6 9
1826 2 4 2
1827 2 5 3
1828 2 6 4
1829 3 4 1
1830 3 5 6
1831 3 6 1
1832 END DATA.
1833
1834 CTABLES
1835     /PCOMPUTE &a = EXPR([1] + [2])
1836     /PCOMPUTE &b = EXPR([2] + [3])
1837     /PCOMPUTE &c = EXPR([4] * [5])
1838     /PCOMPUTE &d = EXPR([5] * [6])
1839     /TABLE x BY y
1840     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1841     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1842 ]])
1843 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1844 [[                   Custom Tables
1845 ╭───────────┬─────────────────────────────────────╮
1846 │           │                  y                  │
1847 │           ├─────┬─────────┬─────┬─────────┬─────┤
1848 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
1849 │           ├─────┼─────────┼─────┼─────────┼─────┤
1850 │           │Count│  Count  │Count│  Count  │Count│
1851 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1852 │x 1        │    5│       10│    2│       18│    9│
1853 │  [1] + [2]│    7│        .│    5│        .│   13│
1854 │  2        │    2│        6│    3│       12│    4│
1855 │  [2] + [3]│    3│        .│    9│        .│    5│
1856 │  3        │    1│        6│    6│        6│    1│
1857 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1858 ]])
1859 AT_CLEANUP
1860
1861 AT_SETUP([CTABLES string and date and time])
1862
1863 weight=1
1864 for gender in F M; do
1865     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1866         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1867             printf "$weight $gender $month $wkday\n"
1868             weight=$(expr \( $weight + 3 \) % 7 + 2)
1869         done
1870     done
1871 done > ctables.txt
1872
1873 AT_DATA([ctables.sps],
1874 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1875     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1876 WEIGHT by w.
1877 VARIABLE LEVEL w (SCALE).
1878 VARIABLE LEVEL gender fmon fday (NOMINAL).
1879 VARIABLE LABEL
1880   gender 'Gender'
1881   fmon 'Favorite month'
1882   fday 'Favorite day of the week'.
1883 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1884 CTABLES
1885     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1886     /PPROPERTIES &q2 LABEL='Q2'
1887     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1888     /PPROPERTIES &weekend LABEL='Weekend'
1889     /TABLE fmon BY gender > fday
1890     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1891                                 4 THRU 6, &q2,
1892                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
1893                                 OTHERNM, SUBTOTAL='Q4']
1894     /CATEGORIES VARIABLES=gender ['M', 'F']
1895     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1896     /SLABELS VISIBLE=NO.
1897 ]])
1898 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1899                                               Custom Tables
1900 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1901 │                  │                                       Gender                                      │
1902 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1903 │                  │                   Male                  │                  Female                 │
1904 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1905 │                  │         Favorite day of the week        │         Favorite day of the week        │
1906 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1907 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1908 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1909 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
1910 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1911 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1912 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
1913 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1914 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1915 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
1916 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
1917 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
1918 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
1919 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1920 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
1921 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1922 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1923 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1924 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
1925 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1926 ])
1927 AT_CLEANUP
1928
1929 AT_SETUP([CTABLES CLABELS])
1930 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1931 AT_DATA([ctables.sps],
1932 [[GET 'nhtsa.sav'.
1933 CTABLES /TABLE AgeGroup BY qns3a.
1934 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1935 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1936 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1937 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1938 ]])
1939 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1940              Custom Tables
1941 ╭───────────────────────┬────────────╮
1942 │                       │S3a. GENDER:│
1943 │                       ├─────┬──────┤
1944 │                       │ Male│Female│
1945 │                       ├─────┼──────┤
1946 │                       │Count│ Count│
1947 ├───────────────────────┼─────┼──────┤
1948 │Age group 15 or younger│    0│     0│
1949 │          16 to 25     │  594│   505│
1950 │          26 to 35     │  476│   491│
1951 │          36 to 45     │  489│   548│
1952 │          46 to 55     │  526│   649│
1953 │          56 to 65     │  516│   731│
1954 │          66 or older  │  531│   943│
1955 ╰───────────────────────┴─────┴──────╯
1956
1957                                                       Custom Tables
1958 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1959 │       │                                                 S3a. GENDER:                                                 │
1960 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1961 │       │                         Male                         │                         Female                        │
1962 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1963 │       │  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 │
1964 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1965 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1966 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1967 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1968 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1969 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1970 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1971
1972                 Custom Tables
1973 ╭──────────────────────────────┬────────────╮
1974 │                              │S3a. GENDER:│
1975 │                              ├────────────┤
1976 │                              │    Count   │
1977 ├──────────────────────────────┼────────────┤
1978 │Age group 15 or younger Male  │           0│
1979 │                        Female│           0│
1980 │         ╶────────────────────┼────────────┤
1981 │          16 to 25      Male  │         594│
1982 │                        Female│         505│
1983 │         ╶────────────────────┼────────────┤
1984 │          26 to 35      Male  │         476│
1985 │                        Female│         491│
1986 │         ╶────────────────────┼────────────┤
1987 │          36 to 45      Male  │         489│
1988 │                        Female│         548│
1989 │         ╶────────────────────┼────────────┤
1990 │          46 to 55      Male  │         526│
1991 │                        Female│         649│
1992 │         ╶────────────────────┼────────────┤
1993 │          56 to 65      Male  │         516│
1994 │                        Female│         731│
1995 │         ╶────────────────────┼────────────┤
1996 │          66 or older   Male  │         531│
1997 │                        Female│         943│
1998 ╰──────────────────────────────┴────────────╯
1999
2000       Custom Tables
2001 15 or younger
2002 ╭─────────┬────────────╮
2003 │         │S3a. GENDER:│
2004 │         ├─────┬──────┤
2005 │         │ Male│Female│
2006 │         ├─────┼──────┤
2007 │         │Count│ Count│
2008 ├─────────┼─────┼──────┤
2009 │Age group│    0│     0│
2010 ╰─────────┴─────┴──────╯
2011
2012       Custom Tables
2013 16 to 25
2014 ╭─────────┬────────────╮
2015 │         │S3a. GENDER:│
2016 │         ├─────┬──────┤
2017 │         │ Male│Female│
2018 │         ├─────┼──────┤
2019 │         │Count│ Count│
2020 ├─────────┼─────┼──────┤
2021 │Age group│  594│   505│
2022 ╰─────────┴─────┴──────╯
2023
2024       Custom Tables
2025 26 to 35
2026 ╭─────────┬────────────╮
2027 │         │S3a. GENDER:│
2028 │         ├─────┬──────┤
2029 │         │ Male│Female│
2030 │         ├─────┼──────┤
2031 │         │Count│ Count│
2032 ├─────────┼─────┼──────┤
2033 │Age group│  476│   491│
2034 ╰─────────┴─────┴──────╯
2035
2036       Custom Tables
2037 36 to 45
2038 ╭─────────┬────────────╮
2039 │         │S3a. GENDER:│
2040 │         ├─────┬──────┤
2041 │         │ Male│Female│
2042 │         ├─────┼──────┤
2043 │         │Count│ Count│
2044 ├─────────┼─────┼──────┤
2045 │Age group│  489│   548│
2046 ╰─────────┴─────┴──────╯
2047
2048       Custom Tables
2049 46 to 55
2050 ╭─────────┬────────────╮
2051 │         │S3a. GENDER:│
2052 │         ├─────┬──────┤
2053 │         │ Male│Female│
2054 │         ├─────┼──────┤
2055 │         │Count│ Count│
2056 ├─────────┼─────┼──────┤
2057 │Age group│  526│   649│
2058 ╰─────────┴─────┴──────╯
2059
2060       Custom Tables
2061 56 to 65
2062 ╭─────────┬────────────╮
2063 │         │S3a. GENDER:│
2064 │         ├─────┬──────┤
2065 │         │ Male│Female│
2066 │         ├─────┼──────┤
2067 │         │Count│ Count│
2068 ├─────────┼─────┼──────┤
2069 │Age group│  516│   731│
2070 ╰─────────┴─────┴──────╯
2071
2072       Custom Tables
2073 66 or older
2074 ╭─────────┬────────────╮
2075 │         │S3a. GENDER:│
2076 │         ├─────┬──────┤
2077 │         │ Male│Female│
2078 │         ├─────┼──────┤
2079 │         │Count│ Count│
2080 ├─────────┼─────┼──────┤
2081 │Age group│  531│   943│
2082 ╰─────────┴─────┴──────╯
2083
2084              Custom Tables
2085 Male
2086 ╭───────────────────────┬────────────╮
2087 │                       │S3a. GENDER:│
2088 │                       ├────────────┤
2089 │                       │    Count   │
2090 ├───────────────────────┼────────────┤
2091 │Age group 15 or younger│           0│
2092 │          16 to 25     │         594│
2093 │          26 to 35     │         476│
2094 │          36 to 45     │         489│
2095 │          46 to 55     │         526│
2096 │          56 to 65     │         516│
2097 │          66 or older  │         531│
2098 ╰───────────────────────┴────────────╯
2099
2100              Custom Tables
2101 Female
2102 ╭───────────────────────┬────────────╮
2103 │                       │S3a. GENDER:│
2104 │                       ├────────────┤
2105 │                       │    Count   │
2106 ├───────────────────────┼────────────┤
2107 │Age group 15 or younger│           0│
2108 │          16 to 25     │         505│
2109 │          26 to 35     │         491│
2110 │          36 to 45     │         548│
2111 │          46 to 55     │         649│
2112 │          56 to 65     │         731│
2113 │          66 or older  │         943│
2114 ╰───────────────────────┴────────────╯
2115 ])
2116 AT_CLEANUP
2117
2118 AT_SETUP([CTABLES missing values])
2119 AT_DATA([ctables.sps],
2120 [[DATA LIST LIST NOTABLE/x y.
2121 BEGIN DATA.
2122 1 1
2123 1 2
2124 1 3
2125 1 4
2126 1 5
2127 1 .
2128 2 1
2129 2 2
2130 2 3
2131 2 4
2132 2 5
2133 2 .
2134 3 1
2135 3 2
2136 3 3
2137 3 4
2138 3 5
2139 3 .
2140 4 1
2141 4 2
2142 4 3
2143 4 4
2144 4 5
2145 4 .
2146 5 1
2147 5 2
2148 5 3
2149 5 4
2150 5 5
2151 5 .
2152 . 1
2153 . 2
2154 . 3
2155 . 4
2156 . 5
2157 . .
2158 END DATA.
2159 MISSING VALUES x (1, 2) y (2, 3).
2160 VARIABLE LEVEL ALL (NOMINAL).
2161
2162 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2163                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2164     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2165 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2166                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2167     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2168 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2169                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2170     /CATEGORIES VARIABLES=ALL TOTAL=YES
2171     /SLABELS POSITION=ROW.
2172 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2173                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2174     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2175     /SLABELS POSITION=ROW.
2176 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2177                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2178     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2179     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2180     /SLABELS POSITION=ROW.
2181 ]])
2182 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2183                                Custom Tables
2184 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2185 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2186 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2187 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2188 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2189 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2190 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2191 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2192 dnl Note that Column Total N % doesn't add up to 100 because missing
2193 dnl values are included in the total but not shown as a category and this
2194 dnl is expected behavior.
2195
2196                                Custom Tables
2197 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2198 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2199 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2200 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2201 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2202 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2203 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2204 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2205 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2206 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2207 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2208 dnl values are included in the total but not shown as a category and this
2209 dnl is expected behavior.
2210
2211                      Custom Tables
2212 ╭────────────────────────┬───────────────────────────╮
2213 │                        │             y             │
2214 │                        ├──────┬──────┬──────┬──────┤
2215 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2216 ├────────────────────────┼──────┼──────┼──────┼──────┤
2217 │x 3.00  Count           │     1│     1│     1│     3│
2218 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2219 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2220 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2221 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2222 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2223 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2224 │        Valid N         │      │      │      │     3│
2225 │        Total N         │      │      │      │     6│
2226 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2227 │  4.00  Count           │     1│     1│     1│     3│
2228 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2229 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2230 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2231 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2232 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2233 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2234 │        Valid N         │      │      │      │     3│
2235 │        Total N         │      │      │      │     6│
2236 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2237 │  5.00  Count           │     1│     1│     1│     3│
2238 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2239 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2240 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2241 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2242 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2243 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2244 │        Valid N         │      │      │      │     3│
2245 │        Total N         │      │      │      │     6│
2246 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2247 │  Total Count           │     3│     3│     3│     9│
2248 │        Column %        │100.0%│100.0%│100.0%│     .│
2249 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2250 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2251 │        Row %           │     .│     .│     .│     .│
2252 │        Row Valid N %   │     .│     .│     .│     .│
2253 │        Row Total N %   │     .│     .│     .│     .│
2254 │        Valid N         │     3│     3│     3│     9│
2255 │        Total N         │     3│     3│     3│    18│
2256 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2257
2258                             Custom Tables
2259 ╭────────────────────────┬─────────────────────────────────────────╮
2260 │                        │                    y                    │
2261 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2262 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2263 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2264 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2265 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2266 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2267 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2268 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2269 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2270 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2271 │        Valid N         │      │      │      │      │      │     3│
2272 │        Total N         │      │      │      │      │      │     6│
2273 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2274 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2275 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2276 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2277 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2278 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2279 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2280 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2281 │        Valid N         │      │      │      │      │      │     3│
2282 │        Total N         │      │      │      │      │      │     6│
2283 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2284 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2285 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2286 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2287 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2288 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2289 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2290 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2291 │        Valid N         │      │      │      │      │      │     3│
2292 │        Total N         │      │      │      │      │      │     6│
2293 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2294 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2295 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2296 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2297 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2298 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2299 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2300 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2301 │        Valid N         │      │      │      │      │      │     3│
2302 │        Total N         │      │      │      │      │      │     6│
2303 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2304 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2305 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2306 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2307 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2308 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2309 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2310 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2311 │        Valid N         │      │      │      │      │      │     3│
2312 │        Total N         │      │      │      │      │      │     6│
2313 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2314 │  Total Count           │     5│     5│     5│     5│     5│    25│
2315 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2316 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2317 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2318 │        Row %           │     .│     .│     .│     .│     .│     .│
2319 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2320 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2321 │        Valid N         │     5│     0│     0│     5│     5│    15│
2322 │        Total N         │     5│     5│     5│     5│     5│    30│
2323 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2324
2325                         Custom Tables
2326 ╭────────────────────────┬──────────────────────────────────╮
2327 │                        │                 y                │
2328 │                        ├──────┬──────┬──────┬──────┬──────┤
2329 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2330 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2331 │x 1.00  Count           │     1│     1│     1│     1│     4│
2332 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2333 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2334 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2335 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2336 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2337 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2338 │        Valid N         │      │      │      │      │     3│
2339 │        Total N         │      │      │      │      │     6│
2340 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2341 │  2.00  Count           │     1│     1│     1│     1│     4│
2342 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2343 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2344 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2345 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2346 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2347 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2348 │        Valid N         │      │      │      │      │     3│
2349 │        Total N         │      │      │      │      │     6│
2350 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2351 │  3.00  Count           │     1│     1│     1│     1│     4│
2352 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2353 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2354 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2355 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2356 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2357 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2358 │        Valid N         │      │      │      │      │     3│
2359 │        Total N         │      │      │      │      │     6│
2360 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2361 │  4.00  Count           │     1│     1│     1│     1│     4│
2362 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2363 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2364 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2365 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2366 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2367 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2368 │        Valid N         │      │      │      │      │     3│
2369 │        Total N         │      │      │      │      │     6│
2370 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2371 │  Total Count           │     4│     4│     4│     4│    16│
2372 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2373 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2374 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2375 │        Row %           │     .│     .│     .│     .│     .│
2376 │        Row Valid N %   │     .│     .│     .│     .│     .│
2377 │        Row Total N %   │     .│     .│     .│     .│     .│
2378 │        Valid N         │     4│     0│     4│     4│    12│
2379 │        Total N         │     4│     4│     4│     4│    24│
2380 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2381 ])
2382 AT_CLEANUP
2383
2384 AT_SETUP([CTABLES SMISSING=LISTWISE])
2385 AT_KEYWORDS([SMISSING LISTWISE])
2386 AT_DATA([ctables.sps],
2387 [[DATA LIST LIST NOTABLE/x y z.
2388 BEGIN DATA.
2389 1  . 40
2390 1 10 50
2391 1 20 60
2392 1  .  .
2393 1 30  .
2394 END DATA.
2395 VARIABLE LEVEL x (NOMINAL).
2396
2397 CTABLES /TABLE (y + z) > x.
2398 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2399
2400 * The following doesn't come out as listwise because the tables are
2401 separate, not linked by an > operator.
2402 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2403 ]])
2404 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2405   Custom Tables
2406 ╭────────┬─────╮
2407 │        │ Mean│
2408 ├────────┼─────┤
2409 │y x 1.00│20.00│
2410 ├────────┼─────┤
2411 │z x 1.00│50.00│
2412 ╰────────┴─────╯
2413
2414   Custom Tables
2415 ╭────────┬─────╮
2416 │        │ Mean│
2417 ├────────┼─────┤
2418 │y x 1.00│15.00│
2419 ├────────┼─────┤
2420 │z x 1.00│55.00│
2421 ╰────────┴─────╯
2422
2423   Custom Tables
2424 ╭────────┬─────╮
2425 │        │ Mean│
2426 ├────────┼─────┤
2427 │y x 1.00│20.00│
2428 ├────────┼─────┤
2429 │z x 1.00│50.00│
2430 ╰────────┴─────╯
2431 ])
2432 AT_CLEANUP
2433
2434 AT_SETUP([CTABLES VLABELS - variables on different axes])
2435 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2436 AT_DATA([ctables.sps],
2437 [[GET 'nhtsa.sav'.
2438 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2439 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2440 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2441 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2442 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2443 ]])
2444 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2445                                  Custom Tables
2446 ╭────────────────────────────────────────────────────────────────┬────────────╮
2447 │                                                                │S3a. GENDER:│
2448 │                                                                ├─────┬──────┤
2449 │                                                                │ Male│Female│
2450 │                                                                ├─────┼──────┤
2451 │                                                                │Count│ Count│
2452 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2453 │D5a. What would you say is your primary    Cuban                │   13│     7│
2454 │ethnic background?                         Mexican              │  175│   136│
2455 │                                           Spanish              │   20│    28│
2456 │                                           South American       │   21│    13│
2457 │                                           Central American     │   27│    25│
2458 │                                           Puerto Rican, OR     │   37│    41│
2459 │                                           Something else       │   35│    33│
2460 │                                           Multiple - cannot    │    2│     5│
2461 │                                           choose one           │     │      │
2462 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2463
2464                   Custom Tables
2465 ╭──────────────────────────────────┬────────────╮
2466 │                                  │    QNS3A   │
2467 │                                  ├─────┬──────┤
2468 │                                  │ Male│Female│
2469 │                                  ├─────┼──────┤
2470 │                                  │Count│ Count│
2471 ├──────────────────────────────────┼─────┼──────┤
2472 │QND5A Cuban                       │   13│     7│
2473 │      Mexican                     │  175│   136│
2474 │      Spanish                     │   20│    28│
2475 │      South American              │   21│    13│
2476 │      Central American            │   27│    25│
2477 │      Puerto Rican, OR            │   37│    41│
2478 │      Something else              │   35│    33│
2479 │      Multiple - cannot choose one│    2│     5│
2480 ╰──────────────────────────────────┴─────┴──────╯
2481
2482                                  Custom Tables
2483 ╭────────────────────────────────────────────────────────────────┬────────────╮
2484 │                                                                │S3a. GENDER:│
2485 │                                                                ├─────┬──────┤
2486 │                                                                │ Male│Female│
2487 │                                                                ├─────┼──────┤
2488 │                                                                │Count│ Count│
2489 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2490 │D5a. What would you say is your primary    Cuban                │   13│     7│
2491 │ethnic background?                         Mexican              │  175│   136│
2492 │                                           Spanish              │   20│    28│
2493 │                                           South American       │   21│    13│
2494 │                                           Central American     │   27│    25│
2495 │                                           Puerto Rican, OR     │   37│    41│
2496 │                                           Something else       │   35│    33│
2497 │                                           Multiple - cannot    │    2│     5│
2498 │                                           choose one           │     │      │
2499 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2500
2501                                  Custom Tables
2502 ╭────────────────────────────────────────────────────────────┬────────────────╮
2503 │                                                            │   QNS3A S3a.   │
2504 │                                                            │     GENDER:    │
2505 │                                                            ├───────┬────────┤
2506 │                                                            │  Male │ Female │
2507 │                                                            ├───────┼────────┤
2508 │                                                            │ Count │  Count │
2509 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2510 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2511 │primary ethnic background?               Mexican            │    175│     136│
2512 │                                         Spanish            │     20│      28│
2513 │                                         South American     │     21│      13│
2514 │                                         Central American   │     27│      25│
2515 │                                         Puerto Rican, OR   │     37│      41│
2516 │                                         Something else     │     35│      33│
2517 │                                         Multiple - cannot  │      2│       5│
2518 │                                         choose one         │       │        │
2519 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2520
2521                Custom Tables
2522 ╭────────────────────────────┬─────┬──────╮
2523 │                            │ Male│Female│
2524 │                            ├─────┼──────┤
2525 │                            │Count│ Count│
2526 ├────────────────────────────┼─────┼──────┤
2527 │Cuban                       │   13│     7│
2528 │Mexican                     │  175│   136│
2529 │Spanish                     │   20│    28│
2530 │South American              │   21│    13│
2531 │Central American            │   27│    25│
2532 │Puerto Rican, OR            │   37│    41│
2533 │Something else              │   35│    33│
2534 │Multiple - cannot choose one│    2│     5│
2535 ╰────────────────────────────┴─────┴──────╯
2536 ])
2537 AT_CLEANUP
2538
2539 AT_SETUP([CTABLES VLABELS - stacked variables])
2540 AT_KEYWORDS([stack stacking])
2541 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2542 AT_DATA([ctables.sps],
2543 [[GET 'nhtsa.sav'.
2544 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2545 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2546 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2547 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2548 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2549 ]])
2550 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2551                                  Custom Tables
2552 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2553 │                                                                       │Count│
2554 ├───────────────────────────────────────────────────────────────────────┼─────┤
2555 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2556 │background?                                     Mexican                │  311│
2557 │                                                Spanish                │   48│
2558 │                                                South American         │   34│
2559 │                                                Central American       │   52│
2560 │                                                Puerto Rican, OR       │   78│
2561 │                                                Something else         │   68│
2562 │                                                Multiple - cannot      │    7│
2563 │                                                choose one             │     │
2564 ├───────────────────────────────────────────────────────────────────────┼─────┤
2565 │QNS3A                                           Male                   │ 3132│
2566 │                                                Female                 │ 3867│
2567 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2568
2569                   Custom Tables
2570 ╭─────────────────────────────────────────┬─────╮
2571 │                                         │Count│
2572 ├─────────────────────────────────────────┼─────┤
2573 │QND5A        Cuban                       │   20│
2574 │             Mexican                     │  311│
2575 │             Spanish                     │   48│
2576 │             South American              │   34│
2577 │             Central American            │   52│
2578 │             Puerto Rican, OR            │   78│
2579 │             Something else              │   68│
2580 │             Multiple - cannot choose one│    7│
2581 ├─────────────────────────────────────────┼─────┤
2582 │S3a. GENDER: Male                        │ 3132│
2583 │             Female                      │ 3867│
2584 ╰─────────────────────────────────────────┴─────╯
2585
2586                                  Custom Tables
2587 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2588 │                                                                       │Count│
2589 ├───────────────────────────────────────────────────────────────────────┼─────┤
2590 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2591 │background?                                     Mexican                │  311│
2592 │                                                Spanish                │   48│
2593 │                                                South American         │   34│
2594 │                                                Central American       │   52│
2595 │                                                Puerto Rican, OR       │   78│
2596 │                                                Something else         │   68│
2597 │                                                Multiple - cannot      │    7│
2598 │                                                choose one             │     │
2599 ├───────────────────────────────────────────────────────────────────────┼─────┤
2600 │Male                                                                   │ 3132│
2601 ├───────────────────────────────────────────────────────────────────────┼─────┤
2602 │Female                                                                 │ 3867│
2603 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2604
2605             Custom Tables
2606 ╭─────────────────────────────┬─────╮
2607 │                             │Count│
2608 ├─────────────────────────────┼─────┤
2609 │Cuban                        │   20│
2610 ├─────────────────────────────┼─────┤
2611 │Mexican                      │  311│
2612 ├─────────────────────────────┼─────┤
2613 │Spanish                      │   48│
2614 ├─────────────────────────────┼─────┤
2615 │South American               │   34│
2616 ├─────────────────────────────┼─────┤
2617 │Central American             │   52│
2618 ├─────────────────────────────┼─────┤
2619 │Puerto Rican, OR             │   78│
2620 ├─────────────────────────────┼─────┤
2621 │Something else               │   68│
2622 ├─────────────────────────────┼─────┤
2623 │Multiple - cannot choose one │    7│
2624 ├─────────────────────────────┼─────┤
2625 │S3a. GENDER:     Male        │ 3132│
2626 │                 Female      │ 3867│
2627 ╰─────────────────────────────┴─────╯
2628
2629             Custom Tables
2630 ╭────────────────────────────┬─────╮
2631 │                            │Count│
2632 ├────────────────────────────┼─────┤
2633 │Cuban                       │   20│
2634 │Mexican                     │  311│
2635 │Spanish                     │   48│
2636 │South American              │   34│
2637 │Central American            │   52│
2638 │Puerto Rican, OR            │   78│
2639 │Something else              │   68│
2640 │Multiple - cannot choose one│    7│
2641 │Male                        │ 3132│
2642 │Female                      │ 3867│
2643 ╰────────────────────────────┴─────╯
2644 ])
2645 AT_CLEANUP
2646
2647 AT_SETUP([CTABLES VLABELS - nested variables])
2648 AT_KEYWORDS([nest nesting])
2649 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2650 AT_DATA([ctables.sps],
2651 [[GET 'nhtsa.sav'.
2652 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2653 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2654 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2655 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2656 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2657 ]])
2658 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2659                                  Custom Tables
2660 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2661 │                                                                       │Count│
2662 ├───────────────────────────────────────────────────────────────────────┼─────┤
2663 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2664 │primary ethnic background?                                       Female│    7│
2665 │                                     ╶─────────────────────────────────┼─────┤
2666 │                                      Mexican              QNS3A Male  │  175│
2667 │                                                                 Female│  136│
2668 │                                     ╶─────────────────────────────────┼─────┤
2669 │                                      Spanish              QNS3A Male  │   20│
2670 │                                                                 Female│   28│
2671 │                                     ╶─────────────────────────────────┼─────┤
2672 │                                      South American       QNS3A Male  │   21│
2673 │                                                                 Female│   13│
2674 │                                     ╶─────────────────────────────────┼─────┤
2675 │                                      Central American     QNS3A Male  │   27│
2676 │                                                                 Female│   25│
2677 │                                     ╶─────────────────────────────────┼─────┤
2678 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2679 │                                                                 Female│   41│
2680 │                                     ╶─────────────────────────────────┼─────┤
2681 │                                      Something else       QNS3A Male  │   35│
2682 │                                                                 Female│   33│
2683 │                                     ╶─────────────────────────────────┼─────┤
2684 │                                      Multiple - cannot    QNS3A Male  │    2│
2685 │                                      choose one                 Female│    5│
2686 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2687
2688                          Custom Tables
2689 ╭──────────────────────────────────────────────────────┬─────╮
2690 │                                                      │Count│
2691 ├──────────────────────────────────────────────────────┼─────┤
2692 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2693 │                                                Female│    7│
2694 │     ╶────────────────────────────────────────────────┼─────┤
2695 │      Mexican                      S3a. GENDER: Male  │  175│
2696 │                                                Female│  136│
2697 │     ╶────────────────────────────────────────────────┼─────┤
2698 │      Spanish                      S3a. GENDER: Male  │   20│
2699 │                                                Female│   28│
2700 │     ╶────────────────────────────────────────────────┼─────┤
2701 │      South American               S3a. GENDER: Male  │   21│
2702 │                                                Female│   13│
2703 │     ╶────────────────────────────────────────────────┼─────┤
2704 │      Central American             S3a. GENDER: Male  │   27│
2705 │                                                Female│   25│
2706 │     ╶────────────────────────────────────────────────┼─────┤
2707 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2708 │                                                Female│   41│
2709 │     ╶────────────────────────────────────────────────┼─────┤
2710 │      Something else               S3a. GENDER: Male  │   35│
2711 │                                                Female│   33│
2712 │     ╶────────────────────────────────────────────────┼─────┤
2713 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2714 │                                                Female│    5│
2715 ╰──────────────────────────────────────────────────────┴─────╯
2716
2717                                  Custom Tables
2718 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2719 │                                                                       │Count│
2720 ├───────────────────────────────────────────────────────────────────────┼─────┤
2721 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2722 │ethnic background?                                               Female│    7│
2723 │                                          ╶────────────────────────────┼─────┤
2724 │                                           Mexican               Male  │  175│
2725 │                                                                 Female│  136│
2726 │                                          ╶────────────────────────────┼─────┤
2727 │                                           Spanish               Male  │   20│
2728 │                                                                 Female│   28│
2729 │                                          ╶────────────────────────────┼─────┤
2730 │                                           South American        Male  │   21│
2731 │                                                                 Female│   13│
2732 │                                          ╶────────────────────────────┼─────┤
2733 │                                           Central American      Male  │   27│
2734 │                                                                 Female│   25│
2735 │                                          ╶────────────────────────────┼─────┤
2736 │                                           Puerto Rican, OR      Male  │   37│
2737 │                                                                 Female│   41│
2738 │                                          ╶────────────────────────────┼─────┤
2739 │                                           Something else        Male  │   35│
2740 │                                                                 Female│   33│
2741 │                                          ╶────────────────────────────┼─────┤
2742 │                                           Multiple - cannot     Male  │    2│
2743 │                                           choose one            Female│    5│
2744 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2745
2746                       Custom Tables
2747 ╭────────────────────────────────────────────────┬─────╮
2748 │                                                │Count│
2749 ├────────────────────────────────────────────────┼─────┤
2750 │Cuban                        S3a. GENDER: Male  │   13│
2751 │                                          Female│    7│
2752 ├────────────────────────────────────────────────┼─────┤
2753 │Mexican                      S3a. GENDER: Male  │  175│
2754 │                                          Female│  136│
2755 ├────────────────────────────────────────────────┼─────┤
2756 │Spanish                      S3a. GENDER: Male  │   20│
2757 │                                          Female│   28│
2758 ├────────────────────────────────────────────────┼─────┤
2759 │South American               S3a. GENDER: Male  │   21│
2760 │                                          Female│   13│
2761 ├────────────────────────────────────────────────┼─────┤
2762 │Central American             S3a. GENDER: Male  │   27│
2763 │                                          Female│   25│
2764 ├────────────────────────────────────────────────┼─────┤
2765 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2766 │                                          Female│   41│
2767 ├────────────────────────────────────────────────┼─────┤
2768 │Something else               S3a. GENDER: Male  │   35│
2769 │                                          Female│   33│
2770 ├────────────────────────────────────────────────┼─────┤
2771 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2772 │                                          Female│    5│
2773 ╰────────────────────────────────────────────────┴─────╯
2774
2775                Custom Tables
2776 ╭───────────────────────────────────┬─────╮
2777 │                                   │Count│
2778 ├───────────────────────────────────┼─────┤
2779 │Cuban                        Male  │   13│
2780 │                             Female│    7│
2781 ├───────────────────────────────────┼─────┤
2782 │Mexican                      Male  │  175│
2783 │                             Female│  136│
2784 ├───────────────────────────────────┼─────┤
2785 │Spanish                      Male  │   20│
2786 │                             Female│   28│
2787 ├───────────────────────────────────┼─────┤
2788 │South American               Male  │   21│
2789 │                             Female│   13│
2790 ├───────────────────────────────────┼─────┤
2791 │Central American             Male  │   27│
2792 │                             Female│   25│
2793 ├───────────────────────────────────┼─────┤
2794 │Puerto Rican, OR             Male  │   37│
2795 │                             Female│   41│
2796 ├───────────────────────────────────┼─────┤
2797 │Something else               Male  │   35│
2798 │                             Female│   33│
2799 ├───────────────────────────────────┼─────┤
2800 │Multiple - cannot choose one Male  │    2│
2801 │                             Female│    5│
2802 ╰───────────────────────────────────┴─────╯
2803 ])
2804 AT_CLEANUP
2805
2806 AT_SETUP([CTABLES FORMAT EMPTY])
2807 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2808 AT_DATA([ctables.sps],
2809 [[GET 'nhtsa.sav'.
2810 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2811 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2812 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2813 ]])
2814 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2815                                  Custom Tables
2816 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2817 │                                             │   D5. ETHNICITY: Are you of   │
2818 │                                             │  Hispanic or Latino origin or │
2819 │                                             │            descent?           │
2820 │                                             ├───────────────┬───────────────┤
2821 │                                             │      Yes      │       No      │
2822 │                                             ├───────────────┼───────────────┤
2823 │                                             │     Count     │     Count     │
2824 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2825 │D5a. What would you say is   Cuban           │             20│              0│
2826 │your primary ethnic          Mexican         │            311│              0│
2827 │background?                  Spanish         │             48│              0│
2828 │                             South American  │             34│              0│
2829 │                             Central American│             52│              0│
2830 │                             Puerto Rican, OR│             78│              0│
2831 │                             Something else  │             68│              0│
2832 │                             Multiple -      │              7│              0│
2833 │                             cannot choose   │               │               │
2834 │                             one             │               │               │
2835 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2836
2837                                  Custom Tables
2838 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2839 │                                             │   D5. ETHNICITY: Are you of   │
2840 │                                             │  Hispanic or Latino origin or │
2841 │                                             │            descent?           │
2842 │                                             ├───────────────┬───────────────┤
2843 │                                             │      Yes      │       No      │
2844 │                                             ├───────────────┼───────────────┤
2845 │                                             │     Count     │     Count     │
2846 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2847 │D5a. What would you say is   Cuban           │             20│               │
2848 │your primary ethnic          Mexican         │            311│               │
2849 │background?                  Spanish         │             48│               │
2850 │                             South American  │             34│               │
2851 │                             Central American│             52│               │
2852 │                             Puerto Rican, OR│             78│               │
2853 │                             Something else  │             68│               │
2854 │                             Multiple -      │              7│               │
2855 │                             cannot choose   │               │               │
2856 │                             one             │               │               │
2857 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2858
2859                                  Custom Tables
2860 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2861 │                                             │   D5. ETHNICITY: Are you of   │
2862 │                                             │  Hispanic or Latino origin or │
2863 │                                             │            descent?           │
2864 │                                             ├───────────────┬───────────────┤
2865 │                                             │      Yes      │       No      │
2866 │                                             ├───────────────┼───────────────┤
2867 │                                             │     Count     │     Count     │
2868 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2869 │D5a. What would you say is   Cuban           │             20│n/a            │
2870 │your primary ethnic          Mexican         │            311│n/a            │
2871 │background?                  Spanish         │             48│n/a            │
2872 │                             South American  │             34│n/a            │
2873 │                             Central American│             52│n/a            │
2874 │                             Puerto Rican, OR│             78│n/a            │
2875 │                             Something else  │             68│n/a            │
2876 │                             Multiple -      │              7│n/a            │
2877 │                             cannot choose   │               │               │
2878 │                             one             │               │               │
2879 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2880 ])
2881 AT_CLEANUP
2882
2883 AT_SETUP([CTABLES FORMAT MISSING])
2884 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2885 AT_DATA([ctables.sps],
2886 [[GET 'nhtsa.sav'.
2887 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2888 ]])
2889 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2890                                  Custom Tables
2891 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2892 │                                             │   D5. ETHNICITY: Are you of   │
2893 │                                             │  Hispanic or Latino origin or │
2894 │                                             │            descent?           │
2895 │                                             ├───────────────┬───────────────┤
2896 │                                             │      Yes      │       No      │
2897 │                                             ├───────────────┼───────────────┤
2898 │                                             │    Column %   │    Column %   │
2899 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2900 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2901 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2902 │background?                  Spanish         │           7.8%│(no data)      │
2903 │                             South American  │           5.5%│(no data)      │
2904 │                             Central American│           8.4%│(no data)      │
2905 │                             Puerto Rican, OR│          12.6%│(no data)      │
2906 │                             Something else  │          11.0%│(no data)      │
2907 │                             Multiple -      │           1.1%│(no data)      │
2908 │                             cannot choose   │               │               │
2909 │                             one             │               │               │
2910 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2911 ])
2912 AT_CLEANUP
2913
2914 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2915 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2916 AT_DATA([ctables.sps],
2917 [[GET 'nhtsa.sav'.
2918 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2919 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2920 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2921 ]])
2922 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2923                                  Custom Tables
2924 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2925 │                                                              │Count│Column %│
2926 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2927 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2928 │occasion?                                        1            │  491│   34.9%│
2929 │                                                 2            │  462│   32.9%│
2930 │                                                 3            │  229│   16.3%│
2931 │                                                 4            │   82│    5.8%│
2932 │                                                 5            │   56│    4.0%│
2933 │                                                 6            │   32│    2.3%│
2934 │                                                 7            │    9│     .6%│
2935 │                                                 8            │    8│     .6%│
2936 │                                                 9            │    4│     .3%│
2937 │                                                 10           │    6│     .4%│
2938 │                                                 11           │    2│     .1%│
2939 │                                                 12           │    5│     .4%│
2940 │                                                 14           │    1│     .1%│
2941 │                                                 15           │    1│     .1%│
2942 │                                                 18           │    1│     .1%│
2943 │                                                 20           │    4│     .3%│
2944 │                                                 25           │    1│     .1%│
2945 │                                                 30           │    3│     .2%│
2946 │                                                 60           │    1│     .1%│
2947 │                                                 99+          │    0│     .0%│
2948 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2949
2950                                  Custom Tables
2951 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2952 │                                                              │Count│Column %│
2953 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2954 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2955 │occasion?                                        1            │  491│   34.9%│
2956 │                                                 2            │  462│   32.9%│
2957 │                                                 3            │  229│   16.3%│
2958 │                                                 4            │   82│    5.8%│
2959 │                                                 5            │   56│    4.0%│
2960 │                                                 6            │   32│    2.3%│
2961 │                                                 7            │    9│     .6%│
2962 │                                                 8            │    8│     .6%│
2963 │                                                 9            │<5   │     .3%│
2964 │                                                 10           │    6│     .4%│
2965 │                                                 11           │<5   │     .1%│
2966 │                                                 12           │    5│     .4%│
2967 │                                                 14           │<5   │     .1%│
2968 │                                                 15           │<5   │     .1%│
2969 │                                                 18           │<5   │     .1%│
2970 │                                                 20           │<5   │     .3%│
2971 │                                                 25           │<5   │     .1%│
2972 │                                                 30           │<5   │     .2%│
2973 │                                                 60           │<5   │     .1%│
2974 │                                                 99+          │<5   │     .0%│
2975 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2976
2977                                  Custom Tables
2978 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2979 │                                                              │Count│Column %│
2980 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2981 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2982 │occasion?                                        1            │  491│   34.9%│
2983 │                                                 2            │  462│   32.9%│
2984 │                                                 3            │  229│   16.3%│
2985 │                                                 4            │   82│    5.8%│
2986 │                                                 5            │   56│    4.0%│
2987 │                                                 6            │   32│    2.3%│
2988 │                                                 7            │<10  │     .6%│
2989 │                                                 8            │<10  │     .6%│
2990 │                                                 9            │<10  │     .3%│
2991 │                                                 10           │<10  │     .4%│
2992 │                                                 11           │<10  │     .1%│
2993 │                                                 12           │<10  │     .4%│
2994 │                                                 14           │<10  │     .1%│
2995 │                                                 15           │<10  │     .1%│
2996 │                                                 18           │<10  │     .1%│
2997 │                                                 20           │<10  │     .3%│
2998 │                                                 25           │<10  │     .1%│
2999 │                                                 30           │<10  │     .2%│
3000 │                                                 60           │<10  │     .1%│
3001 │                                                 99+          │<10  │     .0%│
3002 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3003 ])
3004 AT_CLEANUP
3005
3006 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
3007 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3008 AT_DATA([ctables.sps],
3009 [[GET 'nhtsa.sav'.
3010 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
3011 ]])
3012 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
3013  Custom Tables
3014 ╭────────────╮
3015 │S3a. GENDER:│
3016 ├─────┬──────┤
3017 │ Male│Female│
3018 ├─────┼──────┤
3019 │Count│ Count│
3020 ├─────┼──────┤
3021 │ 3132│  3867│
3022 ╰─────┴──────╯
3023 ])
3024 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
3025 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
3026 maximumColumnWidth="192"
3027 minimumColumnWidth="96"
3028 ])
3029 AT_CLEANUP
3030
3031 AT_SETUP([CTABLES special formats])
3032 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
3033 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3034 AT_DATA([ctables.sps],
3035 [[GET 'nhtsa.sav'.
3036 COMPUTE x = qnd3 - 4.
3037 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].
3038 ]])
3039 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3040                            Custom Tables
3041 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
3042 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
3043 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
3044 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
3045 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
3046 ])
3047 AT_CLEANUP
3048
3049 AT_SETUP([CTABLES TITLES])
3050 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3051 AT_DATA([ctables.sps],
3052 [[GET 'nhtsa.sav'.
3053 CTABLES
3054     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3055     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3056     /TITLES TITLE='How often do you drive?'
3057             CAPTION='Generated )TIME on )DATE'
3058             CORNER=')TABLE'.
3059 ]])
3060 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3061 s&../../..&MM/DD/YY&'], [0], [dnl
3062                             How often do you drive?
3063 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3064 │                                   │               S3a. GENDER:              │
3065 │                                   ├────────────────────┬────────────────────┤
3066 │                                   │        Male        │       Female       │
3067 │                                   ├────────────────────┼────────────────────┤
3068 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3069 │                                   │ you of Hispanic or │ you of Hispanic or │
3070 │                                   │  Latino origin or  │  Latino origin or  │
3071 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3072 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3073 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3074 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3075 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3076 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3077 │Every day                          │      218│      2066│      166│      2175│
3078 │Several days a week                │       44│       391│       45│       782│
3079 │Once a week or less                │       16│       109│       12│       223│
3080 │Only certain times a year          │       15│        41│       11│        61│
3081 │Never                              │       39│       150│       56│       278│
3082 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3083 Generated HH:MM:SS on MM/DD/YY
3084 ])
3085 AT_CLEANUP
3086
3087 AT_SETUP([CTABLES area definitions])
3088 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3089 AT_DATA([ctables.sps],
3090 [[GET 'nhtsa.sav'.
3091 CTABLES
3092     /VLABELS VARIABLES=ALL DISPLAY=NAME
3093     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3094     /SLABELS POSITION=ROW
3095     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3096     /SLABELS POSITION=ROW
3097     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3098     /SLABELS POSITION=ROW.
3099 ]])
3100 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3101                     Custom Tables
3102 Male
3103 ╭─────────────────────────────┬─────────────┬──────╮
3104 │                             │    QND7A    │ QN64B│
3105 │                             ├──────┬──────┼───┬──┤
3106 │                             │  Yes │  No  │   │  │
3107 │                             ├──────┼──────┤   │  │
3108 │                             │ QN86 │ QN86 │   │  │
3109 │                             ├───┬──┼───┬──┤   │  │
3110 │                             │Yes│No│Yes│No│Yes│No│
3111 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3112 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3113 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3114 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3115 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3116 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3117 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3118 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3119 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3120 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3121 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3122 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3123 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3124 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3125 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3126 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3127 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3128
3129                     Custom Tables
3130 Female
3131 ╭─────────────────────────────┬─────────────┬──────╮
3132 │                             │    QND7A    │ QN64B│
3133 │                             ├──────┬──────┼───┬──┤
3134 │                             │  Yes │  No  │   │  │
3135 │                             ├──────┼──────┤   │  │
3136 │                             │ QN86 │ QN86 │   │  │
3137 │                             ├───┬──┼───┬──┤   │  │
3138 │                             │Yes│No│Yes│No│Yes│No│
3139 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3140 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3141 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3142 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3143 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3144 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3145 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3146 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3147 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3148 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3149 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3150 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3151 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3152 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3153 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3154 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3155 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3156
3157                     Custom Tables
3158 Male
3159 ╭──────────────────────────────┬─────────────┬──────╮
3160 │                              │    QND7A    │ QN64B│
3161 │                              ├──────┬──────┼───┬──┤
3162 │                              │  Yes │  No  │   │  │
3163 │                              ├──────┼──────┤   │  │
3164 │                              │ QN86 │ QN86 │   │  │
3165 │                              ├───┬──┼───┬──┤   │  │
3166 │                              │Yes│No│Yes│No│Yes│No│
3167 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3168 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3169 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3170 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3171 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3172 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3173 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3174 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3175 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3176 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3177 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3178 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3179 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3180
3181                     Custom Tables
3182 Female
3183 ╭──────────────────────────────┬─────────────┬──────╮
3184 │                              │    QND7A    │ QN64B│
3185 │                              ├──────┬──────┼───┬──┤
3186 │                              │  Yes │  No  │   │  │
3187 │                              ├──────┼──────┤   │  │
3188 │                              │ QN86 │ QN86 │   │  │
3189 │                              ├───┬──┼───┬──┤   │  │
3190 │                              │Yes│No│Yes│No│Yes│No│
3191 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3192 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3193 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3194 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3195 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3196 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3197 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3198 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3199 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3200 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3201 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3202 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3203 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3204
3205                       Custom Tables
3206 Male
3207 ╭─────────────────────────────────┬─────────────┬──────╮
3208 │                                 │    QND7A    │ QN64B│
3209 │                                 ├──────┬──────┼───┬──┤
3210 │                                 │  Yes │  No  │   │  │
3211 │                                 ├──────┼──────┤   │  │
3212 │                                 │ QN86 │ QN86 │   │  │
3213 │                                 ├───┬──┼───┬──┤   │  │
3214 │                                 │Yes│No│Yes│No│Yes│No│
3215 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3216 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3217 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3218 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3219 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3220 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3221 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3222 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3223 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3224 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3225 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3226 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3227 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3228
3229                       Custom Tables
3230 Female
3231 ╭─────────────────────────────────┬─────────────┬──────╮
3232 │                                 │    QND7A    │ QN64B│
3233 │                                 ├──────┬──────┼───┬──┤
3234 │                                 │  Yes │  No  │   │  │
3235 │                                 ├──────┼──────┤   │  │
3236 │                                 │ QN86 │ QN86 │   │  │
3237 │                                 ├───┬──┼───┬──┤   │  │
3238 │                                 │Yes│No│Yes│No│Yes│No│
3239 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3240 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3241 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3242 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3243 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3244 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3245 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3246 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3247 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3248 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3249 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3250 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3251 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3252 ])
3253 AT_CLEANUP
3254
3255 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3256 AT_KEYWORDS([ROWLABELS OPPOSITE])
3257 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3258 AT_DATA([ctables.sps],
3259 [[GET 'nhtsa.sav'.
3260 CTABLES
3261     /VLABELS VARIABLES=ALL DISPLAY=NAME
3262     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3263     /SLABELS POSITION=ROW
3264     /CLABELS ROWLABELS=OPPOSITE
3265     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3266     /SLABELS POSITION=ROW
3267     /CLABELS ROWLABELS=OPPOSITE
3268     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3269     /SLABELS POSITION=ROW
3270     /CLABELS ROWLABELS=OPPOSITE.
3271 ]])
3272 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3273                                         Custom Tables
3274 Male
3275 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3276 │                                  │                          QN27                         │
3277 │                                  ├───────────────────────────┬───────────────────────────┤
3278 │                                  │            Yes            │             No            │
3279 │                                  ├───────────────────────────┼───────────────────────────┤
3280 │                                  │           QND7A           │           QND7A           │
3281 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3282 │                                  │     Yes     │      No     │     Yes     │      No     │
3283 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3284 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3285 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3286 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3287 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3288 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3289 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3290 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3291 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3292 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3293 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3294 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3295 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3296 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3297 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3298 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3299 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3300 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3301 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3302 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3303 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3304 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3305 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3306
3307                                         Custom Tables
3308 Female
3309 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3310 │                                  │                          QN27                         │
3311 │                                  ├───────────────────────────┬───────────────────────────┤
3312 │                                  │            Yes            │             No            │
3313 │                                  ├───────────────────────────┼───────────────────────────┤
3314 │                                  │           QND7A           │           QND7A           │
3315 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3316 │                                  │     Yes     │      No     │     Yes     │      No     │
3317 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3318 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3319 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3320 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3321 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3322 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3323 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3324 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3325 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3326 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3327 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3328 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3329 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3330 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3331 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3332 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3333 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3334 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3335 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3336 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3337 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3338 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3339 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3340
3341                                         Custom Tables
3342 Male
3343 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3344 │                                   │                          QN27                         │
3345 │                                   ├───────────────────────────┬───────────────────────────┤
3346 │                                   │            Yes            │             No            │
3347 │                                   ├───────────────────────────┼───────────────────────────┤
3348 │                                   │           QND7A           │           QND7A           │
3349 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3350 │                                   │     Yes     │      No     │     Yes     │      No     │
3351 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3352 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3353 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3354 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3355 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3356 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3357 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3358 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3359 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3360 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3361 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3362 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3363 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3364 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3365 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3366 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3367 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3368 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3369 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3370
3371                                         Custom Tables
3372 Female
3373 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3374 │                                   │                          QN27                         │
3375 │                                   ├───────────────────────────┬───────────────────────────┤
3376 │                                   │            Yes            │             No            │
3377 │                                   ├───────────────────────────┼───────────────────────────┤
3378 │                                   │           QND7A           │           QND7A           │
3379 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3380 │                                   │     Yes     │      No     │     Yes     │      No     │
3381 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3382 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3383 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3384 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3385 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3386 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3387 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3388 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3389 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3390 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3391 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3392 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3393 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3394 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3395 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3396 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3397 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3398 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3399 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3400
3401                                           Custom Tables
3402 Male
3403 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3404 │                                      │                          QN27                         │
3405 │                                      ├───────────────────────────┬───────────────────────────┤
3406 │                                      │            Yes            │             No            │
3407 │                                      ├───────────────────────────┼───────────────────────────┤
3408 │                                      │           QND7A           │           QND7A           │
3409 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3410 │                                      │     Yes     │      No     │     Yes     │      No     │
3411 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3412 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3413 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3414 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3415 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3416 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3417 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3418 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3419 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3420 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3421 │              No  QN57 Column ID      │  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3422 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3423 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3424 │     No  QN61 Yes QN57 Column ID      │ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 32│31│
3425 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3426 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3427 │              No  QN57 Column ID      │ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 32│31│
3428 │                       Layer Column ID│  2│ 1│  4│ 3│  6│ 5│  7│ 8│ 10│ 9│ 11│12│ 14│13│ 15│16│
3429 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3430
3431                                           Custom Tables
3432 Female
3433 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3434 │                                      │                          QN27                         │
3435 │                                      ├───────────────────────────┬───────────────────────────┤
3436 │                                      │            Yes            │             No            │
3437 │                                      ├───────────────────────────┼───────────────────────────┤
3438 │                                      │           QND7A           │           QND7A           │
3439 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3440 │                                      │     Yes     │      No     │     Yes     │      No     │
3441 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3442 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3443 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3444 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3445 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3446 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3447 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3448 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│33│ 35│36│ 37│38│ 39│40│ 41│42│ 44│43│ 45│46│ 47│48│
3449 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3450 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3451 │              No  QN57 Column ID      │ 34│33│ 35│36│ 37│38│ 39│40│ 41│42│ 44│43│ 45│46│ 47│48│
3452 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3453 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3454 │     No  QN61 Yes QN57 Column ID      │ 50│49│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 62│61│ 64│63│
3455 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3456 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3457 │              No  QN57 Column ID      │ 50│49│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 62│61│ 64│63│
3458 │                       Layer Column ID│ 18│17│ 19│20│ 21│22│ 23│24│ 25│26│ 28│27│ 29│30│ 31│32│
3459 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3460 ])
3461 AT_CLEANUP
3462
3463 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3464 AT_KEYWORDS([COLLABELS OPPOSITE])
3465 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3466 AT_DATA([ctables.sps],
3467 [[GET 'nhtsa.sav'.
3468 CTABLES
3469     /VLABELS VARIABLES=ALL DISPLAY=NAME
3470     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3471     /SLABELS POSITION=ROW
3472     /CLABELS COLLABELS=OPPOSITE
3473     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3474     /SLABELS POSITION=ROW
3475     /CLABELS COLLABELS=OPPOSITE
3476     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3477     /SLABELS POSITION=ROW
3478     /CLABELS COLLABELS=OPPOSITE.
3479 ]])
3480 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3481                           Custom Tables
3482 Male
3483 ╭──────────────────────────────────────────┬───────────────────╮
3484 │                                          │        QN27       │
3485 │                                          ├─────────┬─────────┤
3486 │                                          │   Yes   │    No   │
3487 │                                          ├─────────┼─────────┤
3488 │                                          │  QND7A  │  QND7A  │
3489 │                                          ├────┬────┼────┬────┤
3490 │                                          │ Yes│ No │ Yes│ No │
3491 │                                          ├────┼────┼────┼────┤
3492 │                                          │QN86│QN86│QN86│QN86│
3493 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3494 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3495 │                               Layer ID   │   1│   1│   1│   1│
3496 │                               Subtable ID│   1│   1│   2│   2│
3497 │                          ╶───────────────┼────┼────┼────┼────┤
3498 │                           No  Table ID   │   1│   1│   1│   1│
3499 │                               Layer ID   │   1│   1│   1│   1│
3500 │                               Subtable ID│   1│   1│   2│   2│
3501 │                      ╶───────────────────┼────┼────┼────┼────┤
3502 │                       No  Yes Table ID   │   1│   1│   1│   1│
3503 │                               Layer ID   │   1│   1│   1│   1│
3504 │                               Subtable ID│   3│   3│   4│   4│
3505 │                          ╶───────────────┼────┼────┼────┼────┤
3506 │                           No  Table ID   │   1│   1│   1│   1│
3507 │                               Layer ID   │   1│   1│   1│   1│
3508 │                               Subtable ID│   3│   3│   4│   4│
3509 │             ╶────────────────────────────┼────┼────┼────┼────┤
3510 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3511 │                               Layer ID   │   1│   1│   1│   1│
3512 │                               Subtable ID│   5│   5│   6│   6│
3513 │                          ╶───────────────┼────┼────┼────┼────┤
3514 │                           No  Table ID   │   1│   1│   1│   1│
3515 │                               Layer ID   │   1│   1│   1│   1│
3516 │                               Subtable ID│   5│   5│   6│   6│
3517 │                      ╶───────────────────┼────┼────┼────┼────┤
3518 │                       No  Yes Table ID   │   1│   1│   1│   1│
3519 │                               Layer ID   │   1│   1│   1│   1│
3520 │                               Subtable ID│   7│   7│   8│   8│
3521 │                          ╶───────────────┼────┼────┼────┼────┤
3522 │                           No  Table ID   │   1│   1│   1│   1│
3523 │                               Layer ID   │   1│   1│   1│   1│
3524 │                               Subtable ID│   7│   7│   8│   8│
3525 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3526 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3527 │                               Layer ID   │   1│   1│   1│   1│
3528 │                               Subtable ID│   9│   9│  10│  10│
3529 │                          ╶───────────────┼────┼────┼────┼────┤
3530 │                           No  Table ID   │   1│   1│   1│   1│
3531 │                               Layer ID   │   1│   1│   1│   1│
3532 │                               Subtable ID│   9│   9│  10│  10│
3533 │                      ╶───────────────────┼────┼────┼────┼────┤
3534 │                       No  Yes Table ID   │   1│   1│   1│   1│
3535 │                               Layer ID   │   1│   1│   1│   1│
3536 │                               Subtable ID│  11│  11│  12│  12│
3537 │                          ╶───────────────┼────┼────┼────┼────┤
3538 │                           No  Table ID   │   1│   1│   1│   1│
3539 │                               Layer ID   │   1│   1│   1│   1│
3540 │                               Subtable ID│  11│  11│  12│  12│
3541 │             ╶────────────────────────────┼────┼────┼────┼────┤
3542 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3543 │                               Layer ID   │   1│   1│   1│   1│
3544 │                               Subtable ID│  13│  13│  14│  14│
3545 │                          ╶───────────────┼────┼────┼────┼────┤
3546 │                           No  Table ID   │   1│   1│   1│   1│
3547 │                               Layer ID   │   1│   1│   1│   1│
3548 │                               Subtable ID│  13│  13│  14│  14│
3549 │                      ╶───────────────────┼────┼────┼────┼────┤
3550 │                       No  Yes Table ID   │   1│   1│   1│   1│
3551 │                               Layer ID   │   1│   1│   1│   1│
3552 │                               Subtable ID│  15│  15│  16│  16│
3553 │                          ╶───────────────┼────┼────┼────┼────┤
3554 │                           No  Table ID   │   1│   1│   1│   1│
3555 │                               Layer ID   │   1│   1│   1│   1│
3556 │                               Subtable ID│  15│  15│  16│  16│
3557 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3558
3559                           Custom Tables
3560 Female
3561 ╭──────────────────────────────────────────┬───────────────────╮
3562 │                                          │        QN27       │
3563 │                                          ├─────────┬─────────┤
3564 │                                          │   Yes   │    No   │
3565 │                                          ├─────────┼─────────┤
3566 │                                          │  QND7A  │  QND7A  │
3567 │                                          ├────┬────┼────┬────┤
3568 │                                          │ Yes│ No │ Yes│ No │
3569 │                                          ├────┼────┼────┼────┤
3570 │                                          │QN86│QN86│QN86│QN86│
3571 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3572 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3573 │                               Layer ID   │   2│   2│   2│   2│
3574 │                               Subtable ID│  17│  17│  18│  18│
3575 │                          ╶───────────────┼────┼────┼────┼────┤
3576 │                           No  Table ID   │   1│   1│   1│   1│
3577 │                               Layer ID   │   2│   2│   2│   2│
3578 │                               Subtable ID│  17│  17│  18│  18│
3579 │                      ╶───────────────────┼────┼────┼────┼────┤
3580 │                       No  Yes Table ID   │   1│   1│   1│   1│
3581 │                               Layer ID   │   2│   2│   2│   2│
3582 │                               Subtable ID│  19│  19│  20│  20│
3583 │                          ╶───────────────┼────┼────┼────┼────┤
3584 │                           No  Table ID   │   1│   1│   1│   1│
3585 │                               Layer ID   │   2│   2│   2│   2│
3586 │                               Subtable ID│  19│  19│  20│  20│
3587 │             ╶────────────────────────────┼────┼────┼────┼────┤
3588 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3589 │                               Layer ID   │   2│   2│   2│   2│
3590 │                               Subtable ID│  21│  21│  22│  22│
3591 │                          ╶───────────────┼────┼────┼────┼────┤
3592 │                           No  Table ID   │   1│   1│   1│   1│
3593 │                               Layer ID   │   2│   2│   2│   2│
3594 │                               Subtable ID│  21│  21│  22│  22│
3595 │                      ╶───────────────────┼────┼────┼────┼────┤
3596 │                       No  Yes Table ID   │   1│   1│   1│   1│
3597 │                               Layer ID   │   2│   2│   2│   2│
3598 │                               Subtable ID│  23│  23│  24│  24│
3599 │                          ╶───────────────┼────┼────┼────┼────┤
3600 │                           No  Table ID   │   1│   1│   1│   1│
3601 │                               Layer ID   │   2│   2│   2│   2│
3602 │                               Subtable ID│  23│  23│  24│  24│
3603 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3604 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3605 │                               Layer ID   │   2│   2│   2│   2│
3606 │                               Subtable ID│  25│  25│  26│  26│
3607 │                          ╶───────────────┼────┼────┼────┼────┤
3608 │                           No  Table ID   │   1│   1│   1│   1│
3609 │                               Layer ID   │   2│   2│   2│   2│
3610 │                               Subtable ID│  25│  25│  26│  26│
3611 │                      ╶───────────────────┼────┼────┼────┼────┤
3612 │                       No  Yes Table ID   │   1│   1│   1│   1│
3613 │                               Layer ID   │   2│   2│   2│   2│
3614 │                               Subtable ID│  27│  27│  28│  28│
3615 │                          ╶───────────────┼────┼────┼────┼────┤
3616 │                           No  Table ID   │   1│   1│   1│   1│
3617 │                               Layer ID   │   2│   2│   2│   2│
3618 │                               Subtable ID│  27│  27│  28│  28│
3619 │             ╶────────────────────────────┼────┼────┼────┼────┤
3620 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3621 │                               Layer ID   │   2│   2│   2│   2│
3622 │                               Subtable ID│  29│  29│  30│  30│
3623 │                          ╶───────────────┼────┼────┼────┼────┤
3624 │                           No  Table ID   │   1│   1│   1│   1│
3625 │                               Layer ID   │   2│   2│   2│   2│
3626 │                               Subtable ID│  29│  29│  30│  30│
3627 │                      ╶───────────────────┼────┼────┼────┼────┤
3628 │                       No  Yes Table ID   │   1│   1│   1│   1│
3629 │                               Layer ID   │   2│   2│   2│   2│
3630 │                               Subtable ID│  31│  31│  32│  32│
3631 │                          ╶───────────────┼────┼────┼────┼────┤
3632 │                           No  Table ID   │   1│   1│   1│   1│
3633 │                               Layer ID   │   2│   2│   2│   2│
3634 │                               Subtable ID│  31│  31│  32│  32│
3635 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3636
3637                           Custom Tables
3638 Male
3639 ╭───────────────────────────────────────────┬───────────────────╮
3640 │                                           │        QN27       │
3641 │                                           ├─────────┬─────────┤
3642 │                                           │   Yes   │    No   │
3643 │                                           ├─────────┼─────────┤
3644 │                                           │  QND7A  │  QND7A  │
3645 │                                           ├────┬────┼────┬────┤
3646 │                                           │ Yes│ No │ Yes│ No │
3647 │                                           ├────┼────┼────┼────┤
3648 │                                           │QN86│QN86│QN86│QN86│
3649 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3650 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   2│   2│   3│   3│
3651 │                               Layer Row ID│   2│   2│   2│   2│
3652 │                          ╶────────────────┼────┼────┼────┼────┤
3653 │                           No  Row ID      │   1│   1│   4│   4│
3654 │                               Layer Row ID│   1│   1│   1│   1│
3655 │                      ╶────────────────────┼────┼────┼────┼────┤
3656 │                       No  Yes Row ID      │   5│   5│   7│   7│
3657 │                               Layer Row ID│   3│   3│   3│   3│
3658 │                          ╶────────────────┼────┼────┼────┼────┤
3659 │                           No  Row ID      │   6│   6│   8│   8│
3660 │                               Layer Row ID│   4│   4│   4│   4│
3661 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3662 │              No  QN57 Yes Yes Row ID      │  10│  10│  11│  11│
3663 │                               Layer Row ID│   6│   6│   6│   6│
3664 │                          ╶────────────────┼────┼────┼────┼────┤
3665 │                           No  Row ID      │   9│   9│  12│  12│
3666 │                               Layer Row ID│   5│   5│   5│   5│
3667 │                      ╶────────────────────┼────┼────┼────┼────┤
3668 │                       No  Yes Row ID      │  14│  14│  16│  16│
3669 │                               Layer Row ID│   8│   8│   8│   8│
3670 │                          ╶────────────────┼────┼────┼────┼────┤
3671 │                           No  Row ID      │  13│  13│  15│  15│
3672 │                               Layer Row ID│   7│   7│   7│   7│
3673 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3674 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  19│  19│
3675 │                               Layer Row ID│   9│   9│   9│   9│
3676 │                          ╶────────────────┼────┼────┼────┼────┤
3677 │                           No  Row ID      │  18│  18│  20│  20│
3678 │                               Layer Row ID│  10│  10│  10│  10│
3679 │                      ╶────────────────────┼────┼────┼────┼────┤
3680 │                       No  Yes Row ID      │  21│  21│  23│  23│
3681 │                               Layer Row ID│  11│  11│  11│  11│
3682 │                          ╶────────────────┼────┼────┼────┼────┤
3683 │                           No  Row ID      │  22│  22│  24│  24│
3684 │                               Layer Row ID│  12│  12│  12│  12│
3685 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3686 │              No  QN57 Yes Yes Row ID      │  26│  26│  28│  28│
3687 │                               Layer Row ID│  14│  14│  14│  14│
3688 │                          ╶────────────────┼────┼────┼────┼────┤
3689 │                           No  Row ID      │  25│  25│  27│  27│
3690 │                               Layer Row ID│  13│  13│  13│  13│
3691 │                      ╶────────────────────┼────┼────┼────┼────┤
3692 │                       No  Yes Row ID      │  30│  30│  32│  32│
3693 │                               Layer Row ID│  16│  16│  16│  16│
3694 │                          ╶────────────────┼────┼────┼────┼────┤
3695 │                           No  Row ID      │  29│  29│  31│  31│
3696 │                               Layer Row ID│  15│  15│  15│  15│
3697 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3698
3699                           Custom Tables
3700 Female
3701 ╭───────────────────────────────────────────┬───────────────────╮
3702 │                                           │        QN27       │
3703 │                                           ├─────────┬─────────┤
3704 │                                           │   Yes   │    No   │
3705 │                                           ├─────────┼─────────┤
3706 │                                           │  QND7A  │  QND7A  │
3707 │                                           ├────┬────┼────┬────┤
3708 │                                           │ Yes│ No │ Yes│ No │
3709 │                                           ├────┼────┼────┼────┤
3710 │                                           │QN86│QN86│QN86│QN86│
3711 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3712 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  33│  33│  36│  36│
3713 │                               Layer Row ID│  17│  17│  17│  17│
3714 │                          ╶────────────────┼────┼────┼────┼────┤
3715 │                           No  Row ID      │  34│  34│  35│  35│
3716 │                               Layer Row ID│  18│  18│  18│  18│
3717 │                      ╶────────────────────┼────┼────┼────┼────┤
3718 │                       No  Yes Row ID      │  37│  37│  39│  39│
3719 │                               Layer Row ID│  19│  19│  19│  19│
3720 │                          ╶────────────────┼────┼────┼────┼────┤
3721 │                           No  Row ID      │  38│  38│  40│  40│
3722 │                               Layer Row ID│  20│  20│  20│  20│
3723 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3724 │              No  QN57 Yes Yes Row ID      │  41│  41│  44│  44│
3725 │                               Layer Row ID│  21│  21│  21│  21│
3726 │                          ╶────────────────┼────┼────┼────┼────┤
3727 │                           No  Row ID      │  42│  42│  43│  43│
3728 │                               Layer Row ID│  22│  22│  22│  22│
3729 │                      ╶────────────────────┼────┼────┼────┼────┤
3730 │                       No  Yes Row ID      │  45│  45│  48│  48│
3731 │                               Layer Row ID│  23│  23│  23│  23│
3732 │                          ╶────────────────┼────┼────┼────┼────┤
3733 │                           No  Row ID      │  46│  46│  47│  47│
3734 │                               Layer Row ID│  24│  24│  24│  24│
3735 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3736 │     No  QN61 Yes QN57 Yes Yes Row ID      │  49│  49│  52│  52│
3737 │                               Layer Row ID│  25│  25│  25│  25│
3738 │                          ╶────────────────┼────┼────┼────┼────┤
3739 │                           No  Row ID      │  50│  50│  51│  51│
3740 │                               Layer Row ID│  26│  26│  26│  26│
3741 │                      ╶────────────────────┼────┼────┼────┼────┤
3742 │                       No  Yes Row ID      │  53│  53│  55│  55│
3743 │                               Layer Row ID│  27│  27│  27│  27│
3744 │                          ╶────────────────┼────┼────┼────┼────┤
3745 │                           No  Row ID      │  54│  54│  56│  56│
3746 │                               Layer Row ID│  28│  28│  28│  28│
3747 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3748 │              No  QN57 Yes Yes Row ID      │  58│  58│  59│  59│
3749 │                               Layer Row ID│  30│  30│  30│  30│
3750 │                          ╶────────────────┼────┼────┼────┼────┤
3751 │                           No  Row ID      │  57│  57│  60│  60│
3752 │                               Layer Row ID│  29│  29│  29│  29│
3753 │                      ╶────────────────────┼────┼────┼────┼────┤
3754 │                       No  Yes Row ID      │  62│  62│  64│  64│
3755 │                               Layer Row ID│  32│  32│  32│  32│
3756 │                          ╶────────────────┼────┼────┼────┼────┤
3757 │                           No  Row ID      │  61│  61│  63│  63│
3758 │                               Layer Row ID│  31│  31│  31│  31│
3759 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3760
3761                             Custom Tables
3762 Male
3763 ╭──────────────────────────────────────────────┬───────────────────╮
3764 │                                              │        QN27       │
3765 │                                              ├─────────┬─────────┤
3766 │                                              │   Yes   │    No   │
3767 │                                              ├─────────┼─────────┤
3768 │                                              │  QND7A  │  QND7A  │
3769 │                                              ├────┬────┼────┬────┤
3770 │                                              │ Yes│ No │ Yes│ No │
3771 │                                              ├────┼────┼────┼────┤
3772 │                                              │QN86│QN86│QN86│QN86│
3773 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3774 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
3775 │                               Layer Column ID│   1│   2│   3│   4│
3776 │                          ╶───────────────────┼────┼────┼────┼────┤
3777 │                           No  Column ID      │   1│   2│   3│   4│
3778 │                               Layer Column ID│   1│   2│   3│   4│
3779 │                      ╶───────────────────────┼────┼────┼────┼────┤
3780 │                       No  Yes Column ID      │   5│   6│   7│   8│
3781 │                               Layer Column ID│   1│   2│   3│   4│
3782 │                          ╶───────────────────┼────┼────┼────┼────┤
3783 │                           No  Column ID      │   5│   6│   7│   8│
3784 │                               Layer Column ID│   1│   2│   3│   4│
3785 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3786 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
3787 │                               Layer Column ID│   1│   2│   3│   4│
3788 │                          ╶───────────────────┼────┼────┼────┼────┤
3789 │                           No  Column ID      │   9│  10│  11│  12│
3790 │                               Layer Column ID│   1│   2│   3│   4│
3791 │                      ╶───────────────────────┼────┼────┼────┼────┤
3792 │                       No  Yes Column ID      │  13│  14│  15│  16│
3793 │                               Layer Column ID│   1│   2│   3│   4│
3794 │                          ╶───────────────────┼────┼────┼────┼────┤
3795 │                           No  Column ID      │  13│  14│  15│  16│
3796 │                               Layer Column ID│   1│   2│   3│   4│
3797 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3798 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
3799 │                               Layer Column ID│   1│   2│   3│   4│
3800 │                          ╶───────────────────┼────┼────┼────┼────┤
3801 │                           No  Column ID      │  17│  18│  19│  20│
3802 │                               Layer Column ID│   1│   2│   3│   4│
3803 │                      ╶───────────────────────┼────┼────┼────┼────┤
3804 │                       No  Yes Column ID      │  21│  22│  23│  24│
3805 │                               Layer Column ID│   1│   2│   3│   4│
3806 │                          ╶───────────────────┼────┼────┼────┼────┤
3807 │                           No  Column ID      │  21│  22│  23│  24│
3808 │                               Layer Column ID│   1│   2│   3│   4│
3809 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3810 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
3811 │                               Layer Column ID│   1│   2│   3│   4│
3812 │                          ╶───────────────────┼────┼────┼────┼────┤
3813 │                           No  Column ID      │  25│  26│  27│  28│
3814 │                               Layer Column ID│   1│   2│   3│   4│
3815 │                      ╶───────────────────────┼────┼────┼────┼────┤
3816 │                       No  Yes Column ID      │  29│  30│  31│  32│
3817 │                               Layer Column ID│   1│   2│   3│   4│
3818 │                          ╶───────────────────┼────┼────┼────┼────┤
3819 │                           No  Column ID      │  29│  30│  31│  32│
3820 │                               Layer Column ID│   1│   2│   3│   4│
3821 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3822
3823                             Custom Tables
3824 Female
3825 ╭──────────────────────────────────────────────┬───────────────────╮
3826 │                                              │        QN27       │
3827 │                                              ├─────────┬─────────┤
3828 │                                              │   Yes   │    No   │
3829 │                                              ├─────────┼─────────┤
3830 │                                              │  QND7A  │  QND7A  │
3831 │                                              ├────┬────┼────┬────┤
3832 │                                              │ Yes│ No │ Yes│ No │
3833 │                                              ├────┼────┼────┼────┤
3834 │                                              │QN86│QN86│QN86│QN86│
3835 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3836 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
3837 │                               Layer Column ID│   5│   6│   7│   8│
3838 │                          ╶───────────────────┼────┼────┼────┼────┤
3839 │                           No  Column ID      │  33│  34│  35│  36│
3840 │                               Layer Column ID│   5│   6│   7│   8│
3841 │                      ╶───────────────────────┼────┼────┼────┼────┤
3842 │                       No  Yes Column ID      │  37│  38│  39│  40│
3843 │                               Layer Column ID│   5│   6│   7│   8│
3844 │                          ╶───────────────────┼────┼────┼────┼────┤
3845 │                           No  Column ID      │  37│  38│  39│  40│
3846 │                               Layer Column ID│   5│   6│   7│   8│
3847 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3848 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
3849 │                               Layer Column ID│   5│   6│   7│   8│
3850 │                          ╶───────────────────┼────┼────┼────┼────┤
3851 │                           No  Column ID      │  41│  42│  43│  44│
3852 │                               Layer Column ID│   5│   6│   7│   8│
3853 │                      ╶───────────────────────┼────┼────┼────┼────┤
3854 │                       No  Yes Column ID      │  45│  46│  47│  48│
3855 │                               Layer Column ID│   5│   6│   7│   8│
3856 │                          ╶───────────────────┼────┼────┼────┼────┤
3857 │                           No  Column ID      │  45│  46│  47│  48│
3858 │                               Layer Column ID│   5│   6│   7│   8│
3859 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3860 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
3861 │                               Layer Column ID│   5│   6│   7│   8│
3862 │                          ╶───────────────────┼────┼────┼────┼────┤
3863 │                           No  Column ID      │  49│  50│  51│  52│
3864 │                               Layer Column ID│   5│   6│   7│   8│
3865 │                      ╶───────────────────────┼────┼────┼────┼────┤
3866 │                       No  Yes Column ID      │  53│  54│  55│  56│
3867 │                               Layer Column ID│   5│   6│   7│   8│
3868 │                          ╶───────────────────┼────┼────┼────┼────┤
3869 │                           No  Column ID      │  53│  54│  55│  56│
3870 │                               Layer Column ID│   5│   6│   7│   8│
3871 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3872 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
3873 │                               Layer Column ID│   5│   6│   7│   8│
3874 │                          ╶───────────────────┼────┼────┼────┼────┤
3875 │                           No  Column ID      │  57│  58│  59│  60│
3876 │                               Layer Column ID│   5│   6│   7│   8│
3877 │                      ╶───────────────────────┼────┼────┼────┼────┤
3878 │                       No  Yes Column ID      │  61│  62│  63│  64│
3879 │                               Layer Column ID│   5│   6│   7│   8│
3880 │                          ╶───────────────────┼────┼────┼────┼────┤
3881 │                           No  Column ID      │  61│  62│  63│  64│
3882 │                               Layer Column ID│   5│   6│   7│   8│
3883 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
3884 ])
3885 AT_CLEANUP
3886
3887 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
3888 AT_KEYWORDS([ROWLABELS LAYER])
3889 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3890 AT_DATA([ctables.sps],
3891 [[GET 'nhtsa.sav'.
3892 CTABLES
3893     /VLABELS VARIABLES=ALL DISPLAY=NAME
3894     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3895     /SLABELS POSITION=ROW
3896     /CLABELS ROWLABELS=LAYER
3897     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3898     /SLABELS POSITION=ROW
3899     /CLABELS ROWLABELS=LAYER
3900     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3901     /SLABELS POSITION=ROW
3902     /CLABELS ROWLABELS=LAYER.
3903 ]])
3904 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3905                           Custom Tables
3906 Male
3907 Yes
3908 ╭──────────────────────────────────┬───────────────────────────╮
3909 │                                  │            QN27           │
3910 │                                  ├─────────────┬─────────────┤
3911 │                                  │     Yes     │      No     │
3912 │                                  ├─────────────┼─────────────┤
3913 │                                  │    QND7A    │    QND7A    │
3914 │                                  ├──────┬──────┼──────┬──────┤
3915 │                                  │  Yes │  No  │  Yes │  No  │
3916 │                                  ├──────┼──────┼──────┼──────┤
3917 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3918 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3919 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3920 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3921 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3922 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3923 │                       Subtable ID│  2│ 2│  3│ 3│  5│ 5│  7│ 7│
3924 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3925 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3926 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3927 │                       Subtable ID│  2│ 2│  3│ 3│  5│ 5│  7│ 7│
3928 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3929 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3930 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3931 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 16│16│
3932 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3933 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3934 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3935 │                       Subtable ID│ 10│10│ 12│12│ 13│13│ 16│16│
3936 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3937
3938                           Custom Tables
3939 Male
3940 No
3941 ╭──────────────────────────────────┬───────────────────────────╮
3942 │                                  │            QN27           │
3943 │                                  ├─────────────┬─────────────┤
3944 │                                  │     Yes     │      No     │
3945 │                                  ├─────────────┼─────────────┤
3946 │                                  │    QND7A    │    QND7A    │
3947 │                                  ├──────┬──────┼──────┬──────┤
3948 │                                  │  Yes │  No  │  Yes │  No  │
3949 │                                  ├──────┼──────┼──────┼──────┤
3950 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3951 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3952 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3953 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3954 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3955 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3956 │                       Subtable ID│  1│ 1│  4│ 4│  6│ 6│  8│ 8│
3957 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3958 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3959 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3960 │                       Subtable ID│  1│ 1│  4│ 4│  6│ 6│  8│ 8│
3961 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3962 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3963 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3964 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 15│15│
3965 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3966 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3967 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3968 │                       Subtable ID│  9│ 9│ 11│11│ 14│14│ 15│15│
3969 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
3970
3971                           Custom Tables
3972 Female
3973 Yes
3974 ╭──────────────────────────────────┬───────────────────────────╮
3975 │                                  │            QN27           │
3976 │                                  ├─────────────┬─────────────┤
3977 │                                  │     Yes     │      No     │
3978 │                                  ├─────────────┼─────────────┤
3979 │                                  │    QND7A    │    QND7A    │
3980 │                                  ├──────┬──────┼──────┬──────┤
3981 │                                  │  Yes │  No  │  Yes │  No  │
3982 │                                  ├──────┼──────┼──────┼──────┤
3983 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
3984 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
3985 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
3986 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3987 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3988 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3989 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
3990 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3991 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3992 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3993 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
3994 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3995 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3996 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3997 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
3998 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
3999 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4000 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4001 │                       Subtable ID│ 25│25│ 28│28│ 29│29│ 32│32│
4002 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4003
4004                           Custom Tables
4005 Female
4006 No
4007 ╭──────────────────────────────────┬───────────────────────────╮
4008 │                                  │            QN27           │
4009 │                                  ├─────────────┬─────────────┤
4010 │                                  │     Yes     │      No     │
4011 │                                  ├─────────────┼─────────────┤
4012 │                                  │    QND7A    │    QND7A    │
4013 │                                  ├──────┬──────┼──────┬──────┤
4014 │                                  │  Yes │  No  │  Yes │  No  │
4015 │                                  ├──────┼──────┼──────┼──────┤
4016 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4017 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4018 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4019 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4020 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4021 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4022 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4023 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4024 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4025 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4026 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4027 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4028 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4029 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4030 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
4031 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4032 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4033 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4034 │                       Subtable ID│ 26│26│ 27│27│ 30│30│ 31│31│
4035 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4036
4037                           Custom Tables
4038 Male
4039 Yes
4040 ╭───────────────────────────────────┬───────────────────────────╮
4041 │                                   │            QN27           │
4042 │                                   ├─────────────┬─────────────┤
4043 │                                   │     Yes     │      No     │
4044 │                                   ├─────────────┼─────────────┤
4045 │                                   │    QND7A    │    QND7A    │
4046 │                                   ├──────┬──────┼──────┬──────┤
4047 │                                   │  Yes │  No  │  Yes │  No  │
4048 │                                   ├──────┼──────┼──────┼──────┤
4049 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4050 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4051 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4052 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4053 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  6│ 6│  8│ 8│
4054 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4055 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4056 │              No  QN57 Row ID      │  9│ 9│ 11│11│ 14│14│ 15│15│
4057 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4058 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4059 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 20│20│ 22│22│ 23│23│
4060 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4061 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4062 │              No  QN57 Row ID      │ 26│26│ 28│28│ 29│29│ 32│32│
4063 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4064 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4065
4066                           Custom Tables
4067 Male
4068 No
4069 ╭───────────────────────────────────┬───────────────────────────╮
4070 │                                   │            QN27           │
4071 │                                   ├─────────────┬─────────────┤
4072 │                                   │     Yes     │      No     │
4073 │                                   ├─────────────┼─────────────┤
4074 │                                   │    QND7A    │    QND7A    │
4075 │                                   ├──────┬──────┼──────┬──────┤
4076 │                                   │  Yes │  No  │  Yes │  No  │
4077 │                                   ├──────┼──────┼──────┼──────┤
4078 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4079 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4080 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4081 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4082 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  5│ 5│  7│ 7│
4083 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4084 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4085 │              No  QN57 Row ID      │ 10│10│ 12│12│ 13│13│ 16│16│
4086 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4087 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4088 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 19│19│ 21│21│ 24│24│
4089 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
4090 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4091 │              No  QN57 Row ID      │ 25│25│ 27│27│ 30│30│ 31│31│
4092 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
4093 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4094
4095                           Custom Tables
4096 Female
4097 Yes
4098 ╭───────────────────────────────────┬───────────────────────────╮
4099 │                                   │            QN27           │
4100 │                                   ├─────────────┬─────────────┤
4101 │                                   │     Yes     │      No     │
4102 │                                   ├─────────────┼─────────────┤
4103 │                                   │    QND7A    │    QND7A    │
4104 │                                   ├──────┬──────┼──────┬──────┤
4105 │                                   │  Yes │  No  │  Yes │  No  │
4106 │                                   ├──────┼──────┼──────┼──────┤
4107 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4108 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4109 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4110 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4111 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 36│36│ 38│38│ 40│40│
4112 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4113 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4114 │              No  QN57 Row ID      │ 42│42│ 43│43│ 45│45│ 47│47│
4115 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4116 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4117 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 52│52│ 53│53│ 56│56│
4118 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4119 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4120 │              No  QN57 Row ID      │ 57│57│ 60│60│ 61│61│ 63│63│
4121 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4122 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4123
4124                           Custom Tables
4125 Female
4126 No
4127 ╭───────────────────────────────────┬───────────────────────────╮
4128 │                                   │            QN27           │
4129 │                                   ├─────────────┬─────────────┤
4130 │                                   │     Yes     │      No     │
4131 │                                   ├─────────────┼─────────────┤
4132 │                                   │    QND7A    │    QND7A    │
4133 │                                   ├──────┬──────┼──────┬──────┤
4134 │                                   │  Yes │  No  │  Yes │  No  │
4135 │                                   ├──────┼──────┼──────┼──────┤
4136 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4137 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4138 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4139 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4140 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 35│35│ 37│37│ 39│39│
4141 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4142 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4143 │              No  QN57 Row ID      │ 41│41│ 44│44│ 46│46│ 48│48│
4144 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4145 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4146 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 51│51│ 54│54│ 55│55│
4147 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4148 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4149 │              No  QN57 Row ID      │ 58│58│ 59│59│ 62│62│ 64│64│
4150 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4151 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4152
4153                             Custom Tables
4154 Male
4155 Yes
4156 ╭──────────────────────────────────────┬───────────────────────────╮
4157 │                                      │            QN27           │
4158 │                                      ├─────────────┬─────────────┤
4159 │                                      │     Yes     │      No     │
4160 │                                      ├─────────────┼─────────────┤
4161 │                                      │    QND7A    │    QND7A    │
4162 │                                      ├──────┬──────┼──────┬──────┤
4163 │                                      │  Yes │  No  │  Yes │  No  │
4164 │                                      ├──────┼──────┼──────┼──────┤
4165 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4166 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4167 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4168 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4169 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 4│  6│ 7│ 10│11│ 14│15│
4170 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4171 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4172 │              No  QN57 Column ID      │  2│ 4│  6│ 7│ 10│11│ 14│15│
4173 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4174 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4175 │     No  QN61 Yes QN57 Column ID      │ 18│19│ 21│23│ 25│28│ 29│32│
4176 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4177 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4178 │              No  QN57 Column ID      │ 18│19│ 21│23│ 25│28│ 29│32│
4179 │                       Layer Column ID│  2│ 4│  6│ 7│ 10│11│ 14│15│
4180 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4181
4182                             Custom Tables
4183 Male
4184 No
4185 ╭──────────────────────────────────────┬───────────────────────────╮
4186 │                                      │            QN27           │
4187 │                                      ├─────────────┬─────────────┤
4188 │                                      │     Yes     │      No     │
4189 │                                      ├─────────────┼─────────────┤
4190 │                                      │    QND7A    │    QND7A    │
4191 │                                      ├──────┬──────┼──────┬──────┤
4192 │                                      │  Yes │  No  │  Yes │  No  │
4193 │                                      ├──────┼──────┼──────┼──────┤
4194 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4195 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4196 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4197 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4198 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 3│  5│ 8│  9│12│ 13│16│
4199 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4200 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4201 │              No  QN57 Column ID      │  1│ 3│  5│ 8│  9│12│ 13│16│
4202 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4203 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4204 │     No  QN61 Yes QN57 Column ID      │ 17│20│ 22│24│ 26│27│ 30│31│
4205 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4206 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4207 │              No  QN57 Column ID      │ 17│20│ 22│24│ 26│27│ 30│31│
4208 │                       Layer Column ID│  1│ 3│  5│ 8│  9│12│ 13│16│
4209 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4210
4211                             Custom Tables
4212 Female
4213 Yes
4214 ╭──────────────────────────────────────┬───────────────────────────╮
4215 │                                      │            QN27           │
4216 │                                      ├─────────────┬─────────────┤
4217 │                                      │     Yes     │      No     │
4218 │                                      ├─────────────┼─────────────┤
4219 │                                      │    QND7A    │    QND7A    │
4220 │                                      ├──────┬──────┼──────┬──────┤
4221 │                                      │  Yes │  No  │  Yes │  No  │
4222 │                                      ├──────┼──────┼──────┼──────┤
4223 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4224 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4225 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4226 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4227 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│35│ 37│39│ 41│44│ 45│47│
4228 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4229 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4230 │              No  QN57 Column ID      │ 34│35│ 37│39│ 41│44│ 45│47│
4231 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4232 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4233 │     No  QN61 Yes QN57 Column ID      │ 50│51│ 53│55│ 57│59│ 62│64│
4234 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4235 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4236 │              No  QN57 Column ID      │ 50│51│ 53│55│ 57│59│ 62│64│
4237 │                       Layer Column ID│ 18│19│ 21│23│ 25│28│ 29│31│
4238 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4239
4240                             Custom Tables
4241 Female
4242 No
4243 ╭──────────────────────────────────────┬───────────────────────────╮
4244 │                                      │            QN27           │
4245 │                                      ├─────────────┬─────────────┤
4246 │                                      │     Yes     │      No     │
4247 │                                      ├─────────────┼─────────────┤
4248 │                                      │    QND7A    │    QND7A    │
4249 │                                      ├──────┬──────┼──────┬──────┤
4250 │                                      │  Yes │  No  │  Yes │  No  │
4251 │                                      ├──────┼──────┼──────┼──────┤
4252 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4253 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4254 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4255 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4256 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│36│ 38│40│ 42│43│ 46│48│
4257 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4258 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4259 │              No  QN57 Column ID      │ 33│36│ 38│40│ 42│43│ 46│48│
4260 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4261 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4262 │     No  QN61 Yes QN57 Column ID      │ 49│52│ 54│56│ 58│60│ 61│63│
4263 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4264 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4265 │              No  QN57 Column ID      │ 49│52│ 54│56│ 58│60│ 61│63│
4266 │                       Layer Column ID│ 17│20│ 22│24│ 26│27│ 30│32│
4267 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4268 ])
4269 AT_CLEANUP
4270
4271 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4272 AT_KEYWORDS([COLLABELS LAYER])
4273 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4274 AT_DATA([ctables.sps],
4275 [[GET 'nhtsa.sav'.
4276 CTABLES
4277     /VLABELS VARIABLES=ALL DISPLAY=NAME
4278     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4279     /SLABELS POSITION=ROW
4280     /CLABELS COLLABELS=LAYER
4281     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4282     /SLABELS POSITION=ROW
4283     /CLABELS COLLABELS=LAYER
4284     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4285     /SLABELS POSITION=ROW
4286     /CLABELS COLLABELS=LAYER.
4287 ]])
4288 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4289                         Custom Tables
4290 Male
4291 Yes
4292 ╭──────────────────────────────────────┬───────────────────╮
4293 │                                      │        QN27       │
4294 │                                      ├─────────┬─────────┤
4295 │                                      │   Yes   │    No   │
4296 │                                      ├─────────┼─────────┤
4297 │                                      │  QND7A  │  QND7A  │
4298 │                                      ├────┬────┼────┬────┤
4299 │                                      │ Yes│ No │ Yes│ No │
4300 │                                      ├────┼────┼────┼────┤
4301 │                                      │QN86│QN86│QN86│QN86│
4302 ├──────────────────────────────────────┼────┼────┼────┼────┤
4303 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4304 │                           Layer ID   │   2│   2│   2│   2│
4305 │                           Subtable ID│   2│   2│   4│   4│
4306 │                      ╶───────────────┼────┼────┼────┼────┤
4307 │                       No  Table ID   │   1│   1│   1│   1│
4308 │                           Layer ID   │   2│   2│   2│   2│
4309 │                           Subtable ID│   2│   2│   4│   4│
4310 │             ╶────────────────────────┼────┼────┼────┼────┤
4311 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4312 │                           Layer ID   │   2│   2│   2│   2│
4313 │                           Subtable ID│   5│   5│   7│   7│
4314 │                      ╶───────────────┼────┼────┼────┼────┤
4315 │                       No  Table ID   │   1│   1│   1│   1│
4316 │                           Layer ID   │   2│   2│   2│   2│
4317 │                           Subtable ID│   5│   5│   7│   7│
4318 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4319 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4320 │                           Layer ID   │   2│   2│   2│   2│
4321 │                           Subtable ID│  10│  10│  12│  12│
4322 │                      ╶───────────────┼────┼────┼────┼────┤
4323 │                       No  Table ID   │   1│   1│   1│   1│
4324 │                           Layer ID   │   2│   2│   2│   2│
4325 │                           Subtable ID│  10│  10│  12│  12│
4326 │             ╶────────────────────────┼────┼────┼────┼────┤
4327 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4328 │                           Layer ID   │   2│   2│   2│   2│
4329 │                           Subtable ID│  13│  13│  15│  15│
4330 │                      ╶───────────────┼────┼────┼────┼────┤
4331 │                       No  Table ID   │   1│   1│   1│   1│
4332 │                           Layer ID   │   2│   2│   2│   2│
4333 │                           Subtable ID│  13│  13│  15│  15│
4334 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4335
4336                         Custom Tables
4337 Male
4338 No
4339 ╭──────────────────────────────────────┬───────────────────╮
4340 │                                      │        QN27       │
4341 │                                      ├─────────┬─────────┤
4342 │                                      │   Yes   │    No   │
4343 │                                      ├─────────┼─────────┤
4344 │                                      │  QND7A  │  QND7A  │
4345 │                                      ├────┬────┼────┬────┤
4346 │                                      │ Yes│ No │ Yes│ No │
4347 │                                      ├────┼────┼────┼────┤
4348 │                                      │QN86│QN86│QN86│QN86│
4349 ├──────────────────────────────────────┼────┼────┼────┼────┤
4350 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4351 │                           Layer ID   │   1│   1│   1│   1│
4352 │                           Subtable ID│   1│   1│   3│   3│
4353 │                      ╶───────────────┼────┼────┼────┼────┤
4354 │                       No  Table ID   │   1│   1│   1│   1│
4355 │                           Layer ID   │   1│   1│   1│   1│
4356 │                           Subtable ID│   1│   1│   3│   3│
4357 │             ╶────────────────────────┼────┼────┼────┼────┤
4358 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4359 │                           Layer ID   │   1│   1│   1│   1│
4360 │                           Subtable ID│   6│   6│   8│   8│
4361 │                      ╶───────────────┼────┼────┼────┼────┤
4362 │                       No  Table ID   │   1│   1│   1│   1│
4363 │                           Layer ID   │   1│   1│   1│   1│
4364 │                           Subtable ID│   6│   6│   8│   8│
4365 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4366 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4367 │                           Layer ID   │   1│   1│   1│   1│
4368 │                           Subtable ID│   9│   9│  11│  11│
4369 │                      ╶───────────────┼────┼────┼────┼────┤
4370 │                       No  Table ID   │   1│   1│   1│   1│
4371 │                           Layer ID   │   1│   1│   1│   1│
4372 │                           Subtable ID│   9│   9│  11│  11│
4373 │             ╶────────────────────────┼────┼────┼────┼────┤
4374 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4375 │                           Layer ID   │   1│   1│   1│   1│
4376 │                           Subtable ID│  14│  14│  16│  16│
4377 │                      ╶───────────────┼────┼────┼────┼────┤
4378 │                       No  Table ID   │   1│   1│   1│   1│
4379 │                           Layer ID   │   1│   1│   1│   1│
4380 │                           Subtable ID│  14│  14│  16│  16│
4381 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4382
4383                         Custom Tables
4384 Female
4385 Yes
4386 ╭──────────────────────────────────────┬───────────────────╮
4387 │                                      │        QN27       │
4388 │                                      ├─────────┬─────────┤
4389 │                                      │   Yes   │    No   │
4390 │                                      ├─────────┼─────────┤
4391 │                                      │  QND7A  │  QND7A  │
4392 │                                      ├────┬────┼────┬────┤
4393 │                                      │ Yes│ No │ Yes│ No │
4394 │                                      ├────┼────┼────┼────┤
4395 │                                      │QN86│QN86│QN86│QN86│
4396 ├──────────────────────────────────────┼────┼────┼────┼────┤
4397 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4398 │                           Layer ID   │   4│   4│   4│   4│
4399 │                           Subtable ID│  18│  18│  19│  19│
4400 │                      ╶───────────────┼────┼────┼────┼────┤
4401 │                       No  Table ID   │   1│   1│   1│   1│
4402 │                           Layer ID   │   4│   4│   4│   4│
4403 │                           Subtable ID│  18│  18│  19│  19│
4404 │             ╶────────────────────────┼────┼────┼────┼────┤
4405 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4406 │                           Layer ID   │   4│   4│   4│   4│
4407 │                           Subtable ID│  22│  22│  23│  23│
4408 │                      ╶───────────────┼────┼────┼────┼────┤
4409 │                       No  Table ID   │   1│   1│   1│   1│
4410 │                           Layer ID   │   4│   4│   4│   4│
4411 │                           Subtable ID│  22│  22│  23│  23│
4412 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4413 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4414 │                           Layer ID   │   4│   4│   4│   4│
4415 │                           Subtable ID│  26│  26│  28│  28│
4416 │                      ╶───────────────┼────┼────┼────┼────┤
4417 │                       No  Table ID   │   1│   1│   1│   1│
4418 │                           Layer ID   │   4│   4│   4│   4│
4419 │                           Subtable ID│  26│  26│  28│  28│
4420 │             ╶────────────────────────┼────┼────┼────┼────┤
4421 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4422 │                           Layer ID   │   4│   4│   4│   4│
4423 │                           Subtable ID│  29│  29│  31│  31│
4424 │                      ╶───────────────┼────┼────┼────┼────┤
4425 │                       No  Table ID   │   1│   1│   1│   1│
4426 │                           Layer ID   │   4│   4│   4│   4│
4427 │                           Subtable ID│  29│  29│  31│  31│
4428 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4429
4430                         Custom Tables
4431 Female
4432 No
4433 ╭──────────────────────────────────────┬───────────────────╮
4434 │                                      │        QN27       │
4435 │                                      ├─────────┬─────────┤
4436 │                                      │   Yes   │    No   │
4437 │                                      ├─────────┼─────────┤
4438 │                                      │  QND7A  │  QND7A  │
4439 │                                      ├────┬────┼────┬────┤
4440 │                                      │ Yes│ No │ Yes│ No │
4441 │                                      ├────┼────┼────┼────┤
4442 │                                      │QN86│QN86│QN86│QN86│
4443 ├──────────────────────────────────────┼────┼────┼────┼────┤
4444 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4445 │                           Layer ID   │   3│   3│   3│   3│
4446 │                           Subtable ID│  17│  17│  20│  20│
4447 │                      ╶───────────────┼────┼────┼────┼────┤
4448 │                       No  Table ID   │   1│   1│   1│   1│
4449 │                           Layer ID   │   3│   3│   3│   3│
4450 │                           Subtable ID│  17│  17│  20│  20│
4451 │             ╶────────────────────────┼────┼────┼────┼────┤
4452 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4453 │                           Layer ID   │   3│   3│   3│   3│
4454 │                           Subtable ID│  21│  21│  24│  24│
4455 │                      ╶───────────────┼────┼────┼────┼────┤
4456 │                       No  Table ID   │   1│   1│   1│   1│
4457 │                           Layer ID   │   3│   3│   3│   3│
4458 │                           Subtable ID│  21│  21│  24│  24│
4459 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4460 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4461 │                           Layer ID   │   3│   3│   3│   3│
4462 │                           Subtable ID│  25│  25│  27│  27│
4463 │                      ╶───────────────┼────┼────┼────┼────┤
4464 │                       No  Table ID   │   1│   1│   1│   1│
4465 │                           Layer ID   │   3│   3│   3│   3│
4466 │                           Subtable ID│  25│  25│  27│  27│
4467 │             ╶────────────────────────┼────┼────┼────┼────┤
4468 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4469 │                           Layer ID   │   3│   3│   3│   3│
4470 │                           Subtable ID│  30│  30│  32│  32│
4471 │                      ╶───────────────┼────┼────┼────┼────┤
4472 │                       No  Table ID   │   1│   1│   1│   1│
4473 │                           Layer ID   │   3│   3│   3│   3│
4474 │                           Subtable ID│  30│  30│  32│  32│
4475 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4476
4477                         Custom Tables
4478 Male
4479 Yes
4480 ╭───────────────────────────────────────┬───────────────────╮
4481 │                                       │        QN27       │
4482 │                                       ├─────────┬─────────┤
4483 │                                       │   Yes   │    No   │
4484 │                                       ├─────────┼─────────┤
4485 │                                       │  QND7A  │  QND7A  │
4486 │                                       ├────┬────┼────┬────┤
4487 │                                       │ Yes│ No │ Yes│ No │
4488 │                                       ├────┼────┼────┼────┤
4489 │                                       │QN86│QN86│QN86│QN86│
4490 ├───────────────────────────────────────┼────┼────┼────┼────┤
4491 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   3│   3│
4492 │                           Layer Row ID│   2│   2│   2│   2│
4493 │                      ╶────────────────┼────┼────┼────┼────┤
4494 │                       No  Row ID      │   5│   5│   7│   7│
4495 │                           Layer Row ID│   3│   3│   3│   3│
4496 │             ╶─────────────────────────┼────┼────┼────┼────┤
4497 │              No  QN57 Yes Row ID      │  10│  10│  11│  11│
4498 │                           Layer Row ID│   6│   6│   6│   6│
4499 │                      ╶────────────────┼────┼────┼────┼────┤
4500 │                       No  Row ID      │  14│  14│  16│  16│
4501 │                           Layer Row ID│   8│   8│   8│   8│
4502 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4503 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  19│  19│
4504 │                           Layer Row ID│   9│   9│   9│   9│
4505 │                      ╶────────────────┼────┼────┼────┼────┤
4506 │                       No  Row ID      │  21│  21│  23│  23│
4507 │                           Layer Row ID│  11│  11│  11│  11│
4508 │             ╶─────────────────────────┼────┼────┼────┼────┤
4509 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4510 │                           Layer Row ID│  14│  14│  14│  14│
4511 │                      ╶────────────────┼────┼────┼────┼────┤
4512 │                       No  Row ID      │  30│  30│  32│  32│
4513 │                           Layer Row ID│  16│  16│  16│  16│
4514 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4515
4516                         Custom Tables
4517 Male
4518 No
4519 ╭───────────────────────────────────────┬───────────────────╮
4520 │                                       │        QN27       │
4521 │                                       ├─────────┬─────────┤
4522 │                                       │   Yes   │    No   │
4523 │                                       ├─────────┼─────────┤
4524 │                                       │  QND7A  │  QND7A  │
4525 │                                       ├────┬────┼────┬────┤
4526 │                                       │ Yes│ No │ Yes│ No │
4527 │                                       ├────┼────┼────┼────┤
4528 │                                       │QN86│QN86│QN86│QN86│
4529 ├───────────────────────────────────────┼────┼────┼────┼────┤
4530 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   4│   4│
4531 │                           Layer Row ID│   1│   1│   1│   1│
4532 │                      ╶────────────────┼────┼────┼────┼────┤
4533 │                       No  Row ID      │   6│   6│   8│   8│
4534 │                           Layer Row ID│   4│   4│   4│   4│
4535 │             ╶─────────────────────────┼────┼────┼────┼────┤
4536 │              No  QN57 Yes Row ID      │   9│   9│  12│  12│
4537 │                           Layer Row ID│   5│   5│   5│   5│
4538 │                      ╶────────────────┼────┼────┼────┼────┤
4539 │                       No  Row ID      │  13│  13│  15│  15│
4540 │                           Layer Row ID│   7│   7│   7│   7│
4541 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4542 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  20│  20│
4543 │                           Layer Row ID│  10│  10│  10│  10│
4544 │                      ╶────────────────┼────┼────┼────┼────┤
4545 │                       No  Row ID      │  22│  22│  24│  24│
4546 │                           Layer Row ID│  12│  12│  12│  12│
4547 │             ╶─────────────────────────┼────┼────┼────┼────┤
4548 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4549 │                           Layer Row ID│  13│  13│  13│  13│
4550 │                      ╶────────────────┼────┼────┼────┼────┤
4551 │                       No  Row ID      │  29│  29│  31│  31│
4552 │                           Layer Row ID│  15│  15│  15│  15│
4553 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4554
4555                         Custom Tables
4556 Female
4557 Yes
4558 ╭───────────────────────────────────────┬───────────────────╮
4559 │                                       │        QN27       │
4560 │                                       ├─────────┬─────────┤
4561 │                                       │   Yes   │    No   │
4562 │                                       ├─────────┼─────────┤
4563 │                                       │  QND7A  │  QND7A  │
4564 │                                       ├────┬────┼────┬────┤
4565 │                                       │ Yes│ No │ Yes│ No │
4566 │                                       ├────┼────┼────┼────┤
4567 │                                       │QN86│QN86│QN86│QN86│
4568 ├───────────────────────────────────────┼────┼────┼────┼────┤
4569 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  36│  36│
4570 │                           Layer Row ID│  17│  17│  17│  17│
4571 │                      ╶────────────────┼────┼────┼────┼────┤
4572 │                       No  Row ID      │  37│  37│  39│  39│
4573 │                           Layer Row ID│  19│  19│  19│  19│
4574 │             ╶─────────────────────────┼────┼────┼────┼────┤
4575 │              No  QN57 Yes Row ID      │  41│  41│  44│  44│
4576 │                           Layer Row ID│  21│  21│  21│  21│
4577 │                      ╶────────────────┼────┼────┼────┼────┤
4578 │                       No  Row ID      │  45│  45│  48│  48│
4579 │                           Layer Row ID│  23│  23│  23│  23│
4580 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4581 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  52│  52│
4582 │                           Layer Row ID│  25│  25│  25│  25│
4583 │                      ╶────────────────┼────┼────┼────┼────┤
4584 │                       No  Row ID      │  53│  53│  55│  55│
4585 │                           Layer Row ID│  27│  27│  27│  27│
4586 │             ╶─────────────────────────┼────┼────┼────┼────┤
4587 │              No  QN57 Yes Row ID      │  58│  58│  59│  59│
4588 │                           Layer Row ID│  30│  30│  30│  30│
4589 │                      ╶────────────────┼────┼────┼────┼────┤
4590 │                       No  Row ID      │  62│  62│  64│  64│
4591 │                           Layer Row ID│  32│  32│  32│  32│
4592 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4593
4594                         Custom Tables
4595 Female
4596 No
4597 ╭───────────────────────────────────────┬───────────────────╮
4598 │                                       │        QN27       │
4599 │                                       ├─────────┬─────────┤
4600 │                                       │   Yes   │    No   │
4601 │                                       ├─────────┼─────────┤
4602 │                                       │  QND7A  │  QND7A  │
4603 │                                       ├────┬────┼────┬────┤
4604 │                                       │ Yes│ No │ Yes│ No │
4605 │                                       ├────┼────┼────┼────┤
4606 │                                       │QN86│QN86│QN86│QN86│
4607 ├───────────────────────────────────────┼────┼────┼────┼────┤
4608 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  35│  35│
4609 │                           Layer Row ID│  18│  18│  18│  18│
4610 │                      ╶────────────────┼────┼────┼────┼────┤
4611 │                       No  Row ID      │  38│  38│  40│  40│
4612 │                           Layer Row ID│  20│  20│  20│  20│
4613 │             ╶─────────────────────────┼────┼────┼────┼────┤
4614 │              No  QN57 Yes Row ID      │  42│  42│  43│  43│
4615 │                           Layer Row ID│  22│  22│  22│  22│
4616 │                      ╶────────────────┼────┼────┼────┼────┤
4617 │                       No  Row ID      │  46│  46│  47│  47│
4618 │                           Layer Row ID│  24│  24│  24│  24│
4619 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4620 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  51│  51│
4621 │                           Layer Row ID│  26│  26│  26│  26│
4622 │                      ╶────────────────┼────┼────┼────┼────┤
4623 │                       No  Row ID      │  54│  54│  56│  56│
4624 │                           Layer Row ID│  28│  28│  28│  28│
4625 │             ╶─────────────────────────┼────┼────┼────┼────┤
4626 │              No  QN57 Yes Row ID      │  57│  57│  60│  60│
4627 │                           Layer Row ID│  29│  29│  29│  29│
4628 │                      ╶────────────────┼────┼────┼────┼────┤
4629 │                       No  Row ID      │  61│  61│  63│  63│
4630 │                           Layer Row ID│  31│  31│  31│  31│
4631 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4632
4633                           Custom Tables
4634 Male
4635 Yes
4636 ╭──────────────────────────────────────────┬───────────────────╮
4637 │                                          │        QN27       │
4638 │                                          ├─────────┬─────────┤
4639 │                                          │   Yes   │    No   │
4640 │                                          ├─────────┼─────────┤
4641 │                                          │  QND7A  │  QND7A  │
4642 │                                          ├────┬────┼────┬────┤
4643 │                                          │ Yes│ No │ Yes│ No │
4644 │                                          ├────┼────┼────┼────┤
4645 │                                          │QN86│QN86│QN86│QN86│
4646 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4647 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   4│   5│   7│
4648 │                           Layer Column ID│   1│   4│   5│   7│
4649 │                      ╶───────────────────┼────┼────┼────┼────┤
4650 │                       No  Column ID      │   1│   4│   5│   7│
4651 │                           Layer Column ID│   1│   4│   5│   7│
4652 │             ╶────────────────────────────┼────┼────┼────┼────┤
4653 │              No  QN57 Yes Column ID      │   9│  12│  14│  15│
4654 │                           Layer Column ID│   1│   4│   5│   7│
4655 │                      ╶───────────────────┼────┼────┼────┼────┤
4656 │                       No  Column ID      │   9│  12│  14│  15│
4657 │                           Layer Column ID│   1│   4│   5│   7│
4658 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4659 │     No  QN61 Yes QN57 Yes Column ID      │  18│  20│  22│  24│
4660 │                           Layer Column ID│   1│   4│   5│   7│
4661 │                      ╶───────────────────┼────┼────┼────┼────┤
4662 │                       No  Column ID      │  18│  20│  22│  24│
4663 │                           Layer Column ID│   1│   4│   5│   7│
4664 │             ╶────────────────────────────┼────┼────┼────┼────┤
4665 │              No  QN57 Yes Column ID      │  26│  27│  30│  31│
4666 │                           Layer Column ID│   1│   4│   5│   7│
4667 │                      ╶───────────────────┼────┼────┼────┼────┤
4668 │                       No  Column ID      │  26│  27│  30│  31│
4669 │                           Layer Column ID│   1│   4│   5│   7│
4670 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4671
4672                           Custom Tables
4673 Male
4674 No
4675 ╭──────────────────────────────────────────┬───────────────────╮
4676 │                                          │        QN27       │
4677 │                                          ├─────────┬─────────┤
4678 │                                          │   Yes   │    No   │
4679 │                                          ├─────────┼─────────┤
4680 │                                          │  QND7A  │  QND7A  │
4681 │                                          ├────┬────┼────┬────┤
4682 │                                          │ Yes│ No │ Yes│ No │
4683 │                                          ├────┼────┼────┼────┤
4684 │                                          │QN86│QN86│QN86│QN86│
4685 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4686 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   3│   6│   8│
4687 │                           Layer Column ID│   2│   3│   6│   8│
4688 │                      ╶───────────────────┼────┼────┼────┼────┤
4689 │                       No  Column ID      │   2│   3│   6│   8│
4690 │                           Layer Column ID│   2│   3│   6│   8│
4691 │             ╶────────────────────────────┼────┼────┼────┼────┤
4692 │              No  QN57 Yes Column ID      │  10│  11│  13│  16│
4693 │                           Layer Column ID│   2│   3│   6│   8│
4694 │                      ╶───────────────────┼────┼────┼────┼────┤
4695 │                       No  Column ID      │  10│  11│  13│  16│
4696 │                           Layer Column ID│   2│   3│   6│   8│
4697 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4698 │     No  QN61 Yes QN57 Yes Column ID      │  17│  19│  21│  23│
4699 │                           Layer Column ID│   2│   3│   6│   8│
4700 │                      ╶───────────────────┼────┼────┼────┼────┤
4701 │                       No  Column ID      │  17│  19│  21│  23│
4702 │                           Layer Column ID│   2│   3│   6│   8│
4703 │             ╶────────────────────────────┼────┼────┼────┼────┤
4704 │              No  QN57 Yes Column ID      │  25│  28│  29│  32│
4705 │                           Layer Column ID│   2│   3│   6│   8│
4706 │                      ╶───────────────────┼────┼────┼────┼────┤
4707 │                       No  Column ID      │  25│  28│  29│  32│
4708 │                           Layer Column ID│   2│   3│   6│   8│
4709 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4710
4711                           Custom Tables
4712 Female
4713 Yes
4714 ╭──────────────────────────────────────────┬───────────────────╮
4715 │                                          │        QN27       │
4716 │                                          ├─────────┬─────────┤
4717 │                                          │   Yes   │    No   │
4718 │                                          ├─────────┼─────────┤
4719 │                                          │  QND7A  │  QND7A  │
4720 │                                          ├────┬────┼────┬────┤
4721 │                                          │ Yes│ No │ Yes│ No │
4722 │                                          ├────┼────┼────┼────┤
4723 │                                          │QN86│QN86│QN86│QN86│
4724 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4725 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  37│  39│
4726 │                           Layer Column ID│  10│  12│  13│  15│
4727 │                      ╶───────────────────┼────┼────┼────┼────┤
4728 │                       No  Column ID      │  34│  36│  37│  39│
4729 │                           Layer Column ID│  10│  12│  13│  15│
4730 │             ╶────────────────────────────┼────┼────┼────┼────┤
4731 │              No  QN57 Yes Column ID      │  41│  43│  46│  48│
4732 │                           Layer Column ID│  10│  12│  13│  15│
4733 │                      ╶───────────────────┼────┼────┼────┼────┤
4734 │                       No  Column ID      │  41│  43│  46│  48│
4735 │                           Layer Column ID│  10│  12│  13│  15│
4736 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4737 │     No  QN61 Yes QN57 Yes Column ID      │  50│  51│  53│  55│
4738 │                           Layer Column ID│  10│  12│  13│  15│
4739 │                      ╶───────────────────┼────┼────┼────┼────┤
4740 │                       No  Column ID      │  50│  51│  53│  55│
4741 │                           Layer Column ID│  10│  12│  13│  15│
4742 │             ╶────────────────────────────┼────┼────┼────┼────┤
4743 │              No  QN57 Yes Column ID      │  58│  60│  62│  64│
4744 │                           Layer Column ID│  10│  12│  13│  15│
4745 │                      ╶───────────────────┼────┼────┼────┼────┤
4746 │                       No  Column ID      │  58│  60│  62│  64│
4747 │                           Layer Column ID│  10│  12│  13│  15│
4748 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4749
4750                           Custom Tables
4751 Female
4752 No
4753 ╭──────────────────────────────────────────┬───────────────────╮
4754 │                                          │        QN27       │
4755 │                                          ├─────────┬─────────┤
4756 │                                          │   Yes   │    No   │
4757 │                                          ├─────────┼─────────┤
4758 │                                          │  QND7A  │  QND7A  │
4759 │                                          ├────┬────┼────┬────┤
4760 │                                          │ Yes│ No │ Yes│ No │
4761 │                                          ├────┼────┼────┼────┤
4762 │                                          │QN86│QN86│QN86│QN86│
4763 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4764 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  38│  40│
4765 │                           Layer Column ID│   9│  11│  14│  16│
4766 │                      ╶───────────────────┼────┼────┼────┼────┤
4767 │                       No  Column ID      │  33│  35│  38│  40│
4768 │                           Layer Column ID│   9│  11│  14│  16│
4769 │             ╶────────────────────────────┼────┼────┼────┼────┤
4770 │              No  QN57 Yes Column ID      │  42│  44│  45│  47│
4771 │                           Layer Column ID│   9│  11│  14│  16│
4772 │                      ╶───────────────────┼────┼────┼────┼────┤
4773 │                       No  Column ID      │  42│  44│  45│  47│
4774 │                           Layer Column ID│   9│  11│  14│  16│
4775 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4776 │     No  QN61 Yes QN57 Yes Column ID      │  49│  52│  54│  56│
4777 │                           Layer Column ID│   9│  11│  14│  16│
4778 │                      ╶───────────────────┼────┼────┼────┼────┤
4779 │                       No  Column ID      │  49│  52│  54│  56│
4780 │                           Layer Column ID│   9│  11│  14│  16│
4781 │             ╶────────────────────────────┼────┼────┼────┼────┤
4782 │              No  QN57 Yes Column ID      │  57│  59│  61│  63│
4783 │                           Layer Column ID│   9│  11│  14│  16│
4784 │                      ╶───────────────────┼────┼────┼────┼────┤
4785 │                       No  Column ID      │  57│  59│  61│  63│
4786 │                           Layer Column ID│   9│  11│  14│  16│
4787 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4788 ])
4789 AT_CLEANUP
4790
4791 AT_SETUP([CTABLES categorical summary functions])
4792 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4793 AT_DATA([ctables.sps],
4794 [[GET 'nhtsa.sav'.
4795 CTABLES
4796     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
4797     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
4798     /SLABELS POSITION=ROW.
4799 ]])
4800 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4801                                                       Custom Tables
4802 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
4803 │                 │                     D5a. What would you say is your primary ethnic background?                     │
4804 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
4805 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
4806 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
4807 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
4808 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4809 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
4810 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
4811 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
4812 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4813 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4814 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
4815 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4816 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4817 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
4818 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
4819 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4820 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
4821 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
4822 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
4823 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4824 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4825 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
4826 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4827 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4828 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
4829 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
4830 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4831 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
4832 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
4833 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
4834 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4835 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4836 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
4837 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4838 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4839 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
4840 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
4841 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4842 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
4843 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
4844 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
4845 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
4846 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4847 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
4848 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
4849 │          %      │     │       │       │          │          │         │          │              │      │       │     │
4850 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
4851 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
4852 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
4853 ])
4854 AT_CLEANUP
4855
4856 AT_SETUP([CTABLES scale summary functions])
4857 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4858 AT_DATA([ctables.sps],
4859 [[GET 'nhtsa.sav'.
4860 SET TVAR=NAME.
4861
4862 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4863   CTABLES later, to make the results easier to verify.
4864 SPLIT FILE BY REGION.
4865 FREQUENCIES
4866     qn19a
4867     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4868     /FORMAT NOTABLE /MISSING=INCLUDE.
4869 SPLIT FILE OFF.
4870
4871 CTABLES
4872     /VLABELS VARIABLE=qn19a DISPLAY=NONE
4873     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
4874     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
4875     /SLABELS POSITION=ROW
4876     /CLABELS ROWLABELS=OPPOSITE.
4877 ]])
4878 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4879                    Statistics
4880 ╭─────────┬───────────────────────────────────╮
4881 │         │               REGION              │
4882 │         ├────────┬────────┬────────┬────────┤
4883 │         │   NE   │   MW   │    S   │    W   │
4884 │         ├────────┼────────┼────────┼────────┤
4885 │         │  QN19A │  QN19A │  QN19A │  QN19A │
4886 ├─────────┼────────┼────────┼────────┼────────┤
4887 │N Valid  │     936│    1019│    1276│     950│
4888 │  Missing│     473│     635│    1114│     596│
4889 ├─────────┼────────┼────────┼────────┼────────┤
4890 │Mean     │   19.33│   19.83│   20.29│   19.87│
4891 ├─────────┼────────┼────────┼────────┼────────┤
4892 │S.E. Mean│     .14│     .16│     .18│     .17│
4893 ├─────────┼────────┼────────┼────────┼────────┤
4894 │Median   │   18.00│   19.00│   19.00│   19.00│
4895 ├─────────┼────────┼────────┼────────┼────────┤
4896 │Mode     │   18.00│   18.00│   18.00│   18.00│
4897 ├─────────┼────────┼────────┼────────┼────────┤
4898 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
4899 ├─────────┼────────┼────────┼────────┼────────┤
4900 │Variance │   19.41│   26.47│   41.43│   27.59│
4901 ├─────────┼────────┼────────┼────────┼────────┤
4902 │Range    │   59.00│   71.00│   75.00│   61.00│
4903 ├─────────┼────────┼────────┼────────┼────────┤
4904 │Minimum  │     .00│    4.00│    4.00│    4.00│
4905 ├─────────┼────────┼────────┼────────┼────────┤
4906 │Maximum  │   59.00│   75.00│   79.00│   65.00│
4907 ├─────────┼────────┼────────┼────────┼────────┤
4908 │Sum      │18092.00│20206.00│25886.00│18877.00│
4909 ╰─────────┴────────┴────────┴────────┴────────╯
4910
4911                          Custom Tables
4912 ╭────────────────────────┬────────┬────────┬────────┬────────╮
4913 │                        │   NE   │   MW   │    S   │    W   │
4914 ├────────────────────────┼────────┼────────┼────────┼────────┤
4915 │REGION Valid N          │     936│    1019│    1276│     950│
4916 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
4917 │       Mean             │   19.33│   19.83│   20.29│   19.87│
4918 │       Std Error of Mean│     .14│     .16│     .18│     .17│
4919 │       Median           │   18.00│   19.00│   19.00│   19.00│
4920 │       Mode             │   18.00│   18.00│   18.00│   18.00│
4921 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
4922 │       Variance         │   19.41│   26.47│   41.43│   27.59│
4923 │       Range            │   59.00│   71.00│   75.00│   61.00│
4924 │       Minimum          │     .00│    4.00│    4.00│    4.00│
4925 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
4926 │       Sum              │18092.00│20206.00│25886.00│18877.00│
4927 │       Count            │    1409│    1654│    2390│    1546│
4928 │       Total N          │    1409│    1654│    2390│    1546│
4929 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
4930 ╰────────────────────────┴────────┴────────┴────────┴────────╯
4931 ])
4932 AT_CLEANUP
4933
4934 AT_SETUP([CTABLES scale summary functions - weighting])
4935 weight=1
4936 c=10
4937 for a in 1 2 9; do
4938     for b in 3 4 9; do
4939         for n in 1 2 3 4 5 6 7 8 9 10; do
4940             if test $c -lt 15; then
4941                 cval=.
4942             else
4943                 cval=$c
4944             fi
4945             printf "$weight $a $b $cval\n"
4946             weight=$(expr \( $weight + 3 \) % 7 + 2)
4947             c=$(expr \( $c + 13 \) % 29 + 7)
4948         done
4949     done
4950 done > ctables.txt
4951
4952 AT_DATA([analysis.sps],
4953 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
4954   CTABLES later, to make the results easier to verify.
4955 SPLIT FILE BY a b.
4956 FREQUENCIES
4957     c
4958     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
4959     /FORMAT NOTABLE /MISSING=INCLUDE.
4960 SPLIT FILE OFF.
4961
4962 CTABLES
4963     /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
4964     /SLABELS POSITION=ROW
4965     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
4966 ]])
4967
4968 AT_DATA([ctables.sps],
4969 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
4970     /w (F5.0) a b c (f2.0).
4971 VAR LEVEL w c (SCALE) a b (NOMINAL).
4972 MISSING VALUES a b (9).
4973
4974 INCLUDE 'analysis.sps'.
4975
4976 WEIGHT BY w.
4977 INCLUDE 'analysis.sps'.
4978
4979 * Same as original analysis using unweighted versions of summaries.
4980 CTABLES
4981     /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
4982     /SLABELS POSITION=ROW
4983     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
4984 ]])
4985 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4986                                 Statistics
4987 ╭─────────┬──────────────────────────────────────────────────────────────╮
4988 │         │                               a                              │
4989 │         ├────────────────────┬────────────────────┬────────────────────┤
4990 │         │          1         │          2         │          9         │
4991 │         ├────────────────────┼────────────────────┼────────────────────┤
4992 │         │          b         │          b         │          b         │
4993 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
4994 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
4995 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4996 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
4997 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
4998 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
4999 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
5000 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5001 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5002 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5003 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5004 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5005 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5006 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5007 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5008 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5009 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5010 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5011 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5012 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5013 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5014 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5015 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5016 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5017 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5018 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5019 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5020 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5021
5022                                     Custom Tables
5023 ╭───────────────────┬──────────────────────────────────────────────────────────────╮
5024 │                   │                               a                              │
5025 │                   ├────────────────────┬────────────────────┬────────────────────┤
5026 │                   │          1         │          2         │          9         │
5027 │                   ├────────────────────┼────────────────────┼────────────────────┤
5028 │                   │          b         │          b         │          b         │
5029 │                   ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5030 │                   │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5031 ├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5032 │c Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5033 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5034 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5035 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5036 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5037 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5038 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5039 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5040 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5041 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5042 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5043 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5044 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5045 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5046 │  Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5047 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5048
5049                                   Statistics
5050 ╭─────────┬─────────────────────────────────────────────────────────────────╮
5051 │         │                                a                                │
5052 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
5053 │         │          1          │          2          │          9          │
5054 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
5055 │         │          b          │          b          │          b          │
5056 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5057 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5058 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5059 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
5060 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5061 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5062 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
5063 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5064 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5065 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5066 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5067 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5068 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5069 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5070 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5071 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5072 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5073 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5074 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5075 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5076 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5077 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5078 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5079 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5080 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5081 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5082 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5083 ╰─────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5084
5085                                      Custom Tables
5086 ╭───────────────────┬─────────────────────────────────────────────────────────────────╮
5087 │                   │                                a                                │
5088 │                   ├─────────────────────┬─────────────────────┬─────────────────────┤
5089 │                   │          1          │          2          │          9          │
5090 │                   ├─────────────────────┼─────────────────────┼─────────────────────┤
5091 │                   │          b          │          b          │          b          │
5092 │                   ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5093 │                   │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5094 ├───────────────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5095 │c Valid N          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5096 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5097 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5098 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5099 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5100 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5101 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5102 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5103 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5104 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5105 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5106 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5107 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5108 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5109 │  Layer Row Sum %  │  13.3%│ 10.3%│ 11.3%│  8.9%│  12.6%│ 11.5%│  9.8%│  9.9%│  12.4%│
5110 ╰───────────────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5111
5112                                          Custom Tables
5113 ╭──────────────────────────────┬──────────────────────────────────────────────────────────────╮
5114 │                              │                               a                              │
5115 │                              ├────────────────────┬────────────────────┬────────────────────┤
5116 │                              │          1         │          2         │          9         │
5117 │                              ├────────────────────┼────────────────────┼────────────────────┤
5118 │                              │          b         │          b         │          b         │
5119 │                              ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5120 │                              │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5121 ├──────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5122 │c Unweighted Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5123 │  Unweighted Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5124 │  Unweighted Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5125 │  Unweighted Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5126 │  Unweighted Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5127 │  Unweighted Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5128 │  Unweighted Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5129 │  Unweighted Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5130 │  Unweighted Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5131 │  Unweighted Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5132 │  Unweighted Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5133 │  Unweighted Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5134 ╰──────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5135 ])
5136 AT_CLEANUP
5137
5138 AT_SETUP([CTABLES hidden scale VLABELS])
5139 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5140 AT_DATA([ctables.sps],
5141 [[GET 'nhtsa.sav'.
5142 CTABLES
5143     /TABLE region BY qn19a + qn35
5144     /SLABELS POSITION=ROW.
5145 CTABLES
5146     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5147     /TABLE region BY qn19a + qn35
5148     /SLABELS POSITION=ROW.
5149 CTABLES
5150     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5151     /TABLE region BY qn19a + qn35
5152     /SLABELS POSITION=ROW.
5153
5154 * This one in particular caused a crash because no categories were
5155   created on the column axis, so passing in 0 for the index was still
5156   too big for that number of categories.  It was fixed by creating a
5157   name-only category for each variable despite the "NONE" request,
5158   then hiding the entire dimension's labels if all its labels were
5159   set to "NONE".
5160 CTABLES
5161     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5162     /TABLE region BY qn19a + qn35
5163     /SLABELS POSITION=ROW.
5164 ]])
5165 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5166                                  Custom Tables
5167 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5168 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5169 │              │   when you first starting  │   many times have you driven a  │
5170 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5171 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5172 │              │      sips of alcohol.      │            beverages?           │
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                                  Custom Tables
5184 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5185 │              │     │  35. In the past thirty days, how many times have you  │
5186 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5187 │              │QN19A│                  alcoholic beverages?                  │
5188 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5189 │Region NE Mean│19.33│                                                       2│
5190 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5191 │       MW Mean│19.83│                                                       2│
5192 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5193 │       S  Mean│20.29│                                                       2│
5194 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5195 │       W  Mean│19.87│                                                       2│
5196 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5197
5198                                  Custom Tables
5199 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5200 │              │   19a. About how old were you when you first starting   │    │
5201 │              │  drinking alcohol, not counting small tastes or sips of │    │
5202 │              │                         alcohol.                        │qn35│
5203 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5204 │Region NE Mean│                                                    19.33│   2│
5205 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5206 │       MW Mean│                                                    19.83│   2│
5207 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5208 │       S  Mean│                                                    20.29│   2│
5209 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5210 │       W  Mean│                                                    19.87│   2│
5211 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5212
5213       Custom Tables
5214 ╭──────────────┬───────╮
5215 │Region NE Mean│19.33 2│
5216 │      ╶───────┼───────┤
5217 │       MW Mean│19.83 2│
5218 │      ╶───────┼───────┤
5219 │       S  Mean│20.29 2│
5220 │      ╶───────┼───────┤
5221 │       W  Mean│19.87 2│
5222 ╰──────────────┴───────╯
5223 ])
5224 AT_CLEANUP
5225
5226 AT_SETUP([CTABLES with SPLIT FILE])
5227 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5228 AT_DATA([ctables.sps],
5229 [[GET 'nhtsa.sav'.
5230
5231 SORT CASES BY qns3a.
5232
5233 CTABLES /TABLE qn105ba.
5234
5235 * Layered split has no effect on output.
5236 SPLIT FILE BY qns3a.
5237 CTABLES /TABLE qn105ba.
5238
5239 * Add column variable qns3a to compare against separate splits.
5240 CTABLES /TABLE qn105ba BY qns3a.
5241
5242 * Separate splits are truly output separately.
5243 SPLIT FILE SEPARATE BY qns3a.
5244 CTABLES /TABLE qn105ba.
5245 ]])
5246 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5247                                   Custom Tables
5248 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5249 │                                                                        │Count│
5250 ├────────────────────────────────────────────────────────────────────────┼─────┤
5251 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5252 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5253 │                                                            Very likely │ 1502│
5254 │                                                            Somewhat    │ 2763│
5255 │                                                            likely      │     │
5256 │                                                            Somewhat    │ 1307│
5257 │                                                            unlikely    │     │
5258 │                                                            Very        │  609│
5259 │                                                            unlikely    │     │
5260 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5261
5262                                   Custom Tables
5263 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5264 │                                                                        │Count│
5265 ├────────────────────────────────────────────────────────────────────────┼─────┤
5266 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5267 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5268 │                                                            Very likely │ 1502│
5269 │                                                            Somewhat    │ 2763│
5270 │                                                            likely      │     │
5271 │                                                            Somewhat    │ 1307│
5272 │                                                            unlikely    │     │
5273 │                                                            Very        │  609│
5274 │                                                            unlikely    │     │
5275 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5276
5277                                   Custom Tables
5278 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5279 │                                                                 │S3a. GENDER:│
5280 │                                                                 ├─────┬──────┤
5281 │                                                                 │ Male│Female│
5282 │                                                                 ├─────┼──────┤
5283 │                                                                 │Count│ Count│
5284 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5285 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5286 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5287 │the police?                                          Very likely │  660│   842│
5288 │                                                     Somewhat    │ 1174│  1589│
5289 │                                                     likely      │     │      │
5290 │                                                     Somewhat    │  640│   667│
5291 │                                                     unlikely    │     │      │
5292 │                                                     Very        │  311│   298│
5293 │                                                     unlikely    │     │      │
5294 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5295
5296     Split Values
5297 ╭────────────┬─────╮
5298 │Variable    │Value│
5299 ├────────────┼─────┤
5300 │S3a. GENDER:│Male │
5301 ╰────────────┴─────╯
5302
5303                                   Custom Tables
5304 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5305 │                                                                        │Count│
5306 ├────────────────────────────────────────────────────────────────────────┼─────┤
5307 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5308 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5309 │                                                            Very likely │  660│
5310 │                                                            Somewhat    │ 1174│
5311 │                                                            likely      │     │
5312 │                                                            Somewhat    │  640│
5313 │                                                            unlikely    │     │
5314 │                                                            Very        │  311│
5315 │                                                            unlikely    │     │
5316 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5317
5318      Split Values
5319 ╭────────────┬──────╮
5320 │Variable    │ Value│
5321 ├────────────┼──────┤
5322 │S3a. GENDER:│Female│
5323 ╰────────────┴──────╯
5324
5325                                   Custom Tables
5326 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5327 │                                                                        │Count│
5328 ├────────────────────────────────────────────────────────────────────────┼─────┤
5329 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5330 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5331 │                                                            Very likely │  842│
5332 │                                                            Somewhat    │ 1589│
5333 │                                                            likely      │     │
5334 │                                                            Somewhat    │  667│
5335 │                                                            unlikely    │     │
5336 │                                                            Very        │  298│
5337 │                                                            unlikely    │     │
5338 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5339 ])
5340 AT_CLEANUP
5341
5342 AT_SETUP([CTABLES variable level inference])
5343 AT_DATA([data.txt], [dnl
5344 dnl n1 has 10 unique small values -> nominal.
5345 dnl n2 has 23 unique small values -> nominal.
5346 dnl n3 is all missing -> nominal.
5347 dnl s1 has 24 unique small values -> scale.
5348 dnl s2 has one negative value -> scale.
5349 dnl s3 has one non-integer value -> scale.
5350 dnl s4 has no valid values less than 10 -> scale.
5351 dnl s5 has no valid values less than 10,000 -> scale.
5352 1  1  . 1  1  1    10 10001
5353 2  2  . 2  2  2    11 10002
5354 3  3  . 3  3  3    12 10003
5355 4  4  . 4  4  4    13 10004
5356 5  5  . 5  5  5    14 10005
5357 6  6  . 6  6  6    15 10006
5358 7  7  . 7  7  7    16 10007
5359 8  8  . 8  8  8    17 10008
5360 9  9  . 9  9  9    18 10009
5361 10 10 . 10 10 10.5 19 110000
5362 1  11 . 11 -1 1    11 10001
5363 2  12 . 12 2  2    12 10002
5364 3  13 . 13 3  3    13 10003
5365 4  14 . 14 4  4    14 10004
5366 5  15 . 15 5  5    15 10005
5367 6  16 . 16 6  6    16 10006
5368 7  17 . 17 7  7    17 10007
5369 8  18 . 18 8  8    18 10008
5370 9  19 . 19 9  9    19 10009
5371 1  20 . 20 1  1    20 10001
5372 2  21 . 21 2  2    21 10002
5373 3  22 . 22 3  3    22 10003
5374 4  23 . 23 4  4    23 10004
5375 5  23 . 24 5  5    24 10005
5376 6  23 . 24 6  6    25 10006
5377 ])
5378
5379 AT_DATA([ctables.sps], [dnl
5380 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5381
5382 * Nominal formats (copied from data that will default to scale).
5383 COMPUTE n4=s1.
5384 COMPUTE n5=s1.
5385 FORMATS n4(WKDAY5) n5(MONTH5).
5386
5387 * Scale formats (copied from data that will default to nominal).
5388 COMPUTE s6=n1.
5389 COMPUTE s7=n1.
5390 COMPUTE s8=n1.
5391 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5392
5393 STRING string(A8).
5394
5395 DISPLAY DICTIONARY.
5396 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5397 DISPLAY DICTIONARY.
5398 ])
5399
5400 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5401                                     Variables
5402 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5403 │      │        │  Measurement │     │     │         │            │            │
5404 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5405 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5406 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5407 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5408 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5409 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5410 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5411 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5412 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5413 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5414 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5415 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5416 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5417 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5418 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5419 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5420 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5421
5422         Custom Tables
5423 ╭────────────┬─────┬────────╮
5424 │            │Count│  Mean  │
5425 ├────────────┼─────┼────────┤
5426 │n1     1.00 │    3│        │
5427 │       2.00 │    3│        │
5428 │       3.00 │    3│        │
5429 │       4.00 │    3│        │
5430 │       5.00 │    3│        │
5431 │       6.00 │    3│        │
5432 │       7.00 │    2│        │
5433 │       8.00 │    2│        │
5434 │       9.00 │    2│        │
5435 │       10.00│    1│        │
5436 ├────────────┼─────┼────────┤
5437 │n2     1.00 │    1│        │
5438 │       2.00 │    1│        │
5439 │       3.00 │    1│        │
5440 │       4.00 │    1│        │
5441 │       5.00 │    1│        │
5442 │       6.00 │    1│        │
5443 │       7.00 │    1│        │
5444 │       8.00 │    1│        │
5445 │       9.00 │    1│        │
5446 │       10.00│    1│        │
5447 │       11.00│    1│        │
5448 │       12.00│    1│        │
5449 │       13.00│    1│        │
5450 │       14.00│    1│        │
5451 │       15.00│    1│        │
5452 │       16.00│    1│        │
5453 │       17.00│    1│        │
5454 │       18.00│    1│        │
5455 │       19.00│    1│        │
5456 │       20.00│    1│        │
5457 │       21.00│    1│        │
5458 │       22.00│    1│        │
5459 │       23.00│    3│        │
5460 ├────────────┼─────┼────────┤
5461 │string      │   25│        │
5462 ├────────────┼─────┼────────┤
5463 │s1          │     │   12.96│
5464 ├────────────┼─────┼────────┤
5465 │s2          │     │    4.76│
5466 ├────────────┼─────┼────────┤
5467 │s3          │     │    4.86│
5468 ├────────────┼─────┼────────┤
5469 │s4          │     │   16.60│
5470 ├────────────┼─────┼────────┤
5471 │s5          │     │14004.44│
5472 ╰────────────┴─────┴────────╯
5473
5474                                     Variables
5475 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5476 │      │        │  Measurement │     │     │         │            │            │
5477 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5478 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5479 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5480 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5481 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5482 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5483 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5484 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5485 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5486 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5487 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5488 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5489 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5490 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5491 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5492 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5493 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5494 ])
5495 AT_CLEANUP