22e1380a58582c74d286e1a09dffcfb659ef9ab0
[pspp] / tests / language / commands / 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/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/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/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/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 /FORMAT.
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 expecting `/'.
226     2 | CTABLES.
227       |        ^
228
229 ctables.sps:3.29-3.33: error: CTABLES: Syntax error expecting non-negative
230 number for MINCOLWIDTH.
231     3 | CTABLES /FORMAT MINCOLWIDTH='foo'.
232       |                             ^~~~~
233
234 ctables.sps:4.21-4.22: error: CTABLES: Syntax error expecting identifier.
235     4 | CTABLES /TABLE qn1 [**].
236       |                     ^~
237
238 ctables.sps:5.21-5.32: error: CTABLES: Syntax error expecting summary function
239 name.
240     5 | CTABLES /TABLE qn1 [NOTAFUNCTION].
241       |                     ^~~~~~~~~~~~
242
243 ctables.sps:6.20: error: CTABLES: Syntax error expecting `@:}@'.
244     6 | CTABLES /TABLE @{:@qn1.
245       |                    ^
246
247 ctables.sps:7.16-7.17: error: CTABLES: Syntax error expecting identifier.
248     7 | CTABLES /TABLE **.
249       |                ^~
250
251 ctables.sps:8.16-8.22: error: CTABLES: NOTAVAR is not a variable name.
252     8 | CTABLES /TABLE NOTAVAR.
253       |                ^~~~~~~
254
255 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
256 scale variable.
257    10 | CTABLES /TABLE string[S].
258       |                ^~~~~~~~~
259
260 ctables.sps:11.27-11.29: error: CTABLES: Syntax error expecting number between 0
261 and 100 for PTILE.
262    11 | CTABLES /TABLE qn1 [PTILE 101].
263       |                           ^~~
264
265 ctables.sps:12.26-12.29: error: CTABLES: Output format F0.1 specifies width 0,
266 but F requires a width between 1 and 40.
267    12 | CTABLES /TABLE qn1 [MEAN F0.1].
268       |                          ^~~~
269
270 ctables.sps:13.26-13.36: error: CTABLES: Output format NEGPAREN requires width 2
271 or greater.
272    13 | CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
273       |                          ^~~~~~~~~~~
274
275 ctables.sps:14.26-14.36: error: CTABLES: Output format NEGPAREN requires width
276 greater than decimals.
277    14 | CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
278       |                          ^~~~~~~~~~~
279
280 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
281 scale variables.
282    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
283       |                     ^~~~
284
285 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
286    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
287       |                ^~~
288
289 ctables.sps:15.32: error: CTABLES: Syntax error expecting `@<:@'.
290    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
291       |                                ^
292
293 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
294 scale variables.
295    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
296       |                     ^~~~
297
298 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
299    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
300       |                ^~~
301
302 ctables.sps:16.40: error: CTABLES: Syntax error expecting `@:>@'.
303    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
304       |                                        ^
305
306 ctables.sps:17.56: error: CTABLES: Syntax error expecting string.
307    17 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
308       |                                                        ^
309
310 ctables.sps:18.50-18.51: error: CTABLES: Syntax error expecting THRU.
311    18 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
312       |                                                  ^~
313
314 ctables.sps:19.55: error: CTABLES: Syntax error expecting number.
315    19 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
316       |                                                       ^
317
318 ctables.sps:20.54-20.55: error: CTABLES: Syntax error expecting number.
319    20 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
320       |                                                      ^~
321
322 ctables.sps:21.56-21.57: error: CTABLES: Syntax error expecting string.
323    21 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
324       |                                                        ^~
325
326 ctables.sps:22.48-22.49: error: CTABLES: Syntax error expecting identifier.
327    22 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
328       |                                                ^~
329
330 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
331    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
332       |                                               ^~
333
334 ctables.sps:24.61-24.63: error: CTABLES: Syntax error expecting number between 0
335 and 100 for PTILE.
336    24 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
337       |                                                             ^~~
338
339 ctables.sps:25.58: error: CTABLES: Syntax error expecting `@:}@'.
340    25 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
341       |                                                          ^
342
343 ctables.sps:26.54: error: CTABLES: Syntax error expecting `@{:@'.
344    26 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
345       |                                                      ^
346
347 ctables.sps:27.54-27.55: error: CTABLES: Syntax error expecting INCLUDE or
348 EXCLUDE.
349    27 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
350       |                                                      ^~
351
352 ctables.sps:28.52-28.53: error: CTABLES: Syntax error expecting YES or NO.
353    28 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
354       |                                                    ^~
355
356 ctables.sps:29.52-29.53: error: CTABLES: Syntax error expecting string.
357    29 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
358       |                                                    ^~
359
360 ctables.sps:30.55-30.56: error: CTABLES: Syntax error expecting BEFORE or AFTER.
361    30 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
362       |                                                       ^~
363
364 ctables.sps:31.52-31.53: error: CTABLES: Syntax error expecting INCLUDE or
365 EXCLUDE.
366    31 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
367       |                                                    ^~
368
369 ctables.sps:32.46-32.47: error: CTABLES: Syntax error expecting ORDER, KEY,
370 MISSING, TOTAL, LABEL, POSITION, or EMPTY.
371    32 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
372       |                                              ^~
373
374 ctables.sps:33.54-33.55: error: CTABLES: Syntax error expecting TOTAL, LABEL,
375 POSITION, or EMPTY.
376    33 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
377       |                                                      ^~
378
379 ctables.sps:34.36: error: CTABLES: Syntax error expecting positive integer for
380 SUBTOTAL.
381    34 | CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
382       |                                    ^
383
384 ctables.sps:35.37-35.38: error: CTABLES: Syntax error expecting `@:>@'.
385    35 | CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
386       |                                     ^~
387
388 ctables.sps:36.31-36.32: error: CTABLES: Syntax error expecting THRU.
389    36 | CTABLES /PCOMPUTE &k=EXPR([LO **]).
390       |                               ^~
391
392 ctables.sps:37.36-37.37: error: CTABLES: Syntax error expecting number.
393    37 | CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
394       |                                    ^~
395
396 ctables.sps:38.35-38.36: error: CTABLES: Syntax error expecting number.
397    38 | CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
398       |                                   ^~
399
400 ctables.sps:39.29-39.30: error: CTABLES: Syntax error expecting `@:>@'.
401    39 | CTABLES /PCOMPUTE &k=EXPR([1**]).
402       |                             ^~
403
404 ctables.sps:40.29: error: CTABLES: Syntax error expecting `@:}@'.
405    40 | CTABLES /PCOMPUTE &k=EXPR((1x)).
406       |                             ^
407
408 ctables.sps:41.19-41.20: error: CTABLES: Syntax error expecting &.
409    41 | CTABLES /PCOMPUTE **k.
410       |                   ^~
411
412 ctables.sps:42.20: error: CTABLES: Syntax error expecting identifier.
413    42 | CTABLES /PCOMPUTE &1.
414       |                    ^
415
416 ctables.sps:43.21-43.22: error: CTABLES: Syntax error expecting `=EXPR@{:@'.
417    43 | CTABLES /PCOMPUTE &k**.
418       |                     ^~
419
420 ctables.sps:44.21-44.23: error: CTABLES: Syntax error expecting `=EXPR@{:@'.
421    44 | CTABLES /PCOMPUTE &k=**.
422       |                     ^~~
423
424 ctables.sps:45.21-45.27: error: CTABLES: Syntax error expecting `=EXPR@{:@'.
425    45 | CTABLES /PCOMPUTE &k=EXPR**.
426       |                     ^~~~~~~
427
428 ctables.sps:46.28: error: CTABLES: Syntax error expecting `@:}@'.
429    46 | CTABLES /PCOMPUTE &k=EXPR(1x).
430       |                            ^
431
432 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
433 the previous definition.
434    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
435       |                               ^~~~~~~~~~~~~~~~~~~
436
437 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
438    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
439       |          ^~~~~~~~~~~~~~~~~~~
440
441 ctables.sps:47.50: error: CTABLES: Syntax error expecting `/'.
442    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
443       |                                                  ^
444
445 ctables.sps:48.53-48.64: error: CTABLES: Syntax error expecting summary function
446 name.
447    48 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
448       |                                                     ^~~~~~~~~~~~
449
450 ctables.sps:49.59-49.60: error: CTABLES: Syntax error expecting number between 0
451 and 100 for PTILE.
452    49 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
453       |                                                           ^~
454
455 ctables.sps:50.52-50.53: error: CTABLES: Syntax error expecting string.
456    50 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
457       |                                                    ^~
458
459 ctables.sps:51.61-51.62: error: CTABLES: Syntax error expecting YES or NO.
460    51 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
461       |                                                             ^~
462
463 ctables.sps:52.46-52.47: error: CTABLES: Syntax error expecting LABEL, FORMAT,
464 or HIDESOURCECATS.
465    52 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
466       |                                              ^~
467
468 ctables.sps:53.23-53.24: error: CTABLES: Syntax error expecting string.
469    53 | CTABLES /FORMAT EMPTY=**.
470       |                       ^~
471
472 ctables.sps:54.25-54.26: error: CTABLES: Syntax error expecting string.
473    54 | CTABLES /FORMAT MISSING=**.
474       |                         ^~
475
476 ctables.sps:55.17-55.18: error: CTABLES: Syntax error expecting MINCOLWIDTH,
477 MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
478    55 | CTABLES /FORMAT **.
479       |                 ^~
480
481 ctables.sps:56.17-56.45: error: CTABLES: MINCOLWIDTH must not be greater than
482 MAXCOLWIDTH.
483    56 | CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
484       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
485
486 ctables.sps:57.18-57.19: error: CTABLES: Syntax error expecting VARIABLES.
487    57 | CTABLES /VLABELS **.
488       |                  ^~
489
490 ctables.sps:58.28-58.34: error: CTABLES: NOTAVAR is not a variable name.
491    58 | CTABLES /VLABELS VARIABLES=NOTAVAR.
492       |                            ^~~~~~~
493
494 ctables.sps:59.32-59.33: error: CTABLES: Syntax error expecting DISPLAY.
495    59 | CTABLES /VLABELS VARIABLES=qn1 **.
496       |                                ^~
497
498 ctables.sps:60.40-60.41: error: CTABLES: Syntax error expecting DEFAULT, NAME,
499 LABEL, BOTH, or NONE.
500    60 | CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
501       |                                        ^~
502
503 ctables.sps:61.17-61.18: error: CTABLES: Syntax error expecting COUNTDUPLICATES.
504    61 | CTABLES /MRSETS **.
505       |                 ^~
506
507 ctables.sps:62.33-62.34: error: CTABLES: Syntax error expecting YES or NO.
508    62 | CTABLES /MRSETS COUNTDUPLICATES=**.
509       |                                 ^~
510
511 ctables.sps:63.19-63.20: error: CTABLES: Syntax error expecting VARIABLE or
512 LISTWISE.
513    63 | CTABLES /SMISSING **.
514       |                   ^~
515
516 ctables.sps:64.17-64.18: error: CTABLES: Syntax error expecting VARIABLE.
517    64 | CTABLES /WEIGHT **.
518       |                 ^~
519
520 ctables.sps:65.26-65.32: error: CTABLES: NOTAVAR is not a variable name.
521    65 | CTABLES /WEIGHT VARIABLE=NOTAVAR.
522       |                          ^~~~~~~
523
524 ctables.sps:66.32: error: CTABLES: Syntax error expecting integer 2 or greater
525 for HIDESMALLCOUNTS COUNT.
526    66 | CTABLES /HIDESMALLCOUNTS COUNT=1.
527       |                                ^
528
529 ctables.sps:67.10-67.13: error: CTABLES: Syntax error expecting one of the
530 following: FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
531 HIDESMALLCOUNTS, TABLE.
532    67 | CTABLES /QUUX.
533       |          ^~~~
534
535 ctables.sps:68.33: error: CTABLES: Syntax error expecting `/'.
536    68 | CTABLES /HIDESMALLCOUNTS COUNT=2.
537       |                                 ^
538
539 ctables.sps:69.19-69.20: error: CTABLES: Syntax error expecting `/'.
540    69 | CTABLES /TABLE qn1**.
541       |                   ^~
542
543 ctables.sps:70.38-70.39: error: CTABLES: Syntax error expecting COLUMN, ROW, or
544 LAYER.
545    70 | CTABLES /TABLE qn1 /SLABELS POSITION=**.
546       |                                      ^~
547
548 ctables.sps:71.37-71.38: error: CTABLES: Syntax error expecting YES or NO.
549    71 | CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
550       |                                     ^~
551
552 ctables.sps:72.29-72.30: error: CTABLES: Syntax error expecting POSITION or
553 VISIBLE.
554    72 | CTABLES /TABLE qn1 /SLABELS **.
555       |                             ^~
556
557 ctables.sps:73.39-73.40: error: CTABLES: Syntax error expecting OPPOSITE or
558 LAYER.
559    73 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
560       |                                       ^~
561
562 ctables.sps:74.39-74.40: error: CTABLES: Syntax error expecting OPPOSITE or
563 LAYER.
564    74 | CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
565       |                                       ^~
566
567 ctables.sps:75.29-75.30: error: CTABLES: Syntax error expecting AUTO, ROWLABELS,
568 or COLLABELS.
569    75 | CTABLES /TABLE qn1 /CLABELS **.
570       |                             ^~
571
572 ctables.sps:76.30-76.31: error: CTABLES: Syntax error expecting CILEVEL.
573    76 | CTABLES /TABLE qn1 /CRITERIA **.
574       |                              ^~
575
576 ctables.sps:77.38-77.40: error: CTABLES: Syntax error expecting number in
577 @<:@0,100@:}@ for CILEVEL.
578    77 | CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
579       |                                      ^~~
580
581 ctables.sps:78.28-78.29: error: CTABLES: Syntax error expecting CAPTION, CORNER,
582 or TITLE.
583    78 | CTABLES /TABLE qn1 /TITLES **.
584       |                            ^~
585
586 ctables.sps:79.34-79.35: error: CTABLES: Syntax error expecting CHISQUARE.
587    79 | CTABLES /TABLE qn1 /SIGTEST TYPE=**.
588       |                                  ^~
589
590 ctables.sps:80.35-80.36: error: CTABLES: Syntax error expecting number in @<:@0,1@:}@
591 for ALPHA.
592    80 | CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
593       |                                   ^~
594
595 ctables.sps:81.43-81.44: error: CTABLES: Syntax error expecting YES or NO.
596    81 | CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
597       |                                           ^~
598
599 ctables.sps:82.40-82.41: error: CTABLES: Syntax error expecting ALLVISIBLE or
600 SUBTOTALS.
601    82 | CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
602       |                                        ^~
603
604 ctables.sps:83.29-83.30: error: CTABLES: Syntax error expecting TYPE, ALPHA,
605 INCLUDEMRSETS, or CATEGORIES.
606    83 | CTABLES /TABLE qn1 /SIGTEST **.
607       |                             ^~
608
609 ctables.sps:84.38-84.39: error: CTABLES: Syntax error expecting PROP or MEAN.
610    84 | CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
611       |                                      ^~
612
613 ctables.sps:85.39-85.40: error: CTABLES: Syntax error expecting number in (0,1)
614 for ALPHA.
615    85 | CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
616       |                                       ^~
617
618 ctables.sps:86.39: error: CTABLES: Syntax error expecting number in (0,1) for
619 ALPHA.
620    86 | CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
621       |                                       ^
622
623 ctables.sps:87.40-87.41: error: CTABLES: Syntax error expecting BONFERRONI, BH,
624 or NONE.
625    87 | CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
626       |                                        ^~
627
628 ctables.sps:88.47-88.48: error: CTABLES: Syntax error expecting YES or NO.
629    88 | CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
630       |                                               ^~
631
632 ctables.sps:89.47-89.48: error: CTABLES: Syntax error expecting ALLCATS or
633 TESTEDCATS.
634    89 | CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
635       |                                               ^~
636
637 ctables.sps:90.44-90.45: error: CTABLES: Syntax error expecting ALLVISIBLE or
638 SUBTOTALS.
639    90 | CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
640       |                                            ^~
641
642 ctables.sps:91.39-91.40: error: CTABLES: Syntax error expecting YES or NO.
643    91 | CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
644       |                                       ^~
645
646 ctables.sps:92.39-92.40: error: CTABLES: Syntax error expecting APA or SIMPLE.
647    92 | CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
648       |                                       ^~
649
650 ctables.sps:93.41-93.42: error: CTABLES: Syntax error expecting YES or NO.
651    93 | CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
652       |                                         ^~
653
654 ctables.sps:94.33-94.34: error: CTABLES: Syntax error expecting one of the
655 following: TYPE, ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE,
656 STYLE, SHOWSIG.
657    94 | CTABLES /TABLE qn1 /COMPARETEST **.
658       |                                 ^~
659
660 ctables.sps:95.21-95.26: error: CTABLES: Syntax error expecting TABLE, SLABELS,
661 CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
662    95 | CTABLES /TABLE qn1 /FORMAT.
663       |                     ^~~~~~
664
665 ctables.sps:95.21-95.26: note: CTABLES: This subcommand must appear before
666 TABLE.
667    95 | CTABLES /TABLE qn1 /FORMAT.
668       |                     ^~~~~~
669
670 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
671 specified.
672
673 ctables.sps:96.21-96.46: note: CTABLES: This is the first specification.
674    96 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS
675 COLLABELS=OPPOSITE.
676       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
677
678 ctables.sps:96.49-96.74: note: CTABLES: This is the second specification.
679    96 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS
680 COLLABELS=OPPOSITE.
681       |
682 ^~~~~~~~~~~~~~~~~~~~~~~~~~
683
684 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
685    97 | CTABLES /TABLE qn20 > qnd1.
686       |                ^~~~~~~~~~~
687
688 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
689    97 | CTABLES /TABLE qn20 > qnd1.
690       |                ^~~~
691
692 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
693    97 | CTABLES /TABLE qn20 > qnd1.
694       |                       ^~~~
695
696 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
697 categorical variables at the innermost nesting level.
698    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
699       |                ^~~~~~~~~~~~~~~~~~~~
700
701 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
702 summary.
703    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
704       |                ^~~
705
706 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
707 specification as format DATETIME: Day (123) must be between 1 and 31..
708   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
709       |                                                    ^~~~~
710 ]])
711 AT_CLEANUP
712
713 AT_SETUP([CTABLES parsing - more negative])
714 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
715 AT_DATA([ctables.sps],
716 [[GET 'nhtsa.sav'.
717 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
718 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
719 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
720
721 STRING string(A8).
722 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
723 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
724
725 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
726
727 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
728 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
729 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
730 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
731
732 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
733 CTABLES /PCOMPUTE &x=EXPR([**]).
734 CTABLES /PCOMPUTE &x=EXPR(**).
735
736 CTABLES /TABLE.
737
738 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
739
740 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
741
742 CTABLES /TABLE $mrset.
743
744 CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
745 CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
746
747 CTABLES /TABLE qn113 [COUNT.UCL].
748
749 CTABLES /TABLE qn1 /CATEGORIES **.
750
751 CTABLES /TITLES.
752 ]])
753 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [1],
754 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a category not included in the category list.
755     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
756       |                                                                            ^~~
757
758 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
759     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
760       |                            ^~~~~~~~
761
762 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the list of categories here.
763     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
764       |                                                                            ^~~~
765
766 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a category not included in the category list.
767     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
768       |                                                                         ^~~
769
770 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
771     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
772       |                            ^~~~~
773
774 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the variable's CATEGORIES specification.
775
776 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of SUBTOTAL or HSUBTOTAL, so references from
777 computed categories must refer to subtotals by position, e.g. SUBTOTAL[1].
778     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
779       |                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~
780
781 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a position.
782     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
783       |                            ^~~~~~~~
784
785 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be applied only to string variables, but this
786 subcommand tries to apply it to numeric variable QN1.
787     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
788       |                                               ^~~~~~~~
789
790 ctables.sps:8.53: error: CTABLES: This category specification may be applied only to numeric variables, but this
791 subcommand tries to apply it to string variable string.
792     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
793       |                                                     ^
794
795 ctables.sps:10.74-10.86: error: CTABLES: Data-dependent sorting is not implemented.
796    10 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
797       |                                                                          ^~~~~~~~~~~~~
798
799 ctables.sps:12: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
800 moved must be categorical, but qnd1 is scale.
801
802 ctables.sps:12.22-12.47: note: CTABLES: This syntax moves category labels to another axis.
803    12 | CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
804       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
805
806 ctables.sps:13: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
807 moved must all have the same width, but QN1 has width 0 and string has width 8.
808
809 ctables.sps:13.30-13.55: note: CTABLES: This syntax moves category labels to another axis.
810    13 | CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
811       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
812
813 ctables.sps:14: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
814 moved must all have the same value labels, but QN1 and QNSA1 have different value labels.
815
816 ctables.sps:14.29-14.54: note: CTABLES: This syntax moves category labels to another axis.
817    14 | CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
818       |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
819
820 ctables.sps:15: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
821 moved must all have the same category specifications, but QN105BA and QN105BB have different category specifications.
822
823 ctables.sps:15.35-15.60: note: CTABLES: This syntax moves category labels to another axis.
824    15 | CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
825       |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
826
827 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is left-associative: `a**b**c' equals
828 `(a**b)**c', not `a**(b**c)'.  To disable this warning, insert parentheses.
829    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
830       |                           ^~~~~~~
831
832 ctables.sps:17.35: error: CTABLES: Syntax error expecting `/'.
833    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
834       |                                   ^
835
836 ctables.sps:18.28-18.29: error: CTABLES: Syntax error expecting number or string or range.
837    18 | CTABLES /PCOMPUTE &x=EXPR([**]).
838       |                            ^~
839
840 ctables.sps:19.27-19.28: error: CTABLES: Syntax error in postcompute expression.
841    19 | CTABLES /PCOMPUTE &x=EXPR(**).
842       |                           ^~
843
844 ctables.sps:21.15: error: CTABLES: At least one variable must be specified.
845    21 | CTABLES /TABLE.
846       |               ^
847
848 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
849
850 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a summary.
851    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
852       |                                                  ^~~~~
853
854 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a summary.
855    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
856       |                ^~~~~
857
858 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a summary.
859    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
860       |                                 ^~~~~
861
862 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always has a summary even if the syntax does not
863 explicitly specify one.
864    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
865       |                                 ^~~~~
866
867 ctables.sps:25.46-25.63: error: CTABLES: Data-dependent sorting is not implemented.
868    25 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
869       |                                              ^~~~~~~~~~~~~~~~~~
870
871 ctables.sps:27.16-27.21: error: CTABLES: Multiple response set support not implemented.
872    27 | CTABLES /TABLE $mrset.
873       |                ^~~~~~
874
875 ctables.sps:29.23-29.44: error: CTABLES: Support for SIGTEST not yet implemented.
876    29 | CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
877       |                       ^~~~~~~~~~~~~~~~~~~~~~
878
879 ctables.sps:30.23-30.43: error: CTABLES: Support for COMPARETEST not yet implemented.
880    30 | CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
881       |                       ^~~~~~~~~~~~~~~~~~~~~
882
883 ctables.sps:32.23-32.31: error: CTABLES: Support for LCL, UCL, and SE summary functions is not yet implemented.
884    32 | CTABLES /TABLE qn113 [COUNT.UCL].
885       |                       ^~~~~~~~~
886
887 ctables.sps:34.32-34.33: error: CTABLES: Syntax error expecting VARIABLES.
888    34 | CTABLES /TABLE qn1 /CATEGORIES **.
889       |                                ^~
890
891 ctables.sps:36.10-36.15: error: CTABLES: Syntax error expecting one of the following: FORMAT, VLABELS, MRSETS, SMISSING,
892 PCOMPUTE, PPROPERTIES, WEIGHT, HIDESMALLCOUNTS, TABLE.
893    36 | CTABLES /TITLES.
894       |          ^~~~~~
895
896 ctables.sps:36.10-36.15: note: CTABLES: TABLE must appear before this subcommand.
897    36 | CTABLES /TITLES.
898       |          ^~~~~~
899 ]])
900 AT_CLEANUP
901
902 AT_SETUP([CTABLES one categorical variable])
903 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
904 AT_DATA([ctables.sps],
905 [[GET 'nhtsa.sav'.
906 CTABLES /TABLE qn1.
907 CTABLES /TABLE BY qn1.
908 CTABLES /TABLE BY BY qn1.
909 ]])
910 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
911                                   Custom Tables
912 ╭────────────────────────────────────────────────────────────────────────┬─────╮
913 │                                                                        │Count│
914 ├────────────────────────────────────────────────────────────────────────┼─────┤
915 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
916 │motor vehicle?                                     Several days a week  │ 1274│
917 │                                                   Once a week or less  │  361│
918 │                                                   Only certain times a │  130│
919 │                                                   year                 │     │
920 │                                                   Never                │  540│
921 ╰────────────────────────────────────────────────────────────────────────┴─────╯
922
923                                   Custom Tables
924 ╭──────────────────────────────────────────────────────────────────────────────╮
925 │        1. How often do you usually drive a car or other motor vehicle?       │
926 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
927 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
928 │Every day│       week       │       less       │          year          │Never│
929 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
930 │  Count  │       Count      │       Count      │          Count         │Count│
931 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
932 │     4667│              1274│               361│                     130│  540│
933 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
934
935 Custom Tables
936 Every day
937 ╭─────╮
938 │Count│
939 ├─────┤
940 │ 4667│
941 ╰─────╯
942 ])
943 AT_CLEANUP
944
945 AT_SETUP([CTABLES one string variable])
946 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
947 AT_DATA([ctables.sps],
948 [[GET 'nhtsa.sav'.
949 STRING licensed(A8).
950 MISSING VALUES licensed('DontKnow', 'Refused').
951 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
952 CTABLES /TABLE licensed.
953 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
954 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
955 * Notice that the string matching is case-sensitive.
956 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
957 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
958 CTABLES
959     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
960     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
961     /TABLE licensed
962     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
963 CTABLES
964     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
965     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
966     /TABLE licensed
967     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
968 ]])
969 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
970     Custom Tables
971 ╭────────────┬─────╮
972 │            │Count│
973 ├────────────┼─────┤
974 │licensed No │  572│
975 │         Yes│ 6379│
976 ╰────────────┴─────╯
977
978           Custom Tables
979 ╭─────────────────┬─────┬───────╮
980 │                 │Count│Valid N│
981 ├─────────────────┼─────┼───────┤
982 │licensed DontKnow│    4│       │
983 │         No      │  572│       │
984 │         Refused │   44│       │
985 │         Yes     │ 6379│       │
986 │         Total   │ 6999│   6951│
987 ╰─────────────────┴─────┴───────╯
988
989      Custom Tables
990 ╭──────────────┬─────╮
991 │              │Count│
992 ├──────────────┼─────┤
993 │licensed Yes  │ 6379│
994 │         No   │  572│
995 │         Total│ 6951│
996 ╰──────────────┴─────╯
997
998      Custom Tables
999 ╭──────────────┬─────╮
1000 │              │Count│
1001 ├──────────────┼─────┤
1002 │licensed Yes  │ 6379│
1003 │         no   │    0│
1004 │         Total│ 6379│
1005 ╰──────────────┴─────╯
1006
1007       Custom Tables
1008 ╭────────────────┬─────╮
1009 │                │Count│
1010 ├────────────────┼─────┤
1011 │licensed No     │  572│
1012 │         Refused│   44│
1013 │         Yes    │ 6379│
1014 │         Total  │ 6995│
1015 ╰────────────────┴─────╯
1016
1017       Custom Tables
1018 ╭────────────────┬─────╮
1019 │                │Count│
1020 ├────────────────┼─────┤
1021 │licensed Yes    │ 6379│
1022 │         Not Yes│  620│
1023 ╰────────────────┴─────╯
1024
1025       Custom Tables
1026 ╭────────────────┬─────╮
1027 │                │Count│
1028 ├────────────────┼─────┤
1029 │licensed Yes    │ 6379│
1030 │         Not Yes│  620│
1031 ╰────────────────┴─────╯
1032 ])
1033 AT_CLEANUP
1034
1035 AT_SETUP([CTABLES one scale variable])
1036 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1037 AT_DATA([ctables.sps],
1038 [[GET 'nhtsa.sav'.
1039 DESCRIPTIVES qnd1.
1040 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
1041 CTABLES /TABLE BY qnd1.
1042 CTABLES /TABLE BY BY qnd1.
1043 ]])
1044 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1045                        Descriptive Statistics
1046 ╭──────────────────────────┬────┬─────┬───────┬───────┬───────────╮
1047 │                          │  N │ Mean│Std Dev│Minimum│  Maximum  │
1048 ├──────────────────────────┼────┼─────┼───────┼───────┼───────────┤
1049 │D1. AGE: What is your age?│6930│48.26│  19.01│     16│86 or older│
1050 │Valid N (listwise)        │6999│     │       │       │           │
1051 │Missing N (listwise)      │  69│     │       │       │           │
1052 ╰──────────────────────────┴────┴─────┴───────┴───────┴───────────╯
1053
1054                                   Custom Tables
1055 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
1056 │                      │     │       │       │    │     Std    │       │       │
1057 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
1058 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
1059 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
1060 │age?                  │     │       │       │    │            │       │       │
1061 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
1062
1063         Custom Tables
1064 ╭──────────────────────────╮
1065 │D1. AGE: What is your age?│
1066 ├──────────────────────────┤
1067 │           Mean           │
1068 ├──────────────────────────┤
1069 │                        48│
1070 ╰──────────────────────────╯
1071
1072 Custom Tables
1073 D1. AGE: What is your age?
1074 ╭────╮
1075 │Mean│
1076 ├────┤
1077 │  48│
1078 ╰────╯
1079 ])
1080 AT_CLEANUP
1081
1082 AT_SETUP([CTABLES simple stacking])
1083 AT_KEYWORDS([stack stacked])
1084 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1085 AT_DATA([ctables.sps],
1086 [[GET 'nhtsa.sav'.
1087 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
1088 ]])
1089 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1090                                   Custom Tables
1091 ╭───────────────────────────────────────────────────────────────┬──────────────╮
1092 │                                                               │ S3a. GENDER: │
1093 │                                                               ├──────┬───────┤
1094 │                                                               │ Male │ Female│
1095 │                                                               ├──────┼───────┤
1096 │                                                               │Column│ Column│
1097 │                                                               │   %  │   %   │
1098 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1099 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
1100 │too much to drink to drive safely will A. Get      certain     │      │       │
1101 │stopped by the police?                             Very likely │   21%│    22%│
1102 │                                                   Somewhat    │   38%│    42%│
1103 │                                                   likely      │      │       │
1104 │                                                   Somewhat    │   21%│    18%│
1105 │                                                   unlikely    │      │       │
1106 │                                                   Very        │   10%│     8%│
1107 │                                                   unlikely    │      │       │
1108 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1109 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
1110 │too much to drink to drive safely will B. Have an  certain     │      │       │
1111 │accident?                                          Very likely │   36%│    45%│
1112 │                                                   Somewhat    │   39%│    32%│
1113 │                                                   likely      │      │       │
1114 │                                                   Somewhat    │    9%│     4%│
1115 │                                                   unlikely    │      │       │
1116 │                                                   Very        │    3%│     2%│
1117 │                                                   unlikely    │      │       │
1118 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1119 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
1120 │too much to drink to drive safely will C. Be       certain     │      │       │
1121 │convicted for drunk driving?                       Very likely │   32%│    28%│
1122 │                                                   Somewhat    │   27%│    32%│
1123 │                                                   likely      │      │       │
1124 │                                                   Somewhat    │   15%│    15%│
1125 │                                                   unlikely    │      │       │
1126 │                                                   Very        │    9%│     9%│
1127 │                                                   unlikely    │      │       │
1128 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1129 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
1130 │too much to drink to drive safely will D. Be       certain     │      │       │
1131 │arrested for drunk driving?                        Very likely │   26%│    27%│
1132 │                                                   Somewhat    │   32%│    35%│
1133 │                                                   likely      │      │       │
1134 │                                                   Somewhat    │   17%│    15%│
1135 │                                                   unlikely    │      │       │
1136 │                                                   Very        │    9%│     7%│
1137 │                                                   unlikely    │      │       │
1138 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
1139 ])
1140 AT_CLEANUP
1141
1142 AT_SETUP([CTABLES show or hide empty categories])
1143 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1144 AT_DATA([ctables.sps],
1145 [[GET 'nhtsa.sav'.
1146 IF (qn105ba = 2) qn105ba = 1.
1147 IF (qns3a = 1) qns3a = 2.
1148 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
1149 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1150     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
1151 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1152     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
1153 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1154     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
1155 ]])
1156 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1157                                   Custom Tables
1158 ╭──────────────────────────────────────────────────────────────┬───────────────╮
1159 │                                                              │  S3a. GENDER: │
1160 │                                                              ├───────┬───────┤
1161 │                                                              │  Male │ Female│
1162 │                                                              ├───────┼───────┤
1163 │                                                              │ Column│ Column│
1164 │                                                              │   %   │   %   │
1165 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
1166 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
1167 │too much to drink to drive safely will A. Get      certain    │       │       │
1168 │stopped by the police?                             Very likely│      .│     0%│
1169 │                                                   Somewhat   │      .│    40%│
1170 │                                                   likely     │       │       │
1171 │                                                   Somewhat   │      .│    19%│
1172 │                                                   unlikely   │       │       │
1173 │                                                   Very       │      .│     9%│
1174 │                                                   unlikely   │       │       │
1175 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
1176
1177                                   Custom Tables
1178 ╭──────────────────────────────────────────────────────────────┬───────────────╮
1179 │                                                              │  S3a. GENDER: │
1180 │                                                              ├───────┬───────┤
1181 │                                                              │  Male │ Female│
1182 │                                                              ├───────┼───────┤
1183 │                                                              │ Column│ Column│
1184 │                                                              │   %   │   %   │
1185 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
1186 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
1187 │too much to drink to drive safely will A. Get      certain    │       │       │
1188 │stopped by the police?                             Somewhat   │      .│    40%│
1189 │                                                   likely     │       │       │
1190 │                                                   Somewhat   │      .│    19%│
1191 │                                                   unlikely   │       │       │
1192 │                                                   Very       │      .│     9%│
1193 │                                                   unlikely   │       │       │
1194 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
1195
1196                                   Custom Tables
1197 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1198 │                                                                    │   S3a.  │
1199 │                                                                    │ GENDER: │
1200 │                                                                    ├─────────┤
1201 │                                                                    │  Female │
1202 │                                                                    ├─────────┤
1203 │                                                                    │ Column %│
1204 ├────────────────────────────────────────────────────────────────────┼─────────┤
1205 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1206 │much to drink to drive safely will A. Get stopped by    certain     │         │
1207 │the police?                                             Very likely │       0%│
1208 │                                                        Somewhat    │      40%│
1209 │                                                        likely      │         │
1210 │                                                        Somewhat    │      19%│
1211 │                                                        unlikely    │         │
1212 │                                                        Very        │       9%│
1213 │                                                        unlikely    │         │
1214 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1215
1216                                   Custom Tables
1217 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1218 │                                                                    │   S3a.  │
1219 │                                                                    │ GENDER: │
1220 │                                                                    ├─────────┤
1221 │                                                                    │  Female │
1222 │                                                                    ├─────────┤
1223 │                                                                    │ Column %│
1224 ├────────────────────────────────────────────────────────────────────┼─────────┤
1225 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1226 │much to drink to drive safely will A. Get stopped by    certain     │         │
1227 │the police?                                             Somewhat    │      40%│
1228 │                                                        likely      │         │
1229 │                                                        Somewhat    │      19%│
1230 │                                                        unlikely    │         │
1231 │                                                        Very        │       9%│
1232 │                                                        unlikely    │         │
1233 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1234 ])
1235 AT_CLEANUP
1236
1237 AT_SETUP([CTABLES categories and EMPTY])
1238 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1239 AT_DATA([ctables.sps],
1240 DATA LIST LIST NOTABLE /class datum size.
1241 BEGIN DATA
1242 1 1 1
1243 2 2 1
1244 1 3 1
1245 2 4 2
1246 1 5 2
1247 2 6 2
1248 END DATA.
1249 VARIABLE LEVEL class datum size (NOMINAL).
1250 FORMATS class datum size (F1.0).
1251
1252 * The following are the same except for the order of the CATEGORIES commands.
1253 * The test checks that they produce the same resuls.
1254 CTABLES /TABLE=class > datum BY size
1255    /CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE
1256    /CATEGORIES VARIABLES=size TOTAL=YES.
1257 CTABLES /TABLE=class > datum BY size
1258    /CATEGORIES VARIABLES=size TOTAL=YES
1259    /CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE.
1260 ])
1261 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1262            Custom Tables
1263 ╭───────────────┬─────────────────╮
1264 │               │       size      │
1265 │               ├─────┬─────┬─────┤
1266 │               │  1  │  2  │Total│
1267 │               ├─────┼─────┼─────┤
1268 │               │Count│Count│Count│
1269 ├───────────────┼─────┼─────┼─────┤
1270 │class 1 datum 1│    1│     │    1│
1271 │              3│    1│     │    1│
1272 │              5│     │    1│    1│
1273 │     ╶─────────┼─────┼─────┼─────┤
1274 │      2 datum 2│    1│     │    1│
1275 │              4│     │    1│    1│
1276 │              6│     │    1│    1│
1277 ╰───────────────┴─────┴─────┴─────╯
1278
1279            Custom Tables
1280 ╭───────────────┬─────────────────╮
1281 │               │       size      │
1282 │               ├─────┬─────┬─────┤
1283 │               │  1  │  2  │Total│
1284 │               ├─────┼─────┼─────┤
1285 │               │Count│Count│Count│
1286 ├───────────────┼─────┼─────┼─────┤
1287 │class 1 datum 1│    1│     │    1│
1288 │              3│    1│     │    1│
1289 │              5│     │    1│    1│
1290 │     ╶─────────┼─────┼─────┼─────┤
1291 │      2 datum 2│    1│     │    1│
1292 │              4│     │    1│    1│
1293 │              6│     │    1│    1│
1294 ╰───────────────┴─────┴─────┴─────╯
1295 ])
1296 AT_CLEANUP
1297
1298 AT_SETUP([CTABLES sorting categories])
1299 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1300 AT_DATA([ctables.sps],
1301 [[GET 'nhtsa.sav'.
1302 IF (QND5A=6) QND5A=-1.
1303 IF (QND5A=5) QND5A=-2.
1304 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1305         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1306         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1307         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1308 ]])
1309 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1310                                   Custom Tables
1311 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1312 │                                                                        │Count│
1313 ├────────────────────────────────────────────────────────────────────────┼─────┤
1314 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1315 │background?                                     -1.00                   │   78│
1316 │                                                Cuban                   │   20│
1317 │                                                Mexican                 │  311│
1318 │                                                Spanish                 │   48│
1319 │                                                South American          │   34│
1320 │                                                Central American        │    0│
1321 │                                                Puerto Rican, OR        │    0│
1322 │                                                Something else          │   68│
1323 │                                                Multiple - cannot choose│    7│
1324 │                                                one                     │     │
1325 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1326
1327                                   Custom Tables
1328 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1329 │                                                                        │Count│
1330 ├────────────────────────────────────────────────────────────────────────┼─────┤
1331 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1332 │background?                                     one                     │     │
1333 │                                                Something else          │   68│
1334 │                                                Puerto Rican, OR        │    0│
1335 │                                                Central American        │    0│
1336 │                                                South American          │   34│
1337 │                                                Spanish                 │   48│
1338 │                                                Mexican                 │  311│
1339 │                                                Cuban                   │   20│
1340 │                                                -1.00                   │   78│
1341 │                                                -2.00                   │   52│
1342 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1343
1344                                   Custom Tables
1345 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1346 │                                                                        │Count│
1347 ├────────────────────────────────────────────────────────────────────────┼─────┤
1348 │D5a. What would you say is your primary ethnic  Central American        │    0│
1349 │background?                                     Cuban                   │   20│
1350 │                                                Mexican                 │  311│
1351 │                                                Multiple - cannot choose│    7│
1352 │                                                one                     │     │
1353 │                                                Puerto Rican, OR        │    0│
1354 │                                                Something else          │   68│
1355 │                                                South American          │   34│
1356 │                                                Spanish                 │   48│
1357 │                                                -2.00                   │   52│
1358 │                                                -1.00                   │   78│
1359 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1360
1361                                   Custom Tables
1362 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1363 │                                                                        │Count│
1364 ├────────────────────────────────────────────────────────────────────────┼─────┤
1365 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1366 │background?                                     South American          │   34│
1367 │                                                Something else          │   68│
1368 │                                                Puerto Rican, OR        │    0│
1369 │                                                Multiple - cannot choose│    7│
1370 │                                                one                     │     │
1371 │                                                Mexican                 │  311│
1372 │                                                Cuban                   │   20│
1373 │                                                Central American        │    0│
1374 │                                                -1.00                   │   78│
1375 │                                                -2.00                   │   52│
1376 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1377 ])
1378 AT_CLEANUP
1379
1380 AT_SETUP([CTABLES simple nesting])
1381 AT_KEYWORDS([nest nested])
1382 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1383 AT_DATA([ctables.sps],
1384 [[GET 'nhtsa.sav'.
1385 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1386   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1387 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1388   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1389   /CLABELS ROW=OPPOSITE.
1390 ]])
1391 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1392                                   Custom Tables
1393 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1394 │                                                                 │     │ Table│
1395 │                                                                 │Count│   %  │
1396 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1397 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1398 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1399 │drive safely will A. Get stopped by                        Total │  700│   10%│
1400 │the police?                           ╶──────────────────────────┼─────┼──────┤
1401 │                                       Very       S3a.     Male  │  660│   10%│
1402 │                                       likely     GENDER:  Female│  842│   12%│
1403 │                                                           Total │ 1502│   22%│
1404 │                                      ╶──────────────────────────┼─────┼──────┤
1405 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1406 │                                       likely     GENDER:  Female│ 1589│   23%│
1407 │                                                           Total │ 2763│   40%│
1408 │                                      ╶──────────────────────────┼─────┼──────┤
1409 │                                       Somewhat   S3a.     Male  │  640│    9%│
1410 │                                       unlikely   GENDER:  Female│  667│   10%│
1411 │                                                           Total │ 1307│   19%│
1412 │                                      ╶──────────────────────────┼─────┼──────┤
1413 │                                       Very       S3a.     Male  │  311│    5%│
1414 │                                       unlikely   GENDER:  Female│  298│    4%│
1415 │                                                           Total │  609│    9%│
1416 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1417 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1418 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1419 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1420 │                                      ╶──────────────────────────┼─────┼──────┤
1421 │                                       Very       S3a.     Male  │ 1104│   16%│
1422 │                                       likely     GENDER:  Female│ 1715│   25%│
1423 │                                                           Total │ 2819│   41%│
1424 │                                      ╶──────────────────────────┼─────┼──────┤
1425 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1426 │                                       likely     GENDER:  Female│ 1214│   18%│
1427 │                                                           Total │ 2417│   35%│
1428 │                                      ╶──────────────────────────┼─────┼──────┤
1429 │                                       Somewhat   S3a.     Male  │  262│    4%│
1430 │                                       unlikely   GENDER:  Female│  168│    2%│
1431 │                                                           Total │  430│    6%│
1432 │                                      ╶──────────────────────────┼─────┼──────┤
1433 │                                       Very       S3a.     Male  │   81│    1%│
1434 │                                       unlikely   GENDER:  Female│   59│    1%│
1435 │                                                           Total │  140│    2%│
1436 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1437 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1438 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1439 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1440 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1441 │                                       Very       S3a.     Male  │  988│   14%│
1442 │                                       likely     GENDER:  Female│ 1049│   15%│
1443 │                                                           Total │ 2037│   30%│
1444 │                                      ╶──────────────────────────┼─────┼──────┤
1445 │                                       Somewhat   S3a.     Male  │  822│   12%│
1446 │                                       likely     GENDER:  Female│ 1210│   18%│
1447 │                                                           Total │ 2032│   30%│
1448 │                                      ╶──────────────────────────┼─────┼──────┤
1449 │                                       Somewhat   S3a.     Male  │  446│    7%│
1450 │                                       unlikely   GENDER:  Female│  548│    8%│
1451 │                                                           Total │  994│   15%│
1452 │                                      ╶──────────────────────────┼─────┼──────┤
1453 │                                       Very       S3a.     Male  │  268│    4%│
1454 │                                       unlikely   GENDER:  Female│  354│    5%│
1455 │                                                           Total │  622│    9%│
1456 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1457 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1458 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1459 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1460 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1461 │                                       Very       S3a.     Male  │  805│   12%│
1462 │                                       likely     GENDER:  Female│ 1029│   15%│
1463 │                                                           Total │ 1834│   27%│
1464 │                                      ╶──────────────────────────┼─────┼──────┤
1465 │                                       Somewhat   S3a.     Male  │  975│   14%│
1466 │                                       likely     GENDER:  Female│ 1332│   19%│
1467 │                                                           Total │ 2307│   34%│
1468 │                                      ╶──────────────────────────┼─────┼──────┤
1469 │                                       Somewhat   S3a.     Male  │  535│    8%│
1470 │                                       unlikely   GENDER:  Female│  560│    8%│
1471 │                                                           Total │ 1095│   16%│
1472 │                                      ╶──────────────────────────┼─────┼──────┤
1473 │                                       Very       S3a.     Male  │  270│    4%│
1474 │                                       unlikely   GENDER:  Female│  279│    4%│
1475 │                                                           Total │  549│    8%│
1476 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1477
1478                                   Custom Tables
1479 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1480 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1481 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1482 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1483 │                                 │        │ Table│         │         │        │
1484 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1485 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1486 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1487 │GENDER:        is it that drivers│        │      │         │         │        │
1488 │               who have had too  │        │      │         │         │        │
1489 │               much to drink to  │        │      │         │         │        │
1490 │               drive safely will │        │      │         │         │        │
1491 │               A. Get stopped by │        │      │         │         │        │
1492 │               the police?       │        │      │         │         │        │
1493 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1494 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1495 │               is it that drivers│        │      │         │         │        │
1496 │               who have had too  │        │      │         │         │        │
1497 │               much to drink to  │        │      │         │         │        │
1498 │               drive safely will │        │      │         │         │        │
1499 │               A. Get stopped by │        │      │         │         │        │
1500 │               the police?       │        │      │         │         │        │
1501 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1502 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1503 │               is it that drivers│        │      │         │         │        │
1504 │               who have had too  │        │      │         │         │        │
1505 │               much to drink to  │        │      │         │         │        │
1506 │               drive safely will │        │      │         │         │        │
1507 │               A. Get stopped by │        │      │         │         │        │
1508 │               the police?       │        │      │         │         │        │
1509 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1510 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1511 │GENDER:        is it that drivers│        │      │         │         │        │
1512 │               who have had too  │        │      │         │         │        │
1513 │               much to drink to  │        │      │         │         │        │
1514 │               drive safely will │        │      │         │         │        │
1515 │               B. Have an        │        │      │         │         │        │
1516 │               accident?         │        │      │         │         │        │
1517 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1518 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1519 │               is it that drivers│        │      │         │         │        │
1520 │               who have had too  │        │      │         │         │        │
1521 │               much to drink to  │        │      │         │         │        │
1522 │               drive safely will │        │      │         │         │        │
1523 │               B. Have an        │        │      │         │         │        │
1524 │               accident?         │        │      │         │         │        │
1525 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1526 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1527 │               is it that drivers│        │      │         │         │        │
1528 │               who have had too  │        │      │         │         │        │
1529 │               much to drink to  │        │      │         │         │        │
1530 │               drive safely will │        │      │         │         │        │
1531 │               B. Have an        │        │      │         │         │        │
1532 │               accident?         │        │      │         │         │        │
1533 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1534 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1535 │GENDER:        is it that drivers│        │      │         │         │        │
1536 │               who have had too  │        │      │         │         │        │
1537 │               much to drink to  │        │      │         │         │        │
1538 │               drive safely will │        │      │         │         │        │
1539 │               C. Be convicted   │        │      │         │         │        │
1540 │               for drunk driving?│        │      │         │         │        │
1541 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1542 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1543 │               is it that drivers│        │      │         │         │        │
1544 │               who have had too  │        │      │         │         │        │
1545 │               much to drink to  │        │      │         │         │        │
1546 │               drive safely will │        │      │         │         │        │
1547 │               C. Be convicted   │        │      │         │         │        │
1548 │               for drunk driving?│        │      │         │         │        │
1549 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1550 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1551 │               is it that drivers│        │      │         │         │        │
1552 │               who have had too  │        │      │         │         │        │
1553 │               much to drink to  │        │      │         │         │        │
1554 │               drive safely will │        │      │         │         │        │
1555 │               C. Be convicted   │        │      │         │         │        │
1556 │               for drunk driving?│        │      │         │         │        │
1557 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1558 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1559 │GENDER:        is it that drivers│        │      │         │         │        │
1560 │               who have had too  │        │      │         │         │        │
1561 │               much to drink to  │        │      │         │         │        │
1562 │               drive safely will │        │      │         │         │        │
1563 │               D. Be arrested for│        │      │         │         │        │
1564 │               drunk driving?    │        │      │         │         │        │
1565 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1566 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1567 │               is it that drivers│        │      │         │         │        │
1568 │               who have had too  │        │      │         │         │        │
1569 │               much to drink to  │        │      │         │         │        │
1570 │               drive safely will │        │      │         │         │        │
1571 │               D. Be arrested for│        │      │         │         │        │
1572 │               drunk driving?    │        │      │         │         │        │
1573 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1574 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1575 │               is it that drivers│        │      │         │         │        │
1576 │               who have had too  │        │      │         │         │        │
1577 │               much to drink to  │        │      │         │         │        │
1578 │               drive safely will │        │      │         │         │        │
1579 │               D. Be arrested for│        │      │         │         │        │
1580 │               drunk driving?    │        │      │         │         │        │
1581 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1582 ])
1583 AT_CLEANUP
1584
1585 AT_SETUP([CTABLES nesting and scale variables])
1586 AT_KEYWORDS([nest nested])
1587 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1588 AT_DATA([ctables.sps],
1589 [[GET 'nhtsa.sav'.
1590 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1591 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1592 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1593   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1594 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1595 ]])
1596 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1597                                   Custom Tables
1598 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1599 │                                                                 │S3a. GENDER:│
1600 │                                                                 ├─────┬──────┤
1601 │                                                                 │ Male│Female│
1602 │                                                                 ├─────┼──────┤
1603 │                                                                 │ Mean│ Mean │
1604 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1605 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1606 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1607 │                                                  week           │     │      │
1608 │                                                  Once a week or │   44│    54│
1609 │                                                  less           │     │      │
1610 │                                                  Only certain   │   34│    41│
1611 │                                                  times a year   │     │      │
1612 │                                                  Never          │   39│    55│
1613 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1614
1615                                   Custom Tables
1616 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1617 │                                                         │Minimum│Maximum│Mean│
1618 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1619 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1620 │What is  GENDER:         months, has there been a        │       │       │    │
1621 │your                     time when you felt you          │       │       │    │
1622 │age?                     should cut down on your      No │     16│     86│  46│
1623 │                         drinking?                       │       │       │    │
1624 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1625 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1626 │                         months, has there been a        │       │       │    │
1627 │                         time when you felt you          │       │       │    │
1628 │                         should cut down on your      No │     16│     86│  48│
1629 │                         drinking?                       │       │       │    │
1630 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1631 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1632 │What is  GENDER:         months, has there been a        │       │       │    │
1633 │your                     time when people criticized  No │     16│     86│  46│
1634 │age?                     your drinking?                  │       │       │    │
1635 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1636 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1637 │                         months, has there been a        │       │       │    │
1638 │                         time when people criticized  No │     16│     86│  48│
1639 │                         your drinking?                  │       │       │    │
1640 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1641
1642                                   Custom Tables
1643 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1644 │                             │S1. Including yourself, how many members of this│
1645 │                             │         household are age 16 or older?         │
1646 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1647 │                             │      │      │      │      │      │      │ 6 or │
1648 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1649 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1650 │                             │Column│Column│Column│Column│Column│Column│Column│
1651 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1652 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1653 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1654 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1655 │SOURCE:     likely           │      │      │      │      │      │      │      │
1656 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1657 │            that     likely  │      │      │      │      │      │      │      │
1658 │            drivers          │      │      │      │      │      │      │      │
1659 │            who have         │      │      │      │      │      │      │      │
1660 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1661 │            much to  likely  │      │      │      │      │      │      │      │
1662 │            drink to         │      │      │      │      │      │      │      │
1663 │            drive    Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1664 │            safely   unlikely│      │      │      │      │      │      │      │
1665 │            will A.          │      │      │      │      │      │      │      │
1666 │            Get              │      │      │      │      │      │      │      │
1667 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1668 │            by the   unlikely│      │      │      │      │      │      │      │
1669 │            police?          │      │      │      │      │      │      │      │
1670 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1671
1672                                   Custom Tables
1673 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1674 │                                                              │    │    Std   │
1675 │                                                              │Mean│ Deviation│
1676 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1677 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1678 │group           typical month did you have one or more        │    │          │
1679 │                alcoholic beverages to drink?                 │    │          │
1680 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1681 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1682 │                typical month did you have one or more        │    │          │
1683 │                alcoholic beverages to drink?                 │    │          │
1684 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1685 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1686 │                typical month did you have one or more        │    │          │
1687 │                alcoholic beverages to drink?                 │    │          │
1688 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1689 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1690 │                typical month did you have one or more        │    │          │
1691 │                alcoholic beverages to drink?                 │    │          │
1692 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1693 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1694 │                typical month did you have one or more        │    │          │
1695 │                alcoholic beverages to drink?                 │    │          │
1696 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1697 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1698 │       older    typical month did you have one or more        │    │          │
1699 │                alcoholic beverages to drink?                 │    │          │
1700 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1701 ])
1702 AT_CLEANUP
1703
1704
1705 AT_SETUP([CTABLES SLABELS])
1706 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1707 AT_DATA([ctables.sps],
1708 [[GET 'nhtsa.sav'.
1709 CTABLES /TABLE qn1 [COUNT COLPCT].
1710 CTABLES /TABLE qn1 [COUNT COLPCT]
1711     /SLABELS POSITION=ROW.
1712 CTABLES /TABLE qn1 [COUNT COLPCT]
1713     /SLABELS POSITION=ROW VISIBLE=NO.
1714 ]])
1715 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1716                                   Custom Tables
1717 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1718 │                                                                │     │ Column│
1719 │                                                                │Count│   %   │
1720 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1721 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1722 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1723 │                                             Once a week or less│  361│   5.2%│
1724 │                                             Only certain times │  130│   1.9%│
1725 │                                             a year             │     │       │
1726 │                                             Never              │  540│   7.7%│
1727 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1728
1729                                   Custom Tables
1730 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1731 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1732 │other motor vehicle?                                             Column │66.9%│
1733 │                                                                 %      │     │
1734 │                                            ╶───────────────────────────┼─────┤
1735 │                                             Several days a week Count  │ 1274│
1736 │                                                                 Column │18.3%│
1737 │                                                                 %      │     │
1738 │                                            ╶───────────────────────────┼─────┤
1739 │                                             Once a week or less Count  │  361│
1740 │                                                                 Column │ 5.2%│
1741 │                                                                 %      │     │
1742 │                                            ╶───────────────────────────┼─────┤
1743 │                                             Only certain times  Count  │  130│
1744 │                                             a year              Column │ 1.9%│
1745 │                                                                 %      │     │
1746 │                                            ╶───────────────────────────┼─────┤
1747 │                                             Never               Count  │  540│
1748 │                                                                 Column │ 7.7%│
1749 │                                                                 %      │     │
1750 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1751
1752                                   Custom Tables
1753 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1754 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1755 │motor vehicle?                                                          │66.9%│
1756 │                                                   Several days a week  │ 1274│
1757 │                                                                        │18.3%│
1758 │                                                   Once a week or less  │  361│
1759 │                                                                        │ 5.2%│
1760 │                                                   Only certain times a │  130│
1761 │                                                   year                 │ 1.9%│
1762 │                                                   Never                │  540│
1763 │                                                                        │ 7.7%│
1764 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1765 ])
1766 AT_CLEANUP
1767
1768 AT_SETUP([CTABLES SLABELS with stacking different summaries])
1769 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1770 AT_DATA([ctables.sps],
1771 [[GET 'nhtsa.sav'.
1772 CTABLES
1773     /VLABELS VARIABLES=ALL DISPLAY=NAME
1774     /TABLE qn1 [COUNT] + qnd1 [MEAN] + qn17 [UCOUNT] BY qns3a
1775     /SLABELS POSITION=ROW.
1776 ]])
1777 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1778                          Custom Tables
1779 ╭─────────────────────────────────────────────────┬───────────╮
1780 │                                                 │   QNS3A   │
1781 │                                                 ├────┬──────┤
1782 │                                                 │Male│Female│
1783 ├─────────────────────────────────────────────────┼────┼──────┤
1784 │QN1  Every day                   Count           │2305│  2362│
1785 │                                 Unweighted Count│    │      │
1786 │                                 Mean            │    │      │
1787 │    ╶────────────────────────────────────────────┼────┼──────┤
1788 │     Several days a week         Count           │ 440│   834│
1789 │                                 Unweighted Count│    │      │
1790 │                                 Mean            │    │      │
1791 │    ╶────────────────────────────────────────────┼────┼──────┤
1792 │     Once a week or less         Count           │ 125│   236│
1793 │                                 Unweighted Count│    │      │
1794 │                                 Mean            │    │      │
1795 │    ╶────────────────────────────────────────────┼────┼──────┤
1796 │     Only certain times a year   Count           │  58│    72│
1797 │                                 Unweighted Count│    │      │
1798 │                                 Mean            │    │      │
1799 │    ╶────────────────────────────────────────────┼────┼──────┤
1800 │     Never                       Count           │ 192│   348│
1801 │                                 Unweighted Count│    │      │
1802 │                                 Mean            │    │      │
1803 ├─────────────────────────────────────────────────┼────┼──────┤
1804 │qnd1 Count                                       │    │      │
1805 │    ╶────────────────────────────────────────────┼────┼──────┤
1806 │     Unweighted Count                            │    │      │
1807 │    ╶────────────────────────────────────────────┼────┼──────┤
1808 │     Mean                                        │  46│    50│
1809 ├─────────────────────────────────────────────────┼────┼──────┤
1810 │QN17 OR, something else          Count           │    │      │
1811 │                                 Unweighted Count│   1│     1│
1812 │                                 Mean            │    │      │
1813 │    ╶────────────────────────────────────────────┼────┼──────┤
1814 │     Beer                        Count           │    │      │
1815 │                                 Unweighted Count│ 817│   256│
1816 │                                 Mean            │    │      │
1817 │    ╶────────────────────────────────────────────┼────┼──────┤
1818 │     Light beer                  Count           │    │      │
1819 │                                 Unweighted Count│ 406│   214│
1820 │                                 Mean            │    │      │
1821 │    ╶────────────────────────────────────────────┼────┼──────┤
1822 │     Wine                        Count           │    │      │
1823 │                                 Unweighted Count│ 390│  1028│
1824 │                                 Mean            │    │      │
1825 │    ╶────────────────────────────────────────────┼────┼──────┤
1826 │     Wine coolers                Count           │    │      │
1827 │                                 Unweighted Count│  20│   117│
1828 │                                 Mean            │    │      │
1829 │    ╶────────────────────────────────────────────┼────┼──────┤
1830 │     Hard liquor or mixed drinks Count           │    │      │
1831 │                                 Unweighted Count│ 392│   496│
1832 │                                 Mean            │    │      │
1833 │    ╶────────────────────────────────────────────┼────┼──────┤
1834 │     Flavored malt drinks        Count           │    │      │
1835 │                                 Unweighted Count│  20│    63│
1836 │                                 Mean            │    │      │
1837 ╰─────────────────────────────────────────────────┴────┴──────╯
1838 ])
1839 AT_CLEANUP
1840
1841 AT_SETUP([CTABLES simple totals])
1842 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1843 AT_DATA([ctables.sps],
1844 [[GET 'nhtsa.sav'.
1845 CTABLES /TABLE=qn17
1846     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1847 DESCRIPTIVES qn18/STATISTICS=MEAN.
1848 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1849     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1850 ]])
1851 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1852                                   Custom Tables
1853 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1854 │                                                                        │Count│
1855 ├────────────────────────────────────────────────────────────────────────┼─────┤
1856 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1857 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1858 │                                                      Light beer        │  620│
1859 │                                                      Wine              │ 1418│
1860 │                                                      Wine coolers      │  137│
1861 │                                                      Hard liquor or    │  888│
1862 │                                                      mixed drinks      │     │
1863 │                                                      Flavored malt     │   83│
1864 │                                                      drinks            │     │
1865 │                                                      Number responding │ 4221│
1866 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1867
1868                              Descriptive Statistics
1869 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1870 │                                                                    │  N │Mean│
1871 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1872 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1873 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1874 │Valid N (listwise)                                                  │6999│    │
1875 │Missing N (listwise)                                                │2781│    │
1876 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1877
1878                                   Custom Tables
1879 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1880 │                                                      │    │     │ Valid│Total│
1881 │                                                      │Mean│Count│   N  │  N  │
1882 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1883 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1884 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1885 │                you usually drink per sitting?        │    │     │      │     │
1886 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1887 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1888 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1889 │                you usually drink per sitting?        │    │     │      │     │
1890 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1891 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1892 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1893 │                you usually drink per sitting?        │    │     │      │     │
1894 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1895 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1896 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1897 │                you usually drink per sitting?        │    │     │      │     │
1898 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1899 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1900 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1901 │                you usually drink per sitting?        │    │     │      │     │
1902 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1903 ])
1904 AT_CLEANUP
1905
1906 AT_SETUP([CTABLES subtotals])
1907 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1908 AT_DATA([ctables.sps],
1909 [[GET 'nhtsa.sav'.
1910 CTABLES /TABLE=qn105ba BY qns1
1911     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1912 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1913     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1914 CTABLES /TABLE=qn105ba BY qns1
1915     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1916     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1917 ]])
1918 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1919                                                       Custom Tables
1920 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1921 │                                                         │ S1. Including yourself, how many members of this household │
1922 │                                                         │                    are age 16 or older?                    │
1923 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1924 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1925 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1926 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1927 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1928 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1929 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1930 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1931 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1932 │                                              likely     │       │       │         │       │        │      │          │
1933 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1934 │                                              unlikely   │       │       │         │       │        │      │          │
1935 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1936 │                                              unlikely   │       │       │         │       │        │      │          │
1937 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1938
1939                                                       Custom Tables
1940 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1941 │                                                        │  S1. Including yourself, how many members of this household │
1942 │                                                        │                     are age 16 or older?                    │
1943 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1944 │                                                        │        │        │        │        │       │        │  6 or  │
1945 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1946 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1947 │                                                        │        │        │        │        │ Column│        │        │
1948 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1949 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1950 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1951 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1952 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1953 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1954 │                                             likely     │        │        │        │        │       │        │        │
1955 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1956 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1957 │                                             unlikely   │        │        │        │        │       │        │        │
1958 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1959 │                                             unlikely   │        │        │        │        │       │        │        │
1960 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1961 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1962
1963                                                       Custom Tables
1964 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1965 │                                                         │ S1. Including yourself, how many members of this household │
1966 │                                                         │                    are age 16 or older?                    │
1967 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1968 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1969 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1970 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1971 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1972 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1973 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1974 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1975 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1976 │                                              likely     │       │       │         │       │        │      │          │
1977 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1978 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1979 │                                              unlikely   │       │       │         │       │        │      │          │
1980 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1981 │                                              unlikely   │       │       │         │       │        │      │          │
1982 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1983 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1984 ])
1985 AT_CLEANUP
1986
1987 AT_SETUP([CTABLES PCOMPUTE])
1988 AT_KEYWORDS([postcompute])
1989 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1990 AT_DATA([ctables.sps],
1991 [[GET 'nhtsa.sav'.
1992 CTABLES
1993     /PCOMPUTE &x=EXPR([3] + [4])
1994     /PCOMPUTE &y=EXPR([4] + [5])
1995     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1996     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1997     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1998     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1999
2000 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
2001 CTABLES
2002     /PCOMPUTE &x=EXPR([3] + [4])
2003     /PCOMPUTE &y=EXPR([4] + [5])
2004     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
2005     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
2006     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
2007     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
2008 ]])
2009 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2010                                                                 Custom Tables
2011 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
2012 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
2013 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
2014 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
2015 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
2016 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
2017 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
2018 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
2019 │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%│
2020 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2021 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2022 │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%│
2023 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2024 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2025 │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%│
2026 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2027 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2028 │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%│
2029 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2030 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2031 │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%│
2032 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2033 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2034 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
2035
2036                                                                 Custom Tables
2037 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
2038 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
2039 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
2040 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
2041 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
2042 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
2043 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
2044 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
2045 │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%│
2046 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2047 │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%│
2048 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2049 │                               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%│
2050 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2051 │                               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%│
2052 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2053 │                               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%│
2054 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2055 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
2056 ])
2057 AT_CLEANUP
2058
2059 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
2060 AT_KEYWORDS([postcompute])
2061 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2062 AT_DATA([ctables.sps],
2063 [[GET 'nhtsa.sav'.
2064 CTABLES
2065     /PCOMPUTE &x=EXPR(OTHERNM)
2066     /PCOMPUTE &y=EXPR(MISSING)
2067     /PPROPERTIES &x LABEL='Drivers'
2068     /PPROPERTIES &y LABEL='Missing Values 2'
2069     /TABLE=qn1 BY qns3a
2070     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
2071 ]])
2072 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2073                                               Custom Tables
2074 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
2075 │                                                                                          │S3a. GENDER:│
2076 │                                                                                          ├─────┬──────┤
2077 │                                                                                          │ Male│Female│
2078 │                                                                                          ├─────┼──────┤
2079 │                                                                                          │Count│ Count│
2080 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
2081 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
2082 │                                                                 Several days a week      │  440│   834│
2083 │                                                                 Once a week or less      │  125│   236│
2084 │                                                                 Only certain times a year│   58│    72│
2085 │                                                                 Never                    │  192│   348│
2086 │                                                                 Drivers                  │ 2928│  3504│
2087 │                                                                 Valid Values             │ 3120│  3852│
2088 │                                                                 Don't know               │    3│     5│
2089 │                                                                 Refused                  │    9│    10│
2090 │                                                                 Missing Values           │   12│    15│
2091 │                                                                 Missing Values 2         │   12│    15│
2092 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
2093 ])
2094 AT_CLEANUP
2095
2096 AT_SETUP([CTABLES PCOMPUTE - THRU])
2097 AT_KEYWORDS([postcompute])
2098 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2099 AT_DATA([ctables.sps],
2100 [[GET 'nhtsa.sav'.
2101 CTABLES
2102     /PCOMPUTE &x=EXPR([1 THRU 2])
2103     /PCOMPUTE &y=EXPR([3 THRU 4])
2104     /PCOMPUTE &z=EXPR([5] + MISSING)
2105     /PPROPERTIES &x LABEL='Frequent Drivers'
2106     /PPROPERTIES &y LABEL='Infrequent Drivers'
2107     /PPROPERTIES &z LABEL='Not Drivers or Missing'
2108     /TABLE=qn1 BY qns3a
2109     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
2110 ]])
2111 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2112                                               Custom Tables
2113 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
2114 │                                                                                          │S3a. GENDER:│
2115 │                                                                                          ├─────┬──────┤
2116 │                                                                                          │ Male│Female│
2117 │                                                                                          ├─────┼──────┤
2118 │                                                                                          │Count│ Count│
2119 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
2120 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
2121 │                                                                 Several days a week      │  440│   834│
2122 │                                                                 Frequent Drivers         │ 2745│  3196│
2123 │                                                                 Once a week or less      │  125│   236│
2124 │                                                                 Only certain times a year│   58│    72│
2125 │                                                                 Infrequent Drivers       │  183│   308│
2126 │                                                                 Drivers                  │ 2928│  3504│
2127 │                                                                 Never                    │  192│   348│
2128 │                                                                 Don't know               │    3│     5│
2129 │                                                                 Refused                  │    9│    10│
2130 │                                                                 Not Drivers or Missing   │  204│   363│
2131 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
2132 ])
2133 AT_CLEANUP
2134
2135 dnl I'm not sure that this is the correct behavior (see
2136 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
2137 dnl but at least this test will notify us if the behavior changes.
2138 AT_SETUP([CTABLES intersecting PCOMPUTEs])
2139 AT_KEYWORDS([PCOMPUTE postcompute])
2140 AT_DATA([ctables.sps],
2141 [[DATA LIST LIST NOTABLE/x y z.
2142 WEIGHT by z.
2143 FORMATS ALL (F1.0).
2144 VARIABLE LEVEL x y (NOMINAL).
2145 BEGIN DATA.
2146 1 4 5
2147 1 5 2
2148 1 6 9
2149 2 4 2
2150 2 5 3
2151 2 6 4
2152 3 4 1
2153 3 5 6
2154 3 6 1
2155 END DATA.
2156
2157 CTABLES
2158     /PCOMPUTE &a = EXPR([1] + [2])
2159     /PCOMPUTE &b = EXPR([2] + [3])
2160     /PCOMPUTE &c = EXPR([4] * [5])
2161     /PCOMPUTE &d = EXPR([5] * [6])
2162     /TABLE x BY y
2163     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
2164     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
2165 ]])
2166 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
2167 [[                   Custom Tables
2168 ╭───────────┬─────────────────────────────────────╮
2169 │           │                  y                  │
2170 │           ├─────┬─────────┬─────┬─────────┬─────┤
2171 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
2172 │           ├─────┼─────────┼─────┼─────────┼─────┤
2173 │           │Count│  Count  │Count│  Count  │Count│
2174 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
2175 │x 1        │    5│       10│    2│       18│    9│
2176 │  [1] + [2]│    7│        .│    5│        .│   13│
2177 │  2        │    2│        6│    3│       12│    4│
2178 │  [2] + [3]│    3│        .│    9│        .│    5│
2179 │  3        │    1│        6│    6│        6│    1│
2180 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
2181 ]])
2182 AT_CLEANUP
2183
2184 AT_SETUP([CTABLES string and date and time])
2185
2186 weight=1
2187 for gender in F M; do
2188     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
2189         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
2190             printf "$weight $gender $month $wkday\n"
2191             weight=$(expr \( $weight + 3 \) % 7 + 2)
2192         done
2193     done
2194 done > ctables.txt
2195
2196 AT_DATA([ctables.sps],
2197 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
2198     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
2199 WEIGHT by w.
2200 VARIABLE LEVEL w (SCALE).
2201 VARIABLE LEVEL gender fmon fday (NOMINAL).
2202 VARIABLE LABEL
2203   gender 'Gender'
2204   fmon 'Favorite month'
2205   fday 'Favorite day of the week'.
2206 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
2207 CTABLES
2208     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
2209     /PPROPERTIES &q2 LABEL='Q2'
2210     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
2211     /PPROPERTIES &weekend LABEL='Weekend'
2212     /TABLE fmon BY gender > fday
2213     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
2214                                 4 THRU 6, &q2,
2215                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
2216                                 OTHERNM, SUBTOTAL='Q4']
2217     /CATEGORIES VARIABLES=gender ['M', 'F']
2218     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
2219     /SLABELS VISIBLE=NO.
2220 ]])
2221 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2222                                               Custom Tables
2223 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
2224 │                  │                                       Gender                                      │
2225 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
2226 │                  │                   Male                  │                  Female                 │
2227 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
2228 │                  │         Favorite day of the week        │         Favorite day of the week        │
2229 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
2230 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
2231 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
2232 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
2233 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2234 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2235 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
2236 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2237 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2238 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
2239 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
2240 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
2241 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
2242 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2243 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
2244 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2245 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2246 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2247 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
2248 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
2249 ])
2250 AT_CLEANUP
2251
2252 AT_SETUP([CTABLES CLABELS])
2253 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2254 AT_DATA([ctables.sps],
2255 [[GET 'nhtsa.sav'.
2256 CTABLES /TABLE AgeGroup BY qns3a.
2257 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
2258 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
2259 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
2260 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
2261 ]])
2262 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
2263              Custom Tables
2264 ╭───────────────────────┬────────────╮
2265 │                       │S3a. GENDER:│
2266 │                       ├─────┬──────┤
2267 │                       │ Male│Female│
2268 │                       ├─────┼──────┤
2269 │                       │Count│ Count│
2270 ├───────────────────────┼─────┼──────┤
2271 │Age group 15 or younger│    0│     0│
2272 │          16 to 25     │  594│   505│
2273 │          26 to 35     │  476│   491│
2274 │          36 to 45     │  489│   548│
2275 │          46 to 55     │  526│   649│
2276 │          56 to 65     │  516│   731│
2277 │          66 or older  │  531│   943│
2278 ╰───────────────────────┴─────┴──────╯
2279
2280                                                       Custom Tables
2281 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
2282 │       │                                                 S3a. GENDER:                                                 │
2283 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
2284 │       │                         Male                         │                         Female                        │
2285 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
2286 │       │  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 │
2287 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
2288 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2289 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
2290 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2291 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
2292 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
2293 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
2294
2295                 Custom Tables
2296 ╭──────────────────────────────┬────────────╮
2297 │                              │S3a. GENDER:│
2298 │                              ├────────────┤
2299 │                              │    Count   │
2300 ├──────────────────────────────┼────────────┤
2301 │Age group 15 or younger Male  │           0│
2302 │                        Female│           0│
2303 │         ╶────────────────────┼────────────┤
2304 │          16 to 25      Male  │         594│
2305 │                        Female│         505│
2306 │         ╶────────────────────┼────────────┤
2307 │          26 to 35      Male  │         476│
2308 │                        Female│         491│
2309 │         ╶────────────────────┼────────────┤
2310 │          36 to 45      Male  │         489│
2311 │                        Female│         548│
2312 │         ╶────────────────────┼────────────┤
2313 │          46 to 55      Male  │         526│
2314 │                        Female│         649│
2315 │         ╶────────────────────┼────────────┤
2316 │          56 to 65      Male  │         516│
2317 │                        Female│         731│
2318 │         ╶────────────────────┼────────────┤
2319 │          66 or older   Male  │         531│
2320 │                        Female│         943│
2321 ╰──────────────────────────────┴────────────╯
2322
2323       Custom Tables
2324 15 or younger
2325 ╭─────────┬────────────╮
2326 │         │S3a. GENDER:│
2327 │         ├─────┬──────┤
2328 │         │ Male│Female│
2329 │         ├─────┼──────┤
2330 │         │Count│ Count│
2331 ├─────────┼─────┼──────┤
2332 │Age group│    0│     0│
2333 ╰─────────┴─────┴──────╯
2334
2335       Custom Tables
2336 16 to 25
2337 ╭─────────┬────────────╮
2338 │         │S3a. GENDER:│
2339 │         ├─────┬──────┤
2340 │         │ Male│Female│
2341 │         ├─────┼──────┤
2342 │         │Count│ Count│
2343 ├─────────┼─────┼──────┤
2344 │Age group│  594│   505│
2345 ╰─────────┴─────┴──────╯
2346
2347       Custom Tables
2348 26 to 35
2349 ╭─────────┬────────────╮
2350 │         │S3a. GENDER:│
2351 │         ├─────┬──────┤
2352 │         │ Male│Female│
2353 │         ├─────┼──────┤
2354 │         │Count│ Count│
2355 ├─────────┼─────┼──────┤
2356 │Age group│  476│   491│
2357 ╰─────────┴─────┴──────╯
2358
2359       Custom Tables
2360 36 to 45
2361 ╭─────────┬────────────╮
2362 │         │S3a. GENDER:│
2363 │         ├─────┬──────┤
2364 │         │ Male│Female│
2365 │         ├─────┼──────┤
2366 │         │Count│ Count│
2367 ├─────────┼─────┼──────┤
2368 │Age group│  489│   548│
2369 ╰─────────┴─────┴──────╯
2370
2371       Custom Tables
2372 46 to 55
2373 ╭─────────┬────────────╮
2374 │         │S3a. GENDER:│
2375 │         ├─────┬──────┤
2376 │         │ Male│Female│
2377 │         ├─────┼──────┤
2378 │         │Count│ Count│
2379 ├─────────┼─────┼──────┤
2380 │Age group│  526│   649│
2381 ╰─────────┴─────┴──────╯
2382
2383       Custom Tables
2384 56 to 65
2385 ╭─────────┬────────────╮
2386 │         │S3a. GENDER:│
2387 │         ├─────┬──────┤
2388 │         │ Male│Female│
2389 │         ├─────┼──────┤
2390 │         │Count│ Count│
2391 ├─────────┼─────┼──────┤
2392 │Age group│  516│   731│
2393 ╰─────────┴─────┴──────╯
2394
2395       Custom Tables
2396 66 or older
2397 ╭─────────┬────────────╮
2398 │         │S3a. GENDER:│
2399 │         ├─────┬──────┤
2400 │         │ Male│Female│
2401 │         ├─────┼──────┤
2402 │         │Count│ Count│
2403 ├─────────┼─────┼──────┤
2404 │Age group│  531│   943│
2405 ╰─────────┴─────┴──────╯
2406
2407              Custom Tables
2408 Male
2409 ╭───────────────────────┬────────────╮
2410 │                       │S3a. GENDER:│
2411 │                       ├────────────┤
2412 │                       │    Count   │
2413 ├───────────────────────┼────────────┤
2414 │Age group 15 or younger│           0│
2415 │          16 to 25     │         594│
2416 │          26 to 35     │         476│
2417 │          36 to 45     │         489│
2418 │          46 to 55     │         526│
2419 │          56 to 65     │         516│
2420 │          66 or older  │         531│
2421 ╰───────────────────────┴────────────╯
2422
2423              Custom Tables
2424 Female
2425 ╭───────────────────────┬────────────╮
2426 │                       │S3a. GENDER:│
2427 │                       ├────────────┤
2428 │                       │    Count   │
2429 ├───────────────────────┼────────────┤
2430 │Age group 15 or younger│           0│
2431 │          16 to 25     │         505│
2432 │          26 to 35     │         491│
2433 │          36 to 45     │         548│
2434 │          46 to 55     │         649│
2435 │          56 to 65     │         731│
2436 │          66 or older  │         943│
2437 ╰───────────────────────┴────────────╯
2438 ])
2439 AT_CLEANUP
2440
2441 AT_SETUP([CTABLES missing values])
2442 AT_DATA([ctables.sps],
2443 [[DATA LIST LIST NOTABLE/x y.
2444 BEGIN DATA.
2445 1 1
2446 1 2
2447 1 3
2448 1 4
2449 1 5
2450 1 .
2451 2 1
2452 2 2
2453 2 3
2454 2 4
2455 2 5
2456 2 .
2457 3 1
2458 3 2
2459 3 3
2460 3 4
2461 3 5
2462 3 .
2463 4 1
2464 4 2
2465 4 3
2466 4 4
2467 4 5
2468 4 .
2469 5 1
2470 5 2
2471 5 3
2472 5 4
2473 5 5
2474 5 .
2475 . 1
2476 . 2
2477 . 3
2478 . 4
2479 . 5
2480 . .
2481 END DATA.
2482 MISSING VALUES x (1, 2) y (2, 3).
2483 VARIABLE LEVEL ALL (NOMINAL).
2484
2485 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2486                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2487     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2488 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2489                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2490     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2491 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2492                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2493     /CATEGORIES VARIABLES=ALL TOTAL=YES
2494     /SLABELS POSITION=ROW.
2495 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2496                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2497     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2498     /SLABELS POSITION=ROW.
2499 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2500                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2501     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2502     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2503     /SLABELS POSITION=ROW.
2504 ]])
2505 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2506                                Custom Tables
2507 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2508 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2509 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2510 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2511 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2512 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2513 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2514 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2515 dnl Note that Column Total N % doesn't add up to 100 because missing
2516 dnl values are included in the total but not shown as a category and this
2517 dnl is expected behavior.
2518
2519                                Custom Tables
2520 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2521 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2522 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2523 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2524 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2525 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2526 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2527 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2528 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2529 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2530 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2531 dnl values are included in the total but not shown as a category and this
2532 dnl is expected behavior.
2533
2534                      Custom Tables
2535 ╭────────────────────────┬───────────────────────────╮
2536 │                        │             y             │
2537 │                        ├──────┬──────┬──────┬──────┤
2538 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2539 ├────────────────────────┼──────┼──────┼──────┼──────┤
2540 │x 3.00  Count           │     1│     1│     1│     3│
2541 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2542 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2543 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2544 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2545 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2546 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2547 │        Valid N         │      │      │      │     3│
2548 │        Total N         │      │      │      │     6│
2549 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2550 │  4.00  Count           │     1│     1│     1│     3│
2551 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2552 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2553 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2554 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2555 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2556 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2557 │        Valid N         │      │      │      │     3│
2558 │        Total N         │      │      │      │     6│
2559 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2560 │  5.00  Count           │     1│     1│     1│     3│
2561 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2562 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2563 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2564 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2565 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2566 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2567 │        Valid N         │      │      │      │     3│
2568 │        Total N         │      │      │      │     6│
2569 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2570 │  Total Count           │     3│     3│     3│     9│
2571 │        Column %        │100.0%│100.0%│100.0%│     .│
2572 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2573 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2574 │        Row %           │     .│     .│     .│     .│
2575 │        Row Valid N %   │     .│     .│     .│     .│
2576 │        Row Total N %   │     .│     .│     .│     .│
2577 │        Valid N         │     3│     3│     3│     9│
2578 │        Total N         │     3│     3│     3│    18│
2579 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2580
2581                             Custom Tables
2582 ╭────────────────────────┬─────────────────────────────────────────╮
2583 │                        │                    y                    │
2584 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2585 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2586 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2587 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2588 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2589 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2590 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2591 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2592 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2593 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2594 │        Valid N         │      │      │      │      │      │     3│
2595 │        Total N         │      │      │      │      │      │     6│
2596 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2597 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2598 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2599 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2600 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2601 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2602 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2603 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2604 │        Valid N         │      │      │      │      │      │     3│
2605 │        Total N         │      │      │      │      │      │     6│
2606 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2607 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2608 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2609 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2610 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2611 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2612 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2613 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2614 │        Valid N         │      │      │      │      │      │     3│
2615 │        Total N         │      │      │      │      │      │     6│
2616 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2617 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2618 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2619 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2620 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2621 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2622 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2623 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2624 │        Valid N         │      │      │      │      │      │     3│
2625 │        Total N         │      │      │      │      │      │     6│
2626 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2627 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2628 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2629 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2630 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2631 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2632 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2633 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2634 │        Valid N         │      │      │      │      │      │     3│
2635 │        Total N         │      │      │      │      │      │     6│
2636 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2637 │  Total Count           │     5│     5│     5│     5│     5│    25│
2638 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2639 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2640 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2641 │        Row %           │     .│     .│     .│     .│     .│     .│
2642 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2643 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2644 │        Valid N         │     5│     0│     0│     5│     5│    15│
2645 │        Total N         │     5│     5│     5│     5│     5│    30│
2646 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2647
2648                         Custom Tables
2649 ╭────────────────────────┬──────────────────────────────────╮
2650 │                        │                 y                │
2651 │                        ├──────┬──────┬──────┬──────┬──────┤
2652 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2653 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2654 │x 1.00  Count           │     1│     1│     1│     1│     4│
2655 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2656 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2657 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2658 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2659 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2660 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2661 │        Valid N         │      │      │      │      │     3│
2662 │        Total N         │      │      │      │      │     6│
2663 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2664 │  2.00  Count           │     1│     1│     1│     1│     4│
2665 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2666 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2667 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2668 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2669 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2670 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2671 │        Valid N         │      │      │      │      │     3│
2672 │        Total N         │      │      │      │      │     6│
2673 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2674 │  3.00  Count           │     1│     1│     1│     1│     4│
2675 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2676 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2677 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2678 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2679 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2680 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2681 │        Valid N         │      │      │      │      │     3│
2682 │        Total N         │      │      │      │      │     6│
2683 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2684 │  4.00  Count           │     1│     1│     1│     1│     4│
2685 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2686 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2687 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2688 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2689 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2690 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2691 │        Valid N         │      │      │      │      │     3│
2692 │        Total N         │      │      │      │      │     6│
2693 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2694 │  Total Count           │     4│     4│     4│     4│    16│
2695 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2696 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2697 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2698 │        Row %           │     .│     .│     .│     .│     .│
2699 │        Row Valid N %   │     .│     .│     .│     .│     .│
2700 │        Row Total N %   │     .│     .│     .│     .│     .│
2701 │        Valid N         │     4│     0│     4│     4│    12│
2702 │        Total N         │     4│     4│     4│     4│    24│
2703 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2704 ])
2705 AT_CLEANUP
2706
2707 AT_SETUP([CTABLES SMISSING=LISTWISE])
2708 AT_KEYWORDS([SMISSING LISTWISE])
2709 AT_DATA([ctables.sps],
2710 [[DATA LIST LIST NOTABLE/x y z.
2711 BEGIN DATA.
2712 1  . 40
2713 1 10 50
2714 1 20 60
2715 1  .  .
2716 1 30  .
2717 END DATA.
2718 VARIABLE LEVEL x (NOMINAL).
2719
2720 CTABLES /TABLE (y + z) > x.
2721 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2722
2723 * The following doesn't come out as listwise because the tables are
2724 separate, not linked by an > operator.
2725 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2726 ]])
2727 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2728   Custom Tables
2729 ╭────────┬─────╮
2730 │        │ Mean│
2731 ├────────┼─────┤
2732 │y x 1.00│20.00│
2733 ├────────┼─────┤
2734 │z x 1.00│50.00│
2735 ╰────────┴─────╯
2736
2737   Custom Tables
2738 ╭────────┬─────╮
2739 │        │ Mean│
2740 ├────────┼─────┤
2741 │y x 1.00│15.00│
2742 ├────────┼─────┤
2743 │z x 1.00│55.00│
2744 ╰────────┴─────╯
2745
2746   Custom Tables
2747 ╭────────┬─────╮
2748 │        │ Mean│
2749 ├────────┼─────┤
2750 │y x 1.00│20.00│
2751 ├────────┼─────┤
2752 │z x 1.00│50.00│
2753 ╰────────┴─────╯
2754 ])
2755 AT_CLEANUP
2756
2757 AT_SETUP([CTABLES VLABELS - variables on different axes])
2758 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2759 AT_DATA([ctables.sps],
2760 [[GET 'nhtsa.sav'.
2761 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2762 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2763 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2764 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2765 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2766 ]])
2767 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2768                                  Custom Tables
2769 ╭────────────────────────────────────────────────────────────────┬────────────╮
2770 │                                                                │S3a. GENDER:│
2771 │                                                                ├─────┬──────┤
2772 │                                                                │ Male│Female│
2773 │                                                                ├─────┼──────┤
2774 │                                                                │Count│ Count│
2775 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2776 │D5a. What would you say is your primary    Cuban                │   13│     7│
2777 │ethnic background?                         Mexican              │  175│   136│
2778 │                                           Spanish              │   20│    28│
2779 │                                           South American       │   21│    13│
2780 │                                           Central American     │   27│    25│
2781 │                                           Puerto Rican, OR     │   37│    41│
2782 │                                           Something else       │   35│    33│
2783 │                                           Multiple - cannot    │    2│     5│
2784 │                                           choose one           │     │      │
2785 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2786
2787                   Custom Tables
2788 ╭──────────────────────────────────┬────────────╮
2789 │                                  │    QNS3A   │
2790 │                                  ├─────┬──────┤
2791 │                                  │ Male│Female│
2792 │                                  ├─────┼──────┤
2793 │                                  │Count│ Count│
2794 ├──────────────────────────────────┼─────┼──────┤
2795 │QND5A Cuban                       │   13│     7│
2796 │      Mexican                     │  175│   136│
2797 │      Spanish                     │   20│    28│
2798 │      South American              │   21│    13│
2799 │      Central American            │   27│    25│
2800 │      Puerto Rican, OR            │   37│    41│
2801 │      Something else              │   35│    33│
2802 │      Multiple - cannot choose one│    2│     5│
2803 ╰──────────────────────────────────┴─────┴──────╯
2804
2805                                  Custom Tables
2806 ╭────────────────────────────────────────────────────────────────┬────────────╮
2807 │                                                                │S3a. GENDER:│
2808 │                                                                ├─────┬──────┤
2809 │                                                                │ Male│Female│
2810 │                                                                ├─────┼──────┤
2811 │                                                                │Count│ Count│
2812 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2813 │D5a. What would you say is your primary    Cuban                │   13│     7│
2814 │ethnic background?                         Mexican              │  175│   136│
2815 │                                           Spanish              │   20│    28│
2816 │                                           South American       │   21│    13│
2817 │                                           Central American     │   27│    25│
2818 │                                           Puerto Rican, OR     │   37│    41│
2819 │                                           Something else       │   35│    33│
2820 │                                           Multiple - cannot    │    2│     5│
2821 │                                           choose one           │     │      │
2822 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2823
2824                                  Custom Tables
2825 ╭────────────────────────────────────────────────────────────┬────────────────╮
2826 │                                                            │   QNS3A S3a.   │
2827 │                                                            │     GENDER:    │
2828 │                                                            ├───────┬────────┤
2829 │                                                            │  Male │ Female │
2830 │                                                            ├───────┼────────┤
2831 │                                                            │ Count │  Count │
2832 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2833 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2834 │primary ethnic background?               Mexican            │    175│     136│
2835 │                                         Spanish            │     20│      28│
2836 │                                         South American     │     21│      13│
2837 │                                         Central American   │     27│      25│
2838 │                                         Puerto Rican, OR   │     37│      41│
2839 │                                         Something else     │     35│      33│
2840 │                                         Multiple - cannot  │      2│       5│
2841 │                                         choose one         │       │        │
2842 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2843
2844                Custom Tables
2845 ╭────────────────────────────┬─────┬──────╮
2846 │                            │ Male│Female│
2847 │                            ├─────┼──────┤
2848 │                            │Count│ Count│
2849 ├────────────────────────────┼─────┼──────┤
2850 │Cuban                       │   13│     7│
2851 │Mexican                     │  175│   136│
2852 │Spanish                     │   20│    28│
2853 │South American              │   21│    13│
2854 │Central American            │   27│    25│
2855 │Puerto Rican, OR            │   37│    41│
2856 │Something else              │   35│    33│
2857 │Multiple - cannot choose one│    2│     5│
2858 ╰────────────────────────────┴─────┴──────╯
2859 ])
2860 AT_CLEANUP
2861
2862 AT_SETUP([CTABLES VLABELS - stacked variables])
2863 AT_KEYWORDS([stack stacking])
2864 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2865 AT_DATA([ctables.sps],
2866 [[GET 'nhtsa.sav'.
2867 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2868 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2869 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2870 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2871 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2872 ]])
2873 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2874                                  Custom Tables
2875 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2876 │                                                                       │Count│
2877 ├───────────────────────────────────────────────────────────────────────┼─────┤
2878 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2879 │background?                                     Mexican                │  311│
2880 │                                                Spanish                │   48│
2881 │                                                South American         │   34│
2882 │                                                Central American       │   52│
2883 │                                                Puerto Rican, OR       │   78│
2884 │                                                Something else         │   68│
2885 │                                                Multiple - cannot      │    7│
2886 │                                                choose one             │     │
2887 ├───────────────────────────────────────────────────────────────────────┼─────┤
2888 │QNS3A                                           Male                   │ 3132│
2889 │                                                Female                 │ 3867│
2890 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2891
2892                   Custom Tables
2893 ╭─────────────────────────────────────────┬─────╮
2894 │                                         │Count│
2895 ├─────────────────────────────────────────┼─────┤
2896 │QND5A        Cuban                       │   20│
2897 │             Mexican                     │  311│
2898 │             Spanish                     │   48│
2899 │             South American              │   34│
2900 │             Central American            │   52│
2901 │             Puerto Rican, OR            │   78│
2902 │             Something else              │   68│
2903 │             Multiple - cannot choose one│    7│
2904 ├─────────────────────────────────────────┼─────┤
2905 │S3a. GENDER: Male                        │ 3132│
2906 │             Female                      │ 3867│
2907 ╰─────────────────────────────────────────┴─────╯
2908
2909                                  Custom Tables
2910 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2911 │                                                                       │Count│
2912 ├───────────────────────────────────────────────────────────────────────┼─────┤
2913 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2914 │background?                                     Mexican                │  311│
2915 │                                                Spanish                │   48│
2916 │                                                South American         │   34│
2917 │                                                Central American       │   52│
2918 │                                                Puerto Rican, OR       │   78│
2919 │                                                Something else         │   68│
2920 │                                                Multiple - cannot      │    7│
2921 │                                                choose one             │     │
2922 ├───────────────────────────────────────────────────────────────────────┼─────┤
2923 │Male                                                                   │ 3132│
2924 ├───────────────────────────────────────────────────────────────────────┼─────┤
2925 │Female                                                                 │ 3867│
2926 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2927
2928             Custom Tables
2929 ╭─────────────────────────────┬─────╮
2930 │                             │Count│
2931 ├─────────────────────────────┼─────┤
2932 │Cuban                        │   20│
2933 ├─────────────────────────────┼─────┤
2934 │Mexican                      │  311│
2935 ├─────────────────────────────┼─────┤
2936 │Spanish                      │   48│
2937 ├─────────────────────────────┼─────┤
2938 │South American               │   34│
2939 ├─────────────────────────────┼─────┤
2940 │Central American             │   52│
2941 ├─────────────────────────────┼─────┤
2942 │Puerto Rican, OR             │   78│
2943 ├─────────────────────────────┼─────┤
2944 │Something else               │   68│
2945 ├─────────────────────────────┼─────┤
2946 │Multiple - cannot choose one │    7│
2947 ├─────────────────────────────┼─────┤
2948 │S3a. GENDER:     Male        │ 3132│
2949 │                 Female      │ 3867│
2950 ╰─────────────────────────────┴─────╯
2951
2952             Custom Tables
2953 ╭────────────────────────────┬─────╮
2954 │                            │Count│
2955 ├────────────────────────────┼─────┤
2956 │Cuban                       │   20│
2957 │Mexican                     │  311│
2958 │Spanish                     │   48│
2959 │South American              │   34│
2960 │Central American            │   52│
2961 │Puerto Rican, OR            │   78│
2962 │Something else              │   68│
2963 │Multiple - cannot choose one│    7│
2964 │Male                        │ 3132│
2965 │Female                      │ 3867│
2966 ╰────────────────────────────┴─────╯
2967 ])
2968 AT_CLEANUP
2969
2970 AT_SETUP([CTABLES VLABELS - nested variables])
2971 AT_KEYWORDS([nest nesting])
2972 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2973 AT_DATA([ctables.sps],
2974 [[GET 'nhtsa.sav'.
2975 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2976 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2977 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2978 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2979 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2980 ]])
2981 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2982                                  Custom Tables
2983 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2984 │                                                                       │Count│
2985 ├───────────────────────────────────────────────────────────────────────┼─────┤
2986 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2987 │primary ethnic background?                                       Female│    7│
2988 │                                     ╶─────────────────────────────────┼─────┤
2989 │                                      Mexican              QNS3A Male  │  175│
2990 │                                                                 Female│  136│
2991 │                                     ╶─────────────────────────────────┼─────┤
2992 │                                      Spanish              QNS3A Male  │   20│
2993 │                                                                 Female│   28│
2994 │                                     ╶─────────────────────────────────┼─────┤
2995 │                                      South American       QNS3A Male  │   21│
2996 │                                                                 Female│   13│
2997 │                                     ╶─────────────────────────────────┼─────┤
2998 │                                      Central American     QNS3A Male  │   27│
2999 │                                                                 Female│   25│
3000 │                                     ╶─────────────────────────────────┼─────┤
3001 │                                      Puerto Rican, OR     QNS3A Male  │   37│
3002 │                                                                 Female│   41│
3003 │                                     ╶─────────────────────────────────┼─────┤
3004 │                                      Something else       QNS3A Male  │   35│
3005 │                                                                 Female│   33│
3006 │                                     ╶─────────────────────────────────┼─────┤
3007 │                                      Multiple - cannot    QNS3A Male  │    2│
3008 │                                      choose one                 Female│    5│
3009 ╰───────────────────────────────────────────────────────────────────────┴─────╯
3010
3011                          Custom Tables
3012 ╭──────────────────────────────────────────────────────┬─────╮
3013 │                                                      │Count│
3014 ├──────────────────────────────────────────────────────┼─────┤
3015 │QND5A Cuban                        S3a. GENDER: Male  │   13│
3016 │                                                Female│    7│
3017 │     ╶────────────────────────────────────────────────┼─────┤
3018 │      Mexican                      S3a. GENDER: Male  │  175│
3019 │                                                Female│  136│
3020 │     ╶────────────────────────────────────────────────┼─────┤
3021 │      Spanish                      S3a. GENDER: Male  │   20│
3022 │                                                Female│   28│
3023 │     ╶────────────────────────────────────────────────┼─────┤
3024 │      South American               S3a. GENDER: Male  │   21│
3025 │                                                Female│   13│
3026 │     ╶────────────────────────────────────────────────┼─────┤
3027 │      Central American             S3a. GENDER: Male  │   27│
3028 │                                                Female│   25│
3029 │     ╶────────────────────────────────────────────────┼─────┤
3030 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
3031 │                                                Female│   41│
3032 │     ╶────────────────────────────────────────────────┼─────┤
3033 │      Something else               S3a. GENDER: Male  │   35│
3034 │                                                Female│   33│
3035 │     ╶────────────────────────────────────────────────┼─────┤
3036 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
3037 │                                                Female│    5│
3038 ╰──────────────────────────────────────────────────────┴─────╯
3039
3040                                  Custom Tables
3041 ╭───────────────────────────────────────────────────────────────────────┬─────╮
3042 │                                                                       │Count│
3043 ├───────────────────────────────────────────────────────────────────────┼─────┤
3044 │D5a. What would you say is your primary    Cuban                 Male  │   13│
3045 │ethnic background?                                               Female│    7│
3046 │                                          ╶────────────────────────────┼─────┤
3047 │                                           Mexican               Male  │  175│
3048 │                                                                 Female│  136│
3049 │                                          ╶────────────────────────────┼─────┤
3050 │                                           Spanish               Male  │   20│
3051 │                                                                 Female│   28│
3052 │                                          ╶────────────────────────────┼─────┤
3053 │                                           South American        Male  │   21│
3054 │                                                                 Female│   13│
3055 │                                          ╶────────────────────────────┼─────┤
3056 │                                           Central American      Male  │   27│
3057 │                                                                 Female│   25│
3058 │                                          ╶────────────────────────────┼─────┤
3059 │                                           Puerto Rican, OR      Male  │   37│
3060 │                                                                 Female│   41│
3061 │                                          ╶────────────────────────────┼─────┤
3062 │                                           Something else        Male  │   35│
3063 │                                                                 Female│   33│
3064 │                                          ╶────────────────────────────┼─────┤
3065 │                                           Multiple - cannot     Male  │    2│
3066 │                                           choose one            Female│    5│
3067 ╰───────────────────────────────────────────────────────────────────────┴─────╯
3068
3069                       Custom Tables
3070 ╭────────────────────────────────────────────────┬─────╮
3071 │                                                │Count│
3072 ├────────────────────────────────────────────────┼─────┤
3073 │Cuban                        S3a. GENDER: Male  │   13│
3074 │                                          Female│    7│
3075 ├────────────────────────────────────────────────┼─────┤
3076 │Mexican                      S3a. GENDER: Male  │  175│
3077 │                                          Female│  136│
3078 ├────────────────────────────────────────────────┼─────┤
3079 │Spanish                      S3a. GENDER: Male  │   20│
3080 │                                          Female│   28│
3081 ├────────────────────────────────────────────────┼─────┤
3082 │South American               S3a. GENDER: Male  │   21│
3083 │                                          Female│   13│
3084 ├────────────────────────────────────────────────┼─────┤
3085 │Central American             S3a. GENDER: Male  │   27│
3086 │                                          Female│   25│
3087 ├────────────────────────────────────────────────┼─────┤
3088 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
3089 │                                          Female│   41│
3090 ├────────────────────────────────────────────────┼─────┤
3091 │Something else               S3a. GENDER: Male  │   35│
3092 │                                          Female│   33│
3093 ├────────────────────────────────────────────────┼─────┤
3094 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
3095 │                                          Female│    5│
3096 ╰────────────────────────────────────────────────┴─────╯
3097
3098                Custom Tables
3099 ╭───────────────────────────────────┬─────╮
3100 │                                   │Count│
3101 ├───────────────────────────────────┼─────┤
3102 │Cuban                        Male  │   13│
3103 │                             Female│    7│
3104 ├───────────────────────────────────┼─────┤
3105 │Mexican                      Male  │  175│
3106 │                             Female│  136│
3107 ├───────────────────────────────────┼─────┤
3108 │Spanish                      Male  │   20│
3109 │                             Female│   28│
3110 ├───────────────────────────────────┼─────┤
3111 │South American               Male  │   21│
3112 │                             Female│   13│
3113 ├───────────────────────────────────┼─────┤
3114 │Central American             Male  │   27│
3115 │                             Female│   25│
3116 ├───────────────────────────────────┼─────┤
3117 │Puerto Rican, OR             Male  │   37│
3118 │                             Female│   41│
3119 ├───────────────────────────────────┼─────┤
3120 │Something else               Male  │   35│
3121 │                             Female│   33│
3122 ├───────────────────────────────────┼─────┤
3123 │Multiple - cannot choose one Male  │    2│
3124 │                             Female│    5│
3125 ╰───────────────────────────────────┴─────╯
3126 ])
3127 AT_CLEANUP
3128
3129 AT_SETUP([CTABLES FORMAT EMPTY])
3130 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3131 AT_DATA([ctables.sps],
3132 [[GET 'nhtsa.sav'.
3133 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
3134 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
3135 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
3136 ]])
3137 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3138                                  Custom Tables
3139 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3140 │                                             │   D5. ETHNICITY: Are you of   │
3141 │                                             │  Hispanic or Latino origin or │
3142 │                                             │            descent?           │
3143 │                                             ├───────────────┬───────────────┤
3144 │                                             │      Yes      │       No      │
3145 │                                             ├───────────────┼───────────────┤
3146 │                                             │     Count     │     Count     │
3147 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3148 │D5a. What would you say is   Cuban           │             20│              0│
3149 │your primary ethnic          Mexican         │            311│              0│
3150 │background?                  Spanish         │             48│              0│
3151 │                             South American  │             34│              0│
3152 │                             Central American│             52│              0│
3153 │                             Puerto Rican, OR│             78│              0│
3154 │                             Something else  │             68│              0│
3155 │                             Multiple -      │              7│              0│
3156 │                             cannot choose   │               │               │
3157 │                             one             │               │               │
3158 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3159
3160                                  Custom Tables
3161 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3162 │                                             │   D5. ETHNICITY: Are you of   │
3163 │                                             │  Hispanic or Latino origin or │
3164 │                                             │            descent?           │
3165 │                                             ├───────────────┬───────────────┤
3166 │                                             │      Yes      │       No      │
3167 │                                             ├───────────────┼───────────────┤
3168 │                                             │     Count     │     Count     │
3169 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3170 │D5a. What would you say is   Cuban           │             20│               │
3171 │your primary ethnic          Mexican         │            311│               │
3172 │background?                  Spanish         │             48│               │
3173 │                             South American  │             34│               │
3174 │                             Central American│             52│               │
3175 │                             Puerto Rican, OR│             78│               │
3176 │                             Something else  │             68│               │
3177 │                             Multiple -      │              7│               │
3178 │                             cannot choose   │               │               │
3179 │                             one             │               │               │
3180 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3181
3182                                  Custom Tables
3183 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3184 │                                             │   D5. ETHNICITY: Are you of   │
3185 │                                             │  Hispanic or Latino origin or │
3186 │                                             │            descent?           │
3187 │                                             ├───────────────┬───────────────┤
3188 │                                             │      Yes      │       No      │
3189 │                                             ├───────────────┼───────────────┤
3190 │                                             │     Count     │     Count     │
3191 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3192 │D5a. What would you say is   Cuban           │             20│n/a            │
3193 │your primary ethnic          Mexican         │            311│n/a            │
3194 │background?                  Spanish         │             48│n/a            │
3195 │                             South American  │             34│n/a            │
3196 │                             Central American│             52│n/a            │
3197 │                             Puerto Rican, OR│             78│n/a            │
3198 │                             Something else  │             68│n/a            │
3199 │                             Multiple -      │              7│n/a            │
3200 │                             cannot choose   │               │               │
3201 │                             one             │               │               │
3202 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3203 ])
3204 AT_CLEANUP
3205
3206 AT_SETUP([CTABLES FORMAT MISSING])
3207 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3208 AT_DATA([ctables.sps],
3209 [[GET 'nhtsa.sav'.
3210 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
3211 ]])
3212 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3213                                  Custom Tables
3214 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3215 │                                             │   D5. ETHNICITY: Are you of   │
3216 │                                             │  Hispanic or Latino origin or │
3217 │                                             │            descent?           │
3218 │                                             ├───────────────┬───────────────┤
3219 │                                             │      Yes      │       No      │
3220 │                                             ├───────────────┼───────────────┤
3221 │                                             │    Column %   │    Column %   │
3222 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3223 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
3224 │your primary ethnic          Mexican         │          50.3%│(no data)      │
3225 │background?                  Spanish         │           7.8%│(no data)      │
3226 │                             South American  │           5.5%│(no data)      │
3227 │                             Central American│           8.4%│(no data)      │
3228 │                             Puerto Rican, OR│          12.6%│(no data)      │
3229 │                             Something else  │          11.0%│(no data)      │
3230 │                             Multiple -      │           1.1%│(no data)      │
3231 │                             cannot choose   │               │               │
3232 │                             one             │               │               │
3233 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3234 ])
3235 AT_CLEANUP
3236
3237 AT_SETUP([CTABLES HIDESMALLCOUNTS])
3238 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3239 AT_DATA([ctables.sps],
3240 [[GET 'nhtsa.sav'.
3241 CTABLES /TABLE qn38[c][COUNT, COLPCT].
3242 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
3243 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
3244 ]])
3245 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3246                                  Custom Tables
3247 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3248 │                                                              │Count│Column %│
3249 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3250 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3251 │occasion?                                        1            │  491│   34.9%│
3252 │                                                 2            │  462│   32.9%│
3253 │                                                 3            │  229│   16.3%│
3254 │                                                 4            │   82│    5.8%│
3255 │                                                 5            │   56│    4.0%│
3256 │                                                 6            │   32│    2.3%│
3257 │                                                 7            │    9│     .6%│
3258 │                                                 8            │    8│     .6%│
3259 │                                                 9            │    4│     .3%│
3260 │                                                 10           │    6│     .4%│
3261 │                                                 11           │    2│     .1%│
3262 │                                                 12           │    5│     .4%│
3263 │                                                 14           │    1│     .1%│
3264 │                                                 15           │    1│     .1%│
3265 │                                                 18           │    1│     .1%│
3266 │                                                 20           │    4│     .3%│
3267 │                                                 25           │    1│     .1%│
3268 │                                                 30           │    3│     .2%│
3269 │                                                 60           │    1│     .1%│
3270 │                                                 99+          │    0│     .0%│
3271 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3272
3273                                  Custom Tables
3274 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3275 │                                                              │Count│Column %│
3276 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3277 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3278 │occasion?                                        1            │  491│   34.9%│
3279 │                                                 2            │  462│   32.9%│
3280 │                                                 3            │  229│   16.3%│
3281 │                                                 4            │   82│    5.8%│
3282 │                                                 5            │   56│    4.0%│
3283 │                                                 6            │   32│    2.3%│
3284 │                                                 7            │    9│     .6%│
3285 │                                                 8            │    8│     .6%│
3286 │                                                 9            │<5   │     .3%│
3287 │                                                 10           │    6│     .4%│
3288 │                                                 11           │<5   │     .1%│
3289 │                                                 12           │    5│     .4%│
3290 │                                                 14           │<5   │     .1%│
3291 │                                                 15           │<5   │     .1%│
3292 │                                                 18           │<5   │     .1%│
3293 │                                                 20           │<5   │     .3%│
3294 │                                                 25           │<5   │     .1%│
3295 │                                                 30           │<5   │     .2%│
3296 │                                                 60           │<5   │     .1%│
3297 │                                                 99+          │<5   │     .0%│
3298 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3299
3300                                  Custom Tables
3301 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3302 │                                                              │Count│Column %│
3303 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3304 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
3305 │occasion?                                        1            │  491│   34.9%│
3306 │                                                 2            │  462│   32.9%│
3307 │                                                 3            │  229│   16.3%│
3308 │                                                 4            │   82│    5.8%│
3309 │                                                 5            │   56│    4.0%│
3310 │                                                 6            │   32│    2.3%│
3311 │                                                 7            │<10  │     .6%│
3312 │                                                 8            │<10  │     .6%│
3313 │                                                 9            │<10  │     .3%│
3314 │                                                 10           │<10  │     .4%│
3315 │                                                 11           │<10  │     .1%│
3316 │                                                 12           │<10  │     .4%│
3317 │                                                 14           │<10  │     .1%│
3318 │                                                 15           │<10  │     .1%│
3319 │                                                 18           │<10  │     .1%│
3320 │                                                 20           │<10  │     .3%│
3321 │                                                 25           │<10  │     .1%│
3322 │                                                 30           │<10  │     .2%│
3323 │                                                 60           │<10  │     .1%│
3324 │                                                 99+          │<10  │     .0%│
3325 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3326 ])
3327 AT_CLEANUP
3328
3329 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
3330 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3331 AT_DATA([ctables.sps],
3332 [[GET 'nhtsa.sav'.
3333 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
3334 ]])
3335 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
3336  Custom Tables
3337 ╭────────────╮
3338 │S3a. GENDER:│
3339 ├─────┬──────┤
3340 │ Male│Female│
3341 ├─────┼──────┤
3342 │Count│ Count│
3343 ├─────┼──────┤
3344 │ 3132│  3867│
3345 ╰─────┴──────╯
3346 ])
3347 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
3348 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
3349 maximumColumnWidth="192"
3350 minimumColumnWidth="96"
3351 ])
3352 AT_CLEANUP
3353
3354 AT_SETUP([CTABLES special formats])
3355 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
3356 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3357 AT_DATA([ctables.sps],
3358 [[GET 'nhtsa.sav'.
3359 COMPUTE x = qnd3 - 4.
3360 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].
3361 ]])
3362 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3363                            Custom Tables
3364 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
3365 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
3366 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
3367 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
3368 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
3369 ])
3370 AT_CLEANUP
3371
3372 AT_SETUP([CTABLES TITLES])
3373 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3374 AT_DATA([ctables.sps],
3375 [[GET 'nhtsa.sav'.
3376 CTABLES
3377     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3378     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3379     /TITLES TITLE='How often do you drive?' 'second line of title'
3380             CAPTION='Generated )TIME on )DATE'
3381             CORNER=')TABLE'.
3382 ]])
3383 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3384 s&../../..&MM/DD/YY&'], [0], [dnl
3385                             How often do you drive?
3386                               second line of title
3387 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3388 │                                   │               S3a. GENDER:              │
3389 │                                   ├────────────────────┬────────────────────┤
3390 │                                   │        Male        │       Female       │
3391 │                                   ├────────────────────┼────────────────────┤
3392 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3393 │                                   │ you of Hispanic or │ you of Hispanic or │
3394 │                                   │  Latino origin or  │  Latino origin or  │
3395 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3396 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3397 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3398 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3399 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3400 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3401 │Every day                          │      218│      2066│      166│      2175│
3402 │Several days a week                │       44│       391│       45│       782│
3403 │Once a week or less                │       16│       109│       12│       223│
3404 │Only certain times a year          │       15│        41│       11│        61│
3405 │Never                              │       39│       150│       56│       278│
3406 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3407 Generated HH:MM:SS on MM/DD/YY
3408 ])
3409 AT_CLEANUP
3410
3411 AT_SETUP([CTABLES area definitions])
3412 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3413 AT_DATA([ctables.sps],
3414 [[GET 'nhtsa.sav'.
3415 CTABLES
3416     /VLABELS VARIABLES=ALL DISPLAY=NAME
3417     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3418     /SLABELS POSITION=ROW
3419     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3420     /SLABELS POSITION=ROW
3421     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3422     /SLABELS POSITION=ROW.
3423 ]])
3424 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3425                     Custom Tables
3426 Male
3427 ╭─────────────────────────────┬─────────────┬──────╮
3428 │                             │    QND7A    │ QN64B│
3429 │                             ├──────┬──────┼───┬──┤
3430 │                             │  Yes │  No  │   │  │
3431 │                             ├──────┼──────┤   │  │
3432 │                             │ QN86 │ QN86 │   │  │
3433 │                             ├───┬──┼───┬──┤   │  │
3434 │                             │Yes│No│Yes│No│Yes│No│
3435 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3436 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3437 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3438 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3439 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3440 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3441 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3442 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3443 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3444 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3445 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3446 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3447 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3448 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3449 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3450 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3451 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3452
3453                     Custom Tables
3454 Female
3455 ╭─────────────────────────────┬─────────────┬──────╮
3456 │                             │    QND7A    │ QN64B│
3457 │                             ├──────┬──────┼───┬──┤
3458 │                             │  Yes │  No  │   │  │
3459 │                             ├──────┼──────┤   │  │
3460 │                             │ QN86 │ QN86 │   │  │
3461 │                             ├───┬──┼───┬──┤   │  │
3462 │                             │Yes│No│Yes│No│Yes│No│
3463 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3464 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3465 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3466 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3467 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3468 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3469 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3470 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3471 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3472 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3473 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3474 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3475 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3476 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3477 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3478 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3479 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3480
3481                     Custom Tables
3482 Male
3483 ╭──────────────────────────────┬─────────────┬──────╮
3484 │                              │    QND7A    │ QN64B│
3485 │                              ├──────┬──────┼───┬──┤
3486 │                              │  Yes │  No  │   │  │
3487 │                              ├──────┼──────┤   │  │
3488 │                              │ QN86 │ QN86 │   │  │
3489 │                              ├───┬──┼───┬──┤   │  │
3490 │                              │Yes│No│Yes│No│Yes│No│
3491 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3492 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3493 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3494 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3495 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3496 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3497 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3498 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3499 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3500 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3501 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3502 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3503 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3504
3505                     Custom Tables
3506 Female
3507 ╭──────────────────────────────┬─────────────┬──────╮
3508 │                              │    QND7A    │ QN64B│
3509 │                              ├──────┬──────┼───┬──┤
3510 │                              │  Yes │  No  │   │  │
3511 │                              ├──────┼──────┤   │  │
3512 │                              │ QN86 │ QN86 │   │  │
3513 │                              ├───┬──┼───┬──┤   │  │
3514 │                              │Yes│No│Yes│No│Yes│No│
3515 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3516 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3517 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3518 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3519 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3520 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3521 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3522 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3523 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3524 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3525 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3526 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3527 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3528
3529                       Custom Tables
3530 Male
3531 ╭─────────────────────────────────┬─────────────┬──────╮
3532 │                                 │    QND7A    │ QN64B│
3533 │                                 ├──────┬──────┼───┬──┤
3534 │                                 │  Yes │  No  │   │  │
3535 │                                 ├──────┼──────┤   │  │
3536 │                                 │ QN86 │ QN86 │   │  │
3537 │                                 ├───┬──┼───┬──┤   │  │
3538 │                                 │Yes│No│Yes│No│Yes│No│
3539 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3540 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3541 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3542 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3543 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3544 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3545 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3546 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3547 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3548 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3549 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3550 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3551 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3552
3553                       Custom Tables
3554 Female
3555 ╭─────────────────────────────────┬─────────────┬──────╮
3556 │                                 │    QND7A    │ QN64B│
3557 │                                 ├──────┬──────┼───┬──┤
3558 │                                 │  Yes │  No  │   │  │
3559 │                                 ├──────┼──────┤   │  │
3560 │                                 │ QN86 │ QN86 │   │  │
3561 │                                 ├───┬──┼───┬──┤   │  │
3562 │                                 │Yes│No│Yes│No│Yes│No│
3563 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3564 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3565 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3566 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3567 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3568 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3569 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3570 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3571 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3572 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3573 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3574 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3575 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3576 ])
3577 AT_CLEANUP
3578
3579 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3580 AT_KEYWORDS([ROWLABELS OPPOSITE])
3581 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3582 AT_DATA([ctables.sps],
3583 [[GET 'nhtsa.sav'.
3584 CTABLES
3585     /VLABELS VARIABLES=ALL DISPLAY=NAME
3586     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3587     /SLABELS POSITION=ROW
3588     /CLABELS ROWLABELS=OPPOSITE
3589     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3590     /SLABELS POSITION=ROW
3591     /CLABELS ROWLABELS=OPPOSITE
3592     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3593     /SLABELS POSITION=ROW
3594     /CLABELS ROWLABELS=OPPOSITE.
3595 ]])
3596 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3597                                         Custom Tables
3598 Male
3599 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3600 │                                  │                          QN27                         │
3601 │                                  ├───────────────────────────┬───────────────────────────┤
3602 │                                  │            Yes            │             No            │
3603 │                                  ├───────────────────────────┼───────────────────────────┤
3604 │                                  │           QND7A           │           QND7A           │
3605 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3606 │                                  │     Yes     │      No     │     Yes     │      No     │
3607 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3608 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3609 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3610 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3611 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3612 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3613 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3614 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3615 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3616 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3617 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3618 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3619 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3620 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3621 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3622 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3623 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3624 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3625 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3626 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3627 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3628 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3629 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3630
3631                                         Custom Tables
3632 Female
3633 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3634 │                                  │                          QN27                         │
3635 │                                  ├───────────────────────────┬───────────────────────────┤
3636 │                                  │            Yes            │             No            │
3637 │                                  ├───────────────────────────┼───────────────────────────┤
3638 │                                  │           QND7A           │           QND7A           │
3639 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3640 │                                  │     Yes     │      No     │     Yes     │      No     │
3641 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3642 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3643 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3644 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3645 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3646 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3647 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3648 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3649 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3650 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3651 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3652 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3653 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3654 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3655 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3656 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3657 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3658 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3659 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3660 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3661 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3662 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3663 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3664
3665                                         Custom Tables
3666 Male
3667 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3668 │                                   │                          QN27                         │
3669 │                                   ├───────────────────────────┬───────────────────────────┤
3670 │                                   │            Yes            │             No            │
3671 │                                   ├───────────────────────────┼───────────────────────────┤
3672 │                                   │           QND7A           │           QND7A           │
3673 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3674 │                                   │     Yes     │      No     │     Yes     │      No     │
3675 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3676 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3677 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3678 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3679 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3680 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3681 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3682 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3683 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3684 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3685 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3686 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3687 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3688 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3689 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3690 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3691 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3692 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3693 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3694
3695                                         Custom Tables
3696 Female
3697 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3698 │                                   │                          QN27                         │
3699 │                                   ├───────────────────────────┬───────────────────────────┤
3700 │                                   │            Yes            │             No            │
3701 │                                   ├───────────────────────────┼───────────────────────────┤
3702 │                                   │           QND7A           │           QND7A           │
3703 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3704 │                                   │     Yes     │      No     │     Yes     │      No     │
3705 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3706 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3707 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3708 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3709 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3710 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3711 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3712 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3713 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3714 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3715 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3716 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3717 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3718 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3719 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3720 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3721 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3722 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3723 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3724
3725                                           Custom Tables
3726 Male
3727 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3728 │                                      │                          QN27                         │
3729 │                                      ├───────────────────────────┬───────────────────────────┤
3730 │                                      │            Yes            │             No            │
3731 │                                      ├───────────────────────────┼───────────────────────────┤
3732 │                                      │           QND7A           │           QND7A           │
3733 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3734 │                                      │     Yes     │      No     │     Yes     │      No     │
3735 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3736 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3737 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3738 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3739 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3740 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3741 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3742 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3743 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3744 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3745 │              No  QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3746 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3747 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3748 │     No  QN61 Yes QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3749 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3750 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3751 │              No  QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3752 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3753 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3754
3755                                           Custom Tables
3756 Female
3757 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3758 │                                      │                          QN27                         │
3759 │                                      ├───────────────────────────┬───────────────────────────┤
3760 │                                      │            Yes            │             No            │
3761 │                                      ├───────────────────────────┼───────────────────────────┤
3762 │                                      │           QND7A           │           QND7A           │
3763 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3764 │                                      │     Yes     │      No     │     Yes     │      No     │
3765 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3766 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3767 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3768 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3769 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3770 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3771 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3772 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3773 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3774 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3775 │              No  QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3776 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3777 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3778 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3779 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3780 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3781 │              No  QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3782 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3783 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3784 ])
3785 AT_CLEANUP
3786
3787 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3788 AT_KEYWORDS([COLLABELS OPPOSITE])
3789 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3790 AT_DATA([ctables.sps],
3791 [[GET 'nhtsa.sav'.
3792 CTABLES
3793     /VLABELS VARIABLES=ALL DISPLAY=NAME
3794     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3795     /SLABELS POSITION=ROW
3796     /CLABELS COLLABELS=OPPOSITE
3797     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3798     /SLABELS POSITION=ROW
3799     /CLABELS COLLABELS=OPPOSITE
3800     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3801     /SLABELS POSITION=ROW
3802     /CLABELS COLLABELS=OPPOSITE.
3803 ]])
3804 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3805                           Custom Tables
3806 Male
3807 ╭──────────────────────────────────────────┬───────────────────╮
3808 │                                          │        QN27       │
3809 │                                          ├─────────┬─────────┤
3810 │                                          │   Yes   │    No   │
3811 │                                          ├─────────┼─────────┤
3812 │                                          │  QND7A  │  QND7A  │
3813 │                                          ├────┬────┼────┬────┤
3814 │                                          │ Yes│ No │ Yes│ No │
3815 │                                          ├────┼────┼────┼────┤
3816 │                                          │QN86│QN86│QN86│QN86│
3817 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3818 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3819 │                               Layer ID   │   1│   1│   1│   1│
3820 │                               Subtable ID│   1│   1│   2│   2│
3821 │                          ╶───────────────┼────┼────┼────┼────┤
3822 │                           No  Table ID   │   1│   1│   1│   1│
3823 │                               Layer ID   │   1│   1│   1│   1│
3824 │                               Subtable ID│   1│   1│   2│   2│
3825 │                      ╶───────────────────┼────┼────┼────┼────┤
3826 │                       No  Yes Table ID   │   1│   1│   1│   1│
3827 │                               Layer ID   │   1│   1│   1│   1│
3828 │                               Subtable ID│   3│   3│   4│   4│
3829 │                          ╶───────────────┼────┼────┼────┼────┤
3830 │                           No  Table ID   │   1│   1│   1│   1│
3831 │                               Layer ID   │   1│   1│   1│   1│
3832 │                               Subtable ID│   3│   3│   4│   4│
3833 │             ╶────────────────────────────┼────┼────┼────┼────┤
3834 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3835 │                               Layer ID   │   1│   1│   1│   1│
3836 │                               Subtable ID│   5│   5│   6│   6│
3837 │                          ╶───────────────┼────┼────┼────┼────┤
3838 │                           No  Table ID   │   1│   1│   1│   1│
3839 │                               Layer ID   │   1│   1│   1│   1│
3840 │                               Subtable ID│   5│   5│   6│   6│
3841 │                      ╶───────────────────┼────┼────┼────┼────┤
3842 │                       No  Yes Table ID   │   1│   1│   1│   1│
3843 │                               Layer ID   │   1│   1│   1│   1│
3844 │                               Subtable ID│   7│   7│   8│   8│
3845 │                          ╶───────────────┼────┼────┼────┼────┤
3846 │                           No  Table ID   │   1│   1│   1│   1│
3847 │                               Layer ID   │   1│   1│   1│   1│
3848 │                               Subtable ID│   7│   7│   8│   8│
3849 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3850 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3851 │                               Layer ID   │   1│   1│   1│   1│
3852 │                               Subtable ID│   9│   9│  10│  10│
3853 │                          ╶───────────────┼────┼────┼────┼────┤
3854 │                           No  Table ID   │   1│   1│   1│   1│
3855 │                               Layer ID   │   1│   1│   1│   1│
3856 │                               Subtable ID│   9│   9│  10│  10│
3857 │                      ╶───────────────────┼────┼────┼────┼────┤
3858 │                       No  Yes Table ID   │   1│   1│   1│   1│
3859 │                               Layer ID   │   1│   1│   1│   1│
3860 │                               Subtable ID│  11│  11│  12│  12│
3861 │                          ╶───────────────┼────┼────┼────┼────┤
3862 │                           No  Table ID   │   1│   1│   1│   1│
3863 │                               Layer ID   │   1│   1│   1│   1│
3864 │                               Subtable ID│  11│  11│  12│  12│
3865 │             ╶────────────────────────────┼────┼────┼────┼────┤
3866 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3867 │                               Layer ID   │   1│   1│   1│   1│
3868 │                               Subtable ID│  13│  13│  14│  14│
3869 │                          ╶───────────────┼────┼────┼────┼────┤
3870 │                           No  Table ID   │   1│   1│   1│   1│
3871 │                               Layer ID   │   1│   1│   1│   1│
3872 │                               Subtable ID│  13│  13│  14│  14│
3873 │                      ╶───────────────────┼────┼────┼────┼────┤
3874 │                       No  Yes Table ID   │   1│   1│   1│   1│
3875 │                               Layer ID   │   1│   1│   1│   1│
3876 │                               Subtable ID│  15│  15│  16│  16│
3877 │                          ╶───────────────┼────┼────┼────┼────┤
3878 │                           No  Table ID   │   1│   1│   1│   1│
3879 │                               Layer ID   │   1│   1│   1│   1│
3880 │                               Subtable ID│  15│  15│  16│  16│
3881 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3882
3883                           Custom Tables
3884 Female
3885 ╭──────────────────────────────────────────┬───────────────────╮
3886 │                                          │        QN27       │
3887 │                                          ├─────────┬─────────┤
3888 │                                          │   Yes   │    No   │
3889 │                                          ├─────────┼─────────┤
3890 │                                          │  QND7A  │  QND7A  │
3891 │                                          ├────┬────┼────┬────┤
3892 │                                          │ Yes│ No │ Yes│ No │
3893 │                                          ├────┼────┼────┼────┤
3894 │                                          │QN86│QN86│QN86│QN86│
3895 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3896 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3897 │                               Layer ID   │   2│   2│   2│   2│
3898 │                               Subtable ID│  17│  17│  18│  18│
3899 │                          ╶───────────────┼────┼────┼────┼────┤
3900 │                           No  Table ID   │   1│   1│   1│   1│
3901 │                               Layer ID   │   2│   2│   2│   2│
3902 │                               Subtable ID│  17│  17│  18│  18│
3903 │                      ╶───────────────────┼────┼────┼────┼────┤
3904 │                       No  Yes Table ID   │   1│   1│   1│   1│
3905 │                               Layer ID   │   2│   2│   2│   2│
3906 │                               Subtable ID│  19│  19│  20│  20│
3907 │                          ╶───────────────┼────┼────┼────┼────┤
3908 │                           No  Table ID   │   1│   1│   1│   1│
3909 │                               Layer ID   │   2│   2│   2│   2│
3910 │                               Subtable ID│  19│  19│  20│  20│
3911 │             ╶────────────────────────────┼────┼────┼────┼────┤
3912 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3913 │                               Layer ID   │   2│   2│   2│   2│
3914 │                               Subtable ID│  21│  21│  22│  22│
3915 │                          ╶───────────────┼────┼────┼────┼────┤
3916 │                           No  Table ID   │   1│   1│   1│   1│
3917 │                               Layer ID   │   2│   2│   2│   2│
3918 │                               Subtable ID│  21│  21│  22│  22│
3919 │                      ╶───────────────────┼────┼────┼────┼────┤
3920 │                       No  Yes Table ID   │   1│   1│   1│   1│
3921 │                               Layer ID   │   2│   2│   2│   2│
3922 │                               Subtable ID│  23│  23│  24│  24│
3923 │                          ╶───────────────┼────┼────┼────┼────┤
3924 │                           No  Table ID   │   1│   1│   1│   1│
3925 │                               Layer ID   │   2│   2│   2│   2│
3926 │                               Subtable ID│  23│  23│  24│  24│
3927 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3928 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3929 │                               Layer ID   │   2│   2│   2│   2│
3930 │                               Subtable ID│  25│  25│  26│  26│
3931 │                          ╶───────────────┼────┼────┼────┼────┤
3932 │                           No  Table ID   │   1│   1│   1│   1│
3933 │                               Layer ID   │   2│   2│   2│   2│
3934 │                               Subtable ID│  25│  25│  26│  26│
3935 │                      ╶───────────────────┼────┼────┼────┼────┤
3936 │                       No  Yes Table ID   │   1│   1│   1│   1│
3937 │                               Layer ID   │   2│   2│   2│   2│
3938 │                               Subtable ID│  27│  27│  28│  28│
3939 │                          ╶───────────────┼────┼────┼────┼────┤
3940 │                           No  Table ID   │   1│   1│   1│   1│
3941 │                               Layer ID   │   2│   2│   2│   2│
3942 │                               Subtable ID│  27│  27│  28│  28│
3943 │             ╶────────────────────────────┼────┼────┼────┼────┤
3944 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3945 │                               Layer ID   │   2│   2│   2│   2│
3946 │                               Subtable ID│  29│  29│  30│  30│
3947 │                          ╶───────────────┼────┼────┼────┼────┤
3948 │                           No  Table ID   │   1│   1│   1│   1│
3949 │                               Layer ID   │   2│   2│   2│   2│
3950 │                               Subtable ID│  29│  29│  30│  30│
3951 │                      ╶───────────────────┼────┼────┼────┼────┤
3952 │                       No  Yes Table ID   │   1│   1│   1│   1│
3953 │                               Layer ID   │   2│   2│   2│   2│
3954 │                               Subtable ID│  31│  31│  32│  32│
3955 │                          ╶───────────────┼────┼────┼────┼────┤
3956 │                           No  Table ID   │   1│   1│   1│   1│
3957 │                               Layer ID   │   2│   2│   2│   2│
3958 │                               Subtable ID│  31│  31│  32│  32│
3959 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3960
3961                           Custom Tables
3962 Male
3963 ╭───────────────────────────────────────────┬───────────────────╮
3964 │                                           │        QN27       │
3965 │                                           ├─────────┬─────────┤
3966 │                                           │   Yes   │    No   │
3967 │                                           ├─────────┼─────────┤
3968 │                                           │  QND7A  │  QND7A  │
3969 │                                           ├────┬────┼────┬────┤
3970 │                                           │ Yes│ No │ Yes│ No │
3971 │                                           ├────┼────┼────┼────┤
3972 │                                           │QN86│QN86│QN86│QN86│
3973 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3974 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   1│   1│   3│   3│
3975 │                               Layer Row ID│   1│   1│   1│   1│
3976 │                          ╶────────────────┼────┼────┼────┼────┤
3977 │                           No  Row ID      │   2│   2│   4│   4│
3978 │                               Layer Row ID│   2│   2│   2│   2│
3979 │                      ╶────────────────────┼────┼────┼────┼────┤
3980 │                       No  Yes Row ID      │   5│   5│   7│   7│
3981 │                               Layer Row ID│   3│   3│   3│   3│
3982 │                          ╶────────────────┼────┼────┼────┼────┤
3983 │                           No  Row ID      │   6│   6│   8│   8│
3984 │                               Layer Row ID│   4│   4│   4│   4│
3985 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3986 │              No  QN57 Yes Yes Row ID      │   9│   9│  11│  11│
3987 │                               Layer Row ID│   5│   5│   5│   5│
3988 │                          ╶────────────────┼────┼────┼────┼────┤
3989 │                           No  Row ID      │  10│  10│  12│  12│
3990 │                               Layer Row ID│   6│   6│   6│   6│
3991 │                      ╶────────────────────┼────┼────┼────┼────┤
3992 │                       No  Yes Row ID      │  13│  13│  15│  15│
3993 │                               Layer Row ID│   7│   7│   7│   7│
3994 │                          ╶────────────────┼────┼────┼────┼────┤
3995 │                           No  Row ID      │  14│  14│  16│  16│
3996 │                               Layer Row ID│   8│   8│   8│   8│
3997 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3998 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  19│  19│
3999 │                               Layer Row ID│   9│   9│   9│   9│
4000 │                          ╶────────────────┼────┼────┼────┼────┤
4001 │                           No  Row ID      │  18│  18│  20│  20│
4002 │                               Layer Row ID│  10│  10│  10│  10│
4003 │                      ╶────────────────────┼────┼────┼────┼────┤
4004 │                       No  Yes Row ID      │  21│  21│  23│  23│
4005 │                               Layer Row ID│  11│  11│  11│  11│
4006 │                          ╶────────────────┼────┼────┼────┼────┤
4007 │                           No  Row ID      │  22│  22│  24│  24│
4008 │                               Layer Row ID│  12│  12│  12│  12│
4009 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4010 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
4011 │                               Layer Row ID│  13│  13│  13│  13│
4012 │                          ╶────────────────┼────┼────┼────┼────┤
4013 │                           No  Row ID      │  26│  26│  28│  28│
4014 │                               Layer Row ID│  14│  14│  14│  14│
4015 │                      ╶────────────────────┼────┼────┼────┼────┤
4016 │                       No  Yes Row ID      │  29│  29│  31│  31│
4017 │                               Layer Row ID│  15│  15│  15│  15│
4018 │                          ╶────────────────┼────┼────┼────┼────┤
4019 │                           No  Row ID      │  30│  30│  32│  32│
4020 │                               Layer Row ID│  16│  16│  16│  16│
4021 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
4022
4023                           Custom Tables
4024 Female
4025 ╭───────────────────────────────────────────┬───────────────────╮
4026 │                                           │        QN27       │
4027 │                                           ├─────────┬─────────┤
4028 │                                           │   Yes   │    No   │
4029 │                                           ├─────────┼─────────┤
4030 │                                           │  QND7A  │  QND7A  │
4031 │                                           ├────┬────┼────┬────┤
4032 │                                           │ Yes│ No │ Yes│ No │
4033 │                                           ├────┼────┼────┼────┤
4034 │                                           │QN86│QN86│QN86│QN86│
4035 ├───────────────────────────────────────────┼────┼────┼────┼────┤
4036 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  33│  33│  35│  35│
4037 │                               Layer Row ID│  17│  17│  17│  17│
4038 │                          ╶────────────────┼────┼────┼────┼────┤
4039 │                           No  Row ID      │  34│  34│  36│  36│
4040 │                               Layer Row ID│  18│  18│  18│  18│
4041 │                      ╶────────────────────┼────┼────┼────┼────┤
4042 │                       No  Yes Row ID      │  37│  37│  39│  39│
4043 │                               Layer Row ID│  19│  19│  19│  19│
4044 │                          ╶────────────────┼────┼────┼────┼────┤
4045 │                           No  Row ID      │  38│  38│  40│  40│
4046 │                               Layer Row ID│  20│  20│  20│  20│
4047 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4048 │              No  QN57 Yes Yes Row ID      │  41│  41│  43│  43│
4049 │                               Layer Row ID│  21│  21│  21│  21│
4050 │                          ╶────────────────┼────┼────┼────┼────┤
4051 │                           No  Row ID      │  42│  42│  44│  44│
4052 │                               Layer Row ID│  22│  22│  22│  22│
4053 │                      ╶────────────────────┼────┼────┼────┼────┤
4054 │                       No  Yes Row ID      │  45│  45│  47│  47│
4055 │                               Layer Row ID│  23│  23│  23│  23│
4056 │                          ╶────────────────┼────┼────┼────┼────┤
4057 │                           No  Row ID      │  46│  46│  48│  48│
4058 │                               Layer Row ID│  24│  24│  24│  24│
4059 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
4060 │     No  QN61 Yes QN57 Yes Yes Row ID      │  49│  49│  51│  51│
4061 │                               Layer Row ID│  25│  25│  25│  25│
4062 │                          ╶────────────────┼────┼────┼────┼────┤
4063 │                           No  Row ID      │  50│  50│  52│  52│
4064 │                               Layer Row ID│  26│  26│  26│  26│
4065 │                      ╶────────────────────┼────┼────┼────┼────┤
4066 │                       No  Yes Row ID      │  53│  53│  55│  55│
4067 │                               Layer Row ID│  27│  27│  27│  27│
4068 │                          ╶────────────────┼────┼────┼────┼────┤
4069 │                           No  Row ID      │  54│  54│  56│  56│
4070 │                               Layer Row ID│  28│  28│  28│  28│
4071 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4072 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
4073 │                               Layer Row ID│  29│  29│  29│  29│
4074 │                          ╶────────────────┼────┼────┼────┼────┤
4075 │                           No  Row ID      │  58│  58│  60│  60│
4076 │                               Layer Row ID│  30│  30│  30│  30│
4077 │                      ╶────────────────────┼────┼────┼────┼────┤
4078 │                       No  Yes Row ID      │  61│  61│  63│  63│
4079 │                               Layer Row ID│  31│  31│  31│  31│
4080 │                          ╶────────────────┼────┼────┼────┼────┤
4081 │                           No  Row ID      │  62│  62│  64│  64│
4082 │                               Layer Row ID│  32│  32│  32│  32│
4083 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
4084
4085                             Custom Tables
4086 Male
4087 ╭──────────────────────────────────────────────┬───────────────────╮
4088 │                                              │        QN27       │
4089 │                                              ├─────────┬─────────┤
4090 │                                              │   Yes   │    No   │
4091 │                                              ├─────────┼─────────┤
4092 │                                              │  QND7A  │  QND7A  │
4093 │                                              ├────┬────┼────┬────┤
4094 │                                              │ Yes│ No │ Yes│ No │
4095 │                                              ├────┼────┼────┼────┤
4096 │                                              │QN86│QN86│QN86│QN86│
4097 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
4098 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
4099 │                               Layer Column ID│   1│   2│   3│   4│
4100 │                          ╶───────────────────┼────┼────┼────┼────┤
4101 │                           No  Column ID      │   1│   2│   3│   4│
4102 │                               Layer Column ID│   1│   2│   3│   4│
4103 │                      ╶───────────────────────┼────┼────┼────┼────┤
4104 │                       No  Yes Column ID      │   5│   6│   7│   8│
4105 │                               Layer Column ID│   1│   2│   3│   4│
4106 │                          ╶───────────────────┼────┼────┼────┼────┤
4107 │                           No  Column ID      │   5│   6│   7│   8│
4108 │                               Layer Column ID│   1│   2│   3│   4│
4109 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4110 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
4111 │                               Layer Column ID│   1│   2│   3│   4│
4112 │                          ╶───────────────────┼────┼────┼────┼────┤
4113 │                           No  Column ID      │   9│  10│  11│  12│
4114 │                               Layer Column ID│   1│   2│   3│   4│
4115 │                      ╶───────────────────────┼────┼────┼────┼────┤
4116 │                       No  Yes Column ID      │  13│  14│  15│  16│
4117 │                               Layer Column ID│   1│   2│   3│   4│
4118 │                          ╶───────────────────┼────┼────┼────┼────┤
4119 │                           No  Column ID      │  13│  14│  15│  16│
4120 │                               Layer Column ID│   1│   2│   3│   4│
4121 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4122 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
4123 │                               Layer Column ID│   1│   2│   3│   4│
4124 │                          ╶───────────────────┼────┼────┼────┼────┤
4125 │                           No  Column ID      │  17│  18│  19│  20│
4126 │                               Layer Column ID│   1│   2│   3│   4│
4127 │                      ╶───────────────────────┼────┼────┼────┼────┤
4128 │                       No  Yes Column ID      │  21│  22│  23│  24│
4129 │                               Layer Column ID│   1│   2│   3│   4│
4130 │                          ╶───────────────────┼────┼────┼────┼────┤
4131 │                           No  Column ID      │  21│  22│  23│  24│
4132 │                               Layer Column ID│   1│   2│   3│   4│
4133 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4134 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
4135 │                               Layer Column ID│   1│   2│   3│   4│
4136 │                          ╶───────────────────┼────┼────┼────┼────┤
4137 │                           No  Column ID      │  25│  26│  27│  28│
4138 │                               Layer Column ID│   1│   2│   3│   4│
4139 │                      ╶───────────────────────┼────┼────┼────┼────┤
4140 │                       No  Yes Column ID      │  29│  30│  31│  32│
4141 │                               Layer Column ID│   1│   2│   3│   4│
4142 │                          ╶───────────────────┼────┼────┼────┼────┤
4143 │                           No  Column ID      │  29│  30│  31│  32│
4144 │                               Layer Column ID│   1│   2│   3│   4│
4145 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4146
4147                             Custom Tables
4148 Female
4149 ╭──────────────────────────────────────────────┬───────────────────╮
4150 │                                              │        QN27       │
4151 │                                              ├─────────┬─────────┤
4152 │                                              │   Yes   │    No   │
4153 │                                              ├─────────┼─────────┤
4154 │                                              │  QND7A  │  QND7A  │
4155 │                                              ├────┬────┼────┬────┤
4156 │                                              │ Yes│ No │ Yes│ No │
4157 │                                              ├────┼────┼────┼────┤
4158 │                                              │QN86│QN86│QN86│QN86│
4159 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
4160 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
4161 │                               Layer Column ID│   5│   6│   7│   8│
4162 │                          ╶───────────────────┼────┼────┼────┼────┤
4163 │                           No  Column ID      │  33│  34│  35│  36│
4164 │                               Layer Column ID│   5│   6│   7│   8│
4165 │                      ╶───────────────────────┼────┼────┼────┼────┤
4166 │                       No  Yes Column ID      │  37│  38│  39│  40│
4167 │                               Layer Column ID│   5│   6│   7│   8│
4168 │                          ╶───────────────────┼────┼────┼────┼────┤
4169 │                           No  Column ID      │  37│  38│  39│  40│
4170 │                               Layer Column ID│   5│   6│   7│   8│
4171 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4172 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
4173 │                               Layer Column ID│   5│   6│   7│   8│
4174 │                          ╶───────────────────┼────┼────┼────┼────┤
4175 │                           No  Column ID      │  41│  42│  43│  44│
4176 │                               Layer Column ID│   5│   6│   7│   8│
4177 │                      ╶───────────────────────┼────┼────┼────┼────┤
4178 │                       No  Yes Column ID      │  45│  46│  47│  48│
4179 │                               Layer Column ID│   5│   6│   7│   8│
4180 │                          ╶───────────────────┼────┼────┼────┼────┤
4181 │                           No  Column ID      │  45│  46│  47│  48│
4182 │                               Layer Column ID│   5│   6│   7│   8│
4183 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4184 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
4185 │                               Layer Column ID│   5│   6│   7│   8│
4186 │                          ╶───────────────────┼────┼────┼────┼────┤
4187 │                           No  Column ID      │  49│  50│  51│  52│
4188 │                               Layer Column ID│   5│   6│   7│   8│
4189 │                      ╶───────────────────────┼────┼────┼────┼────┤
4190 │                       No  Yes Column ID      │  53│  54│  55│  56│
4191 │                               Layer Column ID│   5│   6│   7│   8│
4192 │                          ╶───────────────────┼────┼────┼────┼────┤
4193 │                           No  Column ID      │  53│  54│  55│  56│
4194 │                               Layer Column ID│   5│   6│   7│   8│
4195 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4196 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
4197 │                               Layer Column ID│   5│   6│   7│   8│
4198 │                          ╶───────────────────┼────┼────┼────┼────┤
4199 │                           No  Column ID      │  57│  58│  59│  60│
4200 │                               Layer Column ID│   5│   6│   7│   8│
4201 │                      ╶───────────────────────┼────┼────┼────┼────┤
4202 │                       No  Yes Column ID      │  61│  62│  63│  64│
4203 │                               Layer Column ID│   5│   6│   7│   8│
4204 │                          ╶───────────────────┼────┼────┼────┼────┤
4205 │                           No  Column ID      │  61│  62│  63│  64│
4206 │                               Layer Column ID│   5│   6│   7│   8│
4207 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4208 ])
4209 AT_CLEANUP
4210
4211 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
4212 AT_KEYWORDS([ROWLABELS LAYER])
4213 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
4214 AT_DATA([ctables.sps],
4215 [[GET 'nhtsa.sav'.
4216 CTABLES
4217     /VLABELS VARIABLES=ALL DISPLAY=NAME
4218     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4219     /SLABELS POSITION=ROW
4220     /CLABELS ROWLABELS=LAYER
4221     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4222     /SLABELS POSITION=ROW
4223     /CLABELS ROWLABELS=LAYER
4224     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4225     /SLABELS POSITION=ROW
4226     /CLABELS ROWLABELS=LAYER.
4227 ]])
4228 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4229                           Custom Tables
4230 Male
4231 Yes
4232 ╭──────────────────────────────────┬───────────────────────────╮
4233 │                                  │            QN27           │
4234 │                                  ├─────────────┬─────────────┤
4235 │                                  │     Yes     │      No     │
4236 │                                  ├─────────────┼─────────────┤
4237 │                                  │    QND7A    │    QND7A    │
4238 │                                  ├──────┬──────┼──────┬──────┤
4239 │                                  │  Yes │  No  │  Yes │  No  │
4240 │                                  ├──────┼──────┼──────┼──────┤
4241 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4242 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4243 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4244 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4245 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4246 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4247 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4248 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4249 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4250 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4251 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4252 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4253 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4254 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4255 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4256 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4257 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4258 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4259 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4260 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4261
4262                           Custom Tables
4263 Male
4264 No
4265 ╭──────────────────────────────────┬───────────────────────────╮
4266 │                                  │            QN27           │
4267 │                                  ├─────────────┬─────────────┤
4268 │                                  │     Yes     │      No     │
4269 │                                  ├─────────────┼─────────────┤
4270 │                                  │    QND7A    │    QND7A    │
4271 │                                  ├──────┬──────┼──────┬──────┤
4272 │                                  │  Yes │  No  │  Yes │  No  │
4273 │                                  ├──────┼──────┼──────┼──────┤
4274 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4275 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4276 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4277 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4278 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4279 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4280 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4281 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4282 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4283 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4284 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4285 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4286 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4287 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4288 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4289 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4290 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4291 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4292 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4293 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4294
4295                           Custom Tables
4296 Female
4297 Yes
4298 ╭──────────────────────────────────┬───────────────────────────╮
4299 │                                  │            QN27           │
4300 │                                  ├─────────────┬─────────────┤
4301 │                                  │     Yes     │      No     │
4302 │                                  ├─────────────┼─────────────┤
4303 │                                  │    QND7A    │    QND7A    │
4304 │                                  ├──────┬──────┼──────┬──────┤
4305 │                                  │  Yes │  No  │  Yes │  No  │
4306 │                                  ├──────┼──────┼──────┼──────┤
4307 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4308 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4309 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4310 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4311 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4312 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4313 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4314 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4315 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4316 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4317 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4318 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4319 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4320 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4321 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4322 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4323 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4324 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4325 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4326 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4327
4328                           Custom Tables
4329 Female
4330 No
4331 ╭──────────────────────────────────┬───────────────────────────╮
4332 │                                  │            QN27           │
4333 │                                  ├─────────────┬─────────────┤
4334 │                                  │     Yes     │      No     │
4335 │                                  ├─────────────┼─────────────┤
4336 │                                  │    QND7A    │    QND7A    │
4337 │                                  ├──────┬──────┼──────┬──────┤
4338 │                                  │  Yes │  No  │  Yes │  No  │
4339 │                                  ├──────┼──────┼──────┼──────┤
4340 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4341 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4342 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4343 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4344 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4345 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4346 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4347 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4348 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4349 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4350 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4351 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4352 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4353 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4354 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4355 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4356 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4357 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4358 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4359 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4360
4361                           Custom Tables
4362 Male
4363 Yes
4364 ╭───────────────────────────────────┬───────────────────────────╮
4365 │                                   │            QN27           │
4366 │                                   ├─────────────┬─────────────┤
4367 │                                   │     Yes     │      No     │
4368 │                                   ├─────────────┼─────────────┤
4369 │                                   │    QND7A    │    QND7A    │
4370 │                                   ├──────┬──────┼──────┬──────┤
4371 │                                   │  Yes │  No  │  Yes │  No  │
4372 │                                   ├──────┼──────┼──────┼──────┤
4373 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4374 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4375 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4376 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4377 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4378 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4379 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4380 │              No  QN57 Row ID      │  9│ 9│ 11│11│ 13│13│ 15│15│
4381 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4382 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4383 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 19│19│ 21│21│ 23│23│
4384 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
4385 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4386 │              No  QN57 Row ID      │ 25│25│ 27│27│ 29│29│ 31│31│
4387 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
4388 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4389
4390                           Custom Tables
4391 Male
4392 No
4393 ╭───────────────────────────────────┬───────────────────────────╮
4394 │                                   │            QN27           │
4395 │                                   ├─────────────┬─────────────┤
4396 │                                   │     Yes     │      No     │
4397 │                                   ├─────────────┼─────────────┤
4398 │                                   │    QND7A    │    QND7A    │
4399 │                                   ├──────┬──────┼──────┬──────┤
4400 │                                   │  Yes │  No  │  Yes │  No  │
4401 │                                   ├──────┼──────┼──────┼──────┤
4402 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4403 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4404 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4405 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4406 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4407 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4408 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4409 │              No  QN57 Row ID      │ 10│10│ 12│12│ 14│14│ 16│16│
4410 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4411 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4412 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 20│20│ 22│22│ 24│24│
4413 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4414 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4415 │              No  QN57 Row ID      │ 26│26│ 28│28│ 30│30│ 32│32│
4416 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4417 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4418
4419                           Custom Tables
4420 Female
4421 Yes
4422 ╭───────────────────────────────────┬───────────────────────────╮
4423 │                                   │            QN27           │
4424 │                                   ├─────────────┬─────────────┤
4425 │                                   │     Yes     │      No     │
4426 │                                   ├─────────────┼─────────────┤
4427 │                                   │    QND7A    │    QND7A    │
4428 │                                   ├──────┬──────┼──────┬──────┤
4429 │                                   │  Yes │  No  │  Yes │  No  │
4430 │                                   ├──────┼──────┼──────┼──────┤
4431 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4432 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4433 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4434 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4435 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 39│39│
4436 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4437 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4438 │              No  QN57 Row ID      │ 41│41│ 43│43│ 45│45│ 47│47│
4439 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4440 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4441 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 51│51│ 53│53│ 55│55│
4442 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4443 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4444 │              No  QN57 Row ID      │ 57│57│ 59│59│ 61│61│ 63│63│
4445 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4446 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4447
4448                           Custom Tables
4449 Female
4450 No
4451 ╭───────────────────────────────────┬───────────────────────────╮
4452 │                                   │            QN27           │
4453 │                                   ├─────────────┬─────────────┤
4454 │                                   │     Yes     │      No     │
4455 │                                   ├─────────────┼─────────────┤
4456 │                                   │    QND7A    │    QND7A    │
4457 │                                   ├──────┬──────┼──────┬──────┤
4458 │                                   │  Yes │  No  │  Yes │  No  │
4459 │                                   ├──────┼──────┼──────┼──────┤
4460 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4461 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4462 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4463 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4464 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 40│40│
4465 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4466 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4467 │              No  QN57 Row ID      │ 42│42│ 44│44│ 46│46│ 48│48│
4468 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4469 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4470 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 52│52│ 54│54│ 56│56│
4471 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4472 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4473 │              No  QN57 Row ID      │ 58│58│ 60│60│ 62│62│ 64│64│
4474 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
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 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4492 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4493 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4494 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4495 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4496 │              No  QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4497 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4498 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4499 │     No  QN61 Yes QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4500 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4501 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4502 │              No  QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4503 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4504 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4505
4506                             Custom Tables
4507 Male
4508 No
4509 ╭──────────────────────────────────────┬───────────────────────────╮
4510 │                                      │            QN27           │
4511 │                                      ├─────────────┬─────────────┤
4512 │                                      │     Yes     │      No     │
4513 │                                      ├─────────────┼─────────────┤
4514 │                                      │    QND7A    │    QND7A    │
4515 │                                      ├──────┬──────┼──────┬──────┤
4516 │                                      │  Yes │  No  │  Yes │  No  │
4517 │                                      ├──────┼──────┼──────┼──────┤
4518 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4519 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4520 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4521 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4522 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4523 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4524 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4525 │              No  QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4526 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4527 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4528 │     No  QN61 Yes QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4529 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4530 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4531 │              No  QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4532 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4533 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4534
4535                             Custom Tables
4536 Female
4537 Yes
4538 ╭──────────────────────────────────────┬───────────────────────────╮
4539 │                                      │            QN27           │
4540 │                                      ├─────────────┬─────────────┤
4541 │                                      │     Yes     │      No     │
4542 │                                      ├─────────────┼─────────────┤
4543 │                                      │    QND7A    │    QND7A    │
4544 │                                      ├──────┬──────┼──────┬──────┤
4545 │                                      │  Yes │  No  │  Yes │  No  │
4546 │                                      ├──────┼──────┼──────┼──────┤
4547 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4548 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4549 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4550 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4551 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4552 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4553 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4554 │              No  QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4555 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4556 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4557 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4558 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4559 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4560 │              No  QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4561 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4562 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4563
4564                             Custom Tables
4565 Female
4566 No
4567 ╭──────────────────────────────────────┬───────────────────────────╮
4568 │                                      │            QN27           │
4569 │                                      ├─────────────┬─────────────┤
4570 │                                      │     Yes     │      No     │
4571 │                                      ├─────────────┼─────────────┤
4572 │                                      │    QND7A    │    QND7A    │
4573 │                                      ├──────┬──────┼──────┬──────┤
4574 │                                      │  Yes │  No  │  Yes │  No  │
4575 │                                      ├──────┼──────┼──────┼──────┤
4576 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4577 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4578 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4579 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4580 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4581 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4582 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4583 │              No  QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4584 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4585 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4586 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4587 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4588 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4589 │              No  QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4590 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4591 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4592 ])
4593 AT_CLEANUP
4594
4595 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4596 AT_KEYWORDS([COLLABELS LAYER])
4597 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
4598 AT_DATA([ctables.sps],
4599 [[GET 'nhtsa.sav'.
4600 CTABLES
4601     /VLABELS VARIABLES=ALL DISPLAY=NAME
4602     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4603     /SLABELS POSITION=ROW
4604     /CLABELS COLLABELS=LAYER
4605     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4606     /SLABELS POSITION=ROW
4607     /CLABELS COLLABELS=LAYER
4608     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4609     /SLABELS POSITION=ROW
4610     /CLABELS COLLABELS=LAYER.
4611 ]])
4612 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4613                         Custom Tables
4614 Male
4615 Yes
4616 ╭──────────────────────────────────────┬───────────────────╮
4617 │                                      │        QN27       │
4618 │                                      ├─────────┬─────────┤
4619 │                                      │   Yes   │    No   │
4620 │                                      ├─────────┼─────────┤
4621 │                                      │  QND7A  │  QND7A  │
4622 │                                      ├────┬────┼────┬────┤
4623 │                                      │ Yes│ No │ Yes│ No │
4624 │                                      ├────┼────┼────┼────┤
4625 │                                      │QN86│QN86│QN86│QN86│
4626 ├──────────────────────────────────────┼────┼────┼────┼────┤
4627 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4628 │                           Layer ID   │   1│   1│   1│   1│
4629 │                           Subtable ID│   1│   1│   3│   3│
4630 │                      ╶───────────────┼────┼────┼────┼────┤
4631 │                       No  Table ID   │   1│   1│   1│   1│
4632 │                           Layer ID   │   1│   1│   1│   1│
4633 │                           Subtable ID│   1│   1│   3│   3│
4634 │             ╶────────────────────────┼────┼────┼────┼────┤
4635 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4636 │                           Layer ID   │   1│   1│   1│   1│
4637 │                           Subtable ID│   5│   5│   7│   7│
4638 │                      ╶───────────────┼────┼────┼────┼────┤
4639 │                       No  Table ID   │   1│   1│   1│   1│
4640 │                           Layer ID   │   1│   1│   1│   1│
4641 │                           Subtable ID│   5│   5│   7│   7│
4642 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4643 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4644 │                           Layer ID   │   1│   1│   1│   1│
4645 │                           Subtable ID│   9│   9│  11│  11│
4646 │                      ╶───────────────┼────┼────┼────┼────┤
4647 │                       No  Table ID   │   1│   1│   1│   1│
4648 │                           Layer ID   │   1│   1│   1│   1│
4649 │                           Subtable ID│   9│   9│  11│  11│
4650 │             ╶────────────────────────┼────┼────┼────┼────┤
4651 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4652 │                           Layer ID   │   1│   1│   1│   1│
4653 │                           Subtable ID│  13│  13│  15│  15│
4654 │                      ╶───────────────┼────┼────┼────┼────┤
4655 │                       No  Table ID   │   1│   1│   1│   1│
4656 │                           Layer ID   │   1│   1│   1│   1│
4657 │                           Subtable ID│  13│  13│  15│  15│
4658 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4659
4660                         Custom Tables
4661 Male
4662 No
4663 ╭──────────────────────────────────────┬───────────────────╮
4664 │                                      │        QN27       │
4665 │                                      ├─────────┬─────────┤
4666 │                                      │   Yes   │    No   │
4667 │                                      ├─────────┼─────────┤
4668 │                                      │  QND7A  │  QND7A  │
4669 │                                      ├────┬────┼────┬────┤
4670 │                                      │ Yes│ No │ Yes│ No │
4671 │                                      ├────┼────┼────┼────┤
4672 │                                      │QN86│QN86│QN86│QN86│
4673 ├──────────────────────────────────────┼────┼────┼────┼────┤
4674 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4675 │                           Layer ID   │   2│   2│   2│   2│
4676 │                           Subtable ID│   2│   2│   4│   4│
4677 │                      ╶───────────────┼────┼────┼────┼────┤
4678 │                       No  Table ID   │   1│   1│   1│   1│
4679 │                           Layer ID   │   2│   2│   2│   2│
4680 │                           Subtable ID│   2│   2│   4│   4│
4681 │             ╶────────────────────────┼────┼────┼────┼────┤
4682 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4683 │                           Layer ID   │   2│   2│   2│   2│
4684 │                           Subtable ID│   6│   6│   8│   8│
4685 │                      ╶───────────────┼────┼────┼────┼────┤
4686 │                       No  Table ID   │   1│   1│   1│   1│
4687 │                           Layer ID   │   2│   2│   2│   2│
4688 │                           Subtable ID│   6│   6│   8│   8│
4689 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4690 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4691 │                           Layer ID   │   2│   2│   2│   2│
4692 │                           Subtable ID│  10│  10│  12│  12│
4693 │                      ╶───────────────┼────┼────┼────┼────┤
4694 │                       No  Table ID   │   1│   1│   1│   1│
4695 │                           Layer ID   │   2│   2│   2│   2│
4696 │                           Subtable ID│  10│  10│  12│  12│
4697 │             ╶────────────────────────┼────┼────┼────┼────┤
4698 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4699 │                           Layer ID   │   2│   2│   2│   2│
4700 │                           Subtable ID│  14│  14│  16│  16│
4701 │                      ╶───────────────┼────┼────┼────┼────┤
4702 │                       No  Table ID   │   1│   1│   1│   1│
4703 │                           Layer ID   │   2│   2│   2│   2│
4704 │                           Subtable ID│  14│  14│  16│  16│
4705 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4706
4707                         Custom Tables
4708 Female
4709 Yes
4710 ╭──────────────────────────────────────┬───────────────────╮
4711 │                                      │        QN27       │
4712 │                                      ├─────────┬─────────┤
4713 │                                      │   Yes   │    No   │
4714 │                                      ├─────────┼─────────┤
4715 │                                      │  QND7A  │  QND7A  │
4716 │                                      ├────┬────┼────┬────┤
4717 │                                      │ Yes│ No │ Yes│ No │
4718 │                                      ├────┼────┼────┼────┤
4719 │                                      │QN86│QN86│QN86│QN86│
4720 ├──────────────────────────────────────┼────┼────┼────┼────┤
4721 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4722 │                           Layer ID   │   3│   3│   3│   3│
4723 │                           Subtable ID│  17│  17│  19│  19│
4724 │                      ╶───────────────┼────┼────┼────┼────┤
4725 │                       No  Table ID   │   1│   1│   1│   1│
4726 │                           Layer ID   │   3│   3│   3│   3│
4727 │                           Subtable ID│  17│  17│  19│  19│
4728 │             ╶────────────────────────┼────┼────┼────┼────┤
4729 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4730 │                           Layer ID   │   3│   3│   3│   3│
4731 │                           Subtable ID│  21│  21│  23│  23│
4732 │                      ╶───────────────┼────┼────┼────┼────┤
4733 │                       No  Table ID   │   1│   1│   1│   1│
4734 │                           Layer ID   │   3│   3│   3│   3│
4735 │                           Subtable ID│  21│  21│  23│  23│
4736 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4737 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4738 │                           Layer ID   │   3│   3│   3│   3│
4739 │                           Subtable ID│  25│  25│  27│  27│
4740 │                      ╶───────────────┼────┼────┼────┼────┤
4741 │                       No  Table ID   │   1│   1│   1│   1│
4742 │                           Layer ID   │   3│   3│   3│   3│
4743 │                           Subtable ID│  25│  25│  27│  27│
4744 │             ╶────────────────────────┼────┼────┼────┼────┤
4745 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4746 │                           Layer ID   │   3│   3│   3│   3│
4747 │                           Subtable ID│  29│  29│  31│  31│
4748 │                      ╶───────────────┼────┼────┼────┼────┤
4749 │                       No  Table ID   │   1│   1│   1│   1│
4750 │                           Layer ID   │   3│   3│   3│   3│
4751 │                           Subtable ID│  29│  29│  31│  31│
4752 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4753
4754                         Custom Tables
4755 Female
4756 No
4757 ╭──────────────────────────────────────┬───────────────────╮
4758 │                                      │        QN27       │
4759 │                                      ├─────────┬─────────┤
4760 │                                      │   Yes   │    No   │
4761 │                                      ├─────────┼─────────┤
4762 │                                      │  QND7A  │  QND7A  │
4763 │                                      ├────┬────┼────┬────┤
4764 │                                      │ Yes│ No │ Yes│ No │
4765 │                                      ├────┼────┼────┼────┤
4766 │                                      │QN86│QN86│QN86│QN86│
4767 ├──────────────────────────────────────┼────┼────┼────┼────┤
4768 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4769 │                           Layer ID   │   4│   4│   4│   4│
4770 │                           Subtable ID│  18│  18│  20│  20│
4771 │                      ╶───────────────┼────┼────┼────┼────┤
4772 │                       No  Table ID   │   1│   1│   1│   1│
4773 │                           Layer ID   │   4│   4│   4│   4│
4774 │                           Subtable ID│  18│  18│  20│  20│
4775 │             ╶────────────────────────┼────┼────┼────┼────┤
4776 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4777 │                           Layer ID   │   4│   4│   4│   4│
4778 │                           Subtable ID│  22│  22│  24│  24│
4779 │                      ╶───────────────┼────┼────┼────┼────┤
4780 │                       No  Table ID   │   1│   1│   1│   1│
4781 │                           Layer ID   │   4│   4│   4│   4│
4782 │                           Subtable ID│  22│  22│  24│  24│
4783 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4784 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4785 │                           Layer ID   │   4│   4│   4│   4│
4786 │                           Subtable ID│  26│  26│  28│  28│
4787 │                      ╶───────────────┼────┼────┼────┼────┤
4788 │                       No  Table ID   │   1│   1│   1│   1│
4789 │                           Layer ID   │   4│   4│   4│   4│
4790 │                           Subtable ID│  26│  26│  28│  28│
4791 │             ╶────────────────────────┼────┼────┼────┼────┤
4792 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4793 │                           Layer ID   │   4│   4│   4│   4│
4794 │                           Subtable ID│  30│  30│  32│  32│
4795 │                      ╶───────────────┼────┼────┼────┼────┤
4796 │                       No  Table ID   │   1│   1│   1│   1│
4797 │                           Layer ID   │   4│   4│   4│   4│
4798 │                           Subtable ID│  30│  30│  32│  32│
4799 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4800
4801                         Custom Tables
4802 Male
4803 Yes
4804 ╭───────────────────────────────────────┬───────────────────╮
4805 │                                       │        QN27       │
4806 │                                       ├─────────┬─────────┤
4807 │                                       │   Yes   │    No   │
4808 │                                       ├─────────┼─────────┤
4809 │                                       │  QND7A  │  QND7A  │
4810 │                                       ├────┬────┼────┬────┤
4811 │                                       │ Yes│ No │ Yes│ No │
4812 │                                       ├────┼────┼────┼────┤
4813 │                                       │QN86│QN86│QN86│QN86│
4814 ├───────────────────────────────────────┼────┼────┼────┼────┤
4815 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4816 │                           Layer Row ID│   1│   1│   1│   1│
4817 │                      ╶────────────────┼────┼────┼────┼────┤
4818 │                       No  Row ID      │   5│   5│   7│   7│
4819 │                           Layer Row ID│   3│   3│   3│   3│
4820 │             ╶─────────────────────────┼────┼────┼────┼────┤
4821 │              No  QN57 Yes Row ID      │   9│   9│  11│  11│
4822 │                           Layer Row ID│   5│   5│   5│   5│
4823 │                      ╶────────────────┼────┼────┼────┼────┤
4824 │                       No  Row ID      │  13│  13│  15│  15│
4825 │                           Layer Row ID│   7│   7│   7│   7│
4826 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4827 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  19│  19│
4828 │                           Layer Row ID│   9│   9│   9│   9│
4829 │                      ╶────────────────┼────┼────┼────┼────┤
4830 │                       No  Row ID      │  21│  21│  23│  23│
4831 │                           Layer Row ID│  11│  11│  11│  11│
4832 │             ╶─────────────────────────┼────┼────┼────┼────┤
4833 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4834 │                           Layer Row ID│  13│  13│  13│  13│
4835 │                      ╶────────────────┼────┼────┼────┼────┤
4836 │                       No  Row ID      │  29│  29│  31│  31│
4837 │                           Layer Row ID│  15│  15│  15│  15│
4838 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4839
4840                         Custom Tables
4841 Male
4842 No
4843 ╭───────────────────────────────────────┬───────────────────╮
4844 │                                       │        QN27       │
4845 │                                       ├─────────┬─────────┤
4846 │                                       │   Yes   │    No   │
4847 │                                       ├─────────┼─────────┤
4848 │                                       │  QND7A  │  QND7A  │
4849 │                                       ├────┬────┼────┬────┤
4850 │                                       │ Yes│ No │ Yes│ No │
4851 │                                       ├────┼────┼────┼────┤
4852 │                                       │QN86│QN86│QN86│QN86│
4853 ├───────────────────────────────────────┼────┼────┼────┼────┤
4854 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4855 │                           Layer Row ID│   2│   2│   2│   2│
4856 │                      ╶────────────────┼────┼────┼────┼────┤
4857 │                       No  Row ID      │   6│   6│   8│   8│
4858 │                           Layer Row ID│   4│   4│   4│   4│
4859 │             ╶─────────────────────────┼────┼────┼────┼────┤
4860 │              No  QN57 Yes Row ID      │  10│  10│  12│  12│
4861 │                           Layer Row ID│   6│   6│   6│   6│
4862 │                      ╶────────────────┼────┼────┼────┼────┤
4863 │                       No  Row ID      │  14│  14│  16│  16│
4864 │                           Layer Row ID│   8│   8│   8│   8│
4865 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4866 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  20│  20│
4867 │                           Layer Row ID│  10│  10│  10│  10│
4868 │                      ╶────────────────┼────┼────┼────┼────┤
4869 │                       No  Row ID      │  22│  22│  24│  24│
4870 │                           Layer Row ID│  12│  12│  12│  12│
4871 │             ╶─────────────────────────┼────┼────┼────┼────┤
4872 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4873 │                           Layer Row ID│  14│  14│  14│  14│
4874 │                      ╶────────────────┼────┼────┼────┼────┤
4875 │                       No  Row ID      │  30│  30│  32│  32│
4876 │                           Layer Row ID│  16│  16│  16│  16│
4877 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4878
4879                         Custom Tables
4880 Female
4881 Yes
4882 ╭───────────────────────────────────────┬───────────────────╮
4883 │                                       │        QN27       │
4884 │                                       ├─────────┬─────────┤
4885 │                                       │   Yes   │    No   │
4886 │                                       ├─────────┼─────────┤
4887 │                                       │  QND7A  │  QND7A  │
4888 │                                       ├────┬────┼────┬────┤
4889 │                                       │ Yes│ No │ Yes│ No │
4890 │                                       ├────┼────┼────┼────┤
4891 │                                       │QN86│QN86│QN86│QN86│
4892 ├───────────────────────────────────────┼────┼────┼────┼────┤
4893 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  35│  35│
4894 │                           Layer Row ID│  17│  17│  17│  17│
4895 │                      ╶────────────────┼────┼────┼────┼────┤
4896 │                       No  Row ID      │  37│  37│  39│  39│
4897 │                           Layer Row ID│  19│  19│  19│  19│
4898 │             ╶─────────────────────────┼────┼────┼────┼────┤
4899 │              No  QN57 Yes Row ID      │  41│  41│  43│  43│
4900 │                           Layer Row ID│  21│  21│  21│  21│
4901 │                      ╶────────────────┼────┼────┼────┼────┤
4902 │                       No  Row ID      │  45│  45│  47│  47│
4903 │                           Layer Row ID│  23│  23│  23│  23│
4904 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4905 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  51│  51│
4906 │                           Layer Row ID│  25│  25│  25│  25│
4907 │                      ╶────────────────┼────┼────┼────┼────┤
4908 │                       No  Row ID      │  53│  53│  55│  55│
4909 │                           Layer Row ID│  27│  27│  27│  27│
4910 │             ╶─────────────────────────┼────┼────┼────┼────┤
4911 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4912 │                           Layer Row ID│  29│  29│  29│  29│
4913 │                      ╶────────────────┼────┼────┼────┼────┤
4914 │                       No  Row ID      │  61│  61│  63│  63│
4915 │                           Layer Row ID│  31│  31│  31│  31│
4916 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4917
4918                         Custom Tables
4919 Female
4920 No
4921 ╭───────────────────────────────────────┬───────────────────╮
4922 │                                       │        QN27       │
4923 │                                       ├─────────┬─────────┤
4924 │                                       │   Yes   │    No   │
4925 │                                       ├─────────┼─────────┤
4926 │                                       │  QND7A  │  QND7A  │
4927 │                                       ├────┬────┼────┬────┤
4928 │                                       │ Yes│ No │ Yes│ No │
4929 │                                       ├────┼────┼────┼────┤
4930 │                                       │QN86│QN86│QN86│QN86│
4931 ├───────────────────────────────────────┼────┼────┼────┼────┤
4932 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  36│  36│
4933 │                           Layer Row ID│  18│  18│  18│  18│
4934 │                      ╶────────────────┼────┼────┼────┼────┤
4935 │                       No  Row ID      │  38│  38│  40│  40│
4936 │                           Layer Row ID│  20│  20│  20│  20│
4937 │             ╶─────────────────────────┼────┼────┼────┼────┤
4938 │              No  QN57 Yes Row ID      │  42│  42│  44│  44│
4939 │                           Layer Row ID│  22│  22│  22│  22│
4940 │                      ╶────────────────┼────┼────┼────┼────┤
4941 │                       No  Row ID      │  46│  46│  48│  48│
4942 │                           Layer Row ID│  24│  24│  24│  24│
4943 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4944 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  52│  52│
4945 │                           Layer Row ID│  26│  26│  26│  26│
4946 │                      ╶────────────────┼────┼────┼────┼────┤
4947 │                       No  Row ID      │  54│  54│  56│  56│
4948 │                           Layer Row ID│  28│  28│  28│  28│
4949 │             ╶─────────────────────────┼────┼────┼────┼────┤
4950 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
4951 │                           Layer Row ID│  30│  30│  30│  30│
4952 │                      ╶────────────────┼────┼────┼────┼────┤
4953 │                       No  Row ID      │  62│  62│  64│  64│
4954 │                           Layer Row ID│  32│  32│  32│  32│
4955 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4956
4957                           Custom Tables
4958 Male
4959 Yes
4960 ╭──────────────────────────────────────────┬───────────────────╮
4961 │                                          │        QN27       │
4962 │                                          ├─────────┬─────────┤
4963 │                                          │   Yes   │    No   │
4964 │                                          ├─────────┼─────────┤
4965 │                                          │  QND7A  │  QND7A  │
4966 │                                          ├────┬────┼────┬────┤
4967 │                                          │ Yes│ No │ Yes│ No │
4968 │                                          ├────┼────┼────┼────┤
4969 │                                          │QN86│QN86│QN86│QN86│
4970 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4971 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   7│
4972 │                           Layer Column ID│   1│   3│   5│   7│
4973 │                      ╶───────────────────┼────┼────┼────┼────┤
4974 │                       No  Column ID      │   1│   3│   5│   7│
4975 │                           Layer Column ID│   1│   3│   5│   7│
4976 │             ╶────────────────────────────┼────┼────┼────┼────┤
4977 │              No  QN57 Yes Column ID      │   9│  11│  13│  15│
4978 │                           Layer Column ID│   1│   3│   5│   7│
4979 │                      ╶───────────────────┼────┼────┼────┼────┤
4980 │                       No  Column ID      │   9│  11│  13│  15│
4981 │                           Layer Column ID│   1│   3│   5│   7│
4982 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4983 │     No  QN61 Yes QN57 Yes Column ID      │  17│  19│  21│  23│
4984 │                           Layer Column ID│   1│   3│   5│   7│
4985 │                      ╶───────────────────┼────┼────┼────┼────┤
4986 │                       No  Column ID      │  17│  19│  21│  23│
4987 │                           Layer Column ID│   1│   3│   5│   7│
4988 │             ╶────────────────────────────┼────┼────┼────┼────┤
4989 │              No  QN57 Yes Column ID      │  25│  27│  29│  31│
4990 │                           Layer Column ID│   1│   3│   5│   7│
4991 │                      ╶───────────────────┼────┼────┼────┼────┤
4992 │                       No  Column ID      │  25│  27│  29│  31│
4993 │                           Layer Column ID│   1│   3│   5│   7│
4994 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4995
4996                           Custom Tables
4997 Male
4998 No
4999 ╭──────────────────────────────────────────┬───────────────────╮
5000 │                                          │        QN27       │
5001 │                                          ├─────────┬─────────┤
5002 │                                          │   Yes   │    No   │
5003 │                                          ├─────────┼─────────┤
5004 │                                          │  QND7A  │  QND7A  │
5005 │                                          ├────┬────┼────┬────┤
5006 │                                          │ Yes│ No │ Yes│ No │
5007 │                                          ├────┼────┼────┼────┤
5008 │                                          │QN86│QN86│QN86│QN86│
5009 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5010 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   8│
5011 │                           Layer Column ID│   2│   4│   6│   8│
5012 │                      ╶───────────────────┼────┼────┼────┼────┤
5013 │                       No  Column ID      │   2│   4│   6│   8│
5014 │                           Layer Column ID│   2│   4│   6│   8│
5015 │             ╶────────────────────────────┼────┼────┼────┼────┤
5016 │              No  QN57 Yes Column ID      │  10│  12│  14│  16│
5017 │                           Layer Column ID│   2│   4│   6│   8│
5018 │                      ╶───────────────────┼────┼────┼────┼────┤
5019 │                       No  Column ID      │  10│  12│  14│  16│
5020 │                           Layer Column ID│   2│   4│   6│   8│
5021 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5022 │     No  QN61 Yes QN57 Yes Column ID      │  18│  20│  22│  24│
5023 │                           Layer Column ID│   2│   4│   6│   8│
5024 │                      ╶───────────────────┼────┼────┼────┼────┤
5025 │                       No  Column ID      │  18│  20│  22│  24│
5026 │                           Layer Column ID│   2│   4│   6│   8│
5027 │             ╶────────────────────────────┼────┼────┼────┼────┤
5028 │              No  QN57 Yes Column ID      │  26│  28│  30│  32│
5029 │                           Layer Column ID│   2│   4│   6│   8│
5030 │                      ╶───────────────────┼────┼────┼────┼────┤
5031 │                       No  Column ID      │  26│  28│  30│  32│
5032 │                           Layer Column ID│   2│   4│   6│   8│
5033 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5034
5035                           Custom Tables
5036 Female
5037 Yes
5038 ╭──────────────────────────────────────────┬───────────────────╮
5039 │                                          │        QN27       │
5040 │                                          ├─────────┬─────────┤
5041 │                                          │   Yes   │    No   │
5042 │                                          ├─────────┼─────────┤
5043 │                                          │  QND7A  │  QND7A  │
5044 │                                          ├────┬────┼────┬────┤
5045 │                                          │ Yes│ No │ Yes│ No │
5046 │                                          ├────┼────┼────┼────┤
5047 │                                          │QN86│QN86│QN86│QN86│
5048 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5049 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  37│  39│
5050 │                           Layer Column ID│   9│  11│  13│  15│
5051 │                      ╶───────────────────┼────┼────┼────┼────┤
5052 │                       No  Column ID      │  33│  35│  37│  39│
5053 │                           Layer Column ID│   9│  11│  13│  15│
5054 │             ╶────────────────────────────┼────┼────┼────┼────┤
5055 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
5056 │                           Layer Column ID│   9│  11│  13│  15│
5057 │                      ╶───────────────────┼────┼────┼────┼────┤
5058 │                       No  Column ID      │  41│  43│  45│  47│
5059 │                           Layer Column ID│   9│  11│  13│  15│
5060 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5061 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  53│  55│
5062 │                           Layer Column ID│   9│  11│  13│  15│
5063 │                      ╶───────────────────┼────┼────┼────┼────┤
5064 │                       No  Column ID      │  49│  51│  53│  55│
5065 │                           Layer Column ID│   9│  11│  13│  15│
5066 │             ╶────────────────────────────┼────┼────┼────┼────┤
5067 │              No  QN57 Yes Column ID      │  57│  59│  61│  63│
5068 │                           Layer Column ID│   9│  11│  13│  15│
5069 │                      ╶───────────────────┼────┼────┼────┼────┤
5070 │                       No  Column ID      │  57│  59│  61│  63│
5071 │                           Layer Column ID│   9│  11│  13│  15│
5072 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5073
5074                           Custom Tables
5075 Female
5076 No
5077 ╭──────────────────────────────────────────┬───────────────────╮
5078 │                                          │        QN27       │
5079 │                                          ├─────────┬─────────┤
5080 │                                          │   Yes   │    No   │
5081 │                                          ├─────────┼─────────┤
5082 │                                          │  QND7A  │  QND7A  │
5083 │                                          ├────┬────┼────┬────┤
5084 │                                          │ Yes│ No │ Yes│ No │
5085 │                                          ├────┼────┼────┼────┤
5086 │                                          │QN86│QN86│QN86│QN86│
5087 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5088 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  38│  40│
5089 │                           Layer Column ID│  10│  12│  14│  16│
5090 │                      ╶───────────────────┼────┼────┼────┼────┤
5091 │                       No  Column ID      │  34│  36│  38│  40│
5092 │                           Layer Column ID│  10│  12│  14│  16│
5093 │             ╶────────────────────────────┼────┼────┼────┼────┤
5094 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
5095 │                           Layer Column ID│  10│  12│  14│  16│
5096 │                      ╶───────────────────┼────┼────┼────┼────┤
5097 │                       No  Column ID      │  42│  44│  46│  48│
5098 │                           Layer Column ID│  10│  12│  14│  16│
5099 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5100 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  54│  56│
5101 │                           Layer Column ID│  10│  12│  14│  16│
5102 │                      ╶───────────────────┼────┼────┼────┼────┤
5103 │                       No  Column ID      │  50│  52│  54│  56│
5104 │                           Layer Column ID│  10│  12│  14│  16│
5105 │             ╶────────────────────────────┼────┼────┼────┼────┤
5106 │              No  QN57 Yes Column ID      │  58│  60│  62│  64│
5107 │                           Layer Column ID│  10│  12│  14│  16│
5108 │                      ╶───────────────────┼────┼────┼────┼────┤
5109 │                       No  Column ID      │  58│  60│  62│  64│
5110 │                           Layer Column ID│  10│  12│  14│  16│
5111 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5112 ])
5113 AT_CLEANUP
5114
5115 AT_SETUP([CTABLES categorical summary functions])
5116 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5117 AT_DATA([ctables.sps],
5118 [[GET 'nhtsa.sav'.
5119 CTABLES
5120     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
5121     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
5122     /SLABELS POSITION=ROW.
5123 ]])
5124 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5125                                                       Custom Tables
5126 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
5127 │                 │                     D5a. What would you say is your primary ethnic background?                     │
5128 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
5129 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
5130 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
5131 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
5132 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5133 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
5134 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
5135 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
5136 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5137 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5138 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
5139 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5140 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5141 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
5142 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
5143 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5144 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
5145 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
5146 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
5147 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5148 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5149 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
5150 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5151 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5152 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
5153 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
5154 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5155 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
5156 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
5157 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
5158 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5159 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5160 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
5161 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5162 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5163 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
5164 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
5165 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5166 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
5167 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
5168 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
5169 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5170 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5171 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
5172 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5173 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5174 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
5175 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
5176 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
5177 ])
5178 AT_CLEANUP
5179
5180 AT_SETUP([CTABLES scale summary functions])
5181 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5182 AT_DATA([ctables.sps],
5183 [[GET 'nhtsa.sav'.
5184 SET TVAR=NAME.
5185
5186 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5187   CTABLES later, to make the results easier to verify.
5188 SPLIT FILE BY REGION.
5189 FREQUENCIES
5190     qn19a
5191     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5192     /FORMAT NOTABLE /MISSING=INCLUDE.
5193 SPLIT FILE OFF.
5194
5195 CTABLES
5196     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5197     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
5198     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
5199     /SLABELS POSITION=ROW
5200     /CLABELS ROWLABELS=OPPOSITE.
5201 ]])
5202 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5203                    Statistics
5204 ╭─────────┬───────────────────────────────────╮
5205 │         │               REGION              │
5206 │         ├────────┬────────┬────────┬────────┤
5207 │         │   NE   │   MW   │    S   │    W   │
5208 │         ├────────┼────────┼────────┼────────┤
5209 │         │  QN19A │  QN19A │  QN19A │  QN19A │
5210 ├─────────┼────────┼────────┼────────┼────────┤
5211 │N Valid  │     936│    1019│    1276│     950│
5212 │  Missing│     473│     635│    1114│     596│
5213 ├─────────┼────────┼────────┼────────┼────────┤
5214 │Mean     │   19.33│   19.83│   20.29│   19.87│
5215 ├─────────┼────────┼────────┼────────┼────────┤
5216 │S.E. Mean│     .14│     .16│     .18│     .17│
5217 ├─────────┼────────┼────────┼────────┼────────┤
5218 │Median   │   18.00│   19.00│   19.00│   19.00│
5219 ├─────────┼────────┼────────┼────────┼────────┤
5220 │Mode     │   18.00│   18.00│   18.00│   18.00│
5221 ├─────────┼────────┼────────┼────────┼────────┤
5222 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
5223 ├─────────┼────────┼────────┼────────┼────────┤
5224 │Variance │   19.41│   26.47│   41.43│   27.59│
5225 ├─────────┼────────┼────────┼────────┼────────┤
5226 │Range    │   59.00│   71.00│   75.00│   61.00│
5227 ├─────────┼────────┼────────┼────────┼────────┤
5228 │Minimum  │     .00│    4.00│    4.00│    4.00│
5229 ├─────────┼────────┼────────┼────────┼────────┤
5230 │Maximum  │   59.00│   75.00│   79.00│   65.00│
5231 ├─────────┼────────┼────────┼────────┼────────┤
5232 │Sum      │18092.00│20206.00│25886.00│18877.00│
5233 ╰─────────┴────────┴────────┴────────┴────────╯
5234
5235                          Custom Tables
5236 ╭────────────────────────┬────────┬────────┬────────┬────────╮
5237 │                        │   NE   │   MW   │    S   │    W   │
5238 ├────────────────────────┼────────┼────────┼────────┼────────┤
5239 │REGION Valid N          │     936│    1019│    1276│     950│
5240 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
5241 │       Mean             │   19.33│   19.83│   20.29│   19.87│
5242 │       Std Error of Mean│     .14│     .16│     .18│     .17│
5243 │       Median           │   18.00│   19.00│   19.00│   19.00│
5244 │       Mode             │   18.00│   18.00│   18.00│   18.00│
5245 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
5246 │       Variance         │   19.41│   26.47│   41.43│   27.59│
5247 │       Range            │   59.00│   71.00│   75.00│   61.00│
5248 │       Minimum          │     .00│    4.00│    4.00│    4.00│
5249 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
5250 │       Sum              │18092.00│20206.00│25886.00│18877.00│
5251 │       Count            │    1409│    1654│    2390│    1546│
5252 │       Total N          │    1409│    1654│    2390│    1546│
5253 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
5254 ╰────────────────────────┴────────┴────────┴────────┴────────╯
5255 ])
5256 AT_CLEANUP
5257
5258 AT_SETUP([CTABLES scale summary functions - weighting])
5259 weight=1
5260 c=10
5261 for a in 1 2 9; do
5262     for b in 3 4 9; do
5263         for n in 1 2 3 4 5 6 7 8 9 10; do
5264             if test $c -lt 15; then
5265                 cval=.
5266             else
5267                 cval=$c
5268             fi
5269             printf "$weight $a $b $cval\n"
5270             weight=$(expr \( $weight + 3 \) % 7 + 2)
5271             c=$(expr \( $c + 13 \) % 29 + 7)
5272         done
5273     done
5274 done > ctables.txt
5275
5276 AT_DATA([analysis.sps],
5277 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5278   CTABLES later, to make the results easier to verify.
5279 SPLIT FILE BY a b.
5280 FREQUENCIES
5281     c
5282     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5283     /FORMAT NOTABLE /MISSING=INCLUDE.
5284 SPLIT FILE OFF.
5285
5286 CTABLES
5287     /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
5288     /SLABELS POSITION=ROW
5289     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5290 ]])
5291
5292 AT_DATA([ctables.sps],
5293 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
5294     /w (F5.0) a b c (f2.0).
5295 VAR LEVEL w c (SCALE) a b (NOMINAL).
5296 MISSING VALUES a b (9).
5297
5298 INCLUDE 'analysis.sps'.
5299
5300 WEIGHT BY w.
5301 INCLUDE 'analysis.sps'.
5302
5303 * Same as original analysis using unweighted versions of summaries.
5304 CTABLES
5305     /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
5306     /SLABELS POSITION=ROW
5307     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5308 ]])
5309 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5310                                 Statistics
5311 ╭─────────┬──────────────────────────────────────────────────────────────╮
5312 │         │                               a                              │
5313 │         ├────────────────────┬────────────────────┬────────────────────┤
5314 │         │          1         │          2         │          9         │
5315 │         ├────────────────────┼────────────────────┼────────────────────┤
5316 │         │          b         │          b         │          b         │
5317 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5318 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5319 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5320 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
5321 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5322 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5323 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
5324 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5325 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5326 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5327 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5328 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5329 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5330 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5331 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5332 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5333 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5334 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5335 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5336 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5337 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5338 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5339 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5340 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5341 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5342 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5343 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5344 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5345
5346                                     Custom Tables
5347 ╭───────────────────┬──────────────────────────────────────────────────────────────╮
5348 │                   │                               a                              │
5349 │                   ├────────────────────┬────────────────────┬────────────────────┤
5350 │                   │          1         │          2         │          9         │
5351 │                   ├────────────────────┼────────────────────┼────────────────────┤
5352 │                   │          b         │          b         │          b         │
5353 │                   ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5354 │                   │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5355 ├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5356 │c Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5357 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5358 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5359 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5360 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5361 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5362 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5363 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5364 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5365 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5366 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5367 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5368 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5369 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5370 │  Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5371 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5372
5373                                   Statistics
5374 ╭─────────┬─────────────────────────────────────────────────────────────────╮
5375 │         │                                a                                │
5376 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
5377 │         │          1          │          2          │          9          │
5378 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
5379 │         │          b          │          b          │          b          │
5380 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5381 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5382 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5383 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
5384 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5385 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5386 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
5387 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5388 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5389 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5390 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5391 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5392 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5393 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5394 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5395 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5396 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5397 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5398 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5399 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5400 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5401 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5402 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5403 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5404 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5405 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5406 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5407 ╰─────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5408
5409                                      Custom Tables
5410 ╭───────────────────┬─────────────────────────────────────────────────────────────────╮
5411 │                   │                                a                                │
5412 │                   ├─────────────────────┬─────────────────────┬─────────────────────┤
5413 │                   │          1          │          2          │          9          │
5414 │                   ├─────────────────────┼─────────────────────┼─────────────────────┤
5415 │                   │          b          │          b          │          b          │
5416 │                   ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5417 │                   │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5418 ├───────────────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5419 │c Valid N          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5420 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5421 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5422 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5423 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5424 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5425 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5426 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5427 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5428 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5429 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5430 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5431 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5432 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5433 │  Layer Row Sum %  │  13.3%│ 10.3%│ 11.3%│  8.9%│  12.6%│ 11.5%│  9.8%│  9.9%│  12.4%│
5434 ╰───────────────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5435
5436                                          Custom Tables
5437 ╭──────────────────────────────┬──────────────────────────────────────────────────────────────╮
5438 │                              │                               a                              │
5439 │                              ├────────────────────┬────────────────────┬────────────────────┤
5440 │                              │          1         │          2         │          9         │
5441 │                              ├────────────────────┼────────────────────┼────────────────────┤
5442 │                              │          b         │          b         │          b         │
5443 │                              ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5444 │                              │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5445 ├──────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5446 │c Unweighted Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5447 │  Unweighted Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5448 │  Unweighted Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5449 │  Unweighted Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5450 │  Unweighted Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5451 │  Unweighted Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5452 │  Unweighted Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5453 │  Unweighted Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5454 │  Unweighted Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5455 │  Unweighted Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5456 │  Unweighted Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5457 │  Unweighted Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5458 ╰──────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5459 ])
5460 AT_CLEANUP
5461
5462 AT_SETUP([CTABLES hidden scale VLABELS])
5463 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5464 AT_DATA([ctables.sps],
5465 [[GET 'nhtsa.sav'.
5466 CTABLES
5467     /TABLE region BY qn19a + qn35
5468     /SLABELS POSITION=ROW.
5469 CTABLES
5470     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5471     /TABLE region BY qn19a + qn35
5472     /SLABELS POSITION=ROW.
5473 CTABLES
5474     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5475     /TABLE region BY qn19a + qn35
5476     /SLABELS POSITION=ROW.
5477
5478 * This one in particular caused a crash because no categories were
5479   created on the column axis, so passing in 0 for the index was still
5480   too big for that number of categories.  It was fixed by creating a
5481   name-only category for each variable despite the "NONE" request,
5482   then hiding the entire dimension's labels if all its labels were
5483   set to "NONE".
5484 CTABLES
5485     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5486     /TABLE region BY qn19a + qn35
5487     /SLABELS POSITION=ROW.
5488 ]])
5489 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5490                                  Custom Tables
5491 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5492 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5493 │              │   when you first starting  │   many times have you driven a  │
5494 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5495 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5496 │              │      sips of alcohol.      │            beverages?           │
5497 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5498 │Region NE Mean│                       19.33│                                2│
5499 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5500 │       MW Mean│                       19.83│                                2│
5501 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5502 │       S  Mean│                       20.29│                                2│
5503 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5504 │       W  Mean│                       19.87│                                2│
5505 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5506
5507                                  Custom Tables
5508 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5509 │              │     │  35. In the past thirty days, how many times have you  │
5510 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5511 │              │QN19A│                  alcoholic beverages?                  │
5512 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5513 │Region NE Mean│19.33│                                                       2│
5514 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5515 │       MW Mean│19.83│                                                       2│
5516 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5517 │       S  Mean│20.29│                                                       2│
5518 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5519 │       W  Mean│19.87│                                                       2│
5520 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5521
5522                                  Custom Tables
5523 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5524 │              │   19a. About how old were you when you first starting   │    │
5525 │              │  drinking alcohol, not counting small tastes or sips of │    │
5526 │              │                         alcohol.                        │qn35│
5527 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5528 │Region NE Mean│                                                    19.33│   2│
5529 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5530 │       MW Mean│                                                    19.83│   2│
5531 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5532 │       S  Mean│                                                    20.29│   2│
5533 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5534 │       W  Mean│                                                    19.87│   2│
5535 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5536
5537       Custom Tables
5538 ╭──────────────┬───────╮
5539 │Region NE Mean│19.33 2│
5540 │      ╶───────┼───────┤
5541 │       MW Mean│19.83 2│
5542 │      ╶───────┼───────┤
5543 │       S  Mean│20.29 2│
5544 │      ╶───────┼───────┤
5545 │       W  Mean│19.87 2│
5546 ╰──────────────┴───────╯
5547 ])
5548 AT_CLEANUP
5549
5550 AT_SETUP([CTABLES with SPLIT FILE])
5551 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5552 AT_DATA([ctables.sps],
5553 [[GET 'nhtsa.sav'.
5554
5555 SORT CASES BY qns3a.
5556
5557 CTABLES /TABLE qn105ba.
5558
5559 * Layered split has no effect on output.
5560 SPLIT FILE BY qns3a.
5561 CTABLES /TABLE qn105ba.
5562
5563 * Add column variable qns3a to compare against separate splits.
5564 CTABLES /TABLE qn105ba BY qns3a.
5565
5566 * Separate splits are truly output separately.
5567 SPLIT FILE SEPARATE BY qns3a.
5568 CTABLES /TABLE qn105ba.
5569 ]])
5570 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5571                                   Custom Tables
5572 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5573 │                                                                        │Count│
5574 ├────────────────────────────────────────────────────────────────────────┼─────┤
5575 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5576 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5577 │                                                            Very likely │ 1502│
5578 │                                                            Somewhat    │ 2763│
5579 │                                                            likely      │     │
5580 │                                                            Somewhat    │ 1307│
5581 │                                                            unlikely    │     │
5582 │                                                            Very        │  609│
5583 │                                                            unlikely    │     │
5584 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5585
5586                                   Custom Tables
5587 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5588 │                                                                        │Count│
5589 ├────────────────────────────────────────────────────────────────────────┼─────┤
5590 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5591 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5592 │                                                            Very likely │ 1502│
5593 │                                                            Somewhat    │ 2763│
5594 │                                                            likely      │     │
5595 │                                                            Somewhat    │ 1307│
5596 │                                                            unlikely    │     │
5597 │                                                            Very        │  609│
5598 │                                                            unlikely    │     │
5599 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5600
5601                                   Custom Tables
5602 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5603 │                                                                 │S3a. GENDER:│
5604 │                                                                 ├─────┬──────┤
5605 │                                                                 │ Male│Female│
5606 │                                                                 ├─────┼──────┤
5607 │                                                                 │Count│ Count│
5608 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5609 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5610 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5611 │the police?                                          Very likely │  660│   842│
5612 │                                                     Somewhat    │ 1174│  1589│
5613 │                                                     likely      │     │      │
5614 │                                                     Somewhat    │  640│   667│
5615 │                                                     unlikely    │     │      │
5616 │                                                     Very        │  311│   298│
5617 │                                                     unlikely    │     │      │
5618 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5619
5620     Split Values
5621 ╭────────────┬─────╮
5622 │Variable    │Value│
5623 ├────────────┼─────┤
5624 │S3a. GENDER:│Male │
5625 ╰────────────┴─────╯
5626
5627                                   Custom Tables
5628 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5629 │                                                                        │Count│
5630 ├────────────────────────────────────────────────────────────────────────┼─────┤
5631 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5632 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5633 │                                                            Very likely │  660│
5634 │                                                            Somewhat    │ 1174│
5635 │                                                            likely      │     │
5636 │                                                            Somewhat    │  640│
5637 │                                                            unlikely    │     │
5638 │                                                            Very        │  311│
5639 │                                                            unlikely    │     │
5640 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5641
5642      Split Values
5643 ╭────────────┬──────╮
5644 │Variable    │ Value│
5645 ├────────────┼──────┤
5646 │S3a. GENDER:│Female│
5647 ╰────────────┴──────╯
5648
5649                                   Custom Tables
5650 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5651 │                                                                        │Count│
5652 ├────────────────────────────────────────────────────────────────────────┼─────┤
5653 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5654 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5655 │                                                            Very likely │  842│
5656 │                                                            Somewhat    │ 1589│
5657 │                                                            likely      │     │
5658 │                                                            Somewhat    │  667│
5659 │                                                            unlikely    │     │
5660 │                                                            Very        │  298│
5661 │                                                            unlikely    │     │
5662 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5663 ])
5664 AT_CLEANUP
5665
5666 AT_SETUP([CTABLES variable level inference])
5667 AT_DATA([data.txt], [dnl
5668 dnl n1 has 10 unique small values -> nominal.
5669 dnl n2 has 23 unique small values -> nominal.
5670 dnl n3 is all missing -> nominal.
5671 dnl s1 has 24 unique small values -> scale.
5672 dnl s2 has one negative value -> scale.
5673 dnl s3 has one non-integer value -> scale.
5674 dnl s4 has no valid values less than 10 -> scale.
5675 dnl s5 has no valid values less than 10,000 -> scale.
5676 1  1  . 1  1  1    10 10001
5677 2  2  . 2  2  2    11 10002
5678 3  3  . 3  3  3    12 10003
5679 4  4  . 4  4  4    13 10004
5680 5  5  . 5  5  5    14 10005
5681 6  6  . 6  6  6    15 10006
5682 7  7  . 7  7  7    16 10007
5683 8  8  . 8  8  8    17 10008
5684 9  9  . 9  9  9    18 10009
5685 10 10 . 10 10 10.5 19 110000
5686 1  11 . 11 -1 1    11 10001
5687 2  12 . 12 2  2    12 10002
5688 3  13 . 13 3  3    13 10003
5689 4  14 . 14 4  4    14 10004
5690 5  15 . 15 5  5    15 10005
5691 6  16 . 16 6  6    16 10006
5692 7  17 . 17 7  7    17 10007
5693 8  18 . 18 8  8    18 10008
5694 9  19 . 19 9  9    19 10009
5695 1  20 . 20 1  1    20 10001
5696 2  21 . 21 2  2    21 10002
5697 3  22 . 22 3  3    22 10003
5698 4  23 . 23 4  4    23 10004
5699 5  23 . 24 5  5    24 10005
5700 6  23 . 24 6  6    25 10006
5701 ])
5702
5703 AT_DATA([ctables.sps], [dnl
5704 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5705
5706 * Nominal formats (copied from data that will default to scale).
5707 COMPUTE n4=s1.
5708 COMPUTE n5=s1.
5709 FORMATS n4(WKDAY5) n5(MONTH5).
5710
5711 * Scale formats (copied from data that will default to nominal).
5712 COMPUTE s6=n1.
5713 COMPUTE s7=n1.
5714 COMPUTE s8=n1.
5715 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5716
5717 STRING string(A8).
5718
5719 DISPLAY DICTIONARY.
5720 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5721 DISPLAY DICTIONARY.
5722 ])
5723
5724 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5725                                     Variables
5726 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5727 │      │        │  Measurement │     │     │         │            │            │
5728 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5729 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5730 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5731 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5732 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5733 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5734 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5735 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5736 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5737 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5738 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5739 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5740 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5741 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5742 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5743 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5744 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5745
5746         Custom Tables
5747 ╭────────────┬─────┬────────╮
5748 │            │Count│  Mean  │
5749 ├────────────┼─────┼────────┤
5750 │n1     1.00 │    3│        │
5751 │       2.00 │    3│        │
5752 │       3.00 │    3│        │
5753 │       4.00 │    3│        │
5754 │       5.00 │    3│        │
5755 │       6.00 │    3│        │
5756 │       7.00 │    2│        │
5757 │       8.00 │    2│        │
5758 │       9.00 │    2│        │
5759 │       10.00│    1│        │
5760 ├────────────┼─────┼────────┤
5761 │n2     1.00 │    1│        │
5762 │       2.00 │    1│        │
5763 │       3.00 │    1│        │
5764 │       4.00 │    1│        │
5765 │       5.00 │    1│        │
5766 │       6.00 │    1│        │
5767 │       7.00 │    1│        │
5768 │       8.00 │    1│        │
5769 │       9.00 │    1│        │
5770 │       10.00│    1│        │
5771 │       11.00│    1│        │
5772 │       12.00│    1│        │
5773 │       13.00│    1│        │
5774 │       14.00│    1│        │
5775 │       15.00│    1│        │
5776 │       16.00│    1│        │
5777 │       17.00│    1│        │
5778 │       18.00│    1│        │
5779 │       19.00│    1│        │
5780 │       20.00│    1│        │
5781 │       21.00│    1│        │
5782 │       22.00│    1│        │
5783 │       23.00│    3│        │
5784 ├────────────┼─────┼────────┤
5785 │string      │   25│        │
5786 ├────────────┼─────┼────────┤
5787 │s1          │     │   12.96│
5788 ├────────────┼─────┼────────┤
5789 │s2          │     │    4.76│
5790 ├────────────┼─────┼────────┤
5791 │s3          │     │    4.86│
5792 ├────────────┼─────┼────────┤
5793 │s4          │     │   16.60│
5794 ├────────────┼─────┼────────┤
5795 │s5          │     │14004.44│
5796 ╰────────────┴─────┴────────╯
5797
5798                                     Variables
5799 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5800 │      │        │  Measurement │     │     │         │            │            │
5801 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5802 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5803 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5804 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5805 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5806 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5807 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5808 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5809 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5810 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5811 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5812 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5813 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5814 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5815 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5816 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5817 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5818 ])
5819 AT_CLEANUP