CTABLES: Always show computed categories even if they'd be zeros.
[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], [dnl
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 dnl PCOMPUTE needs to be an internal exception to omitting empty
1299 dnl categories, but the code didn't always implement that
1300 dnl properly.  This test guards against regression.
1301 AT_SETUP([CTABLES interaction between EMPTY and PCOMPUTE])
1302 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1303 AT_DATA([ctables.sps],
1304 [[GET 'nhtsa.sav'.
1305
1306 * Make sure that "Never" has no responses.
1307 SELECT IF qn1 <> 5.
1308
1309 * This will include "% Not Drivers" even though it has a zero value,
1310 because it is explicitly specified.  It will include "missing" and the
1311 "Not Drivers or Missing" subtotal, even though they are both zero,
1312 because we include empty values.
1313 CTABLES
1314   /PCOMPUTE &all_drivers=EXPR([1 THRU 2] + [3 THRU 4])
1315   /PPROPERTIES &all_drivers LABEL='All Drivers'
1316   /PCOMPUTE &pct_never=EXPR([5] / ([1 THRU 2] + [3 THRU 4] + [5]) * 100)
1317   /PPROPERTIES &pct_never LABEL='% Not Drivers' FORMAT=COUNT PCT40.1
1318   /TABLE=qn1 BY qns3a
1319   /CATEGORIES VARIABLES=qn1
1320   [1 THRU 2, SUBTOTAL='Frequent Drivers',
1321   3 THRU 4, SUBTOTAL='Infrequent Drivers',
1322   &all_drivers, 5, &pct_never,
1323   MISSING, SUBTOTAL='Not Drivers or Missing'].
1324
1325 * This will include "% Not Drivers" even though it has a zero value,
1326 because it is explicitly specified.  It will omit "missing" and the
1327 "Not Drivers or Missing" subtotal because they are both zero and
1328 we have EMPTY=EXCLUDE.
1329 CTABLES
1330   /PCOMPUTE &all_drivers=EXPR([1 THRU 2] + [3 THRU 4])
1331   /PPROPERTIES &all_drivers LABEL='All Drivers'
1332   /PCOMPUTE &pct_never=EXPR([5] / ([1 THRU 2] + [3 THRU 4] + [5]) * 100)
1333   /PPROPERTIES &pct_never LABEL='% Not Drivers' FORMAT=COUNT PCT40.1
1334   /TABLE=qn1 BY qns3a
1335   /CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE
1336   /CATEGORIES VARIABLES=qn1
1337   [1 THRU 2, SUBTOTAL='Frequent Drivers',
1338   3 THRU 4, SUBTOTAL='Infrequent Drivers',
1339   &all_drivers, 5, &pct_never,
1340   MISSING, SUBTOTAL='Not Drivers or Missing'].
1341 ]])
1342 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
1343                                  Custom Tables
1344 ╭────────────────────────────────────────────────────────────────┬────────────╮
1345 │                                                                │S3a. GENDER:│
1346 │                                                                ├─────┬──────┤
1347 │                                                                │ Male│Female│
1348 │                                                                ├─────┼──────┤
1349 │                                                                │Count│ Count│
1350 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
1351 │ 1. How often do you usually drive a car or Every day           │ 2305│  2362│
1352 │other motor vehicle?                        Several days a week │  440│   834│
1353 │                                            Frequent Drivers    │ 2745│  3196│
1354 │                                            Once a week or less │  125│   236│
1355 │                                            Only certain times a│   58│    72│
1356 │                                            year                │     │      │
1357 │                                            Infrequent Drivers  │  183│   308│
1358 │                                            All Drivers         │ 2928│  3504│
1359 │                                            Never               │    0│     0│
1360 │                                            % Not Drivers       │  .0%│   .0%│
1361 │                                            Don't know          │    0│     0│
1362 │                                            Refused             │    0│     0│
1363 │                                            Not Drivers or      │    0│     0│
1364 │                                            Missing             │     │      │
1365 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
1366
1367                                  Custom Tables
1368 ╭────────────────────────────────────────────────────────────────┬────────────╮
1369 │                                                                │S3a. GENDER:│
1370 │                                                                ├─────┬──────┤
1371 │                                                                │ Male│Female│
1372 │                                                                ├─────┼──────┤
1373 │                                                                │Count│ Count│
1374 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
1375 │ 1. How often do you usually drive a car or Every day           │ 2305│  2362│
1376 │other motor vehicle?                        Several days a week │  440│   834│
1377 │                                            Frequent Drivers    │ 2745│  3196│
1378 │                                            Once a week or less │  125│   236│
1379 │                                            Only certain times a│   58│    72│
1380 │                                            year                │     │      │
1381 │                                            Infrequent Drivers  │  183│   308│
1382 │                                            All Drivers         │ 2928│  3504│
1383 │                                            % Not Drivers       │  .0%│   .0%│
1384 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
1385 ])
1386 AT_CLEANUP
1387
1388 AT_SETUP([CTABLES sorting categories])
1389 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1390 AT_DATA([ctables.sps],
1391 [[GET 'nhtsa.sav'.
1392 IF (QND5A=6) QND5A=-1.
1393 IF (QND5A=5) QND5A=-2.
1394 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1395         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1396         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1397         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1398 ]])
1399 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1400                                   Custom Tables
1401 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1402 │                                                                        │Count│
1403 ├────────────────────────────────────────────────────────────────────────┼─────┤
1404 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1405 │background?                                     -1.00                   │   78│
1406 │                                                Cuban                   │   20│
1407 │                                                Mexican                 │  311│
1408 │                                                Spanish                 │   48│
1409 │                                                South American          │   34│
1410 │                                                Central American        │    0│
1411 │                                                Puerto Rican, OR        │    0│
1412 │                                                Something else          │   68│
1413 │                                                Multiple - cannot choose│    7│
1414 │                                                one                     │     │
1415 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1416
1417                                   Custom Tables
1418 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1419 │                                                                        │Count│
1420 ├────────────────────────────────────────────────────────────────────────┼─────┤
1421 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1422 │background?                                     one                     │     │
1423 │                                                Something else          │   68│
1424 │                                                Puerto Rican, OR        │    0│
1425 │                                                Central American        │    0│
1426 │                                                South American          │   34│
1427 │                                                Spanish                 │   48│
1428 │                                                Mexican                 │  311│
1429 │                                                Cuban                   │   20│
1430 │                                                -1.00                   │   78│
1431 │                                                -2.00                   │   52│
1432 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1433
1434                                   Custom Tables
1435 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1436 │                                                                        │Count│
1437 ├────────────────────────────────────────────────────────────────────────┼─────┤
1438 │D5a. What would you say is your primary ethnic  Central American        │    0│
1439 │background?                                     Cuban                   │   20│
1440 │                                                Mexican                 │  311│
1441 │                                                Multiple - cannot choose│    7│
1442 │                                                one                     │     │
1443 │                                                Puerto Rican, OR        │    0│
1444 │                                                Something else          │   68│
1445 │                                                South American          │   34│
1446 │                                                Spanish                 │   48│
1447 │                                                -2.00                   │   52│
1448 │                                                -1.00                   │   78│
1449 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1450
1451                                   Custom Tables
1452 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1453 │                                                                        │Count│
1454 ├────────────────────────────────────────────────────────────────────────┼─────┤
1455 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1456 │background?                                     South American          │   34│
1457 │                                                Something else          │   68│
1458 │                                                Puerto Rican, OR        │    0│
1459 │                                                Multiple - cannot choose│    7│
1460 │                                                one                     │     │
1461 │                                                Mexican                 │  311│
1462 │                                                Cuban                   │   20│
1463 │                                                Central American        │    0│
1464 │                                                -1.00                   │   78│
1465 │                                                -2.00                   │   52│
1466 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1467 ])
1468 AT_CLEANUP
1469
1470 AT_SETUP([CTABLES simple nesting])
1471 AT_KEYWORDS([nest nested])
1472 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1473 AT_DATA([ctables.sps],
1474 [[GET 'nhtsa.sav'.
1475 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1476   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1477 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1478   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1479   /CLABELS ROW=OPPOSITE.
1480 ]])
1481 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1482                                   Custom Tables
1483 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1484 │                                                                 │     │ Table│
1485 │                                                                 │Count│   %  │
1486 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1487 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1488 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1489 │drive safely will A. Get stopped by                        Total │  700│   10%│
1490 │the police?                           ╶──────────────────────────┼─────┼──────┤
1491 │                                       Very       S3a.     Male  │  660│   10%│
1492 │                                       likely     GENDER:  Female│  842│   12%│
1493 │                                                           Total │ 1502│   22%│
1494 │                                      ╶──────────────────────────┼─────┼──────┤
1495 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1496 │                                       likely     GENDER:  Female│ 1589│   23%│
1497 │                                                           Total │ 2763│   40%│
1498 │                                      ╶──────────────────────────┼─────┼──────┤
1499 │                                       Somewhat   S3a.     Male  │  640│    9%│
1500 │                                       unlikely   GENDER:  Female│  667│   10%│
1501 │                                                           Total │ 1307│   19%│
1502 │                                      ╶──────────────────────────┼─────┼──────┤
1503 │                                       Very       S3a.     Male  │  311│    5%│
1504 │                                       unlikely   GENDER:  Female│  298│    4%│
1505 │                                                           Total │  609│    9%│
1506 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1507 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1508 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1509 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1510 │                                      ╶──────────────────────────┼─────┼──────┤
1511 │                                       Very       S3a.     Male  │ 1104│   16%│
1512 │                                       likely     GENDER:  Female│ 1715│   25%│
1513 │                                                           Total │ 2819│   41%│
1514 │                                      ╶──────────────────────────┼─────┼──────┤
1515 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1516 │                                       likely     GENDER:  Female│ 1214│   18%│
1517 │                                                           Total │ 2417│   35%│
1518 │                                      ╶──────────────────────────┼─────┼──────┤
1519 │                                       Somewhat   S3a.     Male  │  262│    4%│
1520 │                                       unlikely   GENDER:  Female│  168│    2%│
1521 │                                                           Total │  430│    6%│
1522 │                                      ╶──────────────────────────┼─────┼──────┤
1523 │                                       Very       S3a.     Male  │   81│    1%│
1524 │                                       unlikely   GENDER:  Female│   59│    1%│
1525 │                                                           Total │  140│    2%│
1526 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1527 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1528 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1529 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1530 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1531 │                                       Very       S3a.     Male  │  988│   14%│
1532 │                                       likely     GENDER:  Female│ 1049│   15%│
1533 │                                                           Total │ 2037│   30%│
1534 │                                      ╶──────────────────────────┼─────┼──────┤
1535 │                                       Somewhat   S3a.     Male  │  822│   12%│
1536 │                                       likely     GENDER:  Female│ 1210│   18%│
1537 │                                                           Total │ 2032│   30%│
1538 │                                      ╶──────────────────────────┼─────┼──────┤
1539 │                                       Somewhat   S3a.     Male  │  446│    7%│
1540 │                                       unlikely   GENDER:  Female│  548│    8%│
1541 │                                                           Total │  994│   15%│
1542 │                                      ╶──────────────────────────┼─────┼──────┤
1543 │                                       Very       S3a.     Male  │  268│    4%│
1544 │                                       unlikely   GENDER:  Female│  354│    5%│
1545 │                                                           Total │  622│    9%│
1546 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1547 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1548 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1549 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1550 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1551 │                                       Very       S3a.     Male  │  805│   12%│
1552 │                                       likely     GENDER:  Female│ 1029│   15%│
1553 │                                                           Total │ 1834│   27%│
1554 │                                      ╶──────────────────────────┼─────┼──────┤
1555 │                                       Somewhat   S3a.     Male  │  975│   14%│
1556 │                                       likely     GENDER:  Female│ 1332│   19%│
1557 │                                                           Total │ 2307│   34%│
1558 │                                      ╶──────────────────────────┼─────┼──────┤
1559 │                                       Somewhat   S3a.     Male  │  535│    8%│
1560 │                                       unlikely   GENDER:  Female│  560│    8%│
1561 │                                                           Total │ 1095│   16%│
1562 │                                      ╶──────────────────────────┼─────┼──────┤
1563 │                                       Very       S3a.     Male  │  270│    4%│
1564 │                                       unlikely   GENDER:  Female│  279│    4%│
1565 │                                                           Total │  549│    8%│
1566 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1567
1568                                   Custom Tables
1569 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1570 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1571 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1572 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1573 │                                 │        │ Table│         │         │        │
1574 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1575 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1576 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1577 │GENDER:        is it that drivers│        │      │         │         │        │
1578 │               who have had too  │        │      │         │         │        │
1579 │               much to drink to  │        │      │         │         │        │
1580 │               drive safely will │        │      │         │         │        │
1581 │               A. Get stopped by │        │      │         │         │        │
1582 │               the police?       │        │      │         │         │        │
1583 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1584 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1585 │               is it that drivers│        │      │         │         │        │
1586 │               who have had too  │        │      │         │         │        │
1587 │               much to drink to  │        │      │         │         │        │
1588 │               drive safely will │        │      │         │         │        │
1589 │               A. Get stopped by │        │      │         │         │        │
1590 │               the police?       │        │      │         │         │        │
1591 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1592 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1593 │               is it that drivers│        │      │         │         │        │
1594 │               who have had too  │        │      │         │         │        │
1595 │               much to drink to  │        │      │         │         │        │
1596 │               drive safely will │        │      │         │         │        │
1597 │               A. Get stopped by │        │      │         │         │        │
1598 │               the police?       │        │      │         │         │        │
1599 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1600 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1601 │GENDER:        is it that drivers│        │      │         │         │        │
1602 │               who have had too  │        │      │         │         │        │
1603 │               much to drink to  │        │      │         │         │        │
1604 │               drive safely will │        │      │         │         │        │
1605 │               B. Have an        │        │      │         │         │        │
1606 │               accident?         │        │      │         │         │        │
1607 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1608 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1609 │               is it that drivers│        │      │         │         │        │
1610 │               who have had too  │        │      │         │         │        │
1611 │               much to drink to  │        │      │         │         │        │
1612 │               drive safely will │        │      │         │         │        │
1613 │               B. Have an        │        │      │         │         │        │
1614 │               accident?         │        │      │         │         │        │
1615 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1616 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1617 │               is it that drivers│        │      │         │         │        │
1618 │               who have had too  │        │      │         │         │        │
1619 │               much to drink to  │        │      │         │         │        │
1620 │               drive safely will │        │      │         │         │        │
1621 │               B. Have an        │        │      │         │         │        │
1622 │               accident?         │        │      │         │         │        │
1623 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1624 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1625 │GENDER:        is it that drivers│        │      │         │         │        │
1626 │               who have had too  │        │      │         │         │        │
1627 │               much to drink to  │        │      │         │         │        │
1628 │               drive safely will │        │      │         │         │        │
1629 │               C. Be convicted   │        │      │         │         │        │
1630 │               for drunk driving?│        │      │         │         │        │
1631 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1632 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1633 │               is it that drivers│        │      │         │         │        │
1634 │               who have had too  │        │      │         │         │        │
1635 │               much to drink to  │        │      │         │         │        │
1636 │               drive safely will │        │      │         │         │        │
1637 │               C. Be convicted   │        │      │         │         │        │
1638 │               for drunk driving?│        │      │         │         │        │
1639 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1640 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1641 │               is it that drivers│        │      │         │         │        │
1642 │               who have had too  │        │      │         │         │        │
1643 │               much to drink to  │        │      │         │         │        │
1644 │               drive safely will │        │      │         │         │        │
1645 │               C. Be convicted   │        │      │         │         │        │
1646 │               for drunk driving?│        │      │         │         │        │
1647 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1648 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1649 │GENDER:        is it that drivers│        │      │         │         │        │
1650 │               who have had too  │        │      │         │         │        │
1651 │               much to drink to  │        │      │         │         │        │
1652 │               drive safely will │        │      │         │         │        │
1653 │               D. Be arrested for│        │      │         │         │        │
1654 │               drunk driving?    │        │      │         │         │        │
1655 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1656 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1657 │               is it that drivers│        │      │         │         │        │
1658 │               who have had too  │        │      │         │         │        │
1659 │               much to drink to  │        │      │         │         │        │
1660 │               drive safely will │        │      │         │         │        │
1661 │               D. Be arrested for│        │      │         │         │        │
1662 │               drunk driving?    │        │      │         │         │        │
1663 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1664 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1665 │               is it that drivers│        │      │         │         │        │
1666 │               who have had too  │        │      │         │         │        │
1667 │               much to drink to  │        │      │         │         │        │
1668 │               drive safely will │        │      │         │         │        │
1669 │               D. Be arrested for│        │      │         │         │        │
1670 │               drunk driving?    │        │      │         │         │        │
1671 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1672 ])
1673 AT_CLEANUP
1674
1675 AT_SETUP([CTABLES nesting and scale variables])
1676 AT_KEYWORDS([nest nested])
1677 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1678 AT_DATA([ctables.sps],
1679 [[GET 'nhtsa.sav'.
1680 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1681 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1682 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1683   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1684 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1685 ]])
1686 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1687                                   Custom Tables
1688 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1689 │                                                                 │S3a. GENDER:│
1690 │                                                                 ├─────┬──────┤
1691 │                                                                 │ Male│Female│
1692 │                                                                 ├─────┼──────┤
1693 │                                                                 │ Mean│ Mean │
1694 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1695 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1696 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1697 │                                                  week           │     │      │
1698 │                                                  Once a week or │   44│    54│
1699 │                                                  less           │     │      │
1700 │                                                  Only certain   │   34│    41│
1701 │                                                  times a year   │     │      │
1702 │                                                  Never          │   39│    55│
1703 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1704
1705                                   Custom Tables
1706 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1707 │                                                         │Minimum│Maximum│Mean│
1708 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1709 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1710 │What is  GENDER:         months, has there been a        │       │       │    │
1711 │your                     time when you felt you          │       │       │    │
1712 │age?                     should cut down on your      No │     16│     86│  46│
1713 │                         drinking?                       │       │       │    │
1714 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1715 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1716 │                         months, has there been a        │       │       │    │
1717 │                         time when you felt you          │       │       │    │
1718 │                         should cut down on your      No │     16│     86│  48│
1719 │                         drinking?                       │       │       │    │
1720 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1721 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1722 │What is  GENDER:         months, has there been a        │       │       │    │
1723 │your                     time when people criticized  No │     16│     86│  46│
1724 │age?                     your drinking?                  │       │       │    │
1725 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1726 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1727 │                         months, has there been a        │       │       │    │
1728 │                         time when people criticized  No │     16│     86│  48│
1729 │                         your drinking?                  │       │       │    │
1730 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1731
1732                                   Custom Tables
1733 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1734 │                             │S1. Including yourself, how many members of this│
1735 │                             │         household are age 16 or older?         │
1736 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1737 │                             │      │      │      │      │      │      │ 6 or │
1738 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1739 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1740 │                             │Column│Column│Column│Column│Column│Column│Column│
1741 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1742 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1743 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1744 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1745 │SOURCE:     likely           │      │      │      │      │      │      │      │
1746 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1747 │            that     likely  │      │      │      │      │      │      │      │
1748 │            drivers          │      │      │      │      │      │      │      │
1749 │            who have         │      │      │      │      │      │      │      │
1750 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1751 │            much to  likely  │      │      │      │      │      │      │      │
1752 │            drink to         │      │      │      │      │      │      │      │
1753 │            drive    Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1754 │            safely   unlikely│      │      │      │      │      │      │      │
1755 │            will A.          │      │      │      │      │      │      │      │
1756 │            Get              │      │      │      │      │      │      │      │
1757 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1758 │            by the   unlikely│      │      │      │      │      │      │      │
1759 │            police?          │      │      │      │      │      │      │      │
1760 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1761
1762                                   Custom Tables
1763 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1764 │                                                              │    │    Std   │
1765 │                                                              │Mean│ Deviation│
1766 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1767 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1768 │group           typical month did you have one or more        │    │          │
1769 │                alcoholic beverages to drink?                 │    │          │
1770 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1771 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1772 │                typical month did you have one or more        │    │          │
1773 │                alcoholic beverages to drink?                 │    │          │
1774 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1775 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1776 │                typical month did you have one or more        │    │          │
1777 │                alcoholic beverages to drink?                 │    │          │
1778 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1779 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1780 │                typical month did you have one or more        │    │          │
1781 │                alcoholic beverages to drink?                 │    │          │
1782 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1783 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1784 │                typical month did you have one or more        │    │          │
1785 │                alcoholic beverages to drink?                 │    │          │
1786 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1787 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1788 │       older    typical month did you have one or more        │    │          │
1789 │                alcoholic beverages to drink?                 │    │          │
1790 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1791 ])
1792 AT_CLEANUP
1793
1794
1795 AT_SETUP([CTABLES SLABELS])
1796 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1797 AT_DATA([ctables.sps],
1798 [[GET 'nhtsa.sav'.
1799 CTABLES /TABLE qn1 [COUNT COLPCT].
1800 CTABLES /TABLE qn1 [COUNT COLPCT]
1801     /SLABELS POSITION=ROW.
1802 CTABLES /TABLE qn1 [COUNT COLPCT]
1803     /SLABELS POSITION=ROW VISIBLE=NO.
1804 ]])
1805 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1806                                   Custom Tables
1807 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1808 │                                                                │     │ Column│
1809 │                                                                │Count│   %   │
1810 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1811 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1812 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1813 │                                             Once a week or less│  361│   5.2%│
1814 │                                             Only certain times │  130│   1.9%│
1815 │                                             a year             │     │       │
1816 │                                             Never              │  540│   7.7%│
1817 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1818
1819                                   Custom Tables
1820 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1821 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1822 │other motor vehicle?                                             Column │66.9%│
1823 │                                                                 %      │     │
1824 │                                            ╶───────────────────────────┼─────┤
1825 │                                             Several days a week Count  │ 1274│
1826 │                                                                 Column │18.3%│
1827 │                                                                 %      │     │
1828 │                                            ╶───────────────────────────┼─────┤
1829 │                                             Once a week or less Count  │  361│
1830 │                                                                 Column │ 5.2%│
1831 │                                                                 %      │     │
1832 │                                            ╶───────────────────────────┼─────┤
1833 │                                             Only certain times  Count  │  130│
1834 │                                             a year              Column │ 1.9%│
1835 │                                                                 %      │     │
1836 │                                            ╶───────────────────────────┼─────┤
1837 │                                             Never               Count  │  540│
1838 │                                                                 Column │ 7.7%│
1839 │                                                                 %      │     │
1840 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1841
1842                                   Custom Tables
1843 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1844 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1845 │motor vehicle?                                                          │66.9%│
1846 │                                                   Several days a week  │ 1274│
1847 │                                                                        │18.3%│
1848 │                                                   Once a week or less  │  361│
1849 │                                                                        │ 5.2%│
1850 │                                                   Only certain times a │  130│
1851 │                                                   year                 │ 1.9%│
1852 │                                                   Never                │  540│
1853 │                                                                        │ 7.7%│
1854 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1855 ])
1856 AT_CLEANUP
1857
1858 AT_SETUP([CTABLES SLABELS with stacking different summaries])
1859 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1860 AT_DATA([ctables.sps],
1861 [[GET 'nhtsa.sav'.
1862 CTABLES
1863     /VLABELS VARIABLES=ALL DISPLAY=NAME
1864     /TABLE qn1 [COUNT] + qnd1 [MEAN] + qn17 [UCOUNT] BY qns3a
1865     /SLABELS POSITION=ROW.
1866 ]])
1867 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1868                          Custom Tables
1869 ╭─────────────────────────────────────────────────┬───────────╮
1870 │                                                 │   QNS3A   │
1871 │                                                 ├────┬──────┤
1872 │                                                 │Male│Female│
1873 ├─────────────────────────────────────────────────┼────┼──────┤
1874 │QN1  Every day                   Count           │2305│  2362│
1875 │    ╶────────────────────────────────────────────┼────┼──────┤
1876 │     Several days a week         Count           │ 440│   834│
1877 │    ╶────────────────────────────────────────────┼────┼──────┤
1878 │     Once a week or less         Count           │ 125│   236│
1879 │    ╶────────────────────────────────────────────┼────┼──────┤
1880 │     Only certain times a year   Count           │  58│    72│
1881 │    ╶────────────────────────────────────────────┼────┼──────┤
1882 │     Never                       Count           │ 192│   348│
1883 ├─────────────────────────────────────────────────┼────┼──────┤
1884 │qnd1 Mean                                        │  46│    50│
1885 ├─────────────────────────────────────────────────┼────┼──────┤
1886 │QN17 OR, something else          Unweighted Count│   1│     1│
1887 │    ╶────────────────────────────────────────────┼────┼──────┤
1888 │     Beer                        Unweighted Count│ 817│   256│
1889 │    ╶────────────────────────────────────────────┼────┼──────┤
1890 │     Light beer                  Unweighted Count│ 406│   214│
1891 │    ╶────────────────────────────────────────────┼────┼──────┤
1892 │     Wine                        Unweighted Count│ 390│  1028│
1893 │    ╶────────────────────────────────────────────┼────┼──────┤
1894 │     Wine coolers                Unweighted Count│  20│   117│
1895 │    ╶────────────────────────────────────────────┼────┼──────┤
1896 │     Hard liquor or mixed drinks Unweighted Count│ 392│   496│
1897 │    ╶────────────────────────────────────────────┼────┼──────┤
1898 │     Flavored malt drinks        Unweighted Count│  20│    63│
1899 ╰─────────────────────────────────────────────────┴────┴──────╯
1900 ])
1901 AT_CLEANUP
1902
1903 AT_SETUP([CTABLES simple totals])
1904 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1905 AT_DATA([ctables.sps],
1906 [[GET 'nhtsa.sav'.
1907 CTABLES /TABLE=qn17
1908     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1909 DESCRIPTIVES qn18/STATISTICS=MEAN.
1910 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1911     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1912 ]])
1913 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1914                                   Custom Tables
1915 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1916 │                                                                        │Count│
1917 ├────────────────────────────────────────────────────────────────────────┼─────┤
1918 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1919 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1920 │                                                      Light beer        │  620│
1921 │                                                      Wine              │ 1418│
1922 │                                                      Wine coolers      │  137│
1923 │                                                      Hard liquor or    │  888│
1924 │                                                      mixed drinks      │     │
1925 │                                                      Flavored malt     │   83│
1926 │                                                      drinks            │     │
1927 │                                                      Number responding │ 4221│
1928 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1929
1930                              Descriptive Statistics
1931 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1932 │                                                                    │  N │Mean│
1933 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1934 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1935 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1936 │Valid N (listwise)                                                  │6999│    │
1937 │Missing N (listwise)                                                │2781│    │
1938 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1939
1940                                   Custom Tables
1941 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1942 │                                                      │    │     │ Valid│Total│
1943 │                                                      │Mean│Count│   N  │  N  │
1944 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1945 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1946 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1947 │                you usually drink per sitting?        │    │     │      │     │
1948 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1949 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1950 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1951 │                you usually drink per sitting?        │    │     │      │     │
1952 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1953 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1954 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1955 │                you usually drink per sitting?        │    │     │      │     │
1956 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1957 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1958 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1959 │                you usually drink per sitting?        │    │     │      │     │
1960 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1961 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1962 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1963 │                you usually drink per sitting?        │    │     │      │     │
1964 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1965 ])
1966 AT_CLEANUP
1967
1968 AT_SETUP([CTABLES subtotals])
1969 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1970 AT_DATA([ctables.sps],
1971 [[GET 'nhtsa.sav'.
1972 CTABLES /TABLE=qn105ba BY qns1
1973     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1974 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1975     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1976 CTABLES /TABLE=qn105ba BY qns1
1977     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1978     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1979 ]])
1980 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1981                                                       Custom Tables
1982 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1983 │                                                         │ S1. Including yourself, how many members of this household │
1984 │                                                         │                    are age 16 or older?                    │
1985 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1986 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1987 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1988 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1989 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1990 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1991 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1992 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1993 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1994 │                                              likely     │       │       │         │       │        │      │          │
1995 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1996 │                                              unlikely   │       │       │         │       │        │      │          │
1997 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1998 │                                              unlikely   │       │       │         │       │        │      │          │
1999 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
2000
2001                                                       Custom Tables
2002 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
2003 │                                                        │  S1. Including yourself, how many members of this household │
2004 │                                                        │                     are age 16 or older?                    │
2005 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
2006 │                                                        │        │        │        │        │       │        │  6 or  │
2007 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
2008 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
2009 │                                                        │        │        │        │        │ Column│        │        │
2010 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
2011 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
2012 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
2013 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
2014 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
2015 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
2016 │                                             likely     │        │        │        │        │       │        │        │
2017 │                                             Subtotal   │       .│   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
2018 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
2019 │                                             unlikely   │        │        │        │        │       │        │        │
2020 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
2021 │                                             unlikely   │        │        │        │        │       │        │        │
2022 │                                             Subtotal   │       .│   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
2023 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
2024
2025                                                       Custom Tables
2026 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
2027 │                                                         │ S1. Including yourself, how many members of this household │
2028 │                                                         │                    are age 16 or older?                    │
2029 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
2030 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
2031 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
2032 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
2033 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
2034 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
2035 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
2036 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
2037 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
2038 │                                              likely     │       │       │         │       │        │      │          │
2039 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
2040 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
2041 │                                              unlikely   │       │       │         │       │        │      │          │
2042 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
2043 │                                              unlikely   │       │       │         │       │        │      │          │
2044 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
2045 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
2046 ])
2047 AT_CLEANUP
2048
2049 AT_SETUP([CTABLES PCOMPUTE])
2050 AT_KEYWORDS([postcompute])
2051 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2052 AT_DATA([ctables.sps],
2053 [[GET 'nhtsa.sav'.
2054 CTABLES
2055     /PCOMPUTE &x=EXPR([3] + [4])
2056     /PCOMPUTE &y=EXPR([4] + [5])
2057     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
2058     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
2059     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
2060     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
2061
2062 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
2063 CTABLES
2064     /PCOMPUTE &x=EXPR([3] + [4])
2065     /PCOMPUTE &y=EXPR([4] + [5])
2066     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
2067     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
2068     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
2069     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
2070 ]])
2071 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2072                                                                 Custom Tables
2073 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
2074 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
2075 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
2076 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
2077 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
2078 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
2079 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
2080 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
2081 │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%│
2082 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2083 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2084 │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%│
2085 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2086 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2087 │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%│
2088 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2089 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2090 │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%│
2091 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2092 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2093 │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%│
2094 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2095 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2096 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
2097
2098                                                                 Custom Tables
2099 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
2100 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
2101 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
2102 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
2103 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
2104 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
2105 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
2106 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
2107 │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%│
2108 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2109 │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%│
2110 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2111 │                               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%│
2112 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2113 │                               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%│
2114 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2115 │                               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%│
2116 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2117 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
2118 ])
2119 AT_CLEANUP
2120
2121 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
2122 AT_KEYWORDS([postcompute])
2123 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2124 AT_DATA([ctables.sps],
2125 [[GET 'nhtsa.sav'.
2126 CTABLES
2127     /PCOMPUTE &x=EXPR(OTHERNM)
2128     /PCOMPUTE &y=EXPR(MISSING)
2129     /PPROPERTIES &x LABEL='Drivers'
2130     /PPROPERTIES &y LABEL='Missing Values 2'
2131     /TABLE=qn1 BY qns3a
2132     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
2133 ]])
2134 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2135                                               Custom Tables
2136 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
2137 │                                                                                          │S3a. GENDER:│
2138 │                                                                                          ├─────┬──────┤
2139 │                                                                                          │ Male│Female│
2140 │                                                                                          ├─────┼──────┤
2141 │                                                                                          │Count│ Count│
2142 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
2143 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
2144 │                                                                 Several days a week      │  440│   834│
2145 │                                                                 Once a week or less      │  125│   236│
2146 │                                                                 Only certain times a year│   58│    72│
2147 │                                                                 Never                    │  192│   348│
2148 │                                                                 Drivers                  │ 2928│  3504│
2149 │                                                                 Valid Values             │ 3120│  3852│
2150 │                                                                 Don't know               │    3│     5│
2151 │                                                                 Refused                  │    9│    10│
2152 │                                                                 Missing Values           │   12│    15│
2153 │                                                                 Missing Values 2         │   12│    15│
2154 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
2155 ])
2156 AT_CLEANUP
2157
2158 AT_SETUP([CTABLES PCOMPUTE - THRU])
2159 AT_KEYWORDS([postcompute])
2160 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2161 AT_DATA([ctables.sps],
2162 [[GET 'nhtsa.sav'.
2163 CTABLES
2164     /PCOMPUTE &x=EXPR([1 THRU 2])
2165     /PCOMPUTE &y=EXPR([3 THRU 4])
2166     /PCOMPUTE &z=EXPR([5] + MISSING)
2167     /PPROPERTIES &x LABEL='Frequent Drivers'
2168     /PPROPERTIES &y LABEL='Infrequent Drivers'
2169     /PPROPERTIES &z LABEL='Not Drivers or Missing'
2170     /TABLE=qn1 BY qns3a
2171     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
2172 ]])
2173 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2174                                               Custom Tables
2175 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
2176 │                                                                                          │S3a. GENDER:│
2177 │                                                                                          ├─────┬──────┤
2178 │                                                                                          │ Male│Female│
2179 │                                                                                          ├─────┼──────┤
2180 │                                                                                          │Count│ Count│
2181 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
2182 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
2183 │                                                                 Several days a week      │  440│   834│
2184 │                                                                 Frequent Drivers         │ 2745│  3196│
2185 │                                                                 Once a week or less      │  125│   236│
2186 │                                                                 Only certain times a year│   58│    72│
2187 │                                                                 Infrequent Drivers       │  183│   308│
2188 │                                                                 Drivers                  │ 2928│  3504│
2189 │                                                                 Never                    │  192│   348│
2190 │                                                                 Don't know               │    3│     5│
2191 │                                                                 Refused                  │    9│    10│
2192 │                                                                 Not Drivers or Missing   │  204│   363│
2193 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
2194 ])
2195 AT_CLEANUP
2196
2197 dnl I'm not sure that this is the correct behavior (see
2198 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
2199 dnl but at least this test will notify us if the behavior changes.
2200 AT_SETUP([CTABLES intersecting PCOMPUTEs])
2201 AT_KEYWORDS([PCOMPUTE postcompute])
2202 AT_DATA([ctables.sps],
2203 [[DATA LIST LIST NOTABLE/x y z.
2204 WEIGHT by z.
2205 FORMATS ALL (F1.0).
2206 VARIABLE LEVEL x y (NOMINAL).
2207 BEGIN DATA.
2208 1 4 5
2209 1 5 2
2210 1 6 9
2211 2 4 2
2212 2 5 3
2213 2 6 4
2214 3 4 1
2215 3 5 6
2216 3 6 1
2217 END DATA.
2218
2219 CTABLES
2220     /PCOMPUTE &a = EXPR([1] + [2])
2221     /PCOMPUTE &b = EXPR([2] + [3])
2222     /PCOMPUTE &c = EXPR([4] * [5])
2223     /PCOMPUTE &d = EXPR([5] * [6])
2224     /TABLE x BY y
2225     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
2226     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
2227 ]])
2228 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
2229 [[                   Custom Tables
2230 ╭───────────┬─────────────────────────────────────╮
2231 │           │                  y                  │
2232 │           ├─────┬─────────┬─────┬─────────┬─────┤
2233 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
2234 │           ├─────┼─────────┼─────┼─────────┼─────┤
2235 │           │Count│  Count  │Count│  Count  │Count│
2236 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
2237 │x 1        │    5│       10│    2│       18│    9│
2238 │  [1] + [2]│    7│        .│    5│        .│   13│
2239 │  2        │    2│        6│    3│       12│    4│
2240 │  [2] + [3]│    3│        .│    9│        .│    5│
2241 │  3        │    1│        6│    6│        6│    1│
2242 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
2243 ]])
2244 AT_CLEANUP
2245
2246 AT_SETUP([CTABLES string and date and time])
2247
2248 weight=1
2249 for gender in F M; do
2250     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
2251         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
2252             printf "$weight $gender $month $wkday\n"
2253             weight=$(expr \( $weight + 3 \) % 7 + 2)
2254         done
2255     done
2256 done > ctables.txt
2257
2258 AT_DATA([ctables.sps],
2259 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
2260     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
2261 WEIGHT by w.
2262 VARIABLE LEVEL w (SCALE).
2263 VARIABLE LEVEL gender fmon fday (NOMINAL).
2264 VARIABLE LABEL
2265   gender 'Gender'
2266   fmon 'Favorite month'
2267   fday 'Favorite day of the week'.
2268 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
2269 CTABLES
2270     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
2271     /PPROPERTIES &q2 LABEL='Q2'
2272     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
2273     /PPROPERTIES &weekend LABEL='Weekend'
2274     /TABLE fmon BY gender > fday
2275     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
2276                                 4 THRU 6, &q2,
2277                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
2278                                 OTHERNM, SUBTOTAL='Q4']
2279     /CATEGORIES VARIABLES=gender ['M', 'F']
2280     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
2281     /SLABELS VISIBLE=NO.
2282 ]])
2283 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2284                                               Custom Tables
2285 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
2286 │                  │                                       Gender                                      │
2287 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
2288 │                  │                   Male                  │                  Female                 │
2289 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
2290 │                  │         Favorite day of the week        │         Favorite day of the week        │
2291 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
2292 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
2293 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
2294 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
2295 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2296 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2297 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│     47│     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│     46│     │
2298 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2299 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2300 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
2301 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
2302 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
2303 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
2304 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2305 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│     86│     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│     91│     │
2306 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2307 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2308 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2309 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│     53│     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│     38│     │
2310 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
2311 ])
2312 AT_CLEANUP
2313
2314 AT_SETUP([CTABLES CLABELS])
2315 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2316 AT_DATA([ctables.sps],
2317 [[GET 'nhtsa.sav'.
2318 CTABLES /TABLE AgeGroup BY qns3a.
2319 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
2320 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
2321 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
2322 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
2323 ]])
2324 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
2325              Custom Tables
2326 ╭───────────────────────┬────────────╮
2327 │                       │S3a. GENDER:│
2328 │                       ├─────┬──────┤
2329 │                       │ Male│Female│
2330 │                       ├─────┼──────┤
2331 │                       │Count│ Count│
2332 ├───────────────────────┼─────┼──────┤
2333 │Age group 15 or younger│    0│     0│
2334 │          16 to 25     │  594│   505│
2335 │          26 to 35     │  476│   491│
2336 │          36 to 45     │  489│   548│
2337 │          46 to 55     │  526│   649│
2338 │          56 to 65     │  516│   731│
2339 │          66 or older  │  531│   943│
2340 ╰───────────────────────┴─────┴──────╯
2341
2342                                                       Custom Tables
2343 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
2344 │       │                                                 S3a. GENDER:                                                 │
2345 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
2346 │       │                         Male                         │                         Female                        │
2347 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
2348 │       │  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 │
2349 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
2350 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2351 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
2352 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2353 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
2354 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
2355 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
2356
2357                 Custom Tables
2358 ╭──────────────────────────────┬────────────╮
2359 │                              │S3a. GENDER:│
2360 │                              ├────────────┤
2361 │                              │    Count   │
2362 ├──────────────────────────────┼────────────┤
2363 │Age group 15 or younger Male  │           0│
2364 │                        Female│           0│
2365 │         ╶────────────────────┼────────────┤
2366 │          16 to 25      Male  │         594│
2367 │                        Female│         505│
2368 │         ╶────────────────────┼────────────┤
2369 │          26 to 35      Male  │         476│
2370 │                        Female│         491│
2371 │         ╶────────────────────┼────────────┤
2372 │          36 to 45      Male  │         489│
2373 │                        Female│         548│
2374 │         ╶────────────────────┼────────────┤
2375 │          46 to 55      Male  │         526│
2376 │                        Female│         649│
2377 │         ╶────────────────────┼────────────┤
2378 │          56 to 65      Male  │         516│
2379 │                        Female│         731│
2380 │         ╶────────────────────┼────────────┤
2381 │          66 or older   Male  │         531│
2382 │                        Female│         943│
2383 ╰──────────────────────────────┴────────────╯
2384
2385       Custom Tables
2386 15 or younger
2387 ╭─────────┬────────────╮
2388 │         │S3a. GENDER:│
2389 │         ├─────┬──────┤
2390 │         │ Male│Female│
2391 │         ├─────┼──────┤
2392 │         │Count│ Count│
2393 ├─────────┼─────┼──────┤
2394 │Age group│    0│     0│
2395 ╰─────────┴─────┴──────╯
2396
2397       Custom Tables
2398 16 to 25
2399 ╭─────────┬────────────╮
2400 │         │S3a. GENDER:│
2401 │         ├─────┬──────┤
2402 │         │ Male│Female│
2403 │         ├─────┼──────┤
2404 │         │Count│ Count│
2405 ├─────────┼─────┼──────┤
2406 │Age group│  594│   505│
2407 ╰─────────┴─────┴──────╯
2408
2409       Custom Tables
2410 26 to 35
2411 ╭─────────┬────────────╮
2412 │         │S3a. GENDER:│
2413 │         ├─────┬──────┤
2414 │         │ Male│Female│
2415 │         ├─────┼──────┤
2416 │         │Count│ Count│
2417 ├─────────┼─────┼──────┤
2418 │Age group│  476│   491│
2419 ╰─────────┴─────┴──────╯
2420
2421       Custom Tables
2422 36 to 45
2423 ╭─────────┬────────────╮
2424 │         │S3a. GENDER:│
2425 │         ├─────┬──────┤
2426 │         │ Male│Female│
2427 │         ├─────┼──────┤
2428 │         │Count│ Count│
2429 ├─────────┼─────┼──────┤
2430 │Age group│  489│   548│
2431 ╰─────────┴─────┴──────╯
2432
2433       Custom Tables
2434 46 to 55
2435 ╭─────────┬────────────╮
2436 │         │S3a. GENDER:│
2437 │         ├─────┬──────┤
2438 │         │ Male│Female│
2439 │         ├─────┼──────┤
2440 │         │Count│ Count│
2441 ├─────────┼─────┼──────┤
2442 │Age group│  526│   649│
2443 ╰─────────┴─────┴──────╯
2444
2445       Custom Tables
2446 56 to 65
2447 ╭─────────┬────────────╮
2448 │         │S3a. GENDER:│
2449 │         ├─────┬──────┤
2450 │         │ Male│Female│
2451 │         ├─────┼──────┤
2452 │         │Count│ Count│
2453 ├─────────┼─────┼──────┤
2454 │Age group│  516│   731│
2455 ╰─────────┴─────┴──────╯
2456
2457       Custom Tables
2458 66 or older
2459 ╭─────────┬────────────╮
2460 │         │S3a. GENDER:│
2461 │         ├─────┬──────┤
2462 │         │ Male│Female│
2463 │         ├─────┼──────┤
2464 │         │Count│ Count│
2465 ├─────────┼─────┼──────┤
2466 │Age group│  531│   943│
2467 ╰─────────┴─────┴──────╯
2468
2469              Custom Tables
2470 Male
2471 ╭───────────────────────┬────────────╮
2472 │                       │S3a. GENDER:│
2473 │                       ├────────────┤
2474 │                       │    Count   │
2475 ├───────────────────────┼────────────┤
2476 │Age group 15 or younger│           0│
2477 │          16 to 25     │         594│
2478 │          26 to 35     │         476│
2479 │          36 to 45     │         489│
2480 │          46 to 55     │         526│
2481 │          56 to 65     │         516│
2482 │          66 or older  │         531│
2483 ╰───────────────────────┴────────────╯
2484
2485              Custom Tables
2486 Female
2487 ╭───────────────────────┬────────────╮
2488 │                       │S3a. GENDER:│
2489 │                       ├────────────┤
2490 │                       │    Count   │
2491 ├───────────────────────┼────────────┤
2492 │Age group 15 or younger│           0│
2493 │          16 to 25     │         505│
2494 │          26 to 35     │         491│
2495 │          36 to 45     │         548│
2496 │          46 to 55     │         649│
2497 │          56 to 65     │         731│
2498 │          66 or older  │         943│
2499 ╰───────────────────────┴────────────╯
2500 ])
2501 AT_CLEANUP
2502
2503 AT_SETUP([CTABLES missing values])
2504 AT_DATA([ctables.sps],
2505 [[DATA LIST LIST NOTABLE/x y.
2506 BEGIN DATA.
2507 1 1
2508 1 2
2509 1 3
2510 1 4
2511 1 5
2512 1 .
2513 2 1
2514 2 2
2515 2 3
2516 2 4
2517 2 5
2518 2 .
2519 3 1
2520 3 2
2521 3 3
2522 3 4
2523 3 5
2524 3 .
2525 4 1
2526 4 2
2527 4 3
2528 4 4
2529 4 5
2530 4 .
2531 5 1
2532 5 2
2533 5 3
2534 5 4
2535 5 5
2536 5 .
2537 . 1
2538 . 2
2539 . 3
2540 . 4
2541 . 5
2542 . .
2543 END DATA.
2544 MISSING VALUES x (1, 2) y (2, 3).
2545 VARIABLE LEVEL ALL (NOMINAL).
2546
2547 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2548                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2549     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2550 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2551                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2552     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2553 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2554                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2555     /CATEGORIES VARIABLES=ALL TOTAL=YES
2556     /SLABELS POSITION=ROW.
2557 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2558                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2559     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2560     /SLABELS POSITION=ROW.
2561 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2562                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2563     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2564     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2565     /SLABELS POSITION=ROW.
2566 ]])
2567 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2568                                Custom Tables
2569 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2570 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2571 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2572 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2573 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2574 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2575 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2576 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2577 dnl Note that Column Total N % doesn't add up to 100 because missing
2578 dnl values are included in the total but not shown as a category and this
2579 dnl is expected behavior.
2580
2581                                Custom Tables
2582 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2583 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2584 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2585 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2586 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2587 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2588 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2589 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2590 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2591 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2592 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2593 dnl values are included in the total but not shown as a category and this
2594 dnl is expected behavior.
2595
2596                      Custom Tables
2597 ╭────────────────────────┬───────────────────────────╮
2598 │                        │             y             │
2599 │                        ├──────┬──────┬──────┬──────┤
2600 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2601 ├────────────────────────┼──────┼──────┼──────┼──────┤
2602 │x 3.00  Count           │     1│     1│     1│     3│
2603 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2604 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2605 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2606 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2607 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2608 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2609 │        Valid N         │      │      │      │     3│
2610 │        Total N         │      │      │      │     6│
2611 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2612 │  4.00  Count           │     1│     1│     1│     3│
2613 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2614 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2615 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2616 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2617 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2618 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2619 │        Valid N         │      │      │      │     3│
2620 │        Total N         │      │      │      │     6│
2621 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2622 │  5.00  Count           │     1│     1│     1│     3│
2623 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2624 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2625 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2626 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2627 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2628 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2629 │        Valid N         │      │      │      │     3│
2630 │        Total N         │      │      │      │     6│
2631 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2632 │  Total Count           │     3│     3│     3│     9│
2633 │        Column %        │100.0%│100.0%│100.0%│     .│
2634 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2635 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2636 │        Row %           │     .│     .│     .│     .│
2637 │        Row Valid N %   │     .│     .│     .│     .│
2638 │        Row Total N %   │     .│     .│     .│     .│
2639 │        Valid N         │     3│     3│     3│     9│
2640 │        Total N         │     3│     3│     3│    18│
2641 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2642
2643                             Custom Tables
2644 ╭────────────────────────┬─────────────────────────────────────────╮
2645 │                        │                    y                    │
2646 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2647 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2648 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2649 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2650 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2651 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2652 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2653 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2654 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2655 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2656 │        Valid N         │      │      │      │      │      │     3│
2657 │        Total N         │      │      │      │      │      │     6│
2658 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2659 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2660 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2661 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2662 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2663 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2664 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2665 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2666 │        Valid N         │      │      │      │      │      │     3│
2667 │        Total N         │      │      │      │      │      │     6│
2668 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2669 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2670 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2671 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2672 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2673 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2674 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2675 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2676 │        Valid N         │      │      │      │      │      │     3│
2677 │        Total N         │      │      │      │      │      │     6│
2678 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2679 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2680 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2681 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2682 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2683 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2684 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2685 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2686 │        Valid N         │      │      │      │      │      │     3│
2687 │        Total N         │      │      │      │      │      │     6│
2688 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2689 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2690 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2691 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2692 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2693 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2694 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2695 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2696 │        Valid N         │      │      │      │      │      │     3│
2697 │        Total N         │      │      │      │      │      │     6│
2698 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2699 │  Total Count           │     5│     5│     5│     5│     5│    25│
2700 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2701 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2702 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2703 │        Row %           │     .│     .│     .│     .│     .│     .│
2704 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2705 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2706 │        Valid N         │     5│     0│     0│     5│     5│    15│
2707 │        Total N         │     5│     5│     5│     5│     5│    30│
2708 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2709
2710                         Custom Tables
2711 ╭────────────────────────┬──────────────────────────────────╮
2712 │                        │                 y                │
2713 │                        ├──────┬──────┬──────┬──────┬──────┤
2714 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2715 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2716 │x 1.00  Count           │     1│     1│     1│     1│     4│
2717 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2718 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2719 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2720 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2721 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2722 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2723 │        Valid N         │      │      │      │      │     3│
2724 │        Total N         │      │      │      │      │     6│
2725 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2726 │  2.00  Count           │     1│     1│     1│     1│     4│
2727 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2728 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2729 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2730 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2731 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2732 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2733 │        Valid N         │      │      │      │      │     3│
2734 │        Total N         │      │      │      │      │     6│
2735 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2736 │  3.00  Count           │     1│     1│     1│     1│     4│
2737 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2738 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2739 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2740 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2741 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2742 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2743 │        Valid N         │      │      │      │      │     3│
2744 │        Total N         │      │      │      │      │     6│
2745 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2746 │  4.00  Count           │     1│     1│     1│     1│     4│
2747 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2748 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2749 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2750 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2751 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2752 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2753 │        Valid N         │      │      │      │      │     3│
2754 │        Total N         │      │      │      │      │     6│
2755 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2756 │  Total Count           │     4│     4│     4│     4│    16│
2757 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2758 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2759 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2760 │        Row %           │     .│     .│     .│     .│     .│
2761 │        Row Valid N %   │     .│     .│     .│     .│     .│
2762 │        Row Total N %   │     .│     .│     .│     .│     .│
2763 │        Valid N         │     4│     0│     4│     4│    12│
2764 │        Total N         │     4│     4│     4│     4│    24│
2765 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2766 ])
2767 AT_CLEANUP
2768
2769 AT_SETUP([CTABLES SMISSING=LISTWISE])
2770 AT_KEYWORDS([SMISSING LISTWISE])
2771 AT_DATA([ctables.sps],
2772 [[DATA LIST LIST NOTABLE/x y z.
2773 BEGIN DATA.
2774 1  . 40
2775 1 10 50
2776 1 20 60
2777 1  .  .
2778 1 30  .
2779 END DATA.
2780 VARIABLE LEVEL x (NOMINAL).
2781
2782 CTABLES /TABLE (y + z) > x.
2783 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2784
2785 * The following doesn't come out as listwise because the tables are
2786 separate, not linked by an > operator.
2787 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2788 ]])
2789 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2790   Custom Tables
2791 ╭────────┬─────╮
2792 │        │ Mean│
2793 ├────────┼─────┤
2794 │y x 1.00│20.00│
2795 ├────────┼─────┤
2796 │z x 1.00│50.00│
2797 ╰────────┴─────╯
2798
2799   Custom Tables
2800 ╭────────┬─────╮
2801 │        │ Mean│
2802 ├────────┼─────┤
2803 │y x 1.00│15.00│
2804 ├────────┼─────┤
2805 │z x 1.00│55.00│
2806 ╰────────┴─────╯
2807
2808   Custom Tables
2809 ╭────────┬─────╮
2810 │        │ Mean│
2811 ├────────┼─────┤
2812 │y x 1.00│20.00│
2813 ├────────┼─────┤
2814 │z x 1.00│50.00│
2815 ╰────────┴─────╯
2816 ])
2817 AT_CLEANUP
2818
2819 AT_SETUP([CTABLES VLABELS - variables on different axes])
2820 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2821 AT_DATA([ctables.sps],
2822 [[GET 'nhtsa.sav'.
2823 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2824 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2825 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2826 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2827 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2828 ]])
2829 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2830                                  Custom Tables
2831 ╭────────────────────────────────────────────────────────────────┬────────────╮
2832 │                                                                │S3a. GENDER:│
2833 │                                                                ├─────┬──────┤
2834 │                                                                │ Male│Female│
2835 │                                                                ├─────┼──────┤
2836 │                                                                │Count│ Count│
2837 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2838 │D5a. What would you say is your primary    Cuban                │   13│     7│
2839 │ethnic background?                         Mexican              │  175│   136│
2840 │                                           Spanish              │   20│    28│
2841 │                                           South American       │   21│    13│
2842 │                                           Central American     │   27│    25│
2843 │                                           Puerto Rican, OR     │   37│    41│
2844 │                                           Something else       │   35│    33│
2845 │                                           Multiple - cannot    │    2│     5│
2846 │                                           choose one           │     │      │
2847 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2848
2849                   Custom Tables
2850 ╭──────────────────────────────────┬────────────╮
2851 │                                  │    QNS3A   │
2852 │                                  ├─────┬──────┤
2853 │                                  │ Male│Female│
2854 │                                  ├─────┼──────┤
2855 │                                  │Count│ Count│
2856 ├──────────────────────────────────┼─────┼──────┤
2857 │QND5A Cuban                       │   13│     7│
2858 │      Mexican                     │  175│   136│
2859 │      Spanish                     │   20│    28│
2860 │      South American              │   21│    13│
2861 │      Central American            │   27│    25│
2862 │      Puerto Rican, OR            │   37│    41│
2863 │      Something else              │   35│    33│
2864 │      Multiple - cannot choose one│    2│     5│
2865 ╰──────────────────────────────────┴─────┴──────╯
2866
2867                                  Custom Tables
2868 ╭────────────────────────────────────────────────────────────────┬────────────╮
2869 │                                                                │S3a. GENDER:│
2870 │                                                                ├─────┬──────┤
2871 │                                                                │ Male│Female│
2872 │                                                                ├─────┼──────┤
2873 │                                                                │Count│ Count│
2874 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2875 │D5a. What would you say is your primary    Cuban                │   13│     7│
2876 │ethnic background?                         Mexican              │  175│   136│
2877 │                                           Spanish              │   20│    28│
2878 │                                           South American       │   21│    13│
2879 │                                           Central American     │   27│    25│
2880 │                                           Puerto Rican, OR     │   37│    41│
2881 │                                           Something else       │   35│    33│
2882 │                                           Multiple - cannot    │    2│     5│
2883 │                                           choose one           │     │      │
2884 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2885
2886                                  Custom Tables
2887 ╭────────────────────────────────────────────────────────────┬────────────────╮
2888 │                                                            │   QNS3A S3a.   │
2889 │                                                            │     GENDER:    │
2890 │                                                            ├───────┬────────┤
2891 │                                                            │  Male │ Female │
2892 │                                                            ├───────┼────────┤
2893 │                                                            │ Count │  Count │
2894 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2895 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2896 │primary ethnic background?               Mexican            │    175│     136│
2897 │                                         Spanish            │     20│      28│
2898 │                                         South American     │     21│      13│
2899 │                                         Central American   │     27│      25│
2900 │                                         Puerto Rican, OR   │     37│      41│
2901 │                                         Something else     │     35│      33│
2902 │                                         Multiple - cannot  │      2│       5│
2903 │                                         choose one         │       │        │
2904 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2905
2906                Custom Tables
2907 ╭────────────────────────────┬─────┬──────╮
2908 │                            │ Male│Female│
2909 │                            ├─────┼──────┤
2910 │                            │Count│ Count│
2911 ├────────────────────────────┼─────┼──────┤
2912 │Cuban                       │   13│     7│
2913 │Mexican                     │  175│   136│
2914 │Spanish                     │   20│    28│
2915 │South American              │   21│    13│
2916 │Central American            │   27│    25│
2917 │Puerto Rican, OR            │   37│    41│
2918 │Something else              │   35│    33│
2919 │Multiple - cannot choose one│    2│     5│
2920 ╰────────────────────────────┴─────┴──────╯
2921 ])
2922 AT_CLEANUP
2923
2924 AT_SETUP([CTABLES VLABELS - stacked variables])
2925 AT_KEYWORDS([stack stacking])
2926 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2927 AT_DATA([ctables.sps],
2928 [[GET 'nhtsa.sav'.
2929 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2930 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2931 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2932 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2933 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2934 ]])
2935 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2936                                  Custom Tables
2937 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2938 │                                                                       │Count│
2939 ├───────────────────────────────────────────────────────────────────────┼─────┤
2940 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2941 │background?                                     Mexican                │  311│
2942 │                                                Spanish                │   48│
2943 │                                                South American         │   34│
2944 │                                                Central American       │   52│
2945 │                                                Puerto Rican, OR       │   78│
2946 │                                                Something else         │   68│
2947 │                                                Multiple - cannot      │    7│
2948 │                                                choose one             │     │
2949 ├───────────────────────────────────────────────────────────────────────┼─────┤
2950 │QNS3A                                           Male                   │ 3132│
2951 │                                                Female                 │ 3867│
2952 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2953
2954                   Custom Tables
2955 ╭─────────────────────────────────────────┬─────╮
2956 │                                         │Count│
2957 ├─────────────────────────────────────────┼─────┤
2958 │QND5A        Cuban                       │   20│
2959 │             Mexican                     │  311│
2960 │             Spanish                     │   48│
2961 │             South American              │   34│
2962 │             Central American            │   52│
2963 │             Puerto Rican, OR            │   78│
2964 │             Something else              │   68│
2965 │             Multiple - cannot choose one│    7│
2966 ├─────────────────────────────────────────┼─────┤
2967 │S3a. GENDER: Male                        │ 3132│
2968 │             Female                      │ 3867│
2969 ╰─────────────────────────────────────────┴─────╯
2970
2971                                  Custom Tables
2972 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2973 │                                                                       │Count│
2974 ├───────────────────────────────────────────────────────────────────────┼─────┤
2975 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2976 │background?                                     Mexican                │  311│
2977 │                                                Spanish                │   48│
2978 │                                                South American         │   34│
2979 │                                                Central American       │   52│
2980 │                                                Puerto Rican, OR       │   78│
2981 │                                                Something else         │   68│
2982 │                                                Multiple - cannot      │    7│
2983 │                                                choose one             │     │
2984 ├───────────────────────────────────────────────────────────────────────┼─────┤
2985 │Male                                                                   │ 3132│
2986 ├───────────────────────────────────────────────────────────────────────┼─────┤
2987 │Female                                                                 │ 3867│
2988 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2989
2990             Custom Tables
2991 ╭─────────────────────────────┬─────╮
2992 │                             │Count│
2993 ├─────────────────────────────┼─────┤
2994 │Cuban                        │   20│
2995 ├─────────────────────────────┼─────┤
2996 │Mexican                      │  311│
2997 ├─────────────────────────────┼─────┤
2998 │Spanish                      │   48│
2999 ├─────────────────────────────┼─────┤
3000 │South American               │   34│
3001 ├─────────────────────────────┼─────┤
3002 │Central American             │   52│
3003 ├─────────────────────────────┼─────┤
3004 │Puerto Rican, OR             │   78│
3005 ├─────────────────────────────┼─────┤
3006 │Something else               │   68│
3007 ├─────────────────────────────┼─────┤
3008 │Multiple - cannot choose one │    7│
3009 ├─────────────────────────────┼─────┤
3010 │S3a. GENDER:     Male        │ 3132│
3011 │                 Female      │ 3867│
3012 ╰─────────────────────────────┴─────╯
3013
3014             Custom Tables
3015 ╭────────────────────────────┬─────╮
3016 │                            │Count│
3017 ├────────────────────────────┼─────┤
3018 │Cuban                       │   20│
3019 │Mexican                     │  311│
3020 │Spanish                     │   48│
3021 │South American              │   34│
3022 │Central American            │   52│
3023 │Puerto Rican, OR            │   78│
3024 │Something else              │   68│
3025 │Multiple - cannot choose one│    7│
3026 │Male                        │ 3132│
3027 │Female                      │ 3867│
3028 ╰────────────────────────────┴─────╯
3029 ])
3030 AT_CLEANUP
3031
3032 AT_SETUP([CTABLES VLABELS - nested variables])
3033 AT_KEYWORDS([nest nesting])
3034 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3035 AT_DATA([ctables.sps],
3036 [[GET 'nhtsa.sav'.
3037 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
3038 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
3039 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
3040 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
3041 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
3042 ]])
3043 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3044                                  Custom Tables
3045 ╭───────────────────────────────────────────────────────────────────────┬─────╮
3046 │                                                                       │Count│
3047 ├───────────────────────────────────────────────────────────────────────┼─────┤
3048 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
3049 │primary ethnic background?                                       Female│    7│
3050 │                                     ╶─────────────────────────────────┼─────┤
3051 │                                      Mexican              QNS3A Male  │  175│
3052 │                                                                 Female│  136│
3053 │                                     ╶─────────────────────────────────┼─────┤
3054 │                                      Spanish              QNS3A Male  │   20│
3055 │                                                                 Female│   28│
3056 │                                     ╶─────────────────────────────────┼─────┤
3057 │                                      South American       QNS3A Male  │   21│
3058 │                                                                 Female│   13│
3059 │                                     ╶─────────────────────────────────┼─────┤
3060 │                                      Central American     QNS3A Male  │   27│
3061 │                                                                 Female│   25│
3062 │                                     ╶─────────────────────────────────┼─────┤
3063 │                                      Puerto Rican, OR     QNS3A Male  │   37│
3064 │                                                                 Female│   41│
3065 │                                     ╶─────────────────────────────────┼─────┤
3066 │                                      Something else       QNS3A Male  │   35│
3067 │                                                                 Female│   33│
3068 │                                     ╶─────────────────────────────────┼─────┤
3069 │                                      Multiple - cannot    QNS3A Male  │    2│
3070 │                                      choose one                 Female│    5│
3071 ╰───────────────────────────────────────────────────────────────────────┴─────╯
3072
3073                          Custom Tables
3074 ╭──────────────────────────────────────────────────────┬─────╮
3075 │                                                      │Count│
3076 ├──────────────────────────────────────────────────────┼─────┤
3077 │QND5A Cuban                        S3a. GENDER: Male  │   13│
3078 │                                                Female│    7│
3079 │     ╶────────────────────────────────────────────────┼─────┤
3080 │      Mexican                      S3a. GENDER: Male  │  175│
3081 │                                                Female│  136│
3082 │     ╶────────────────────────────────────────────────┼─────┤
3083 │      Spanish                      S3a. GENDER: Male  │   20│
3084 │                                                Female│   28│
3085 │     ╶────────────────────────────────────────────────┼─────┤
3086 │      South American               S3a. GENDER: Male  │   21│
3087 │                                                Female│   13│
3088 │     ╶────────────────────────────────────────────────┼─────┤
3089 │      Central American             S3a. GENDER: Male  │   27│
3090 │                                                Female│   25│
3091 │     ╶────────────────────────────────────────────────┼─────┤
3092 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
3093 │                                                Female│   41│
3094 │     ╶────────────────────────────────────────────────┼─────┤
3095 │      Something else               S3a. GENDER: Male  │   35│
3096 │                                                Female│   33│
3097 │     ╶────────────────────────────────────────────────┼─────┤
3098 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
3099 │                                                Female│    5│
3100 ╰──────────────────────────────────────────────────────┴─────╯
3101
3102                                  Custom Tables
3103 ╭───────────────────────────────────────────────────────────────────────┬─────╮
3104 │                                                                       │Count│
3105 ├───────────────────────────────────────────────────────────────────────┼─────┤
3106 │D5a. What would you say is your primary    Cuban                 Male  │   13│
3107 │ethnic background?                                               Female│    7│
3108 │                                          ╶────────────────────────────┼─────┤
3109 │                                           Mexican               Male  │  175│
3110 │                                                                 Female│  136│
3111 │                                          ╶────────────────────────────┼─────┤
3112 │                                           Spanish               Male  │   20│
3113 │                                                                 Female│   28│
3114 │                                          ╶────────────────────────────┼─────┤
3115 │                                           South American        Male  │   21│
3116 │                                                                 Female│   13│
3117 │                                          ╶────────────────────────────┼─────┤
3118 │                                           Central American      Male  │   27│
3119 │                                                                 Female│   25│
3120 │                                          ╶────────────────────────────┼─────┤
3121 │                                           Puerto Rican, OR      Male  │   37│
3122 │                                                                 Female│   41│
3123 │                                          ╶────────────────────────────┼─────┤
3124 │                                           Something else        Male  │   35│
3125 │                                                                 Female│   33│
3126 │                                          ╶────────────────────────────┼─────┤
3127 │                                           Multiple - cannot     Male  │    2│
3128 │                                           choose one            Female│    5│
3129 ╰───────────────────────────────────────────────────────────────────────┴─────╯
3130
3131                       Custom Tables
3132 ╭────────────────────────────────────────────────┬─────╮
3133 │                                                │Count│
3134 ├────────────────────────────────────────────────┼─────┤
3135 │Cuban                        S3a. GENDER: Male  │   13│
3136 │                                          Female│    7│
3137 ├────────────────────────────────────────────────┼─────┤
3138 │Mexican                      S3a. GENDER: Male  │  175│
3139 │                                          Female│  136│
3140 ├────────────────────────────────────────────────┼─────┤
3141 │Spanish                      S3a. GENDER: Male  │   20│
3142 │                                          Female│   28│
3143 ├────────────────────────────────────────────────┼─────┤
3144 │South American               S3a. GENDER: Male  │   21│
3145 │                                          Female│   13│
3146 ├────────────────────────────────────────────────┼─────┤
3147 │Central American             S3a. GENDER: Male  │   27│
3148 │                                          Female│   25│
3149 ├────────────────────────────────────────────────┼─────┤
3150 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
3151 │                                          Female│   41│
3152 ├────────────────────────────────────────────────┼─────┤
3153 │Something else               S3a. GENDER: Male  │   35│
3154 │                                          Female│   33│
3155 ├────────────────────────────────────────────────┼─────┤
3156 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
3157 │                                          Female│    5│
3158 ╰────────────────────────────────────────────────┴─────╯
3159
3160                Custom Tables
3161 ╭───────────────────────────────────┬─────╮
3162 │                                   │Count│
3163 ├───────────────────────────────────┼─────┤
3164 │Cuban                        Male  │   13│
3165 │                             Female│    7│
3166 ├───────────────────────────────────┼─────┤
3167 │Mexican                      Male  │  175│
3168 │                             Female│  136│
3169 ├───────────────────────────────────┼─────┤
3170 │Spanish                      Male  │   20│
3171 │                             Female│   28│
3172 ├───────────────────────────────────┼─────┤
3173 │South American               Male  │   21│
3174 │                             Female│   13│
3175 ├───────────────────────────────────┼─────┤
3176 │Central American             Male  │   27│
3177 │                             Female│   25│
3178 ├───────────────────────────────────┼─────┤
3179 │Puerto Rican, OR             Male  │   37│
3180 │                             Female│   41│
3181 ├───────────────────────────────────┼─────┤
3182 │Something else               Male  │   35│
3183 │                             Female│   33│
3184 ├───────────────────────────────────┼─────┤
3185 │Multiple - cannot choose one Male  │    2│
3186 │                             Female│    5│
3187 ╰───────────────────────────────────┴─────╯
3188 ])
3189 AT_CLEANUP
3190
3191 AT_SETUP([CTABLES FORMAT EMPTY])
3192 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3193 AT_DATA([ctables.sps],
3194 [[GET 'nhtsa.sav'.
3195 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
3196 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
3197 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
3198 ]])
3199 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3200                                  Custom Tables
3201 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3202 │                                             │   D5. ETHNICITY: Are you of   │
3203 │                                             │  Hispanic or Latino origin or │
3204 │                                             │            descent?           │
3205 │                                             ├───────────────┬───────────────┤
3206 │                                             │      Yes      │       No      │
3207 │                                             ├───────────────┼───────────────┤
3208 │                                             │     Count     │     Count     │
3209 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3210 │D5a. What would you say is   Cuban           │             20│              0│
3211 │your primary ethnic          Mexican         │            311│              0│
3212 │background?                  Spanish         │             48│              0│
3213 │                             South American  │             34│              0│
3214 │                             Central American│             52│              0│
3215 │                             Puerto Rican, OR│             78│              0│
3216 │                             Something else  │             68│              0│
3217 │                             Multiple -      │              7│              0│
3218 │                             cannot choose   │               │               │
3219 │                             one             │               │               │
3220 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3221
3222                                  Custom Tables
3223 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3224 │                                             │   D5. ETHNICITY: Are you of   │
3225 │                                             │  Hispanic or Latino origin or │
3226 │                                             │            descent?           │
3227 │                                             ├───────────────┬───────────────┤
3228 │                                             │      Yes      │       No      │
3229 │                                             ├───────────────┼───────────────┤
3230 │                                             │     Count     │     Count     │
3231 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3232 │D5a. What would you say is   Cuban           │             20│               │
3233 │your primary ethnic          Mexican         │            311│               │
3234 │background?                  Spanish         │             48│               │
3235 │                             South American  │             34│               │
3236 │                             Central American│             52│               │
3237 │                             Puerto Rican, OR│             78│               │
3238 │                             Something else  │             68│               │
3239 │                             Multiple -      │              7│               │
3240 │                             cannot choose   │               │               │
3241 │                             one             │               │               │
3242 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3243
3244                                  Custom Tables
3245 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3246 │                                             │   D5. ETHNICITY: Are you of   │
3247 │                                             │  Hispanic or Latino origin or │
3248 │                                             │            descent?           │
3249 │                                             ├───────────────┬───────────────┤
3250 │                                             │      Yes      │       No      │
3251 │                                             ├───────────────┼───────────────┤
3252 │                                             │     Count     │     Count     │
3253 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3254 │D5a. What would you say is   Cuban           │             20│n/a            │
3255 │your primary ethnic          Mexican         │            311│n/a            │
3256 │background?                  Spanish         │             48│n/a            │
3257 │                             South American  │             34│n/a            │
3258 │                             Central American│             52│n/a            │
3259 │                             Puerto Rican, OR│             78│n/a            │
3260 │                             Something else  │             68│n/a            │
3261 │                             Multiple -      │              7│n/a            │
3262 │                             cannot choose   │               │               │
3263 │                             one             │               │               │
3264 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3265 ])
3266 AT_CLEANUP
3267
3268 AT_SETUP([CTABLES FORMAT MISSING])
3269 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3270 AT_DATA([ctables.sps],
3271 [[GET 'nhtsa.sav'.
3272 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
3273 ]])
3274 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3275                                  Custom Tables
3276 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3277 │                                             │   D5. ETHNICITY: Are you of   │
3278 │                                             │  Hispanic or Latino origin or │
3279 │                                             │            descent?           │
3280 │                                             ├───────────────┬───────────────┤
3281 │                                             │      Yes      │       No      │
3282 │                                             ├───────────────┼───────────────┤
3283 │                                             │    Column %   │    Column %   │
3284 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3285 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
3286 │your primary ethnic          Mexican         │          50.3%│(no data)      │
3287 │background?                  Spanish         │           7.8%│(no data)      │
3288 │                             South American  │           5.5%│(no data)      │
3289 │                             Central American│           8.4%│(no data)      │
3290 │                             Puerto Rican, OR│          12.6%│(no data)      │
3291 │                             Something else  │          11.0%│(no data)      │
3292 │                             Multiple -      │           1.1%│(no data)      │
3293 │                             cannot choose   │               │               │
3294 │                             one             │               │               │
3295 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3296 ])
3297 AT_CLEANUP
3298
3299 AT_SETUP([CTABLES HIDESMALLCOUNTS])
3300 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3301 AT_DATA([ctables.sps],
3302 [[GET 'nhtsa.sav'.
3303 CTABLES /TABLE qn38[c][COUNT, COLPCT].
3304 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
3305 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
3306 ]])
3307 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3308                                  Custom Tables
3309 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3310 │                                                              │Count│Column %│
3311 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3312 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3313 │occasion?                                        1            │  491│   34.9%│
3314 │                                                 2            │  462│   32.9%│
3315 │                                                 3            │  229│   16.3%│
3316 │                                                 4            │   82│    5.8%│
3317 │                                                 5            │   56│    4.0%│
3318 │                                                 6            │   32│    2.3%│
3319 │                                                 7            │    9│     .6%│
3320 │                                                 8            │    8│     .6%│
3321 │                                                 9            │    4│     .3%│
3322 │                                                 10           │    6│     .4%│
3323 │                                                 11           │    2│     .1%│
3324 │                                                 12           │    5│     .4%│
3325 │                                                 14           │    1│     .1%│
3326 │                                                 15           │    1│     .1%│
3327 │                                                 18           │    1│     .1%│
3328 │                                                 20           │    4│     .3%│
3329 │                                                 25           │    1│     .1%│
3330 │                                                 30           │    3│     .2%│
3331 │                                                 60           │    1│     .1%│
3332 │                                                 99+          │    0│     .0%│
3333 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3334
3335                                  Custom Tables
3336 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3337 │                                                              │Count│Column %│
3338 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3339 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3340 │occasion?                                        1            │  491│   34.9%│
3341 │                                                 2            │  462│   32.9%│
3342 │                                                 3            │  229│   16.3%│
3343 │                                                 4            │   82│    5.8%│
3344 │                                                 5            │   56│    4.0%│
3345 │                                                 6            │   32│    2.3%│
3346 │                                                 7            │    9│     .6%│
3347 │                                                 8            │    8│     .6%│
3348 │                                                 9            │<5   │     .3%│
3349 │                                                 10           │    6│     .4%│
3350 │                                                 11           │<5   │     .1%│
3351 │                                                 12           │    5│     .4%│
3352 │                                                 14           │<5   │     .1%│
3353 │                                                 15           │<5   │     .1%│
3354 │                                                 18           │<5   │     .1%│
3355 │                                                 20           │<5   │     .3%│
3356 │                                                 25           │<5   │     .1%│
3357 │                                                 30           │<5   │     .2%│
3358 │                                                 60           │<5   │     .1%│
3359 │                                                 99+          │<5   │     .0%│
3360 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3361
3362                                  Custom Tables
3363 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3364 │                                                              │Count│Column %│
3365 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3366 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
3367 │occasion?                                        1            │  491│   34.9%│
3368 │                                                 2            │  462│   32.9%│
3369 │                                                 3            │  229│   16.3%│
3370 │                                                 4            │   82│    5.8%│
3371 │                                                 5            │   56│    4.0%│
3372 │                                                 6            │   32│    2.3%│
3373 │                                                 7            │<10  │     .6%│
3374 │                                                 8            │<10  │     .6%│
3375 │                                                 9            │<10  │     .3%│
3376 │                                                 10           │<10  │     .4%│
3377 │                                                 11           │<10  │     .1%│
3378 │                                                 12           │<10  │     .4%│
3379 │                                                 14           │<10  │     .1%│
3380 │                                                 15           │<10  │     .1%│
3381 │                                                 18           │<10  │     .1%│
3382 │                                                 20           │<10  │     .3%│
3383 │                                                 25           │<10  │     .1%│
3384 │                                                 30           │<10  │     .2%│
3385 │                                                 60           │<10  │     .1%│
3386 │                                                 99+          │<10  │     .0%│
3387 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3388 ])
3389 AT_CLEANUP
3390
3391 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
3392 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3393 AT_DATA([ctables.sps],
3394 [[GET 'nhtsa.sav'.
3395 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
3396 ]])
3397 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
3398  Custom Tables
3399 ╭────────────╮
3400 │S3a. GENDER:│
3401 ├─────┬──────┤
3402 │ Male│Female│
3403 ├─────┼──────┤
3404 │Count│ Count│
3405 ├─────┼──────┤
3406 │ 3132│  3867│
3407 ╰─────┴──────╯
3408 ])
3409 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
3410 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
3411 maximumColumnWidth="192"
3412 minimumColumnWidth="96"
3413 ])
3414 AT_CLEANUP
3415
3416 AT_SETUP([CTABLES special formats])
3417 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
3418 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3419 AT_DATA([ctables.sps],
3420 [[GET 'nhtsa.sav'.
3421 COMPUTE x = qnd3 - 4.
3422 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].
3423 ]])
3424 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3425                            Custom Tables
3426 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
3427 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
3428 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
3429 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
3430 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
3431 ])
3432 AT_CLEANUP
3433
3434 AT_SETUP([CTABLES TITLES])
3435 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3436 AT_DATA([ctables.sps],
3437 [[GET 'nhtsa.sav'.
3438 CTABLES
3439     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3440     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3441     /TITLES TITLE='How often do you drive?' 'second line of title'
3442             CAPTION='Generated )TIME on )DATE'
3443             CORNER=')TABLE'.
3444 ]])
3445 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3446 s&../../..&MM/DD/YY&'], [0], [dnl
3447                             How often do you drive?
3448                               second line of title
3449 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3450 │                                   │               S3a. GENDER:              │
3451 │                                   ├────────────────────┬────────────────────┤
3452 │                                   │        Male        │       Female       │
3453 │                                   ├────────────────────┼────────────────────┤
3454 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3455 │                                   │ you of Hispanic or │ you of Hispanic or │
3456 │                                   │  Latino origin or  │  Latino origin or  │
3457 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3458 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3459 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3460 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3461 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3462 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3463 │Every day                          │      218│      2066│      166│      2175│
3464 │Several days a week                │       44│       391│       45│       782│
3465 │Once a week or less                │       16│       109│       12│       223│
3466 │Only certain times a year          │       15│        41│       11│        61│
3467 │Never                              │       39│       150│       56│       278│
3468 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3469 Generated HH:MM:SS on MM/DD/YY
3470 ])
3471 AT_CLEANUP
3472
3473 AT_SETUP([CTABLES area definitions])
3474 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3475 AT_DATA([ctables.sps],
3476 [[GET 'nhtsa.sav'.
3477 CTABLES
3478     /VLABELS VARIABLES=ALL DISPLAY=NAME
3479     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3480     /SLABELS POSITION=ROW
3481     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3482     /SLABELS POSITION=ROW
3483     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3484     /SLABELS POSITION=ROW.
3485 ]])
3486 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3487                     Custom Tables
3488 Male
3489 ╭─────────────────────────────┬─────────────┬──────╮
3490 │                             │    QND7A    │ QN64B│
3491 │                             ├──────┬──────┼───┬──┤
3492 │                             │  Yes │  No  │   │  │
3493 │                             ├──────┼──────┤   │  │
3494 │                             │ QN86 │ QN86 │   │  │
3495 │                             ├───┬──┼───┬──┤   │  │
3496 │                             │Yes│No│Yes│No│Yes│No│
3497 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3498 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3499 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3500 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3501 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3502 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3503 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3504 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3505 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3506 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3507 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3508 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3509 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3510 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3511 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3512 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3513 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3514
3515                     Custom Tables
3516 Female
3517 ╭─────────────────────────────┬─────────────┬──────╮
3518 │                             │    QND7A    │ QN64B│
3519 │                             ├──────┬──────┼───┬──┤
3520 │                             │  Yes │  No  │   │  │
3521 │                             ├──────┼──────┤   │  │
3522 │                             │ QN86 │ QN86 │   │  │
3523 │                             ├───┬──┼───┬──┤   │  │
3524 │                             │Yes│No│Yes│No│Yes│No│
3525 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3526 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3527 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3528 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3529 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3530 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3531 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3532 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3533 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3534 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3535 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3536 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3537 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3538 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3539 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3540 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3541 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3542
3543                     Custom Tables
3544 Male
3545 ╭──────────────────────────────┬─────────────┬──────╮
3546 │                              │    QND7A    │ QN64B│
3547 │                              ├──────┬──────┼───┬──┤
3548 │                              │  Yes │  No  │   │  │
3549 │                              ├──────┼──────┤   │  │
3550 │                              │ QN86 │ QN86 │   │  │
3551 │                              ├───┬──┼───┬──┤   │  │
3552 │                              │Yes│No│Yes│No│Yes│No│
3553 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3554 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3555 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3556 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3557 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3558 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3559 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3560 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3561 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3562 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3563 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3564 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3565 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3566
3567                     Custom Tables
3568 Female
3569 ╭──────────────────────────────┬─────────────┬──────╮
3570 │                              │    QND7A    │ QN64B│
3571 │                              ├──────┬──────┼───┬──┤
3572 │                              │  Yes │  No  │   │  │
3573 │                              ├──────┼──────┤   │  │
3574 │                              │ QN86 │ QN86 │   │  │
3575 │                              ├───┬──┼───┬──┤   │  │
3576 │                              │Yes│No│Yes│No│Yes│No│
3577 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3578 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3579 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3580 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3581 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3582 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3583 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3584 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3585 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3586 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3587 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3588 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3589 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3590
3591                       Custom Tables
3592 Male
3593 ╭─────────────────────────────────┬─────────────┬──────╮
3594 │                                 │    QND7A    │ QN64B│
3595 │                                 ├──────┬──────┼───┬──┤
3596 │                                 │  Yes │  No  │   │  │
3597 │                                 ├──────┼──────┤   │  │
3598 │                                 │ QN86 │ QN86 │   │  │
3599 │                                 ├───┬──┼───┬──┤   │  │
3600 │                                 │Yes│No│Yes│No│Yes│No│
3601 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3602 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3603 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3604 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3605 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3606 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3607 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3608 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3609 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3610 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3611 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3612 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3613 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3614
3615                       Custom Tables
3616 Female
3617 ╭─────────────────────────────────┬─────────────┬──────╮
3618 │                                 │    QND7A    │ QN64B│
3619 │                                 ├──────┬──────┼───┬──┤
3620 │                                 │  Yes │  No  │   │  │
3621 │                                 ├──────┼──────┤   │  │
3622 │                                 │ QN86 │ QN86 │   │  │
3623 │                                 ├───┬──┼───┬──┤   │  │
3624 │                                 │Yes│No│Yes│No│Yes│No│
3625 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3626 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3627 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3628 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3629 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3630 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3631 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3632 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3633 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3634 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3635 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3636 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3637 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3638 ])
3639 AT_CLEANUP
3640
3641 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3642 AT_KEYWORDS([ROWLABELS OPPOSITE])
3643 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3644 AT_DATA([ctables.sps],
3645 [[GET 'nhtsa.sav'.
3646 CTABLES
3647     /VLABELS VARIABLES=ALL DISPLAY=NAME
3648     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3649     /SLABELS POSITION=ROW
3650     /CLABELS ROWLABELS=OPPOSITE
3651     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3652     /SLABELS POSITION=ROW
3653     /CLABELS ROWLABELS=OPPOSITE
3654     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3655     /SLABELS POSITION=ROW
3656     /CLABELS ROWLABELS=OPPOSITE.
3657 ]])
3658 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3659                                         Custom Tables
3660 Male
3661 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3662 │                                  │                          QN27                         │
3663 │                                  ├───────────────────────────┬───────────────────────────┤
3664 │                                  │            Yes            │             No            │
3665 │                                  ├───────────────────────────┼───────────────────────────┤
3666 │                                  │           QND7A           │           QND7A           │
3667 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3668 │                                  │     Yes     │      No     │     Yes     │      No     │
3669 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3670 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3671 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3672 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3673 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3674 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3675 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3676 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3677 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3678 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3679 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3680 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3681 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3682 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3683 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3684 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3685 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3686 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3687 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3688 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3689 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3690 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3691 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3692
3693                                         Custom Tables
3694 Female
3695 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3696 │                                  │                          QN27                         │
3697 │                                  ├───────────────────────────┬───────────────────────────┤
3698 │                                  │            Yes            │             No            │
3699 │                                  ├───────────────────────────┼───────────────────────────┤
3700 │                                  │           QND7A           │           QND7A           │
3701 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3702 │                                  │     Yes     │      No     │     Yes     │      No     │
3703 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3704 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3705 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3706 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3707 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3708 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3709 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3710 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3711 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3712 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3713 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3714 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3715 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3716 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3717 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3718 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3719 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3720 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3721 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3722 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3723 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3724 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3725 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3726
3727                                         Custom Tables
3728 Male
3729 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3730 │                                   │                          QN27                         │
3731 │                                   ├───────────────────────────┬───────────────────────────┤
3732 │                                   │            Yes            │             No            │
3733 │                                   ├───────────────────────────┼───────────────────────────┤
3734 │                                   │           QND7A           │           QND7A           │
3735 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3736 │                                   │     Yes     │      No     │     Yes     │      No     │
3737 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3738 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3739 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3740 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3741 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3742 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3743 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3744 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3745 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3746 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3747 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3748 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3749 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3750 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3751 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3752 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3753 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3754 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3755 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3756
3757                                         Custom Tables
3758 Female
3759 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3760 │                                   │                          QN27                         │
3761 │                                   ├───────────────────────────┬───────────────────────────┤
3762 │                                   │            Yes            │             No            │
3763 │                                   ├───────────────────────────┼───────────────────────────┤
3764 │                                   │           QND7A           │           QND7A           │
3765 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3766 │                                   │     Yes     │      No     │     Yes     │      No     │
3767 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3768 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3769 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3770 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3771 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3772 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3773 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3774 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3775 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3776 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3777 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3778 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3779 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3780 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3781 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3782 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3783 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3784 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3785 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3786
3787                                           Custom Tables
3788 Male
3789 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3790 │                                      │                          QN27                         │
3791 │                                      ├───────────────────────────┬───────────────────────────┤
3792 │                                      │            Yes            │             No            │
3793 │                                      ├───────────────────────────┼───────────────────────────┤
3794 │                                      │           QND7A           │           QND7A           │
3795 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3796 │                                      │     Yes     │      No     │     Yes     │      No     │
3797 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3798 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3799 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3800 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3801 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3802 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3803 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3804 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3805 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3806 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3807 │              No  QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3808 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3809 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3810 │     No  QN61 Yes QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3811 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3812 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3813 │              No  QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3814 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3815 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3816
3817                                           Custom Tables
3818 Female
3819 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3820 │                                      │                          QN27                         │
3821 │                                      ├───────────────────────────┬───────────────────────────┤
3822 │                                      │            Yes            │             No            │
3823 │                                      ├───────────────────────────┼───────────────────────────┤
3824 │                                      │           QND7A           │           QND7A           │
3825 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3826 │                                      │     Yes     │      No     │     Yes     │      No     │
3827 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3828 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3829 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3830 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3831 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3832 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3833 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3834 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3835 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3836 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3837 │              No  QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3838 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3839 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3840 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3841 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3842 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3843 │              No  QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3844 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3845 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3846 ])
3847 AT_CLEANUP
3848
3849 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3850 AT_KEYWORDS([COLLABELS OPPOSITE])
3851 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3852 AT_DATA([ctables.sps],
3853 [[GET 'nhtsa.sav'.
3854 CTABLES
3855     /VLABELS VARIABLES=ALL DISPLAY=NAME
3856     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3857     /SLABELS POSITION=ROW
3858     /CLABELS COLLABELS=OPPOSITE
3859     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3860     /SLABELS POSITION=ROW
3861     /CLABELS COLLABELS=OPPOSITE
3862     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3863     /SLABELS POSITION=ROW
3864     /CLABELS COLLABELS=OPPOSITE.
3865 ]])
3866 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3867                           Custom Tables
3868 Male
3869 ╭──────────────────────────────────────────┬───────────────────╮
3870 │                                          │        QN27       │
3871 │                                          ├─────────┬─────────┤
3872 │                                          │   Yes   │    No   │
3873 │                                          ├─────────┼─────────┤
3874 │                                          │  QND7A  │  QND7A  │
3875 │                                          ├────┬────┼────┬────┤
3876 │                                          │ Yes│ No │ Yes│ No │
3877 │                                          ├────┼────┼────┼────┤
3878 │                                          │QN86│QN86│QN86│QN86│
3879 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3880 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3881 │                               Layer ID   │   1│   1│   1│   1│
3882 │                               Subtable ID│   1│   1│   2│   2│
3883 │                          ╶───────────────┼────┼────┼────┼────┤
3884 │                           No  Table ID   │   1│   1│   1│   1│
3885 │                               Layer ID   │   1│   1│   1│   1│
3886 │                               Subtable ID│   1│   1│   2│   2│
3887 │                      ╶───────────────────┼────┼────┼────┼────┤
3888 │                       No  Yes Table ID   │   1│   1│   1│   1│
3889 │                               Layer ID   │   1│   1│   1│   1│
3890 │                               Subtable ID│   3│   3│   4│   4│
3891 │                          ╶───────────────┼────┼────┼────┼────┤
3892 │                           No  Table ID   │   1│   1│   1│   1│
3893 │                               Layer ID   │   1│   1│   1│   1│
3894 │                               Subtable ID│   3│   3│   4│   4│
3895 │             ╶────────────────────────────┼────┼────┼────┼────┤
3896 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3897 │                               Layer ID   │   1│   1│   1│   1│
3898 │                               Subtable ID│   5│   5│   6│   6│
3899 │                          ╶───────────────┼────┼────┼────┼────┤
3900 │                           No  Table ID   │   1│   1│   1│   1│
3901 │                               Layer ID   │   1│   1│   1│   1│
3902 │                               Subtable ID│   5│   5│   6│   6│
3903 │                      ╶───────────────────┼────┼────┼────┼────┤
3904 │                       No  Yes Table ID   │   1│   1│   1│   1│
3905 │                               Layer ID   │   1│   1│   1│   1│
3906 │                               Subtable ID│   7│   7│   8│   8│
3907 │                          ╶───────────────┼────┼────┼────┼────┤
3908 │                           No  Table ID   │   1│   1│   1│   1│
3909 │                               Layer ID   │   1│   1│   1│   1│
3910 │                               Subtable ID│   7│   7│   8│   8│
3911 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3912 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3913 │                               Layer ID   │   1│   1│   1│   1│
3914 │                               Subtable ID│   9│   9│  10│  10│
3915 │                          ╶───────────────┼────┼────┼────┼────┤
3916 │                           No  Table ID   │   1│   1│   1│   1│
3917 │                               Layer ID   │   1│   1│   1│   1│
3918 │                               Subtable ID│   9│   9│  10│  10│
3919 │                      ╶───────────────────┼────┼────┼────┼────┤
3920 │                       No  Yes Table ID   │   1│   1│   1│   1│
3921 │                               Layer ID   │   1│   1│   1│   1│
3922 │                               Subtable ID│  11│  11│  12│  12│
3923 │                          ╶───────────────┼────┼────┼────┼────┤
3924 │                           No  Table ID   │   1│   1│   1│   1│
3925 │                               Layer ID   │   1│   1│   1│   1│
3926 │                               Subtable ID│  11│  11│  12│  12│
3927 │             ╶────────────────────────────┼────┼────┼────┼────┤
3928 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3929 │                               Layer ID   │   1│   1│   1│   1│
3930 │                               Subtable ID│  13│  13│  14│  14│
3931 │                          ╶───────────────┼────┼────┼────┼────┤
3932 │                           No  Table ID   │   1│   1│   1│   1│
3933 │                               Layer ID   │   1│   1│   1│   1│
3934 │                               Subtable ID│  13│  13│  14│  14│
3935 │                      ╶───────────────────┼────┼────┼────┼────┤
3936 │                       No  Yes Table ID   │   1│   1│   1│   1│
3937 │                               Layer ID   │   1│   1│   1│   1│
3938 │                               Subtable ID│  15│  15│  16│  16│
3939 │                          ╶───────────────┼────┼────┼────┼────┤
3940 │                           No  Table ID   │   1│   1│   1│   1│
3941 │                               Layer ID   │   1│   1│   1│   1│
3942 │                               Subtable ID│  15│  15│  16│  16│
3943 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3944
3945                           Custom Tables
3946 Female
3947 ╭──────────────────────────────────────────┬───────────────────╮
3948 │                                          │        QN27       │
3949 │                                          ├─────────┬─────────┤
3950 │                                          │   Yes   │    No   │
3951 │                                          ├─────────┼─────────┤
3952 │                                          │  QND7A  │  QND7A  │
3953 │                                          ├────┬────┼────┬────┤
3954 │                                          │ Yes│ No │ Yes│ No │
3955 │                                          ├────┼────┼────┼────┤
3956 │                                          │QN86│QN86│QN86│QN86│
3957 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3958 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3959 │                               Layer ID   │   2│   2│   2│   2│
3960 │                               Subtable ID│  17│  17│  18│  18│
3961 │                          ╶───────────────┼────┼────┼────┼────┤
3962 │                           No  Table ID   │   1│   1│   1│   1│
3963 │                               Layer ID   │   2│   2│   2│   2│
3964 │                               Subtable ID│  17│  17│  18│  18│
3965 │                      ╶───────────────────┼────┼────┼────┼────┤
3966 │                       No  Yes Table ID   │   1│   1│   1│   1│
3967 │                               Layer ID   │   2│   2│   2│   2│
3968 │                               Subtable ID│  19│  19│  20│  20│
3969 │                          ╶───────────────┼────┼────┼────┼────┤
3970 │                           No  Table ID   │   1│   1│   1│   1│
3971 │                               Layer ID   │   2│   2│   2│   2│
3972 │                               Subtable ID│  19│  19│  20│  20│
3973 │             ╶────────────────────────────┼────┼────┼────┼────┤
3974 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3975 │                               Layer ID   │   2│   2│   2│   2│
3976 │                               Subtable ID│  21│  21│  22│  22│
3977 │                          ╶───────────────┼────┼────┼────┼────┤
3978 │                           No  Table ID   │   1│   1│   1│   1│
3979 │                               Layer ID   │   2│   2│   2│   2│
3980 │                               Subtable ID│  21│  21│  22│  22│
3981 │                      ╶───────────────────┼────┼────┼────┼────┤
3982 │                       No  Yes Table ID   │   1│   1│   1│   1│
3983 │                               Layer ID   │   2│   2│   2│   2│
3984 │                               Subtable ID│  23│  23│  24│  24│
3985 │                          ╶───────────────┼────┼────┼────┼────┤
3986 │                           No  Table ID   │   1│   1│   1│   1│
3987 │                               Layer ID   │   2│   2│   2│   2│
3988 │                               Subtable ID│  23│  23│  24│  24│
3989 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3990 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3991 │                               Layer ID   │   2│   2│   2│   2│
3992 │                               Subtable ID│  25│  25│  26│  26│
3993 │                          ╶───────────────┼────┼────┼────┼────┤
3994 │                           No  Table ID   │   1│   1│   1│   1│
3995 │                               Layer ID   │   2│   2│   2│   2│
3996 │                               Subtable ID│  25│  25│  26│  26│
3997 │                      ╶───────────────────┼────┼────┼────┼────┤
3998 │                       No  Yes Table ID   │   1│   1│   1│   1│
3999 │                               Layer ID   │   2│   2│   2│   2│
4000 │                               Subtable ID│  27│  27│  28│  28│
4001 │                          ╶───────────────┼────┼────┼────┼────┤
4002 │                           No  Table ID   │   1│   1│   1│   1│
4003 │                               Layer ID   │   2│   2│   2│   2│
4004 │                               Subtable ID│  27│  27│  28│  28│
4005 │             ╶────────────────────────────┼────┼────┼────┼────┤
4006 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
4007 │                               Layer ID   │   2│   2│   2│   2│
4008 │                               Subtable ID│  29│  29│  30│  30│
4009 │                          ╶───────────────┼────┼────┼────┼────┤
4010 │                           No  Table ID   │   1│   1│   1│   1│
4011 │                               Layer ID   │   2│   2│   2│   2│
4012 │                               Subtable ID│  29│  29│  30│  30│
4013 │                      ╶───────────────────┼────┼────┼────┼────┤
4014 │                       No  Yes Table ID   │   1│   1│   1│   1│
4015 │                               Layer ID   │   2│   2│   2│   2│
4016 │                               Subtable ID│  31│  31│  32│  32│
4017 │                          ╶───────────────┼────┼────┼────┼────┤
4018 │                           No  Table ID   │   1│   1│   1│   1│
4019 │                               Layer ID   │   2│   2│   2│   2│
4020 │                               Subtable ID│  31│  31│  32│  32│
4021 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4022
4023                           Custom Tables
4024 Male
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      │   1│   1│   3│   3│
4037 │                               Layer Row ID│   1│   1│   1│   1│
4038 │                          ╶────────────────┼────┼────┼────┼────┤
4039 │                           No  Row ID      │   2│   2│   4│   4│
4040 │                               Layer Row ID│   2│   2│   2│   2│
4041 │                      ╶────────────────────┼────┼────┼────┼────┤
4042 │                       No  Yes Row ID      │   5│   5│   7│   7│
4043 │                               Layer Row ID│   3│   3│   3│   3│
4044 │                          ╶────────────────┼────┼────┼────┼────┤
4045 │                           No  Row ID      │   6│   6│   8│   8│
4046 │                               Layer Row ID│   4│   4│   4│   4│
4047 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4048 │              No  QN57 Yes Yes Row ID      │   9│   9│  11│  11│
4049 │                               Layer Row ID│   5│   5│   5│   5│
4050 │                          ╶────────────────┼────┼────┼────┼────┤
4051 │                           No  Row ID      │  10│  10│  12│  12│
4052 │                               Layer Row ID│   6│   6│   6│   6│
4053 │                      ╶────────────────────┼────┼────┼────┼────┤
4054 │                       No  Yes Row ID      │  13│  13│  15│  15│
4055 │                               Layer Row ID│   7│   7│   7│   7│
4056 │                          ╶────────────────┼────┼────┼────┼────┤
4057 │                           No  Row ID      │  14│  14│  16│  16│
4058 │                               Layer Row ID│   8│   8│   8│   8│
4059 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
4060 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  19│  19│
4061 │                               Layer Row ID│   9│   9│   9│   9│
4062 │                          ╶────────────────┼────┼────┼────┼────┤
4063 │                           No  Row ID      │  18│  18│  20│  20│
4064 │                               Layer Row ID│  10│  10│  10│  10│
4065 │                      ╶────────────────────┼────┼────┼────┼────┤
4066 │                       No  Yes Row ID      │  21│  21│  23│  23│
4067 │                               Layer Row ID│  11│  11│  11│  11│
4068 │                          ╶────────────────┼────┼────┼────┼────┤
4069 │                           No  Row ID      │  22│  22│  24│  24│
4070 │                               Layer Row ID│  12│  12│  12│  12│
4071 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4072 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
4073 │                               Layer Row ID│  13│  13│  13│  13│
4074 │                          ╶────────────────┼────┼────┼────┼────┤
4075 │                           No  Row ID      │  26│  26│  28│  28│
4076 │                               Layer Row ID│  14│  14│  14│  14│
4077 │                      ╶────────────────────┼────┼────┼────┼────┤
4078 │                       No  Yes Row ID      │  29│  29│  31│  31│
4079 │                               Layer Row ID│  15│  15│  15│  15│
4080 │                          ╶────────────────┼────┼────┼────┼────┤
4081 │                           No  Row ID      │  30│  30│  32│  32│
4082 │                               Layer Row ID│  16│  16│  16│  16│
4083 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
4084
4085                           Custom Tables
4086 Female
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 Row ID      │  33│  33│  35│  35│
4099 │                               Layer Row ID│  17│  17│  17│  17│
4100 │                          ╶────────────────┼────┼────┼────┼────┤
4101 │                           No  Row ID      │  34│  34│  36│  36│
4102 │                               Layer Row ID│  18│  18│  18│  18│
4103 │                      ╶────────────────────┼────┼────┼────┼────┤
4104 │                       No  Yes Row ID      │  37│  37│  39│  39│
4105 │                               Layer Row ID│  19│  19│  19│  19│
4106 │                          ╶────────────────┼────┼────┼────┼────┤
4107 │                           No  Row ID      │  38│  38│  40│  40│
4108 │                               Layer Row ID│  20│  20│  20│  20│
4109 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4110 │              No  QN57 Yes Yes Row ID      │  41│  41│  43│  43│
4111 │                               Layer Row ID│  21│  21│  21│  21│
4112 │                          ╶────────────────┼────┼────┼────┼────┤
4113 │                           No  Row ID      │  42│  42│  44│  44│
4114 │                               Layer Row ID│  22│  22│  22│  22│
4115 │                      ╶────────────────────┼────┼────┼────┼────┤
4116 │                       No  Yes Row ID      │  45│  45│  47│  47│
4117 │                               Layer Row ID│  23│  23│  23│  23│
4118 │                          ╶────────────────┼────┼────┼────┼────┤
4119 │                           No  Row ID      │  46│  46│  48│  48│
4120 │                               Layer Row ID│  24│  24│  24│  24│
4121 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
4122 │     No  QN61 Yes QN57 Yes Yes Row ID      │  49│  49│  51│  51│
4123 │                               Layer Row ID│  25│  25│  25│  25│
4124 │                          ╶────────────────┼────┼────┼────┼────┤
4125 │                           No  Row ID      │  50│  50│  52│  52│
4126 │                               Layer Row ID│  26│  26│  26│  26│
4127 │                      ╶────────────────────┼────┼────┼────┼────┤
4128 │                       No  Yes Row ID      │  53│  53│  55│  55│
4129 │                               Layer Row ID│  27│  27│  27│  27│
4130 │                          ╶────────────────┼────┼────┼────┼────┤
4131 │                           No  Row ID      │  54│  54│  56│  56│
4132 │                               Layer Row ID│  28│  28│  28│  28│
4133 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4134 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
4135 │                               Layer Row ID│  29│  29│  29│  29│
4136 │                          ╶────────────────┼────┼────┼────┼────┤
4137 │                           No  Row ID      │  58│  58│  60│  60│
4138 │                               Layer Row ID│  30│  30│  30│  30│
4139 │                      ╶────────────────────┼────┼────┼────┼────┤
4140 │                       No  Yes Row ID      │  61│  61│  63│  63│
4141 │                               Layer Row ID│  31│  31│  31│  31│
4142 │                          ╶────────────────┼────┼────┼────┼────┤
4143 │                           No  Row ID      │  62│  62│  64│  64│
4144 │                               Layer Row ID│  32│  32│  32│  32│
4145 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
4146
4147                             Custom Tables
4148 Male
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      │   1│   2│   3│   4│
4161 │                               Layer Column ID│   1│   2│   3│   4│
4162 │                          ╶───────────────────┼────┼────┼────┼────┤
4163 │                           No  Column ID      │   1│   2│   3│   4│
4164 │                               Layer Column ID│   1│   2│   3│   4│
4165 │                      ╶───────────────────────┼────┼────┼────┼────┤
4166 │                       No  Yes Column ID      │   5│   6│   7│   8│
4167 │                               Layer Column ID│   1│   2│   3│   4│
4168 │                          ╶───────────────────┼────┼────┼────┼────┤
4169 │                           No  Column ID      │   5│   6│   7│   8│
4170 │                               Layer Column ID│   1│   2│   3│   4│
4171 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4172 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
4173 │                               Layer Column ID│   1│   2│   3│   4│
4174 │                          ╶───────────────────┼────┼────┼────┼────┤
4175 │                           No  Column ID      │   9│  10│  11│  12│
4176 │                               Layer Column ID│   1│   2│   3│   4│
4177 │                      ╶───────────────────────┼────┼────┼────┼────┤
4178 │                       No  Yes Column ID      │  13│  14│  15│  16│
4179 │                               Layer Column ID│   1│   2│   3│   4│
4180 │                          ╶───────────────────┼────┼────┼────┼────┤
4181 │                           No  Column ID      │  13│  14│  15│  16│
4182 │                               Layer Column ID│   1│   2│   3│   4│
4183 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4184 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
4185 │                               Layer Column ID│   1│   2│   3│   4│
4186 │                          ╶───────────────────┼────┼────┼────┼────┤
4187 │                           No  Column ID      │  17│  18│  19│  20│
4188 │                               Layer Column ID│   1│   2│   3│   4│
4189 │                      ╶───────────────────────┼────┼────┼────┼────┤
4190 │                       No  Yes Column ID      │  21│  22│  23│  24│
4191 │                               Layer Column ID│   1│   2│   3│   4│
4192 │                          ╶───────────────────┼────┼────┼────┼────┤
4193 │                           No  Column ID      │  21│  22│  23│  24│
4194 │                               Layer Column ID│   1│   2│   3│   4│
4195 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4196 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
4197 │                               Layer Column ID│   1│   2│   3│   4│
4198 │                          ╶───────────────────┼────┼────┼────┼────┤
4199 │                           No  Column ID      │  25│  26│  27│  28│
4200 │                               Layer Column ID│   1│   2│   3│   4│
4201 │                      ╶───────────────────────┼────┼────┼────┼────┤
4202 │                       No  Yes Column ID      │  29│  30│  31│  32│
4203 │                               Layer Column ID│   1│   2│   3│   4│
4204 │                          ╶───────────────────┼────┼────┼────┼────┤
4205 │                           No  Column ID      │  29│  30│  31│  32│
4206 │                               Layer Column ID│   1│   2│   3│   4│
4207 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4208
4209                             Custom Tables
4210 Female
4211 ╭──────────────────────────────────────────────┬───────────────────╮
4212 │                                              │        QN27       │
4213 │                                              ├─────────┬─────────┤
4214 │                                              │   Yes   │    No   │
4215 │                                              ├─────────┼─────────┤
4216 │                                              │  QND7A  │  QND7A  │
4217 │                                              ├────┬────┼────┬────┤
4218 │                                              │ Yes│ No │ Yes│ No │
4219 │                                              ├────┼────┼────┼────┤
4220 │                                              │QN86│QN86│QN86│QN86│
4221 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
4222 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
4223 │                               Layer Column ID│   5│   6│   7│   8│
4224 │                          ╶───────────────────┼────┼────┼────┼────┤
4225 │                           No  Column ID      │  33│  34│  35│  36│
4226 │                               Layer Column ID│   5│   6│   7│   8│
4227 │                      ╶───────────────────────┼────┼────┼────┼────┤
4228 │                       No  Yes Column ID      │  37│  38│  39│  40│
4229 │                               Layer Column ID│   5│   6│   7│   8│
4230 │                          ╶───────────────────┼────┼────┼────┼────┤
4231 │                           No  Column ID      │  37│  38│  39│  40│
4232 │                               Layer Column ID│   5│   6│   7│   8│
4233 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4234 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
4235 │                               Layer Column ID│   5│   6│   7│   8│
4236 │                          ╶───────────────────┼────┼────┼────┼────┤
4237 │                           No  Column ID      │  41│  42│  43│  44│
4238 │                               Layer Column ID│   5│   6│   7│   8│
4239 │                      ╶───────────────────────┼────┼────┼────┼────┤
4240 │                       No  Yes Column ID      │  45│  46│  47│  48│
4241 │                               Layer Column ID│   5│   6│   7│   8│
4242 │                          ╶───────────────────┼────┼────┼────┼────┤
4243 │                           No  Column ID      │  45│  46│  47│  48│
4244 │                               Layer Column ID│   5│   6│   7│   8│
4245 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4246 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
4247 │                               Layer Column ID│   5│   6│   7│   8│
4248 │                          ╶───────────────────┼────┼────┼────┼────┤
4249 │                           No  Column ID      │  49│  50│  51│  52│
4250 │                               Layer Column ID│   5│   6│   7│   8│
4251 │                      ╶───────────────────────┼────┼────┼────┼────┤
4252 │                       No  Yes Column ID      │  53│  54│  55│  56│
4253 │                               Layer Column ID│   5│   6│   7│   8│
4254 │                          ╶───────────────────┼────┼────┼────┼────┤
4255 │                           No  Column ID      │  53│  54│  55│  56│
4256 │                               Layer Column ID│   5│   6│   7│   8│
4257 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4258 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
4259 │                               Layer Column ID│   5│   6│   7│   8│
4260 │                          ╶───────────────────┼────┼────┼────┼────┤
4261 │                           No  Column ID      │  57│  58│  59│  60│
4262 │                               Layer Column ID│   5│   6│   7│   8│
4263 │                      ╶───────────────────────┼────┼────┼────┼────┤
4264 │                       No  Yes Column ID      │  61│  62│  63│  64│
4265 │                               Layer Column ID│   5│   6│   7│   8│
4266 │                          ╶───────────────────┼────┼────┼────┼────┤
4267 │                           No  Column ID      │  61│  62│  63│  64│
4268 │                               Layer Column ID│   5│   6│   7│   8│
4269 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4270 ])
4271 AT_CLEANUP
4272
4273 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
4274 AT_KEYWORDS([ROWLABELS LAYER])
4275 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
4276 AT_DATA([ctables.sps],
4277 [[GET 'nhtsa.sav'.
4278 CTABLES
4279     /VLABELS VARIABLES=ALL DISPLAY=NAME
4280     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4281     /SLABELS POSITION=ROW
4282     /CLABELS ROWLABELS=LAYER
4283     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4284     /SLABELS POSITION=ROW
4285     /CLABELS ROWLABELS=LAYER
4286     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4287     /SLABELS POSITION=ROW
4288     /CLABELS ROWLABELS=LAYER.
4289 ]])
4290 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4291                           Custom Tables
4292 Male
4293 Yes
4294 ╭──────────────────────────────────┬───────────────────────────╮
4295 │                                  │            QN27           │
4296 │                                  ├─────────────┬─────────────┤
4297 │                                  │     Yes     │      No     │
4298 │                                  ├─────────────┼─────────────┤
4299 │                                  │    QND7A    │    QND7A    │
4300 │                                  ├──────┬──────┼──────┬──────┤
4301 │                                  │  Yes │  No  │  Yes │  No  │
4302 │                                  ├──────┼──────┼──────┼──────┤
4303 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4304 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4305 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4306 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4307 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4308 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4309 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4310 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4311 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4312 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4313 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4314 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4315 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4316 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4317 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4318 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4319 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4320 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4321 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4322 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4323
4324                           Custom Tables
4325 Male
4326 No
4327 ╭──────────────────────────────────┬───────────────────────────╮
4328 │                                  │            QN27           │
4329 │                                  ├─────────────┬─────────────┤
4330 │                                  │     Yes     │      No     │
4331 │                                  ├─────────────┼─────────────┤
4332 │                                  │    QND7A    │    QND7A    │
4333 │                                  ├──────┬──────┼──────┬──────┤
4334 │                                  │  Yes │  No  │  Yes │  No  │
4335 │                                  ├──────┼──────┼──────┼──────┤
4336 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4337 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4338 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4339 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4340 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4341 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4342 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4343 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4344 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4345 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4346 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4347 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4348 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4349 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4350 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4351 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4352 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4353 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4354 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4355 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4356
4357                           Custom Tables
4358 Female
4359 Yes
4360 ╭──────────────────────────────────┬───────────────────────────╮
4361 │                                  │            QN27           │
4362 │                                  ├─────────────┬─────────────┤
4363 │                                  │     Yes     │      No     │
4364 │                                  ├─────────────┼─────────────┤
4365 │                                  │    QND7A    │    QND7A    │
4366 │                                  ├──────┬──────┼──────┬──────┤
4367 │                                  │  Yes │  No  │  Yes │  No  │
4368 │                                  ├──────┼──────┼──────┼──────┤
4369 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4370 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4371 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4372 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4373 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4374 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4375 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4376 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4377 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4378 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4379 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4380 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4381 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4382 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4383 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4384 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4385 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4386 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4387 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4388 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4389
4390                           Custom Tables
4391 Female
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 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4407 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4408 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4409 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4410 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4411 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4412 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4413 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4414 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4415 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4416 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4417 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4418 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4419 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4420 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4421 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4422
4423                           Custom Tables
4424 Male
4425 Yes
4426 ╭───────────────────────────────────┬───────────────────────────╮
4427 │                                   │            QN27           │
4428 │                                   ├─────────────┬─────────────┤
4429 │                                   │     Yes     │      No     │
4430 │                                   ├─────────────┼─────────────┤
4431 │                                   │    QND7A    │    QND7A    │
4432 │                                   ├──────┬──────┼──────┬──────┤
4433 │                                   │  Yes │  No  │  Yes │  No  │
4434 │                                   ├──────┼──────┼──────┼──────┤
4435 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4436 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4437 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4438 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4439 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4440 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4441 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4442 │              No  QN57 Row ID      │  9│ 9│ 11│11│ 13│13│ 15│15│
4443 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4444 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4445 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 19│19│ 21│21│ 23│23│
4446 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
4447 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4448 │              No  QN57 Row ID      │ 25│25│ 27│27│ 29│29│ 31│31│
4449 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
4450 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4451
4452                           Custom Tables
4453 Male
4454 No
4455 ╭───────────────────────────────────┬───────────────────────────╮
4456 │                                   │            QN27           │
4457 │                                   ├─────────────┬─────────────┤
4458 │                                   │     Yes     │      No     │
4459 │                                   ├─────────────┼─────────────┤
4460 │                                   │    QND7A    │    QND7A    │
4461 │                                   ├──────┬──────┼──────┬──────┤
4462 │                                   │  Yes │  No  │  Yes │  No  │
4463 │                                   ├──────┼──────┼──────┼──────┤
4464 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4465 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4466 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4467 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4468 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4469 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4470 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4471 │              No  QN57 Row ID      │ 10│10│ 12│12│ 14│14│ 16│16│
4472 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4473 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4474 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 20│20│ 22│22│ 24│24│
4475 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4476 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4477 │              No  QN57 Row ID      │ 26│26│ 28│28│ 30│30│ 32│32│
4478 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4479 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4480
4481                           Custom Tables
4482 Female
4483 Yes
4484 ╭───────────────────────────────────┬───────────────────────────╮
4485 │                                   │            QN27           │
4486 │                                   ├─────────────┬─────────────┤
4487 │                                   │     Yes     │      No     │
4488 │                                   ├─────────────┼─────────────┤
4489 │                                   │    QND7A    │    QND7A    │
4490 │                                   ├──────┬──────┼──────┬──────┤
4491 │                                   │  Yes │  No  │  Yes │  No  │
4492 │                                   ├──────┼──────┼──────┼──────┤
4493 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4494 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4495 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4496 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4497 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 39│39│
4498 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4499 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4500 │              No  QN57 Row ID      │ 41│41│ 43│43│ 45│45│ 47│47│
4501 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4502 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4503 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 51│51│ 53│53│ 55│55│
4504 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4505 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4506 │              No  QN57 Row ID      │ 57│57│ 59│59│ 61│61│ 63│63│
4507 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4508 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4509
4510                           Custom Tables
4511 Female
4512 No
4513 ╭───────────────────────────────────┬───────────────────────────╮
4514 │                                   │            QN27           │
4515 │                                   ├─────────────┬─────────────┤
4516 │                                   │     Yes     │      No     │
4517 │                                   ├─────────────┼─────────────┤
4518 │                                   │    QND7A    │    QND7A    │
4519 │                                   ├──────┬──────┼──────┬──────┤
4520 │                                   │  Yes │  No  │  Yes │  No  │
4521 │                                   ├──────┼──────┼──────┼──────┤
4522 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4523 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4524 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4525 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4526 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 40│40│
4527 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4528 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4529 │              No  QN57 Row ID      │ 42│42│ 44│44│ 46│46│ 48│48│
4530 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4531 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4532 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 52│52│ 54│54│ 56│56│
4533 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4534 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4535 │              No  QN57 Row ID      │ 58│58│ 60│60│ 62│62│ 64│64│
4536 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4537 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4538
4539                             Custom Tables
4540 Male
4541 Yes
4542 ╭──────────────────────────────────────┬───────────────────────────╮
4543 │                                      │            QN27           │
4544 │                                      ├─────────────┬─────────────┤
4545 │                                      │     Yes     │      No     │
4546 │                                      ├─────────────┼─────────────┤
4547 │                                      │    QND7A    │    QND7A    │
4548 │                                      ├──────┬──────┼──────┬──────┤
4549 │                                      │  Yes │  No  │  Yes │  No  │
4550 │                                      ├──────┼──────┼──────┼──────┤
4551 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4552 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4553 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4554 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4555 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4556 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4557 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4558 │              No  QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4559 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4560 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4561 │     No  QN61 Yes QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4562 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4563 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4564 │              No  QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4565 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4566 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4567
4568                             Custom Tables
4569 Male
4570 No
4571 ╭──────────────────────────────────────┬───────────────────────────╮
4572 │                                      │            QN27           │
4573 │                                      ├─────────────┬─────────────┤
4574 │                                      │     Yes     │      No     │
4575 │                                      ├─────────────┼─────────────┤
4576 │                                      │    QND7A    │    QND7A    │
4577 │                                      ├──────┬──────┼──────┬──────┤
4578 │                                      │  Yes │  No  │  Yes │  No  │
4579 │                                      ├──────┼──────┼──────┼──────┤
4580 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4581 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4582 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4583 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4584 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4585 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4586 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4587 │              No  QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4588 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4589 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4590 │     No  QN61 Yes QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4591 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4592 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4593 │              No  QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4594 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4595 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4596
4597                             Custom Tables
4598 Female
4599 Yes
4600 ╭──────────────────────────────────────┬───────────────────────────╮
4601 │                                      │            QN27           │
4602 │                                      ├─────────────┬─────────────┤
4603 │                                      │     Yes     │      No     │
4604 │                                      ├─────────────┼─────────────┤
4605 │                                      │    QND7A    │    QND7A    │
4606 │                                      ├──────┬──────┼──────┬──────┤
4607 │                                      │  Yes │  No  │  Yes │  No  │
4608 │                                      ├──────┼──────┼──────┼──────┤
4609 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4610 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4611 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4612 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4613 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4614 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4615 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4616 │              No  QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4617 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4618 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4619 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4620 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4621 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4622 │              No  QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4623 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4624 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4625
4626                             Custom Tables
4627 Female
4628 No
4629 ╭──────────────────────────────────────┬───────────────────────────╮
4630 │                                      │            QN27           │
4631 │                                      ├─────────────┬─────────────┤
4632 │                                      │     Yes     │      No     │
4633 │                                      ├─────────────┼─────────────┤
4634 │                                      │    QND7A    │    QND7A    │
4635 │                                      ├──────┬──────┼──────┬──────┤
4636 │                                      │  Yes │  No  │  Yes │  No  │
4637 │                                      ├──────┼──────┼──────┼──────┤
4638 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4639 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4640 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4641 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4642 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4643 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4644 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4645 │              No  QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4646 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4647 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4648 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4649 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4650 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4651 │              No  QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4652 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4653 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4654 ])
4655 AT_CLEANUP
4656
4657 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4658 AT_KEYWORDS([COLLABELS LAYER])
4659 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
4660 AT_DATA([ctables.sps],
4661 [[GET 'nhtsa.sav'.
4662 CTABLES
4663     /VLABELS VARIABLES=ALL DISPLAY=NAME
4664     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4665     /SLABELS POSITION=ROW
4666     /CLABELS COLLABELS=LAYER
4667     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4668     /SLABELS POSITION=ROW
4669     /CLABELS COLLABELS=LAYER
4670     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4671     /SLABELS POSITION=ROW
4672     /CLABELS COLLABELS=LAYER.
4673 ]])
4674 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4675                         Custom Tables
4676 Male
4677 Yes
4678 ╭──────────────────────────────────────┬───────────────────╮
4679 │                                      │        QN27       │
4680 │                                      ├─────────┬─────────┤
4681 │                                      │   Yes   │    No   │
4682 │                                      ├─────────┼─────────┤
4683 │                                      │  QND7A  │  QND7A  │
4684 │                                      ├────┬────┼────┬────┤
4685 │                                      │ Yes│ No │ Yes│ No │
4686 │                                      ├────┼────┼────┼────┤
4687 │                                      │QN86│QN86│QN86│QN86│
4688 ├──────────────────────────────────────┼────┼────┼────┼────┤
4689 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4690 │                           Layer ID   │   1│   1│   1│   1│
4691 │                           Subtable ID│   1│   1│   3│   3│
4692 │                      ╶───────────────┼────┼────┼────┼────┤
4693 │                       No  Table ID   │   1│   1│   1│   1│
4694 │                           Layer ID   │   1│   1│   1│   1│
4695 │                           Subtable ID│   1│   1│   3│   3│
4696 │             ╶────────────────────────┼────┼────┼────┼────┤
4697 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4698 │                           Layer ID   │   1│   1│   1│   1│
4699 │                           Subtable ID│   5│   5│   7│   7│
4700 │                      ╶───────────────┼────┼────┼────┼────┤
4701 │                       No  Table ID   │   1│   1│   1│   1│
4702 │                           Layer ID   │   1│   1│   1│   1│
4703 │                           Subtable ID│   5│   5│   7│   7│
4704 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4705 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4706 │                           Layer ID   │   1│   1│   1│   1│
4707 │                           Subtable ID│   9│   9│  11│  11│
4708 │                      ╶───────────────┼────┼────┼────┼────┤
4709 │                       No  Table ID   │   1│   1│   1│   1│
4710 │                           Layer ID   │   1│   1│   1│   1│
4711 │                           Subtable ID│   9│   9│  11│  11│
4712 │             ╶────────────────────────┼────┼────┼────┼────┤
4713 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4714 │                           Layer ID   │   1│   1│   1│   1│
4715 │                           Subtable ID│  13│  13│  15│  15│
4716 │                      ╶───────────────┼────┼────┼────┼────┤
4717 │                       No  Table ID   │   1│   1│   1│   1│
4718 │                           Layer ID   │   1│   1│   1│   1│
4719 │                           Subtable ID│  13│  13│  15│  15│
4720 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4721
4722                         Custom Tables
4723 Male
4724 No
4725 ╭──────────────────────────────────────┬───────────────────╮
4726 │                                      │        QN27       │
4727 │                                      ├─────────┬─────────┤
4728 │                                      │   Yes   │    No   │
4729 │                                      ├─────────┼─────────┤
4730 │                                      │  QND7A  │  QND7A  │
4731 │                                      ├────┬────┼────┬────┤
4732 │                                      │ Yes│ No │ Yes│ No │
4733 │                                      ├────┼────┼────┼────┤
4734 │                                      │QN86│QN86│QN86│QN86│
4735 ├──────────────────────────────────────┼────┼────┼────┼────┤
4736 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4737 │                           Layer ID   │   2│   2│   2│   2│
4738 │                           Subtable ID│   2│   2│   4│   4│
4739 │                      ╶───────────────┼────┼────┼────┼────┤
4740 │                       No  Table ID   │   1│   1│   1│   1│
4741 │                           Layer ID   │   2│   2│   2│   2│
4742 │                           Subtable ID│   2│   2│   4│   4│
4743 │             ╶────────────────────────┼────┼────┼────┼────┤
4744 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4745 │                           Layer ID   │   2│   2│   2│   2│
4746 │                           Subtable ID│   6│   6│   8│   8│
4747 │                      ╶───────────────┼────┼────┼────┼────┤
4748 │                       No  Table ID   │   1│   1│   1│   1│
4749 │                           Layer ID   │   2│   2│   2│   2│
4750 │                           Subtable ID│   6│   6│   8│   8│
4751 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4752 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4753 │                           Layer ID   │   2│   2│   2│   2│
4754 │                           Subtable ID│  10│  10│  12│  12│
4755 │                      ╶───────────────┼────┼────┼────┼────┤
4756 │                       No  Table ID   │   1│   1│   1│   1│
4757 │                           Layer ID   │   2│   2│   2│   2│
4758 │                           Subtable ID│  10│  10│  12│  12│
4759 │             ╶────────────────────────┼────┼────┼────┼────┤
4760 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4761 │                           Layer ID   │   2│   2│   2│   2│
4762 │                           Subtable ID│  14│  14│  16│  16│
4763 │                      ╶───────────────┼────┼────┼────┼────┤
4764 │                       No  Table ID   │   1│   1│   1│   1│
4765 │                           Layer ID   │   2│   2│   2│   2│
4766 │                           Subtable ID│  14│  14│  16│  16│
4767 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4768
4769                         Custom Tables
4770 Female
4771 Yes
4772 ╭──────────────────────────────────────┬───────────────────╮
4773 │                                      │        QN27       │
4774 │                                      ├─────────┬─────────┤
4775 │                                      │   Yes   │    No   │
4776 │                                      ├─────────┼─────────┤
4777 │                                      │  QND7A  │  QND7A  │
4778 │                                      ├────┬────┼────┬────┤
4779 │                                      │ Yes│ No │ Yes│ No │
4780 │                                      ├────┼────┼────┼────┤
4781 │                                      │QN86│QN86│QN86│QN86│
4782 ├──────────────────────────────────────┼────┼────┼────┼────┤
4783 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4784 │                           Layer ID   │   3│   3│   3│   3│
4785 │                           Subtable ID│  17│  17│  19│  19│
4786 │                      ╶───────────────┼────┼────┼────┼────┤
4787 │                       No  Table ID   │   1│   1│   1│   1│
4788 │                           Layer ID   │   3│   3│   3│   3│
4789 │                           Subtable ID│  17│  17│  19│  19│
4790 │             ╶────────────────────────┼────┼────┼────┼────┤
4791 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4792 │                           Layer ID   │   3│   3│   3│   3│
4793 │                           Subtable ID│  21│  21│  23│  23│
4794 │                      ╶───────────────┼────┼────┼────┼────┤
4795 │                       No  Table ID   │   1│   1│   1│   1│
4796 │                           Layer ID   │   3│   3│   3│   3│
4797 │                           Subtable ID│  21│  21│  23│  23│
4798 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4799 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4800 │                           Layer ID   │   3│   3│   3│   3│
4801 │                           Subtable ID│  25│  25│  27│  27│
4802 │                      ╶───────────────┼────┼────┼────┼────┤
4803 │                       No  Table ID   │   1│   1│   1│   1│
4804 │                           Layer ID   │   3│   3│   3│   3│
4805 │                           Subtable ID│  25│  25│  27│  27│
4806 │             ╶────────────────────────┼────┼────┼────┼────┤
4807 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4808 │                           Layer ID   │   3│   3│   3│   3│
4809 │                           Subtable ID│  29│  29│  31│  31│
4810 │                      ╶───────────────┼────┼────┼────┼────┤
4811 │                       No  Table ID   │   1│   1│   1│   1│
4812 │                           Layer ID   │   3│   3│   3│   3│
4813 │                           Subtable ID│  29│  29│  31│  31│
4814 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4815
4816                         Custom Tables
4817 Female
4818 No
4819 ╭──────────────────────────────────────┬───────────────────╮
4820 │                                      │        QN27       │
4821 │                                      ├─────────┬─────────┤
4822 │                                      │   Yes   │    No   │
4823 │                                      ├─────────┼─────────┤
4824 │                                      │  QND7A  │  QND7A  │
4825 │                                      ├────┬────┼────┬────┤
4826 │                                      │ Yes│ No │ Yes│ No │
4827 │                                      ├────┼────┼────┼────┤
4828 │                                      │QN86│QN86│QN86│QN86│
4829 ├──────────────────────────────────────┼────┼────┼────┼────┤
4830 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4831 │                           Layer ID   │   4│   4│   4│   4│
4832 │                           Subtable ID│  18│  18│  20│  20│
4833 │                      ╶───────────────┼────┼────┼────┼────┤
4834 │                       No  Table ID   │   1│   1│   1│   1│
4835 │                           Layer ID   │   4│   4│   4│   4│
4836 │                           Subtable ID│  18│  18│  20│  20│
4837 │             ╶────────────────────────┼────┼────┼────┼────┤
4838 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4839 │                           Layer ID   │   4│   4│   4│   4│
4840 │                           Subtable ID│  22│  22│  24│  24│
4841 │                      ╶───────────────┼────┼────┼────┼────┤
4842 │                       No  Table ID   │   1│   1│   1│   1│
4843 │                           Layer ID   │   4│   4│   4│   4│
4844 │                           Subtable ID│  22│  22│  24│  24│
4845 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4846 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4847 │                           Layer ID   │   4│   4│   4│   4│
4848 │                           Subtable ID│  26│  26│  28│  28│
4849 │                      ╶───────────────┼────┼────┼────┼────┤
4850 │                       No  Table ID   │   1│   1│   1│   1│
4851 │                           Layer ID   │   4│   4│   4│   4│
4852 │                           Subtable ID│  26│  26│  28│  28│
4853 │             ╶────────────────────────┼────┼────┼────┼────┤
4854 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4855 │                           Layer ID   │   4│   4│   4│   4│
4856 │                           Subtable ID│  30│  30│  32│  32│
4857 │                      ╶───────────────┼────┼────┼────┼────┤
4858 │                       No  Table ID   │   1│   1│   1│   1│
4859 │                           Layer ID   │   4│   4│   4│   4│
4860 │                           Subtable ID│  30│  30│  32│  32│
4861 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4862
4863                         Custom Tables
4864 Male
4865 Yes
4866 ╭───────────────────────────────────────┬───────────────────╮
4867 │                                       │        QN27       │
4868 │                                       ├─────────┬─────────┤
4869 │                                       │   Yes   │    No   │
4870 │                                       ├─────────┼─────────┤
4871 │                                       │  QND7A  │  QND7A  │
4872 │                                       ├────┬────┼────┬────┤
4873 │                                       │ Yes│ No │ Yes│ No │
4874 │                                       ├────┼────┼────┼────┤
4875 │                                       │QN86│QN86│QN86│QN86│
4876 ├───────────────────────────────────────┼────┼────┼────┼────┤
4877 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4878 │                           Layer Row ID│   1│   1│   1│   1│
4879 │                      ╶────────────────┼────┼────┼────┼────┤
4880 │                       No  Row ID      │   5│   5│   7│   7│
4881 │                           Layer Row ID│   3│   3│   3│   3│
4882 │             ╶─────────────────────────┼────┼────┼────┼────┤
4883 │              No  QN57 Yes Row ID      │   9│   9│  11│  11│
4884 │                           Layer Row ID│   5│   5│   5│   5│
4885 │                      ╶────────────────┼────┼────┼────┼────┤
4886 │                       No  Row ID      │  13│  13│  15│  15│
4887 │                           Layer Row ID│   7│   7│   7│   7│
4888 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4889 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  19│  19│
4890 │                           Layer Row ID│   9│   9│   9│   9│
4891 │                      ╶────────────────┼────┼────┼────┼────┤
4892 │                       No  Row ID      │  21│  21│  23│  23│
4893 │                           Layer Row ID│  11│  11│  11│  11│
4894 │             ╶─────────────────────────┼────┼────┼────┼────┤
4895 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4896 │                           Layer Row ID│  13│  13│  13│  13│
4897 │                      ╶────────────────┼────┼────┼────┼────┤
4898 │                       No  Row ID      │  29│  29│  31│  31│
4899 │                           Layer Row ID│  15│  15│  15│  15│
4900 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4901
4902                         Custom Tables
4903 Male
4904 No
4905 ╭───────────────────────────────────────┬───────────────────╮
4906 │                                       │        QN27       │
4907 │                                       ├─────────┬─────────┤
4908 │                                       │   Yes   │    No   │
4909 │                                       ├─────────┼─────────┤
4910 │                                       │  QND7A  │  QND7A  │
4911 │                                       ├────┬────┼────┬────┤
4912 │                                       │ Yes│ No │ Yes│ No │
4913 │                                       ├────┼────┼────┼────┤
4914 │                                       │QN86│QN86│QN86│QN86│
4915 ├───────────────────────────────────────┼────┼────┼────┼────┤
4916 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4917 │                           Layer Row ID│   2│   2│   2│   2│
4918 │                      ╶────────────────┼────┼────┼────┼────┤
4919 │                       No  Row ID      │   6│   6│   8│   8│
4920 │                           Layer Row ID│   4│   4│   4│   4│
4921 │             ╶─────────────────────────┼────┼────┼────┼────┤
4922 │              No  QN57 Yes Row ID      │  10│  10│  12│  12│
4923 │                           Layer Row ID│   6│   6│   6│   6│
4924 │                      ╶────────────────┼────┼────┼────┼────┤
4925 │                       No  Row ID      │  14│  14│  16│  16│
4926 │                           Layer Row ID│   8│   8│   8│   8│
4927 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4928 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  20│  20│
4929 │                           Layer Row ID│  10│  10│  10│  10│
4930 │                      ╶────────────────┼────┼────┼────┼────┤
4931 │                       No  Row ID      │  22│  22│  24│  24│
4932 │                           Layer Row ID│  12│  12│  12│  12│
4933 │             ╶─────────────────────────┼────┼────┼────┼────┤
4934 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4935 │                           Layer Row ID│  14│  14│  14│  14│
4936 │                      ╶────────────────┼────┼────┼────┼────┤
4937 │                       No  Row ID      │  30│  30│  32│  32│
4938 │                           Layer Row ID│  16│  16│  16│  16│
4939 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4940
4941                         Custom Tables
4942 Female
4943 Yes
4944 ╭───────────────────────────────────────┬───────────────────╮
4945 │                                       │        QN27       │
4946 │                                       ├─────────┬─────────┤
4947 │                                       │   Yes   │    No   │
4948 │                                       ├─────────┼─────────┤
4949 │                                       │  QND7A  │  QND7A  │
4950 │                                       ├────┬────┼────┬────┤
4951 │                                       │ Yes│ No │ Yes│ No │
4952 │                                       ├────┼────┼────┼────┤
4953 │                                       │QN86│QN86│QN86│QN86│
4954 ├───────────────────────────────────────┼────┼────┼────┼────┤
4955 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  35│  35│
4956 │                           Layer Row ID│  17│  17│  17│  17│
4957 │                      ╶────────────────┼────┼────┼────┼────┤
4958 │                       No  Row ID      │  37│  37│  39│  39│
4959 │                           Layer Row ID│  19│  19│  19│  19│
4960 │             ╶─────────────────────────┼────┼────┼────┼────┤
4961 │              No  QN57 Yes Row ID      │  41│  41│  43│  43│
4962 │                           Layer Row ID│  21│  21│  21│  21│
4963 │                      ╶────────────────┼────┼────┼────┼────┤
4964 │                       No  Row ID      │  45│  45│  47│  47│
4965 │                           Layer Row ID│  23│  23│  23│  23│
4966 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4967 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  51│  51│
4968 │                           Layer Row ID│  25│  25│  25│  25│
4969 │                      ╶────────────────┼────┼────┼────┼────┤
4970 │                       No  Row ID      │  53│  53│  55│  55│
4971 │                           Layer Row ID│  27│  27│  27│  27│
4972 │             ╶─────────────────────────┼────┼────┼────┼────┤
4973 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4974 │                           Layer Row ID│  29│  29│  29│  29│
4975 │                      ╶────────────────┼────┼────┼────┼────┤
4976 │                       No  Row ID      │  61│  61│  63│  63│
4977 │                           Layer Row ID│  31│  31│  31│  31│
4978 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4979
4980                         Custom Tables
4981 Female
4982 No
4983 ╭───────────────────────────────────────┬───────────────────╮
4984 │                                       │        QN27       │
4985 │                                       ├─────────┬─────────┤
4986 │                                       │   Yes   │    No   │
4987 │                                       ├─────────┼─────────┤
4988 │                                       │  QND7A  │  QND7A  │
4989 │                                       ├────┬────┼────┬────┤
4990 │                                       │ Yes│ No │ Yes│ No │
4991 │                                       ├────┼────┼────┼────┤
4992 │                                       │QN86│QN86│QN86│QN86│
4993 ├───────────────────────────────────────┼────┼────┼────┼────┤
4994 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  36│  36│
4995 │                           Layer Row ID│  18│  18│  18│  18│
4996 │                      ╶────────────────┼────┼────┼────┼────┤
4997 │                       No  Row ID      │  38│  38│  40│  40│
4998 │                           Layer Row ID│  20│  20│  20│  20│
4999 │             ╶─────────────────────────┼────┼────┼────┼────┤
5000 │              No  QN57 Yes Row ID      │  42│  42│  44│  44│
5001 │                           Layer Row ID│  22│  22│  22│  22│
5002 │                      ╶────────────────┼────┼────┼────┼────┤
5003 │                       No  Row ID      │  46│  46│  48│  48│
5004 │                           Layer Row ID│  24│  24│  24│  24│
5005 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
5006 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  52│  52│
5007 │                           Layer Row ID│  26│  26│  26│  26│
5008 │                      ╶────────────────┼────┼────┼────┼────┤
5009 │                       No  Row ID      │  54│  54│  56│  56│
5010 │                           Layer Row ID│  28│  28│  28│  28│
5011 │             ╶─────────────────────────┼────┼────┼────┼────┤
5012 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
5013 │                           Layer Row ID│  30│  30│  30│  30│
5014 │                      ╶────────────────┼────┼────┼────┼────┤
5015 │                       No  Row ID      │  62│  62│  64│  64│
5016 │                           Layer Row ID│  32│  32│  32│  32│
5017 ╰───────────────────────────────────────┴────┴────┴────┴────╯
5018
5019                           Custom Tables
5020 Male
5021 Yes
5022 ╭──────────────────────────────────────────┬───────────────────╮
5023 │                                          │        QN27       │
5024 │                                          ├─────────┬─────────┤
5025 │                                          │   Yes   │    No   │
5026 │                                          ├─────────┼─────────┤
5027 │                                          │  QND7A  │  QND7A  │
5028 │                                          ├────┬────┼────┬────┤
5029 │                                          │ Yes│ No │ Yes│ No │
5030 │                                          ├────┼────┼────┼────┤
5031 │                                          │QN86│QN86│QN86│QN86│
5032 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5033 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   7│
5034 │                           Layer Column ID│   1│   3│   5│   7│
5035 │                      ╶───────────────────┼────┼────┼────┼────┤
5036 │                       No  Column ID      │   1│   3│   5│   7│
5037 │                           Layer Column ID│   1│   3│   5│   7│
5038 │             ╶────────────────────────────┼────┼────┼────┼────┤
5039 │              No  QN57 Yes Column ID      │   9│  11│  13│  15│
5040 │                           Layer Column ID│   1│   3│   5│   7│
5041 │                      ╶───────────────────┼────┼────┼────┼────┤
5042 │                       No  Column ID      │   9│  11│  13│  15│
5043 │                           Layer Column ID│   1│   3│   5│   7│
5044 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5045 │     No  QN61 Yes QN57 Yes Column ID      │  17│  19│  21│  23│
5046 │                           Layer Column ID│   1│   3│   5│   7│
5047 │                      ╶───────────────────┼────┼────┼────┼────┤
5048 │                       No  Column ID      │  17│  19│  21│  23│
5049 │                           Layer Column ID│   1│   3│   5│   7│
5050 │             ╶────────────────────────────┼────┼────┼────┼────┤
5051 │              No  QN57 Yes Column ID      │  25│  27│  29│  31│
5052 │                           Layer Column ID│   1│   3│   5│   7│
5053 │                      ╶───────────────────┼────┼────┼────┼────┤
5054 │                       No  Column ID      │  25│  27│  29│  31│
5055 │                           Layer Column ID│   1│   3│   5│   7│
5056 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5057
5058                           Custom Tables
5059 Male
5060 No
5061 ╭──────────────────────────────────────────┬───────────────────╮
5062 │                                          │        QN27       │
5063 │                                          ├─────────┬─────────┤
5064 │                                          │   Yes   │    No   │
5065 │                                          ├─────────┼─────────┤
5066 │                                          │  QND7A  │  QND7A  │
5067 │                                          ├────┬────┼────┬────┤
5068 │                                          │ Yes│ No │ Yes│ No │
5069 │                                          ├────┼────┼────┼────┤
5070 │                                          │QN86│QN86│QN86│QN86│
5071 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5072 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   8│
5073 │                           Layer Column ID│   2│   4│   6│   8│
5074 │                      ╶───────────────────┼────┼────┼────┼────┤
5075 │                       No  Column ID      │   2│   4│   6│   8│
5076 │                           Layer Column ID│   2│   4│   6│   8│
5077 │             ╶────────────────────────────┼────┼────┼────┼────┤
5078 │              No  QN57 Yes Column ID      │  10│  12│  14│  16│
5079 │                           Layer Column ID│   2│   4│   6│   8│
5080 │                      ╶───────────────────┼────┼────┼────┼────┤
5081 │                       No  Column ID      │  10│  12│  14│  16│
5082 │                           Layer Column ID│   2│   4│   6│   8│
5083 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5084 │     No  QN61 Yes QN57 Yes Column ID      │  18│  20│  22│  24│
5085 │                           Layer Column ID│   2│   4│   6│   8│
5086 │                      ╶───────────────────┼────┼────┼────┼────┤
5087 │                       No  Column ID      │  18│  20│  22│  24│
5088 │                           Layer Column ID│   2│   4│   6│   8│
5089 │             ╶────────────────────────────┼────┼────┼────┼────┤
5090 │              No  QN57 Yes Column ID      │  26│  28│  30│  32│
5091 │                           Layer Column ID│   2│   4│   6│   8│
5092 │                      ╶───────────────────┼────┼────┼────┼────┤
5093 │                       No  Column ID      │  26│  28│  30│  32│
5094 │                           Layer Column ID│   2│   4│   6│   8│
5095 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5096
5097                           Custom Tables
5098 Female
5099 Yes
5100 ╭──────────────────────────────────────────┬───────────────────╮
5101 │                                          │        QN27       │
5102 │                                          ├─────────┬─────────┤
5103 │                                          │   Yes   │    No   │
5104 │                                          ├─────────┼─────────┤
5105 │                                          │  QND7A  │  QND7A  │
5106 │                                          ├────┬────┼────┬────┤
5107 │                                          │ Yes│ No │ Yes│ No │
5108 │                                          ├────┼────┼────┼────┤
5109 │                                          │QN86│QN86│QN86│QN86│
5110 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5111 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  37│  39│
5112 │                           Layer Column ID│   9│  11│  13│  15│
5113 │                      ╶───────────────────┼────┼────┼────┼────┤
5114 │                       No  Column ID      │  33│  35│  37│  39│
5115 │                           Layer Column ID│   9│  11│  13│  15│
5116 │             ╶────────────────────────────┼────┼────┼────┼────┤
5117 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
5118 │                           Layer Column ID│   9│  11│  13│  15│
5119 │                      ╶───────────────────┼────┼────┼────┼────┤
5120 │                       No  Column ID      │  41│  43│  45│  47│
5121 │                           Layer Column ID│   9│  11│  13│  15│
5122 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5123 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  53│  55│
5124 │                           Layer Column ID│   9│  11│  13│  15│
5125 │                      ╶───────────────────┼────┼────┼────┼────┤
5126 │                       No  Column ID      │  49│  51│  53│  55│
5127 │                           Layer Column ID│   9│  11│  13│  15│
5128 │             ╶────────────────────────────┼────┼────┼────┼────┤
5129 │              No  QN57 Yes Column ID      │  57│  59│  61│  63│
5130 │                           Layer Column ID│   9│  11│  13│  15│
5131 │                      ╶───────────────────┼────┼────┼────┼────┤
5132 │                       No  Column ID      │  57│  59│  61│  63│
5133 │                           Layer Column ID│   9│  11│  13│  15│
5134 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5135
5136                           Custom Tables
5137 Female
5138 No
5139 ╭──────────────────────────────────────────┬───────────────────╮
5140 │                                          │        QN27       │
5141 │                                          ├─────────┬─────────┤
5142 │                                          │   Yes   │    No   │
5143 │                                          ├─────────┼─────────┤
5144 │                                          │  QND7A  │  QND7A  │
5145 │                                          ├────┬────┼────┬────┤
5146 │                                          │ Yes│ No │ Yes│ No │
5147 │                                          ├────┼────┼────┼────┤
5148 │                                          │QN86│QN86│QN86│QN86│
5149 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5150 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  38│  40│
5151 │                           Layer Column ID│  10│  12│  14│  16│
5152 │                      ╶───────────────────┼────┼────┼────┼────┤
5153 │                       No  Column ID      │  34│  36│  38│  40│
5154 │                           Layer Column ID│  10│  12│  14│  16│
5155 │             ╶────────────────────────────┼────┼────┼────┼────┤
5156 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
5157 │                           Layer Column ID│  10│  12│  14│  16│
5158 │                      ╶───────────────────┼────┼────┼────┼────┤
5159 │                       No  Column ID      │  42│  44│  46│  48│
5160 │                           Layer Column ID│  10│  12│  14│  16│
5161 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5162 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  54│  56│
5163 │                           Layer Column ID│  10│  12│  14│  16│
5164 │                      ╶───────────────────┼────┼────┼────┼────┤
5165 │                       No  Column ID      │  50│  52│  54│  56│
5166 │                           Layer Column ID│  10│  12│  14│  16│
5167 │             ╶────────────────────────────┼────┼────┼────┼────┤
5168 │              No  QN57 Yes Column ID      │  58│  60│  62│  64│
5169 │                           Layer Column ID│  10│  12│  14│  16│
5170 │                      ╶───────────────────┼────┼────┼────┼────┤
5171 │                       No  Column ID      │  58│  60│  62│  64│
5172 │                           Layer Column ID│  10│  12│  14│  16│
5173 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5174 ])
5175 AT_CLEANUP
5176
5177 AT_SETUP([CTABLES categorical summary functions])
5178 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5179 AT_DATA([ctables.sps],
5180 [[GET 'nhtsa.sav'.
5181 CTABLES
5182     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
5183     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
5184     /SLABELS POSITION=ROW.
5185 ]])
5186 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5187                                                       Custom Tables
5188 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
5189 │                 │                     D5a. What would you say is your primary ethnic background?                     │
5190 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
5191 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
5192 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
5193 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
5194 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5195 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
5196 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
5197 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
5198 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5199 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5200 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
5201 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5202 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5203 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
5204 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
5205 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5206 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
5207 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
5208 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
5209 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5210 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5211 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
5212 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5213 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5214 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
5215 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
5216 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5217 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
5218 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
5219 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
5220 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5221 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5222 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
5223 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5224 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5225 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
5226 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
5227 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5228 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
5229 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
5230 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
5231 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5232 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5233 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
5234 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5235 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5236 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
5237 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
5238 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
5239 ])
5240 AT_CLEANUP
5241
5242 AT_SETUP([CTABLES scale summary functions])
5243 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5244 AT_DATA([ctables.sps],
5245 [[GET 'nhtsa.sav'.
5246 SET TVAR=NAME.
5247
5248 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5249   CTABLES later, to make the results easier to verify.
5250 SPLIT FILE BY REGION.
5251 FREQUENCIES
5252     qn19a
5253     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5254     /FORMAT NOTABLE /MISSING=INCLUDE.
5255 SPLIT FILE OFF.
5256
5257 CTABLES
5258     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5259     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
5260     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
5261     /SLABELS POSITION=ROW
5262     /CLABELS ROWLABELS=OPPOSITE.
5263 ]])
5264 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5265                    Statistics
5266 ╭─────────┬───────────────────────────────────╮
5267 │         │               REGION              │
5268 │         ├────────┬────────┬────────┬────────┤
5269 │         │   NE   │   MW   │    S   │    W   │
5270 │         ├────────┼────────┼────────┼────────┤
5271 │         │  QN19A │  QN19A │  QN19A │  QN19A │
5272 ├─────────┼────────┼────────┼────────┼────────┤
5273 │N Valid  │     936│    1019│    1276│     950│
5274 │  Missing│     473│     635│    1114│     596│
5275 ├─────────┼────────┼────────┼────────┼────────┤
5276 │Mean     │   19.33│   19.83│   20.29│   19.87│
5277 ├─────────┼────────┼────────┼────────┼────────┤
5278 │S.E. Mean│     .14│     .16│     .18│     .17│
5279 ├─────────┼────────┼────────┼────────┼────────┤
5280 │Median   │   18.00│   19.00│   19.00│   19.00│
5281 ├─────────┼────────┼────────┼────────┼────────┤
5282 │Mode     │   18.00│   18.00│   18.00│   18.00│
5283 ├─────────┼────────┼────────┼────────┼────────┤
5284 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
5285 ├─────────┼────────┼────────┼────────┼────────┤
5286 │Variance │   19.41│   26.47│   41.43│   27.59│
5287 ├─────────┼────────┼────────┼────────┼────────┤
5288 │Range    │   59.00│   71.00│   75.00│   61.00│
5289 ├─────────┼────────┼────────┼────────┼────────┤
5290 │Minimum  │     .00│    4.00│    4.00│    4.00│
5291 ├─────────┼────────┼────────┼────────┼────────┤
5292 │Maximum  │   59.00│   75.00│   79.00│   65.00│
5293 ├─────────┼────────┼────────┼────────┼────────┤
5294 │Sum      │18092.00│20206.00│25886.00│18877.00│
5295 ╰─────────┴────────┴────────┴────────┴────────╯
5296
5297                          Custom Tables
5298 ╭────────────────────────┬────────┬────────┬────────┬────────╮
5299 │                        │   NE   │   MW   │    S   │    W   │
5300 ├────────────────────────┼────────┼────────┼────────┼────────┤
5301 │REGION Valid N          │     936│    1019│    1276│     950│
5302 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
5303 │       Mean             │   19.33│   19.83│   20.29│   19.87│
5304 │       Std Error of Mean│     .14│     .16│     .18│     .17│
5305 │       Median           │   18.00│   19.00│   19.00│   19.00│
5306 │       Mode             │   18.00│   18.00│   18.00│   18.00│
5307 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
5308 │       Variance         │   19.41│   26.47│   41.43│   27.59│
5309 │       Range            │   59.00│   71.00│   75.00│   61.00│
5310 │       Minimum          │     .00│    4.00│    4.00│    4.00│
5311 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
5312 │       Sum              │18092.00│20206.00│25886.00│18877.00│
5313 │       Count            │    1409│    1654│    2390│    1546│
5314 │       Total N          │    1409│    1654│    2390│    1546│
5315 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
5316 ╰────────────────────────┴────────┴────────┴────────┴────────╯
5317 ])
5318 AT_CLEANUP
5319
5320 AT_SETUP([CTABLES scale summary functions - weighting])
5321 weight=1
5322 c=10
5323 for a in 1 2 9; do
5324     for b in 3 4 9; do
5325         for n in 1 2 3 4 5 6 7 8 9 10; do
5326             if test $c -lt 15; then
5327                 cval=.
5328             else
5329                 cval=$c
5330             fi
5331             printf "$weight $a $b $cval\n"
5332             weight=$(expr \( $weight + 3 \) % 7 + 2)
5333             c=$(expr \( $c + 13 \) % 29 + 7)
5334         done
5335     done
5336 done > ctables.txt
5337
5338 AT_DATA([analysis.sps],
5339 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5340   CTABLES later, to make the results easier to verify.
5341 SPLIT FILE BY a b.
5342 FREQUENCIES
5343     c
5344     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5345     /FORMAT NOTABLE /MISSING=INCLUDE.
5346 SPLIT FILE OFF.
5347
5348 CTABLES
5349     /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
5350     /SLABELS POSITION=ROW
5351     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5352 ]])
5353
5354 AT_DATA([ctables.sps],
5355 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
5356     /w (F5.0) a b c (f2.0).
5357 VAR LEVEL w c (SCALE) a b (NOMINAL).
5358 MISSING VALUES a b (9).
5359
5360 INCLUDE 'analysis.sps'.
5361
5362 WEIGHT BY w.
5363 INCLUDE 'analysis.sps'.
5364
5365 * Same as original analysis using unweighted versions of summaries.
5366 CTABLES
5367     /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
5368     /SLABELS POSITION=ROW
5369     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5370 ]])
5371 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5372                                 Statistics
5373 ╭─────────┬──────────────────────────────────────────────────────────────╮
5374 │         │                               a                              │
5375 │         ├────────────────────┬────────────────────┬────────────────────┤
5376 │         │          1         │          2         │          9         │
5377 │         ├────────────────────┼────────────────────┼────────────────────┤
5378 │         │          b         │          b         │          b         │
5379 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5380 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5381 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5382 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
5383 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5384 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5385 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
5386 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5387 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5388 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5389 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5390 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5391 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5392 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5393 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5394 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5395 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5396 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5397 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5398 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5399 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5400 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5401 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5402 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5403 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5404 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5405 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5406 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5407
5408                                     Custom Tables
5409 ╭───────────────────┬──────────────────────────────────────────────────────────────╮
5410 │                   │                               a                              │
5411 │                   ├────────────────────┬────────────────────┬────────────────────┤
5412 │                   │          1         │          2         │          9         │
5413 │                   ├────────────────────┼────────────────────┼────────────────────┤
5414 │                   │          b         │          b         │          b         │
5415 │                   ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5416 │                   │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5417 ├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5418 │c Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5419 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5420 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5421 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5422 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5423 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5424 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5425 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5426 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5427 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5428 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5429 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5430 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5431 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5432 │  Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5433 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5434
5435                                   Statistics
5436 ╭─────────┬─────────────────────────────────────────────────────────────────╮
5437 │         │                                a                                │
5438 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
5439 │         │          1          │          2          │          9          │
5440 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
5441 │         │          b          │          b          │          b          │
5442 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5443 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5444 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5445 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
5446 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5447 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5448 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
5449 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5450 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5451 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5452 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5453 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5454 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5455 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5456 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5457 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5458 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5459 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5460 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5461 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5462 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5463 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5464 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5465 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5466 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5467 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5468 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5469 ╰─────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5470
5471                                      Custom Tables
5472 ╭───────────────────┬─────────────────────────────────────────────────────────────────╮
5473 │                   │                                a                                │
5474 │                   ├─────────────────────┬─────────────────────┬─────────────────────┤
5475 │                   │          1          │          2          │          9          │
5476 │                   ├─────────────────────┼─────────────────────┼─────────────────────┤
5477 │                   │          b          │          b          │          b          │
5478 │                   ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5479 │                   │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5480 ├───────────────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5481 │c Valid N          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5482 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5483 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5484 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5485 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5486 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5487 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5488 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5489 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5490 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5491 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5492 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5493 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5494 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5495 │  Layer Row Sum %  │  13.3%│ 10.3%│ 11.3%│  8.9%│  12.6%│ 11.5%│  9.8%│  9.9%│  12.4%│
5496 ╰───────────────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5497
5498                                          Custom Tables
5499 ╭──────────────────────────────┬──────────────────────────────────────────────────────────────╮
5500 │                              │                               a                              │
5501 │                              ├────────────────────┬────────────────────┬────────────────────┤
5502 │                              │          1         │          2         │          9         │
5503 │                              ├────────────────────┼────────────────────┼────────────────────┤
5504 │                              │          b         │          b         │          b         │
5505 │                              ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5506 │                              │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5507 ├──────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5508 │c Unweighted Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5509 │  Unweighted Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5510 │  Unweighted Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5511 │  Unweighted Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5512 │  Unweighted Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5513 │  Unweighted Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5514 │  Unweighted Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5515 │  Unweighted Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5516 │  Unweighted Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5517 │  Unweighted Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5518 │  Unweighted Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5519 │  Unweighted Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5520 ╰──────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5521 ])
5522 AT_CLEANUP
5523
5524 AT_SETUP([CTABLES hidden scale VLABELS])
5525 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5526 AT_DATA([ctables.sps],
5527 [[GET 'nhtsa.sav'.
5528 CTABLES
5529     /TABLE region BY qn19a + qn35
5530     /SLABELS POSITION=ROW.
5531 CTABLES
5532     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5533     /TABLE region BY qn19a + qn35
5534     /SLABELS POSITION=ROW.
5535 CTABLES
5536     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5537     /TABLE region BY qn19a + qn35
5538     /SLABELS POSITION=ROW.
5539
5540 * This one in particular caused a crash because no categories were
5541   created on the column axis, so passing in 0 for the index was still
5542   too big for that number of categories.  It was fixed by creating a
5543   name-only category for each variable despite the "NONE" request,
5544   then hiding the entire dimension's labels if all its labels were
5545   set to "NONE".
5546 CTABLES
5547     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5548     /TABLE region BY qn19a + qn35
5549     /SLABELS POSITION=ROW.
5550 ]])
5551 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5552                                  Custom Tables
5553 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5554 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5555 │              │   when you first starting  │   many times have you driven a  │
5556 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5557 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5558 │              │      sips of alcohol.      │            beverages?           │
5559 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5560 │Region NE Mean│                       19.33│                                2│
5561 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5562 │       MW Mean│                       19.83│                                2│
5563 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5564 │       S  Mean│                       20.29│                                2│
5565 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5566 │       W  Mean│                       19.87│                                2│
5567 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5568
5569                                  Custom Tables
5570 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5571 │              │     │  35. In the past thirty days, how many times have you  │
5572 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5573 │              │QN19A│                  alcoholic beverages?                  │
5574 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5575 │Region NE Mean│19.33│                                                       2│
5576 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5577 │       MW Mean│19.83│                                                       2│
5578 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5579 │       S  Mean│20.29│                                                       2│
5580 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5581 │       W  Mean│19.87│                                                       2│
5582 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5583
5584                                  Custom Tables
5585 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5586 │              │   19a. About how old were you when you first starting   │    │
5587 │              │  drinking alcohol, not counting small tastes or sips of │    │
5588 │              │                         alcohol.                        │qn35│
5589 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5590 │Region NE Mean│                                                    19.33│   2│
5591 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5592 │       MW Mean│                                                    19.83│   2│
5593 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5594 │       S  Mean│                                                    20.29│   2│
5595 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5596 │       W  Mean│                                                    19.87│   2│
5597 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5598
5599       Custom Tables
5600 ╭──────────────┬───────╮
5601 │Region NE Mean│19.33 2│
5602 │      ╶───────┼───────┤
5603 │       MW Mean│19.83 2│
5604 │      ╶───────┼───────┤
5605 │       S  Mean│20.29 2│
5606 │      ╶───────┼───────┤
5607 │       W  Mean│19.87 2│
5608 ╰──────────────┴───────╯
5609 ])
5610 AT_CLEANUP
5611
5612 AT_SETUP([CTABLES with SPLIT FILE])
5613 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5614 AT_DATA([ctables.sps],
5615 [[GET 'nhtsa.sav'.
5616
5617 SORT CASES BY qns3a.
5618
5619 CTABLES /TABLE qn105ba.
5620
5621 * Layered split has no effect on output.
5622 SPLIT FILE BY qns3a.
5623 CTABLES /TABLE qn105ba.
5624
5625 * Add column variable qns3a to compare against separate splits.
5626 CTABLES /TABLE qn105ba BY qns3a.
5627
5628 * Separate splits are truly output separately.
5629 SPLIT FILE SEPARATE BY qns3a.
5630 CTABLES /TABLE qn105ba.
5631 ]])
5632 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5633                                   Custom Tables
5634 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5635 │                                                                        │Count│
5636 ├────────────────────────────────────────────────────────────────────────┼─────┤
5637 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5638 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5639 │                                                            Very likely │ 1502│
5640 │                                                            Somewhat    │ 2763│
5641 │                                                            likely      │     │
5642 │                                                            Somewhat    │ 1307│
5643 │                                                            unlikely    │     │
5644 │                                                            Very        │  609│
5645 │                                                            unlikely    │     │
5646 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5647
5648                                   Custom Tables
5649 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5650 │                                                                        │Count│
5651 ├────────────────────────────────────────────────────────────────────────┼─────┤
5652 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5653 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5654 │                                                            Very likely │ 1502│
5655 │                                                            Somewhat    │ 2763│
5656 │                                                            likely      │     │
5657 │                                                            Somewhat    │ 1307│
5658 │                                                            unlikely    │     │
5659 │                                                            Very        │  609│
5660 │                                                            unlikely    │     │
5661 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5662
5663                                   Custom Tables
5664 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5665 │                                                                 │S3a. GENDER:│
5666 │                                                                 ├─────┬──────┤
5667 │                                                                 │ Male│Female│
5668 │                                                                 ├─────┼──────┤
5669 │                                                                 │Count│ Count│
5670 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5671 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5672 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5673 │the police?                                          Very likely │  660│   842│
5674 │                                                     Somewhat    │ 1174│  1589│
5675 │                                                     likely      │     │      │
5676 │                                                     Somewhat    │  640│   667│
5677 │                                                     unlikely    │     │      │
5678 │                                                     Very        │  311│   298│
5679 │                                                     unlikely    │     │      │
5680 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5681
5682     Split Values
5683 ╭────────────┬─────╮
5684 │Variable    │Value│
5685 ├────────────┼─────┤
5686 │S3a. GENDER:│Male │
5687 ╰────────────┴─────╯
5688
5689                                   Custom Tables
5690 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5691 │                                                                        │Count│
5692 ├────────────────────────────────────────────────────────────────────────┼─────┤
5693 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5694 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5695 │                                                            Very likely │  660│
5696 │                                                            Somewhat    │ 1174│
5697 │                                                            likely      │     │
5698 │                                                            Somewhat    │  640│
5699 │                                                            unlikely    │     │
5700 │                                                            Very        │  311│
5701 │                                                            unlikely    │     │
5702 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5703
5704      Split Values
5705 ╭────────────┬──────╮
5706 │Variable    │ Value│
5707 ├────────────┼──────┤
5708 │S3a. GENDER:│Female│
5709 ╰────────────┴──────╯
5710
5711                                   Custom Tables
5712 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5713 │                                                                        │Count│
5714 ├────────────────────────────────────────────────────────────────────────┼─────┤
5715 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5716 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5717 │                                                            Very likely │  842│
5718 │                                                            Somewhat    │ 1589│
5719 │                                                            likely      │     │
5720 │                                                            Somewhat    │  667│
5721 │                                                            unlikely    │     │
5722 │                                                            Very        │  298│
5723 │                                                            unlikely    │     │
5724 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5725 ])
5726 AT_CLEANUP
5727
5728 AT_SETUP([CTABLES variable level inference])
5729 AT_DATA([data.txt], [dnl
5730 dnl n1 has 10 unique small values -> nominal.
5731 dnl n2 has 23 unique small values -> nominal.
5732 dnl n3 is all missing -> nominal.
5733 dnl s1 has 24 unique small values -> scale.
5734 dnl s2 has one negative value -> scale.
5735 dnl s3 has one non-integer value -> scale.
5736 dnl s4 has no valid values less than 10 -> scale.
5737 dnl s5 has no valid values less than 10,000 -> scale.
5738 1  1  . 1  1  1    10 10001
5739 2  2  . 2  2  2    11 10002
5740 3  3  . 3  3  3    12 10003
5741 4  4  . 4  4  4    13 10004
5742 5  5  . 5  5  5    14 10005
5743 6  6  . 6  6  6    15 10006
5744 7  7  . 7  7  7    16 10007
5745 8  8  . 8  8  8    17 10008
5746 9  9  . 9  9  9    18 10009
5747 10 10 . 10 10 10.5 19 110000
5748 1  11 . 11 -1 1    11 10001
5749 2  12 . 12 2  2    12 10002
5750 3  13 . 13 3  3    13 10003
5751 4  14 . 14 4  4    14 10004
5752 5  15 . 15 5  5    15 10005
5753 6  16 . 16 6  6    16 10006
5754 7  17 . 17 7  7    17 10007
5755 8  18 . 18 8  8    18 10008
5756 9  19 . 19 9  9    19 10009
5757 1  20 . 20 1  1    20 10001
5758 2  21 . 21 2  2    21 10002
5759 3  22 . 22 3  3    22 10003
5760 4  23 . 23 4  4    23 10004
5761 5  23 . 24 5  5    24 10005
5762 6  23 . 24 6  6    25 10006
5763 ])
5764
5765 AT_DATA([ctables.sps], [dnl
5766 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5767
5768 * Nominal formats (copied from data that will default to scale).
5769 COMPUTE n4=s1.
5770 COMPUTE n5=s1.
5771 FORMATS n4(WKDAY5) n5(MONTH5).
5772
5773 * Scale formats (copied from data that will default to nominal).
5774 COMPUTE s6=n1.
5775 COMPUTE s7=n1.
5776 COMPUTE s8=n1.
5777 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5778
5779 STRING string(A8).
5780
5781 DISPLAY DICTIONARY.
5782 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5783 DISPLAY DICTIONARY.
5784 ])
5785
5786 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5787                                     Variables
5788 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5789 │      │        │  Measurement │     │     │         │            │            │
5790 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5791 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5792 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5793 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5794 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5795 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5796 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5797 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5798 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5799 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5800 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5801 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5802 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5803 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5804 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5805 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5806 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5807
5808         Custom Tables
5809 ╭────────────┬─────┬────────╮
5810 │            │Count│  Mean  │
5811 ├────────────┼─────┼────────┤
5812 │n1     1.00 │    3│        │
5813 │       2.00 │    3│        │
5814 │       3.00 │    3│        │
5815 │       4.00 │    3│        │
5816 │       5.00 │    3│        │
5817 │       6.00 │    3│        │
5818 │       7.00 │    2│        │
5819 │       8.00 │    2│        │
5820 │       9.00 │    2│        │
5821 │       10.00│    1│        │
5822 ├────────────┼─────┼────────┤
5823 │n2     1.00 │    1│        │
5824 │       2.00 │    1│        │
5825 │       3.00 │    1│        │
5826 │       4.00 │    1│        │
5827 │       5.00 │    1│        │
5828 │       6.00 │    1│        │
5829 │       7.00 │    1│        │
5830 │       8.00 │    1│        │
5831 │       9.00 │    1│        │
5832 │       10.00│    1│        │
5833 │       11.00│    1│        │
5834 │       12.00│    1│        │
5835 │       13.00│    1│        │
5836 │       14.00│    1│        │
5837 │       15.00│    1│        │
5838 │       16.00│    1│        │
5839 │       17.00│    1│        │
5840 │       18.00│    1│        │
5841 │       19.00│    1│        │
5842 │       20.00│    1│        │
5843 │       21.00│    1│        │
5844 │       22.00│    1│        │
5845 │       23.00│    3│        │
5846 ├────────────┼─────┼────────┤
5847 │string      │   25│        │
5848 ├────────────┼─────┼────────┤
5849 │s1          │     │   12.96│
5850 ├────────────┼─────┼────────┤
5851 │s2          │     │    4.76│
5852 ├────────────┼─────┼────────┤
5853 │s3          │     │    4.86│
5854 ├────────────┼─────┼────────┤
5855 │s4          │     │   16.60│
5856 ├────────────┼─────┼────────┤
5857 │s5          │     │14004.44│
5858 ╰────────────┴─────┴────────╯
5859
5860                                     Variables
5861 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5862 │      │        │  Measurement │     │     │         │            │            │
5863 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5864 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5865 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5866 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5867 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5868 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5869 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5870 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5871 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5872 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5873 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5874 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5875 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5876 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5877 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5878 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5879 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5880 ])
5881 AT_CLEANUP