CTABLES: Don't force the look to include empty rows and columns.
[pspp] / tests / language / commands / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Known bugs:
4 dnl TOTAL interaction with PCOMPUTE, e.g. the following
5 dnl CTABLES
6 dnl     /PCOMPUTE &all_drivers=EXPR([1 THRU 2] + [3 THRU 4])
7 dnl     /PPROPERTIES &all_drivers LABEL='All Drivers'
8 dnl     /PCOMPUTE &pct_not_drivers=EXPR([5] / ([1 THRU 2] + [3 THRU 4] + [5]) * 100)
9 dnl     /PPROPERTIES &pct_not_drivers LABEL='% Not Drivers' FORMAT=COUNT PCT40.1
10 dnl     /TABLE=qn1 BY qns3a
11 dnl     /CATEGORIES VARIABLES=qns3a TOTAL=YES
12 dnl     /CATEGORIES VARIABLES=qn1 [1 THRU 2, SUBTOTAL='Frequent Drivers',
13 dnl                                3 THRU 4, SUBTOTAL='Infrequent Drivers',
14 dnl                                &all_drivers, 5, &pct_not_drivers,
15 dnl                                MISSING, SUBTOTAL='Not Drivers or Missing'].
16 dnl yields gaps in the Total column:
17 dnl ╭─────────────────────────────────────────────────────────────────────────┬──────────────────╮
18 dnl │                                                                         │   S3a. GENDER:   │
19 dnl │                                                                         ├─────┬──────┬─────┤
20 dnl │                                                                         │ Male│Female│Total│
21 dnl │                                                                         ├─────┼──────┼─────┤
22 dnl │                                                                         │Count│ Count│Count│
23 dnl ├─────────────────────────────────────────────────────────────────────────┼─────┼──────┼─────┤
24 dnl │ 1. How often do you usually drive a car or other   Every day            │ 2305│  2362│ 4667│
25 dnl │motor vehicle?                                      Several days a week  │  440│   834│ 1274│
26 dnl │                                                    Frequent Drivers     │ 2745│  3196│     │
27 dnl │                                                    Once a week or less  │  125│   236│  361│
28 dnl │                                                    Only certain times a │   58│    72│  130│
29 dnl │                                                    year                 │     │      │     │
30 dnl │                                                    Infrequent Drivers   │  183│   308│     │
31 dnl │                                                    All Drivers          │ 2928│  3504│     │
32 dnl │                                                    Never                │  192│   348│  540│
33 dnl │                                                    % Not Drivers        │ 6.2%│  9.0%│     │
34 dnl │                                                    Don't know           │    3│     5│    8│
35 dnl │                                                    Refused              │    9│    10│   19│
36 dnl │                                                    Not Drivers or       │  204│   363│     │
37 dnl │                                                    Missing              │     │      │     │
38 dnl ╰─────────────────────────────────────────────────────────────────────────┴─────┴──────┴─────╯
39 dnl Features not yet implemented:
40 dnl - Multiple response sets
41 dnl - MRSETS subcommand.
42 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
43 dnl - SIGTEST
44 dnl - COMPARETEST
45 dnl - Summary functions:
46 dnl   * .LCL and .UCL suffixes.
47 dnl   * .SE suffixes.
48 dnl - CATEGORIES:
49 dnl   * Data-dependent sorting.
50
51 AT_SETUP([CTABLES parsing])
52 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
53 AT_DATA([ctables.sps],
54 [[GET 'nhtsa.sav'.
55 CTABLES
56     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
57     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
58     /FORMAT UNITS=CM EMPTY="(-)"
59     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
60     /VLABELS VARIABLES=qn17 DISPLAY=NAME
61     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
62     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
63     /VLABELS VARIABLES=qn20 DISPLAY=NONE
64     /MRSETS COUNTDUPLICATES=NO
65     /MRSETS COUNTDUPLICATES=YES
66     /SMISSING VARIABLE
67     /SMISSING LISTWISE
68     /WEIGHT VARIABLE=qns3a
69     /HIDESMALLCOUNTS
70     /HIDESMALLCOUNTS COUNT=10
71     /TABLE qnsa1
72     /SLABELS POSITION=COLUMN VISIBLE=YES
73     /SLABELS VISIBLE=NO POSITION=ROW
74     /SLABELS POSITION=LAYER
75     /CLABELS AUTO
76     /CLABELS ROWLABELS=OPPOSITE
77     /CRITERIA CILEVEL=50
78     /CATEGORIES VARIABLES=qn1 qn17
79                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
80                 POSITION=BEFORE EMPTY=INCLUDE.
81 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
82 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
83 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
84 ]])
85 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
86          Custom Tables
87 Count
88 ╭───────────────────┬────┬────╮
89 │                   │ RDD│CELL│
90 ├───────────────────┼────┼────┤
91 │Sa1. SAMPLE SOURCE:│5392│1607│
92 ╰───────────────────┴────┴────╯
93
94        Custom Tables
95 RDD
96 ╭───────────────────┬─────╮
97 │                   │Count│
98 ├───────────────────┼─────┤
99 │Sa1. SAMPLE SOURCE:│ 5392│
100 ╰───────────────────┴─────╯
101
102           Custom Tables
103 ╭────────────────────────┬─────╮
104 │                        │Count│
105 ├────────────────────────┼─────┤
106 │Sa1. SAMPLE SOURCE: RDD │ 5392│
107 │                    CELL│ 1607│
108 ╰────────────────────────┴─────╯
109
110           Custom Tables
111 ╭────────────────────────┬─────╮
112 │                        │Count│
113 ├────────────────────────┼─────┤
114 │Sa1. SAMPLE SOURCE: RDD │ 5392│
115 │                    CELL│ 1607│
116 ╰────────────────────────┴─────╯
117 ])
118 AT_CLEANUP
119
120 AT_SETUP([CTABLES parsing - negative])
121 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
122 AT_DATA([ctables.sps],
123 [[GET 'nhtsa.sav'.
124 CTABLES.
125 CTABLES /FORMAT MINCOLWIDTH='foo'.
126 CTABLES /TABLE qn1 [**].
127 CTABLES /TABLE qn1 [NOTAFUNCTION].
128 CTABLES /TABLE (qn1.
129 CTABLES /TABLE **.
130 CTABLES /TABLE NOTAVAR.
131 STRING string(A8).
132 CTABLES /TABLE string[S].
133 CTABLES /TABLE qn1 [PTILE 101].
134 CTABLES /TABLE qn1 [MEAN F0.1].
135 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
136 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
137 CTABLES /TABLE qn1 [MEAN TOTALS].
138 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
142 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
143 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
144 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
145 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
146 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
147 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
148 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
149 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
150 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
151 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
152 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
153 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
154 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
155 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
156 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
157 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
158 CTABLES /PCOMPUTE &k=EXPR([LO **]).
159 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
160 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
161 CTABLES /PCOMPUTE &k=EXPR([1**]).
162 CTABLES /PCOMPUTE &k=EXPR((1x)).
163 CTABLES /PCOMPUTE **k.
164 CTABLES /PCOMPUTE &1.
165 CTABLES /PCOMPUTE &k**.
166 CTABLES /PCOMPUTE &k=**.
167 CTABLES /PCOMPUTE &k=EXPR**.
168 CTABLES /PCOMPUTE &k=EXPR(1x).
169 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
170 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
171 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
172 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
173 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
174 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
175 CTABLES /FORMAT EMPTY=**.
176 CTABLES /FORMAT MISSING=**.
177 CTABLES /FORMAT **.
178 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
179 CTABLES /VLABELS **.
180 CTABLES /VLABELS VARIABLES=NOTAVAR.
181 CTABLES /VLABELS VARIABLES=qn1 **.
182 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
183 CTABLES /MRSETS **.
184 CTABLES /MRSETS COUNTDUPLICATES=**.
185 CTABLES /SMISSING **.
186 CTABLES /WEIGHT **.
187 CTABLES /WEIGHT VARIABLE=NOTAVAR.
188 CTABLES /HIDESMALLCOUNTS COUNT=1.
189 CTABLES /QUUX.
190 CTABLES /HIDESMALLCOUNTS COUNT=2.
191 CTABLES /TABLE qn1**.
192 CTABLES /TABLE qn1 /SLABELS POSITION=**.
193 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
194 CTABLES /TABLE qn1 /SLABELS **.
195 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
196 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
197 CTABLES /TABLE qn1 /CLABELS **.
198 CTABLES /TABLE qn1 /CRITERIA **.
199 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
200 CTABLES /TABLE qn1 /TITLES **.
201 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
202 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
203 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
204 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
205 CTABLES /TABLE qn1 /SIGTEST **.
206 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
207 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
208 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
209 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
210 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
211 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
212 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
213 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
214 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
215 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
216 CTABLES /TABLE qn1 /COMPARETEST **.
217 CTABLES /TABLE qn1 /FORMAT.
218 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
219 CTABLES /TABLE qn20 > qnd1.
220 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
221 NUMERIC datetime (DATETIME17.0).
222 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
223 ]])
224 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
225 [[ctables.sps:2.8: error: CTABLES: Syntax error expecting `/'.
226     2 | CTABLES.
227       |        ^
228
229 ctables.sps:3.29-3.33: error: CTABLES: Syntax error expecting non-negative
230 number for MINCOLWIDTH.
231     3 | CTABLES /FORMAT MINCOLWIDTH='foo'.
232       |                             ^~~~~
233
234 ctables.sps:4.21-4.22: error: CTABLES: Syntax error expecting identifier.
235     4 | CTABLES /TABLE qn1 [**].
236       |                     ^~
237
238 ctables.sps:5.21-5.32: error: CTABLES: Syntax error expecting summary function
239 name.
240     5 | CTABLES /TABLE qn1 [NOTAFUNCTION].
241       |                     ^~~~~~~~~~~~
242
243 ctables.sps:6.20: error: CTABLES: Syntax error expecting `@:}@'.
244     6 | CTABLES /TABLE @{:@qn1.
245       |                    ^
246
247 ctables.sps:7.16-7.17: error: CTABLES: Syntax error expecting identifier.
248     7 | CTABLES /TABLE **.
249       |                ^~
250
251 ctables.sps:8.16-8.22: error: CTABLES: NOTAVAR is not a variable name.
252     8 | CTABLES /TABLE NOTAVAR.
253       |                ^~~~~~~
254
255 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
256 scale variable.
257    10 | CTABLES /TABLE string[S].
258       |                ^~~~~~~~~
259
260 ctables.sps:11.27-11.29: error: CTABLES: Syntax error expecting number between 0
261 and 100 for PTILE.
262    11 | CTABLES /TABLE qn1 [PTILE 101].
263       |                           ^~~
264
265 ctables.sps:12.26-12.29: error: CTABLES: Output format F0.1 specifies width 0,
266 but F requires a width between 1 and 40.
267    12 | CTABLES /TABLE qn1 [MEAN F0.1].
268       |                          ^~~~
269
270 ctables.sps:13.26-13.36: error: CTABLES: Output format NEGPAREN requires width 2
271 or greater.
272    13 | CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
273       |                          ^~~~~~~~~~~
274
275 ctables.sps:14.26-14.36: error: CTABLES: Output format NEGPAREN requires width
276 greater than decimals.
277    14 | CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
278       |                          ^~~~~~~~~~~
279
280 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
281 scale variables.
282    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
283       |                     ^~~~
284
285 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
286    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
287       |                ^~~
288
289 ctables.sps:15.32: error: CTABLES: Syntax error expecting `@<:@'.
290    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
291       |                                ^
292
293 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
294 scale variables.
295    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
296       |                     ^~~~
297
298 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
299    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
300       |                ^~~
301
302 ctables.sps:16.40: error: CTABLES: Syntax error expecting `@:>@'.
303    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
304       |                                        ^
305
306 ctables.sps:17.56: error: CTABLES: Syntax error expecting string.
307    17 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
308       |                                                        ^
309
310 ctables.sps:18.50-18.51: error: CTABLES: Syntax error expecting THRU.
311    18 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
312       |                                                  ^~
313
314 ctables.sps:19.55: error: CTABLES: Syntax error expecting number.
315    19 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
316       |                                                       ^
317
318 ctables.sps:20.54-20.55: error: CTABLES: Syntax error expecting number.
319    20 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
320       |                                                      ^~
321
322 ctables.sps:21.56-21.57: error: CTABLES: Syntax error expecting string.
323    21 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
324       |                                                        ^~
325
326 ctables.sps:22.48-22.49: error: CTABLES: Syntax error expecting identifier.
327    22 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
328       |                                                ^~
329
330 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
331    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
332       |                                               ^~
333
334 ctables.sps:24.61-24.63: error: CTABLES: Syntax error expecting number between 0
335 and 100 for PTILE.
336    24 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
337       |                                                             ^~~
338
339 ctables.sps:25.58: error: CTABLES: Syntax error expecting `@:}@'.
340    25 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
341       |                                                          ^
342
343 ctables.sps:26.54: error: CTABLES: Syntax error expecting `@{:@'.
344    26 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
345       |                                                      ^
346
347 ctables.sps:27.54-27.55: error: CTABLES: Syntax error expecting INCLUDE or
348 EXCLUDE.
349    27 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
350       |                                                      ^~
351
352 ctables.sps:28.52-28.53: error: CTABLES: Syntax error expecting YES or NO.
353    28 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
354       |                                                    ^~
355
356 ctables.sps:29.52-29.53: error: CTABLES: Syntax error expecting string.
357    29 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
358       |                                                    ^~
359
360 ctables.sps:30.55-30.56: error: CTABLES: Syntax error expecting BEFORE or AFTER.
361    30 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
362       |                                                       ^~
363
364 ctables.sps:31.52-31.53: error: CTABLES: Syntax error expecting INCLUDE or
365 EXCLUDE.
366    31 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
367       |                                                    ^~
368
369 ctables.sps:32.46-32.47: error: CTABLES: Syntax error expecting ORDER, KEY,
370 MISSING, TOTAL, LABEL, POSITION, or EMPTY.
371    32 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
372       |                                              ^~
373
374 ctables.sps:33.54-33.55: error: CTABLES: Syntax error expecting TOTAL, LABEL,
375 POSITION, or EMPTY.
376    33 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
377       |                                                      ^~
378
379 ctables.sps:34.36: error: CTABLES: Syntax error expecting positive integer for
380 SUBTOTAL.
381    34 | CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
382       |                                    ^
383
384 ctables.sps:35.37-35.38: error: CTABLES: Syntax error expecting `@:>@'.
385    35 | CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
386       |                                     ^~
387
388 ctables.sps:36.31-36.32: error: CTABLES: Syntax error expecting THRU.
389    36 | CTABLES /PCOMPUTE &k=EXPR([LO **]).
390       |                               ^~
391
392 ctables.sps:37.36-37.37: error: CTABLES: Syntax error expecting number.
393    37 | CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
394       |                                    ^~
395
396 ctables.sps:38.35-38.36: error: CTABLES: Syntax error expecting number.
397    38 | CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
398       |                                   ^~
399
400 ctables.sps:39.29-39.30: error: CTABLES: Syntax error expecting `@:>@'.
401    39 | CTABLES /PCOMPUTE &k=EXPR([1**]).
402       |                             ^~
403
404 ctables.sps:40.29: error: CTABLES: Syntax error expecting `@:}@'.
405    40 | CTABLES /PCOMPUTE &k=EXPR((1x)).
406       |                             ^
407
408 ctables.sps:41.19-41.20: error: CTABLES: Syntax error expecting &.
409    41 | CTABLES /PCOMPUTE **k.
410       |                   ^~
411
412 ctables.sps:42.20: error: CTABLES: Syntax error expecting identifier.
413    42 | CTABLES /PCOMPUTE &1.
414       |                    ^
415
416 ctables.sps:43.21-43.22: error: CTABLES: Syntax error expecting `=EXPR@{:@'.
417    43 | CTABLES /PCOMPUTE &k**.
418       |                     ^~
419
420 ctables.sps:44.21-44.23: error: CTABLES: Syntax error expecting `=EXPR@{:@'.
421    44 | CTABLES /PCOMPUTE &k=**.
422       |                     ^~~
423
424 ctables.sps:45.21-45.27: error: CTABLES: Syntax error expecting `=EXPR@{:@'.
425    45 | CTABLES /PCOMPUTE &k=EXPR**.
426       |                     ^~~~~~~
427
428 ctables.sps:46.28: error: CTABLES: Syntax error expecting `@:}@'.
429    46 | CTABLES /PCOMPUTE &k=EXPR(1x).
430       |                            ^
431
432 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
433 the previous definition.
434    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
435       |                               ^~~~~~~~~~~~~~~~~~~
436
437 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
438    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
439       |          ^~~~~~~~~~~~~~~~~~~
440
441 ctables.sps:47.50: error: CTABLES: Syntax error expecting `/'.
442    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
443       |                                                  ^
444
445 ctables.sps:48.53-48.64: error: CTABLES: Syntax error expecting summary function
446 name.
447    48 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
448       |                                                     ^~~~~~~~~~~~
449
450 ctables.sps:49.59-49.60: error: CTABLES: Syntax error expecting number between 0
451 and 100 for PTILE.
452    49 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
453       |                                                           ^~
454
455 ctables.sps:50.52-50.53: error: CTABLES: Syntax error expecting string.
456    50 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
457       |                                                    ^~
458
459 ctables.sps:51.61-51.62: error: CTABLES: Syntax error expecting YES or NO.
460    51 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
461       |                                                             ^~
462
463 ctables.sps:52.46-52.47: error: CTABLES: Syntax error expecting LABEL, FORMAT,
464 or HIDESOURCECATS.
465    52 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
466       |                                              ^~
467
468 ctables.sps:53.23-53.24: error: CTABLES: Syntax error expecting string.
469    53 | CTABLES /FORMAT EMPTY=**.
470       |                       ^~
471
472 ctables.sps:54.25-54.26: error: CTABLES: Syntax error expecting string.
473    54 | CTABLES /FORMAT MISSING=**.
474       |                         ^~
475
476 ctables.sps:55.17-55.18: error: CTABLES: Syntax error expecting MINCOLWIDTH,
477 MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
478    55 | CTABLES /FORMAT **.
479       |                 ^~
480
481 ctables.sps:56.17-56.45: error: CTABLES: MINCOLWIDTH must not be greater than
482 MAXCOLWIDTH.
483    56 | CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
484       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
485
486 ctables.sps:57.18-57.19: error: CTABLES: Syntax error expecting VARIABLES.
487    57 | CTABLES /VLABELS **.
488       |                  ^~
489
490 ctables.sps:58.28-58.34: error: CTABLES: NOTAVAR is not a variable name.
491    58 | CTABLES /VLABELS VARIABLES=NOTAVAR.
492       |                            ^~~~~~~
493
494 ctables.sps:59.32-59.33: error: CTABLES: Syntax error expecting DISPLAY.
495    59 | CTABLES /VLABELS VARIABLES=qn1 **.
496       |                                ^~
497
498 ctables.sps:60.40-60.41: error: CTABLES: Syntax error expecting DEFAULT, NAME,
499 LABEL, BOTH, or NONE.
500    60 | CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
501       |                                        ^~
502
503 ctables.sps:61.17-61.18: error: CTABLES: Syntax error expecting COUNTDUPLICATES.
504    61 | CTABLES /MRSETS **.
505       |                 ^~
506
507 ctables.sps:62.33-62.34: error: CTABLES: Syntax error expecting YES or NO.
508    62 | CTABLES /MRSETS COUNTDUPLICATES=**.
509       |                                 ^~
510
511 ctables.sps:63.19-63.20: error: CTABLES: Syntax error expecting VARIABLE or
512 LISTWISE.
513    63 | CTABLES /SMISSING **.
514       |                   ^~
515
516 ctables.sps:64.17-64.18: error: CTABLES: Syntax error expecting VARIABLE.
517    64 | CTABLES /WEIGHT **.
518       |                 ^~
519
520 ctables.sps:65.26-65.32: error: CTABLES: NOTAVAR is not a variable name.
521    65 | CTABLES /WEIGHT VARIABLE=NOTAVAR.
522       |                          ^~~~~~~
523
524 ctables.sps:66.32: error: CTABLES: Syntax error expecting integer 2 or greater
525 for HIDESMALLCOUNTS COUNT.
526    66 | CTABLES /HIDESMALLCOUNTS COUNT=1.
527       |                                ^
528
529 ctables.sps:67.10-67.13: error: CTABLES: Syntax error expecting one of the
530 following: FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
531 HIDESMALLCOUNTS, TABLE.
532    67 | CTABLES /QUUX.
533       |          ^~~~
534
535 ctables.sps:68.33: error: CTABLES: Syntax error expecting `/'.
536    68 | CTABLES /HIDESMALLCOUNTS COUNT=2.
537       |                                 ^
538
539 ctables.sps:69.19-69.20: error: CTABLES: Syntax error expecting `/'.
540    69 | CTABLES /TABLE qn1**.
541       |                   ^~
542
543 ctables.sps:70.38-70.39: error: CTABLES: Syntax error expecting COLUMN, ROW, or
544 LAYER.
545    70 | CTABLES /TABLE qn1 /SLABELS POSITION=**.
546       |                                      ^~
547
548 ctables.sps:71.37-71.38: error: CTABLES: Syntax error expecting YES or NO.
549    71 | CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
550       |                                     ^~
551
552 ctables.sps:72.29-72.30: error: CTABLES: Syntax error expecting POSITION or
553 VISIBLE.
554    72 | CTABLES /TABLE qn1 /SLABELS **.
555       |                             ^~
556
557 ctables.sps:73.39-73.40: error: CTABLES: Syntax error expecting OPPOSITE or
558 LAYER.
559    73 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
560       |                                       ^~
561
562 ctables.sps:74.39-74.40: error: CTABLES: Syntax error expecting OPPOSITE or
563 LAYER.
564    74 | CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
565       |                                       ^~
566
567 ctables.sps:75.29-75.30: error: CTABLES: Syntax error expecting AUTO, ROWLABELS,
568 or COLLABELS.
569    75 | CTABLES /TABLE qn1 /CLABELS **.
570       |                             ^~
571
572 ctables.sps:76.30-76.31: error: CTABLES: Syntax error expecting CILEVEL.
573    76 | CTABLES /TABLE qn1 /CRITERIA **.
574       |                              ^~
575
576 ctables.sps:77.38-77.40: error: CTABLES: Syntax error expecting number in
577 @<:@0,100@:}@ for CILEVEL.
578    77 | CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
579       |                                      ^~~
580
581 ctables.sps:78.28-78.29: error: CTABLES: Syntax error expecting CAPTION, CORNER,
582 or TITLE.
583    78 | CTABLES /TABLE qn1 /TITLES **.
584       |                            ^~
585
586 ctables.sps:79.34-79.35: error: CTABLES: Syntax error expecting CHISQUARE.
587    79 | CTABLES /TABLE qn1 /SIGTEST TYPE=**.
588       |                                  ^~
589
590 ctables.sps:80.35-80.36: error: CTABLES: Syntax error expecting number in @<:@0,1@:}@
591 for ALPHA.
592    80 | CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
593       |                                   ^~
594
595 ctables.sps:81.43-81.44: error: CTABLES: Syntax error expecting YES or NO.
596    81 | CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
597       |                                           ^~
598
599 ctables.sps:82.40-82.41: error: CTABLES: Syntax error expecting ALLVISIBLE or
600 SUBTOTALS.
601    82 | CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
602       |                                        ^~
603
604 ctables.sps:83.29-83.30: error: CTABLES: Syntax error expecting TYPE, ALPHA,
605 INCLUDEMRSETS, or CATEGORIES.
606    83 | CTABLES /TABLE qn1 /SIGTEST **.
607       |                             ^~
608
609 ctables.sps:84.38-84.39: error: CTABLES: Syntax error expecting PROP or MEAN.
610    84 | CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
611       |                                      ^~
612
613 ctables.sps:85.39-85.40: error: CTABLES: Syntax error expecting number in (0,1)
614 for ALPHA.
615    85 | CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
616       |                                       ^~
617
618 ctables.sps:86.39: error: CTABLES: Syntax error expecting number in (0,1) for
619 ALPHA.
620    86 | CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
621       |                                       ^
622
623 ctables.sps:87.40-87.41: error: CTABLES: Syntax error expecting BONFERRONI, BH,
624 or NONE.
625    87 | CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
626       |                                        ^~
627
628 ctables.sps:88.47-88.48: error: CTABLES: Syntax error expecting YES or NO.
629    88 | CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
630       |                                               ^~
631
632 ctables.sps:89.47-89.48: error: CTABLES: Syntax error expecting ALLCATS or
633 TESTEDCATS.
634    89 | CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
635       |                                               ^~
636
637 ctables.sps:90.44-90.45: error: CTABLES: Syntax error expecting ALLVISIBLE or
638 SUBTOTALS.
639    90 | CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
640       |                                            ^~
641
642 ctables.sps:91.39-91.40: error: CTABLES: Syntax error expecting YES or NO.
643    91 | CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
644       |                                       ^~
645
646 ctables.sps:92.39-92.40: error: CTABLES: Syntax error expecting APA or SIMPLE.
647    92 | CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
648       |                                       ^~
649
650 ctables.sps:93.41-93.42: error: CTABLES: Syntax error expecting YES or NO.
651    93 | CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
652       |                                         ^~
653
654 ctables.sps:94.33-94.34: error: CTABLES: Syntax error expecting one of the
655 following: TYPE, ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE,
656 STYLE, SHOWSIG.
657    94 | CTABLES /TABLE qn1 /COMPARETEST **.
658       |                                 ^~
659
660 ctables.sps:95.21-95.26: error: CTABLES: Syntax error expecting TABLE, SLABELS,
661 CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
662    95 | CTABLES /TABLE qn1 /FORMAT.
663       |                     ^~~~~~
664
665 ctables.sps:95.21-95.26: note: CTABLES: This subcommand must appear before
666 TABLE.
667    95 | CTABLES /TABLE qn1 /FORMAT.
668       |                     ^~~~~~
669
670 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
671 specified.
672
673 ctables.sps:96.21-96.46: note: CTABLES: This is the first specification.
674    96 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS
675 COLLABELS=OPPOSITE.
676       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
677
678 ctables.sps:96.49-96.74: note: CTABLES: This is the second specification.
679    96 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS
680 COLLABELS=OPPOSITE.
681       |
682 ^~~~~~~~~~~~~~~~~~~~~~~~~~
683
684 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
685    97 | CTABLES /TABLE qn20 > qnd1.
686       |                ^~~~~~~~~~~
687
688 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
689    97 | CTABLES /TABLE qn20 > qnd1.
690       |                ^~~~
691
692 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
693    97 | CTABLES /TABLE qn20 > qnd1.
694       |                       ^~~~
695
696 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
697 categorical variables at the innermost nesting level.
698    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
699       |                ^~~~~~~~~~~~~~~~~~~~
700
701 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
702 summary.
703    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
704       |                ^~~
705
706 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
707 specification as format DATETIME: Day (123) must be between 1 and 31..
708   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
709       |                                                    ^~~~~
710 ]])
711 AT_CLEANUP
712
713 AT_SETUP([CTABLES parsing - more negative])
714 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
715 AT_DATA([ctables.sps],
716 [[GET 'nhtsa.sav'.
717 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
718 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
719 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
720
721 STRING string(A8).
722 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
723 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
724
725 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
726
727 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
728 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
729 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
730 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
731
732 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
733 CTABLES /PCOMPUTE &x=EXPR([**]).
734 CTABLES /PCOMPUTE &x=EXPR(**).
735
736 CTABLES /TABLE.
737
738 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
739
740 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
741
742 CTABLES /TABLE $mrset.
743
744 CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
745 CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
746
747 CTABLES /TABLE qn113 [COUNT.UCL].
748
749 CTABLES /TABLE qn1 /CATEGORIES **.
750
751 CTABLES /TITLES.
752 ]])
753 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [1],
754 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a category not included in the category list.
755     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
756       |                                                                            ^~~
757
758 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
759     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
760       |                            ^~~~~~~~
761
762 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the list of categories here.
763     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
764       |                                                                            ^~~~
765
766 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a category not included in the category list.
767     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
768       |                                                                         ^~~
769
770 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
771     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
772       |                            ^~~~~
773
774 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the variable's CATEGORIES specification.
775
776 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of SUBTOTAL or HSUBTOTAL, so references from
777 computed categories must refer to subtotals by position, e.g. SUBTOTAL[1].
778     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
779       |                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~
780
781 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a position.
782     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
783       |                            ^~~~~~~~
784
785 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be applied only to string variables, but this
786 subcommand tries to apply it to numeric variable QN1.
787     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
788       |                                               ^~~~~~~~
789
790 ctables.sps:8.53: error: CTABLES: This category specification may be applied only to numeric variables, but this
791 subcommand tries to apply it to string variable string.
792     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
793       |                                                     ^
794
795 ctables.sps:10.74-10.86: error: CTABLES: Data-dependent sorting is not implemented.
796    10 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
797       |                                                                          ^~~~~~~~~~~~~
798
799 ctables.sps:12: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
800 moved must be categorical, but qnd1 is scale.
801
802 ctables.sps:12.22-12.47: note: CTABLES: This syntax moves category labels to another axis.
803    12 | CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
804       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
805
806 ctables.sps:13: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
807 moved must all have the same width, but QN1 has width 0 and string has width 8.
808
809 ctables.sps:13.30-13.55: note: CTABLES: This syntax moves category labels to another axis.
810    13 | CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
811       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
812
813 ctables.sps:14: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
814 moved must all have the same value labels, but QN1 and QNSA1 have different value labels.
815
816 ctables.sps:14.29-14.54: note: CTABLES: This syntax moves category labels to another axis.
817    14 | CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
818       |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
819
820 ctables.sps:15: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
821 moved must all have the same category specifications, but QN105BA and QN105BB have different category specifications.
822
823 ctables.sps:15.35-15.60: note: CTABLES: This syntax moves category labels to another axis.
824    15 | CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
825       |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
826
827 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is left-associative: `a**b**c' equals
828 `(a**b)**c', not `a**(b**c)'.  To disable this warning, insert parentheses.
829    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
830       |                           ^~~~~~~
831
832 ctables.sps:17.35: error: CTABLES: Syntax error expecting `/'.
833    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
834       |                                   ^
835
836 ctables.sps:18.28-18.29: error: CTABLES: Syntax error expecting number or string or range.
837    18 | CTABLES /PCOMPUTE &x=EXPR([**]).
838       |                            ^~
839
840 ctables.sps:19.27-19.28: error: CTABLES: Syntax error in postcompute expression.
841    19 | CTABLES /PCOMPUTE &x=EXPR(**).
842       |                           ^~
843
844 ctables.sps:21.15: error: CTABLES: At least one variable must be specified.
845    21 | CTABLES /TABLE.
846       |               ^
847
848 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
849
850 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a summary.
851    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
852       |                                                  ^~~~~
853
854 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a summary.
855    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
856       |                ^~~~~
857
858 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a summary.
859    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
860       |                                 ^~~~~
861
862 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always has a summary even if the syntax does not
863 explicitly specify one.
864    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
865       |                                 ^~~~~
866
867 ctables.sps:25.46-25.63: error: CTABLES: Data-dependent sorting is not implemented.
868    25 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
869       |                                              ^~~~~~~~~~~~~~~~~~
870
871 ctables.sps:27.16-27.21: error: CTABLES: Multiple response set support not implemented.
872    27 | CTABLES /TABLE $mrset.
873       |                ^~~~~~
874
875 ctables.sps:29.23-29.44: error: CTABLES: Support for SIGTEST not yet implemented.
876    29 | CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
877       |                       ^~~~~~~~~~~~~~~~~~~~~~
878
879 ctables.sps:30.23-30.43: error: CTABLES: Support for COMPARETEST not yet implemented.
880    30 | CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
881       |                       ^~~~~~~~~~~~~~~~~~~~~
882
883 ctables.sps:32.23-32.31: error: CTABLES: Support for LCL, UCL, and SE summary functions is not yet implemented.
884    32 | CTABLES /TABLE qn113 [COUNT.UCL].
885       |                       ^~~~~~~~~
886
887 ctables.sps:34.32-34.33: error: CTABLES: Syntax error expecting VARIABLES.
888    34 | CTABLES /TABLE qn1 /CATEGORIES **.
889       |                                ^~
890
891 ctables.sps:36.10-36.15: error: CTABLES: Syntax error expecting one of the following: FORMAT, VLABELS, MRSETS, SMISSING,
892 PCOMPUTE, PPROPERTIES, WEIGHT, HIDESMALLCOUNTS, TABLE.
893    36 | CTABLES /TITLES.
894       |          ^~~~~~
895
896 ctables.sps:36.10-36.15: note: CTABLES: TABLE must appear before this subcommand.
897    36 | CTABLES /TITLES.
898       |          ^~~~~~
899 ]])
900 AT_CLEANUP
901
902 AT_SETUP([CTABLES one categorical variable])
903 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
904 AT_DATA([ctables.sps],
905 [[GET 'nhtsa.sav'.
906 CTABLES /TABLE qn1.
907 CTABLES /TABLE BY qn1.
908 CTABLES /TABLE BY BY qn1.
909 ]])
910 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
911                                   Custom Tables
912 ╭────────────────────────────────────────────────────────────────────────┬─────╮
913 │                                                                        │Count│
914 ├────────────────────────────────────────────────────────────────────────┼─────┤
915 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
916 │motor vehicle?                                     Several days a week  │ 1274│
917 │                                                   Once a week or less  │  361│
918 │                                                   Only certain times a │  130│
919 │                                                   year                 │     │
920 │                                                   Never                │  540│
921 ╰────────────────────────────────────────────────────────────────────────┴─────╯
922
923                                   Custom Tables
924 ╭──────────────────────────────────────────────────────────────────────────────╮
925 │        1. How often do you usually drive a car or other motor vehicle?       │
926 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
927 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
928 │Every day│       week       │       less       │          year          │Never│
929 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
930 │  Count  │       Count      │       Count      │          Count         │Count│
931 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
932 │     4667│              1274│               361│                     130│  540│
933 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
934
935 Custom Tables
936 Every day
937 ╭─────╮
938 │Count│
939 ├─────┤
940 │ 4667│
941 ╰─────╯
942 ])
943 AT_CLEANUP
944
945 AT_SETUP([CTABLES one string variable])
946 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
947 AT_DATA([ctables.sps],
948 [[GET 'nhtsa.sav'.
949 STRING licensed(A8).
950 MISSING VALUES licensed('DontKnow', 'Refused').
951 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
952 CTABLES /TABLE licensed.
953 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
954 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
955 * Notice that the string matching is case-sensitive.
956 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
957 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
958 CTABLES
959     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
960     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
961     /TABLE licensed
962     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
963 CTABLES
964     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
965     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
966     /TABLE licensed
967     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
968 ]])
969 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
970     Custom Tables
971 ╭────────────┬─────╮
972 │            │Count│
973 ├────────────┼─────┤
974 │licensed No │  572│
975 │         Yes│ 6379│
976 ╰────────────┴─────╯
977
978           Custom Tables
979 ╭─────────────────┬─────┬───────╮
980 │                 │Count│Valid N│
981 ├─────────────────┼─────┼───────┤
982 │licensed DontKnow│    4│       │
983 │         No      │  572│       │
984 │         Refused │   44│       │
985 │         Yes     │ 6379│       │
986 │         Total   │ 6999│   6951│
987 ╰─────────────────┴─────┴───────╯
988
989      Custom Tables
990 ╭──────────────┬─────╮
991 │              │Count│
992 ├──────────────┼─────┤
993 │licensed Yes  │ 6379│
994 │         No   │  572│
995 │         Total│ 6951│
996 ╰──────────────┴─────╯
997
998      Custom Tables
999 ╭──────────────┬─────╮
1000 │              │Count│
1001 ├──────────────┼─────┤
1002 │licensed Yes  │ 6379│
1003 │         no   │    0│
1004 │         Total│ 6379│
1005 ╰──────────────┴─────╯
1006
1007       Custom Tables
1008 ╭────────────────┬─────╮
1009 │                │Count│
1010 ├────────────────┼─────┤
1011 │licensed No     │  572│
1012 │         Refused│   44│
1013 │         Yes    │ 6379│
1014 │         Total  │ 6995│
1015 ╰────────────────┴─────╯
1016
1017       Custom Tables
1018 ╭────────────────┬─────╮
1019 │                │Count│
1020 ├────────────────┼─────┤
1021 │licensed Yes    │ 6379│
1022 │         Not Yes│  620│
1023 ╰────────────────┴─────╯
1024
1025       Custom Tables
1026 ╭────────────────┬─────╮
1027 │                │Count│
1028 ├────────────────┼─────┤
1029 │licensed Yes    │ 6379│
1030 │         Not Yes│  620│
1031 ╰────────────────┴─────╯
1032 ])
1033 AT_CLEANUP
1034
1035 AT_SETUP([CTABLES one scale variable])
1036 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1037 AT_DATA([ctables.sps],
1038 [[GET 'nhtsa.sav'.
1039 DESCRIPTIVES qnd1.
1040 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
1041 CTABLES /TABLE BY qnd1.
1042 CTABLES /TABLE BY BY qnd1.
1043 ]])
1044 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1045                        Descriptive Statistics
1046 ╭──────────────────────────┬────┬─────┬───────┬───────┬───────────╮
1047 │                          │  N │ Mean│Std Dev│Minimum│  Maximum  │
1048 ├──────────────────────────┼────┼─────┼───────┼───────┼───────────┤
1049 │D1. AGE: What is your age?│6930│48.26│  19.01│     16│86 or older│
1050 │Valid N (listwise)        │6999│     │       │       │           │
1051 │Missing N (listwise)      │  69│     │       │       │           │
1052 ╰──────────────────────────┴────┴─────┴───────┴───────┴───────────╯
1053
1054                                   Custom Tables
1055 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
1056 │                      │     │       │       │    │     Std    │       │       │
1057 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
1058 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
1059 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
1060 │age?                  │     │       │       │    │            │       │       │
1061 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
1062
1063         Custom Tables
1064 ╭──────────────────────────╮
1065 │D1. AGE: What is your age?│
1066 ├──────────────────────────┤
1067 │           Mean           │
1068 ├──────────────────────────┤
1069 │                        48│
1070 ╰──────────────────────────╯
1071
1072 Custom Tables
1073 D1. AGE: What is your age?
1074 ╭────╮
1075 │Mean│
1076 ├────┤
1077 │  48│
1078 ╰────╯
1079 ])
1080 AT_CLEANUP
1081
1082 AT_SETUP([CTABLES simple stacking])
1083 AT_KEYWORDS([stack stacked])
1084 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1085 AT_DATA([ctables.sps],
1086 [[GET 'nhtsa.sav'.
1087 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
1088 ]])
1089 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1090                                   Custom Tables
1091 ╭───────────────────────────────────────────────────────────────┬──────────────╮
1092 │                                                               │ S3a. GENDER: │
1093 │                                                               ├──────┬───────┤
1094 │                                                               │ Male │ Female│
1095 │                                                               ├──────┼───────┤
1096 │                                                               │Column│ Column│
1097 │                                                               │   %  │   %   │
1098 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1099 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
1100 │too much to drink to drive safely will A. Get      certain     │      │       │
1101 │stopped by the police?                             Very likely │   21%│    22%│
1102 │                                                   Somewhat    │   38%│    42%│
1103 │                                                   likely      │      │       │
1104 │                                                   Somewhat    │   21%│    18%│
1105 │                                                   unlikely    │      │       │
1106 │                                                   Very        │   10%│     8%│
1107 │                                                   unlikely    │      │       │
1108 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1109 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
1110 │too much to drink to drive safely will B. Have an  certain     │      │       │
1111 │accident?                                          Very likely │   36%│    45%│
1112 │                                                   Somewhat    │   39%│    32%│
1113 │                                                   likely      │      │       │
1114 │                                                   Somewhat    │    9%│     4%│
1115 │                                                   unlikely    │      │       │
1116 │                                                   Very        │    3%│     2%│
1117 │                                                   unlikely    │      │       │
1118 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1119 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
1120 │too much to drink to drive safely will C. Be       certain     │      │       │
1121 │convicted for drunk driving?                       Very likely │   32%│    28%│
1122 │                                                   Somewhat    │   27%│    32%│
1123 │                                                   likely      │      │       │
1124 │                                                   Somewhat    │   15%│    15%│
1125 │                                                   unlikely    │      │       │
1126 │                                                   Very        │    9%│     9%│
1127 │                                                   unlikely    │      │       │
1128 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1129 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
1130 │too much to drink to drive safely will D. Be       certain     │      │       │
1131 │arrested for drunk driving?                        Very likely │   26%│    27%│
1132 │                                                   Somewhat    │   32%│    35%│
1133 │                                                   likely      │      │       │
1134 │                                                   Somewhat    │   17%│    15%│
1135 │                                                   unlikely    │      │       │
1136 │                                                   Very        │    9%│     7%│
1137 │                                                   unlikely    │      │       │
1138 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
1139 ])
1140 AT_CLEANUP
1141
1142 AT_SETUP([CTABLES show or hide empty categories])
1143 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1144 AT_DATA([ctables.sps],
1145 [[GET 'nhtsa.sav'.
1146 IF (qn105ba = 2) qn105ba = 1.
1147 IF (qns3a = 1) qns3a = 2.
1148 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
1149 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1150     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
1151 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1152     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
1153 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1154     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
1155 ]])
1156 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1157                                   Custom Tables
1158 ╭──────────────────────────────────────────────────────────────┬───────────────╮
1159 │                                                              │  S3a. GENDER: │
1160 │                                                              ├───────┬───────┤
1161 │                                                              │  Male │ Female│
1162 │                                                              ├───────┼───────┤
1163 │                                                              │ Column│ Column│
1164 │                                                              │   %   │   %   │
1165 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
1166 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
1167 │too much to drink to drive safely will A. Get      certain    │       │       │
1168 │stopped by the police?                             Very likely│      .│     0%│
1169 │                                                   Somewhat   │      .│    40%│
1170 │                                                   likely     │       │       │
1171 │                                                   Somewhat   │      .│    19%│
1172 │                                                   unlikely   │       │       │
1173 │                                                   Very       │      .│     9%│
1174 │                                                   unlikely   │       │       │
1175 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
1176
1177                                   Custom Tables
1178 ╭──────────────────────────────────────────────────────────────┬───────────────╮
1179 │                                                              │  S3a. GENDER: │
1180 │                                                              ├───────┬───────┤
1181 │                                                              │  Male │ Female│
1182 │                                                              ├───────┼───────┤
1183 │                                                              │ Column│ Column│
1184 │                                                              │   %   │   %   │
1185 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
1186 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
1187 │too much to drink to drive safely will A. Get      certain    │       │       │
1188 │stopped by the police?                             Somewhat   │      .│    40%│
1189 │                                                   likely     │       │       │
1190 │                                                   Somewhat   │      .│    19%│
1191 │                                                   unlikely   │       │       │
1192 │                                                   Very       │      .│     9%│
1193 │                                                   unlikely   │       │       │
1194 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
1195
1196                                   Custom Tables
1197 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1198 │                                                                    │   S3a.  │
1199 │                                                                    │ GENDER: │
1200 │                                                                    ├─────────┤
1201 │                                                                    │  Female │
1202 │                                                                    ├─────────┤
1203 │                                                                    │ Column %│
1204 ├────────────────────────────────────────────────────────────────────┼─────────┤
1205 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1206 │much to drink to drive safely will A. Get stopped by    certain     │         │
1207 │the police?                                             Very likely │       0%│
1208 │                                                        Somewhat    │      40%│
1209 │                                                        likely      │         │
1210 │                                                        Somewhat    │      19%│
1211 │                                                        unlikely    │         │
1212 │                                                        Very        │       9%│
1213 │                                                        unlikely    │         │
1214 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1215
1216                                   Custom Tables
1217 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1218 │                                                                    │   S3a.  │
1219 │                                                                    │ GENDER: │
1220 │                                                                    ├─────────┤
1221 │                                                                    │  Female │
1222 │                                                                    ├─────────┤
1223 │                                                                    │ Column %│
1224 ├────────────────────────────────────────────────────────────────────┼─────────┤
1225 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1226 │much to drink to drive safely will A. Get stopped by    certain     │         │
1227 │the police?                                             Somewhat    │      40%│
1228 │                                                        likely      │         │
1229 │                                                        Somewhat    │      19%│
1230 │                                                        unlikely    │         │
1231 │                                                        Very        │       9%│
1232 │                                                        unlikely    │         │
1233 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1234 ])
1235 AT_CLEANUP
1236
1237 AT_SETUP([CTABLES categories and EMPTY])
1238 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1239 AT_DATA([ctables.sps],
1240 DATA LIST LIST NOTABLE /class datum size.
1241 BEGIN DATA
1242 1 1 1
1243 2 2 1
1244 1 3 1
1245 2 4 2
1246 1 5 2
1247 2 6 2
1248 END DATA.
1249 VARIABLE LEVEL class datum size (NOMINAL).
1250 FORMATS class datum size (F1.0).
1251
1252 * The following are the same except for the order of the CATEGORIES commands.
1253 * The test checks that they produce the same resuls.
1254 CTABLES /TABLE=class > datum BY size
1255    /CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE
1256    /CATEGORIES VARIABLES=size TOTAL=YES.
1257 CTABLES /TABLE=class > datum BY size
1258    /CATEGORIES VARIABLES=size TOTAL=YES
1259    /CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE.
1260 ])
1261 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1262            Custom Tables
1263 ╭───────────────┬─────────────────╮
1264 │               │       size      │
1265 │               ├─────┬─────┬─────┤
1266 │               │  1  │  2  │Total│
1267 │               ├─────┼─────┼─────┤
1268 │               │Count│Count│Count│
1269 ├───────────────┼─────┼─────┼─────┤
1270 │class 1 datum 1│    1│     │    1│
1271 │              3│    1│     │    1│
1272 │              5│     │    1│    1│
1273 │     ╶─────────┼─────┼─────┼─────┤
1274 │      2 datum 2│    1│     │    1│
1275 │              4│     │    1│    1│
1276 │              6│     │    1│    1│
1277 ╰───────────────┴─────┴─────┴─────╯
1278
1279            Custom Tables
1280 ╭───────────────┬─────────────────╮
1281 │               │       size      │
1282 │               ├─────┬─────┬─────┤
1283 │               │  1  │  2  │Total│
1284 │               ├─────┼─────┼─────┤
1285 │               │Count│Count│Count│
1286 ├───────────────┼─────┼─────┼─────┤
1287 │class 1 datum 1│    1│     │    1│
1288 │              3│    1│     │    1│
1289 │              5│     │    1│    1│
1290 │     ╶─────────┼─────┼─────┼─────┤
1291 │      2 datum 2│    1│     │    1│
1292 │              4│     │    1│    1│
1293 │              6│     │    1│    1│
1294 ╰───────────────┴─────┴─────┴─────╯
1295 ])
1296 AT_CLEANUP
1297
1298 AT_SETUP([CTABLES sorting categories])
1299 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1300 AT_DATA([ctables.sps],
1301 [[GET 'nhtsa.sav'.
1302 IF (QND5A=6) QND5A=-1.
1303 IF (QND5A=5) QND5A=-2.
1304 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1305         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1306         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1307         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1308 ]])
1309 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1310                                   Custom Tables
1311 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1312 │                                                                        │Count│
1313 ├────────────────────────────────────────────────────────────────────────┼─────┤
1314 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1315 │background?                                     -1.00                   │   78│
1316 │                                                Cuban                   │   20│
1317 │                                                Mexican                 │  311│
1318 │                                                Spanish                 │   48│
1319 │                                                South American          │   34│
1320 │                                                Central American        │    0│
1321 │                                                Puerto Rican, OR        │    0│
1322 │                                                Something else          │   68│
1323 │                                                Multiple - cannot choose│    7│
1324 │                                                one                     │     │
1325 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1326
1327                                   Custom Tables
1328 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1329 │                                                                        │Count│
1330 ├────────────────────────────────────────────────────────────────────────┼─────┤
1331 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1332 │background?                                     one                     │     │
1333 │                                                Something else          │   68│
1334 │                                                Puerto Rican, OR        │    0│
1335 │                                                Central American        │    0│
1336 │                                                South American          │   34│
1337 │                                                Spanish                 │   48│
1338 │                                                Mexican                 │  311│
1339 │                                                Cuban                   │   20│
1340 │                                                -1.00                   │   78│
1341 │                                                -2.00                   │   52│
1342 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1343
1344                                   Custom Tables
1345 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1346 │                                                                        │Count│
1347 ├────────────────────────────────────────────────────────────────────────┼─────┤
1348 │D5a. What would you say is your primary ethnic  Central American        │    0│
1349 │background?                                     Cuban                   │   20│
1350 │                                                Mexican                 │  311│
1351 │                                                Multiple - cannot choose│    7│
1352 │                                                one                     │     │
1353 │                                                Puerto Rican, OR        │    0│
1354 │                                                Something else          │   68│
1355 │                                                South American          │   34│
1356 │                                                Spanish                 │   48│
1357 │                                                -2.00                   │   52│
1358 │                                                -1.00                   │   78│
1359 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1360
1361                                   Custom Tables
1362 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1363 │                                                                        │Count│
1364 ├────────────────────────────────────────────────────────────────────────┼─────┤
1365 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1366 │background?                                     South American          │   34│
1367 │                                                Something else          │   68│
1368 │                                                Puerto Rican, OR        │    0│
1369 │                                                Multiple - cannot choose│    7│
1370 │                                                one                     │     │
1371 │                                                Mexican                 │  311│
1372 │                                                Cuban                   │   20│
1373 │                                                Central American        │    0│
1374 │                                                -1.00                   │   78│
1375 │                                                -2.00                   │   52│
1376 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1377 ])
1378 AT_CLEANUP
1379
1380 AT_SETUP([CTABLES simple nesting])
1381 AT_KEYWORDS([nest nested])
1382 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1383 AT_DATA([ctables.sps],
1384 [[GET 'nhtsa.sav'.
1385 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1386   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1387 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1388   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1389   /CLABELS ROW=OPPOSITE.
1390 ]])
1391 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1392                                   Custom Tables
1393 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1394 │                                                                 │     │ Table│
1395 │                                                                 │Count│   %  │
1396 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1397 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1398 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1399 │drive safely will A. Get stopped by                        Total │  700│   10%│
1400 │the police?                           ╶──────────────────────────┼─────┼──────┤
1401 │                                       Very       S3a.     Male  │  660│   10%│
1402 │                                       likely     GENDER:  Female│  842│   12%│
1403 │                                                           Total │ 1502│   22%│
1404 │                                      ╶──────────────────────────┼─────┼──────┤
1405 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1406 │                                       likely     GENDER:  Female│ 1589│   23%│
1407 │                                                           Total │ 2763│   40%│
1408 │                                      ╶──────────────────────────┼─────┼──────┤
1409 │                                       Somewhat   S3a.     Male  │  640│    9%│
1410 │                                       unlikely   GENDER:  Female│  667│   10%│
1411 │                                                           Total │ 1307│   19%│
1412 │                                      ╶──────────────────────────┼─────┼──────┤
1413 │                                       Very       S3a.     Male  │  311│    5%│
1414 │                                       unlikely   GENDER:  Female│  298│    4%│
1415 │                                                           Total │  609│    9%│
1416 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1417 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1418 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1419 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1420 │                                      ╶──────────────────────────┼─────┼──────┤
1421 │                                       Very       S3a.     Male  │ 1104│   16%│
1422 │                                       likely     GENDER:  Female│ 1715│   25%│
1423 │                                                           Total │ 2819│   41%│
1424 │                                      ╶──────────────────────────┼─────┼──────┤
1425 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1426 │                                       likely     GENDER:  Female│ 1214│   18%│
1427 │                                                           Total │ 2417│   35%│
1428 │                                      ╶──────────────────────────┼─────┼──────┤
1429 │                                       Somewhat   S3a.     Male  │  262│    4%│
1430 │                                       unlikely   GENDER:  Female│  168│    2%│
1431 │                                                           Total │  430│    6%│
1432 │                                      ╶──────────────────────────┼─────┼──────┤
1433 │                                       Very       S3a.     Male  │   81│    1%│
1434 │                                       unlikely   GENDER:  Female│   59│    1%│
1435 │                                                           Total │  140│    2%│
1436 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1437 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1438 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1439 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1440 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1441 │                                       Very       S3a.     Male  │  988│   14%│
1442 │                                       likely     GENDER:  Female│ 1049│   15%│
1443 │                                                           Total │ 2037│   30%│
1444 │                                      ╶──────────────────────────┼─────┼──────┤
1445 │                                       Somewhat   S3a.     Male  │  822│   12%│
1446 │                                       likely     GENDER:  Female│ 1210│   18%│
1447 │                                                           Total │ 2032│   30%│
1448 │                                      ╶──────────────────────────┼─────┼──────┤
1449 │                                       Somewhat   S3a.     Male  │  446│    7%│
1450 │                                       unlikely   GENDER:  Female│  548│    8%│
1451 │                                                           Total │  994│   15%│
1452 │                                      ╶──────────────────────────┼─────┼──────┤
1453 │                                       Very       S3a.     Male  │  268│    4%│
1454 │                                       unlikely   GENDER:  Female│  354│    5%│
1455 │                                                           Total │  622│    9%│
1456 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1457 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1458 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1459 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1460 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1461 │                                       Very       S3a.     Male  │  805│   12%│
1462 │                                       likely     GENDER:  Female│ 1029│   15%│
1463 │                                                           Total │ 1834│   27%│
1464 │                                      ╶──────────────────────────┼─────┼──────┤
1465 │                                       Somewhat   S3a.     Male  │  975│   14%│
1466 │                                       likely     GENDER:  Female│ 1332│   19%│
1467 │                                                           Total │ 2307│   34%│
1468 │                                      ╶──────────────────────────┼─────┼──────┤
1469 │                                       Somewhat   S3a.     Male  │  535│    8%│
1470 │                                       unlikely   GENDER:  Female│  560│    8%│
1471 │                                                           Total │ 1095│   16%│
1472 │                                      ╶──────────────────────────┼─────┼──────┤
1473 │                                       Very       S3a.     Male  │  270│    4%│
1474 │                                       unlikely   GENDER:  Female│  279│    4%│
1475 │                                                           Total │  549│    8%│
1476 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1477
1478                                   Custom Tables
1479 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1480 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1481 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1482 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1483 │                                 │        │ Table│         │         │        │
1484 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1485 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1486 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1487 │GENDER:        is it that drivers│        │      │         │         │        │
1488 │               who have had too  │        │      │         │         │        │
1489 │               much to drink to  │        │      │         │         │        │
1490 │               drive safely will │        │      │         │         │        │
1491 │               A. Get stopped by │        │      │         │         │        │
1492 │               the police?       │        │      │         │         │        │
1493 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1494 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1495 │               is it that drivers│        │      │         │         │        │
1496 │               who have had too  │        │      │         │         │        │
1497 │               much to drink to  │        │      │         │         │        │
1498 │               drive safely will │        │      │         │         │        │
1499 │               A. Get stopped by │        │      │         │         │        │
1500 │               the police?       │        │      │         │         │        │
1501 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1502 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1503 │               is it that drivers│        │      │         │         │        │
1504 │               who have had too  │        │      │         │         │        │
1505 │               much to drink to  │        │      │         │         │        │
1506 │               drive safely will │        │      │         │         │        │
1507 │               A. Get stopped by │        │      │         │         │        │
1508 │               the police?       │        │      │         │         │        │
1509 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1510 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1511 │GENDER:        is it that drivers│        │      │         │         │        │
1512 │               who have had too  │        │      │         │         │        │
1513 │               much to drink to  │        │      │         │         │        │
1514 │               drive safely will │        │      │         │         │        │
1515 │               B. Have an        │        │      │         │         │        │
1516 │               accident?         │        │      │         │         │        │
1517 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1518 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1519 │               is it that drivers│        │      │         │         │        │
1520 │               who have had too  │        │      │         │         │        │
1521 │               much to drink to  │        │      │         │         │        │
1522 │               drive safely will │        │      │         │         │        │
1523 │               B. Have an        │        │      │         │         │        │
1524 │               accident?         │        │      │         │         │        │
1525 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1526 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1527 │               is it that drivers│        │      │         │         │        │
1528 │               who have had too  │        │      │         │         │        │
1529 │               much to drink to  │        │      │         │         │        │
1530 │               drive safely will │        │      │         │         │        │
1531 │               B. Have an        │        │      │         │         │        │
1532 │               accident?         │        │      │         │         │        │
1533 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1534 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1535 │GENDER:        is it that drivers│        │      │         │         │        │
1536 │               who have had too  │        │      │         │         │        │
1537 │               much to drink to  │        │      │         │         │        │
1538 │               drive safely will │        │      │         │         │        │
1539 │               C. Be convicted   │        │      │         │         │        │
1540 │               for drunk driving?│        │      │         │         │        │
1541 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1542 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1543 │               is it that drivers│        │      │         │         │        │
1544 │               who have had too  │        │      │         │         │        │
1545 │               much to drink to  │        │      │         │         │        │
1546 │               drive safely will │        │      │         │         │        │
1547 │               C. Be convicted   │        │      │         │         │        │
1548 │               for drunk driving?│        │      │         │         │        │
1549 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1550 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1551 │               is it that drivers│        │      │         │         │        │
1552 │               who have had too  │        │      │         │         │        │
1553 │               much to drink to  │        │      │         │         │        │
1554 │               drive safely will │        │      │         │         │        │
1555 │               C. Be convicted   │        │      │         │         │        │
1556 │               for drunk driving?│        │      │         │         │        │
1557 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1558 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1559 │GENDER:        is it that drivers│        │      │         │         │        │
1560 │               who have had too  │        │      │         │         │        │
1561 │               much to drink to  │        │      │         │         │        │
1562 │               drive safely will │        │      │         │         │        │
1563 │               D. Be arrested for│        │      │         │         │        │
1564 │               drunk driving?    │        │      │         │         │        │
1565 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1566 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1567 │               is it that drivers│        │      │         │         │        │
1568 │               who have had too  │        │      │         │         │        │
1569 │               much to drink to  │        │      │         │         │        │
1570 │               drive safely will │        │      │         │         │        │
1571 │               D. Be arrested for│        │      │         │         │        │
1572 │               drunk driving?    │        │      │         │         │        │
1573 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1574 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1575 │               is it that drivers│        │      │         │         │        │
1576 │               who have had too  │        │      │         │         │        │
1577 │               much to drink to  │        │      │         │         │        │
1578 │               drive safely will │        │      │         │         │        │
1579 │               D. Be arrested for│        │      │         │         │        │
1580 │               drunk driving?    │        │      │         │         │        │
1581 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1582 ])
1583 AT_CLEANUP
1584
1585 AT_SETUP([CTABLES nesting and scale variables])
1586 AT_KEYWORDS([nest nested])
1587 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1588 AT_DATA([ctables.sps],
1589 [[GET 'nhtsa.sav'.
1590 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1591 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1592 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1593   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1594 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1595 ]])
1596 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1597                                   Custom Tables
1598 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1599 │                                                                 │S3a. GENDER:│
1600 │                                                                 ├─────┬──────┤
1601 │                                                                 │ Male│Female│
1602 │                                                                 ├─────┼──────┤
1603 │                                                                 │ Mean│ Mean │
1604 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1605 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1606 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1607 │                                                  week           │     │      │
1608 │                                                  Once a week or │   44│    54│
1609 │                                                  less           │     │      │
1610 │                                                  Only certain   │   34│    41│
1611 │                                                  times a year   │     │      │
1612 │                                                  Never          │   39│    55│
1613 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1614
1615                                   Custom Tables
1616 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1617 │                                                         │Minimum│Maximum│Mean│
1618 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1619 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1620 │What is  GENDER:         months, has there been a        │       │       │    │
1621 │your                     time when you felt you          │       │       │    │
1622 │age?                     should cut down on your      No │     16│     86│  46│
1623 │                         drinking?                       │       │       │    │
1624 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1625 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1626 │                         months, has there been a        │       │       │    │
1627 │                         time when you felt you          │       │       │    │
1628 │                         should cut down on your      No │     16│     86│  48│
1629 │                         drinking?                       │       │       │    │
1630 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1631 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1632 │What is  GENDER:         months, has there been a        │       │       │    │
1633 │your                     time when people criticized  No │     16│     86│  46│
1634 │age?                     your drinking?                  │       │       │    │
1635 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1636 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1637 │                         months, has there been a        │       │       │    │
1638 │                         time when people criticized  No │     16│     86│  48│
1639 │                         your drinking?                  │       │       │    │
1640 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1641
1642                                   Custom Tables
1643 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1644 │                             │S1. Including yourself, how many members of this│
1645 │                             │         household are age 16 or older?         │
1646 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1647 │                             │      │      │      │      │      │      │ 6 or │
1648 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1649 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1650 │                             │Column│Column│Column│Column│Column│Column│Column│
1651 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1652 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1653 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1654 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1655 │SOURCE:     likely           │      │      │      │      │      │      │      │
1656 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1657 │            that     likely  │      │      │      │      │      │      │      │
1658 │            drivers          │      │      │      │      │      │      │      │
1659 │            who have         │      │      │      │      │      │      │      │
1660 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1661 │            much to  likely  │      │      │      │      │      │      │      │
1662 │            drink to         │      │      │      │      │      │      │      │
1663 │            drive    Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1664 │            safely   unlikely│      │      │      │      │      │      │      │
1665 │            will A.          │      │      │      │      │      │      │      │
1666 │            Get              │      │      │      │      │      │      │      │
1667 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1668 │            by the   unlikely│      │      │      │      │      │      │      │
1669 │            police?          │      │      │      │      │      │      │      │
1670 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1671
1672                                   Custom Tables
1673 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1674 │                                                              │    │    Std   │
1675 │                                                              │Mean│ Deviation│
1676 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1677 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1678 │group           typical month did you have one or more        │    │          │
1679 │                alcoholic beverages to drink?                 │    │          │
1680 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1681 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1682 │                typical month did you have one or more        │    │          │
1683 │                alcoholic beverages to drink?                 │    │          │
1684 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1685 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1686 │                typical month did you have one or more        │    │          │
1687 │                alcoholic beverages to drink?                 │    │          │
1688 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1689 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1690 │                typical month did you have one or more        │    │          │
1691 │                alcoholic beverages to drink?                 │    │          │
1692 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1693 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1694 │                typical month did you have one or more        │    │          │
1695 │                alcoholic beverages to drink?                 │    │          │
1696 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1697 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1698 │       older    typical month did you have one or more        │    │          │
1699 │                alcoholic beverages to drink?                 │    │          │
1700 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1701 ])
1702 AT_CLEANUP
1703
1704
1705 AT_SETUP([CTABLES SLABELS])
1706 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1707 AT_DATA([ctables.sps],
1708 [[GET 'nhtsa.sav'.
1709 CTABLES /TABLE qn1 [COUNT COLPCT].
1710 CTABLES /TABLE qn1 [COUNT COLPCT]
1711     /SLABELS POSITION=ROW.
1712 CTABLES /TABLE qn1 [COUNT COLPCT]
1713     /SLABELS POSITION=ROW VISIBLE=NO.
1714 ]])
1715 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1716                                   Custom Tables
1717 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1718 │                                                                │     │ Column│
1719 │                                                                │Count│   %   │
1720 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1721 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1722 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1723 │                                             Once a week or less│  361│   5.2%│
1724 │                                             Only certain times │  130│   1.9%│
1725 │                                             a year             │     │       │
1726 │                                             Never              │  540│   7.7%│
1727 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1728
1729                                   Custom Tables
1730 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1731 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1732 │other motor vehicle?                                             Column │66.9%│
1733 │                                                                 %      │     │
1734 │                                            ╶───────────────────────────┼─────┤
1735 │                                             Several days a week Count  │ 1274│
1736 │                                                                 Column │18.3%│
1737 │                                                                 %      │     │
1738 │                                            ╶───────────────────────────┼─────┤
1739 │                                             Once a week or less Count  │  361│
1740 │                                                                 Column │ 5.2%│
1741 │                                                                 %      │     │
1742 │                                            ╶───────────────────────────┼─────┤
1743 │                                             Only certain times  Count  │  130│
1744 │                                             a year              Column │ 1.9%│
1745 │                                                                 %      │     │
1746 │                                            ╶───────────────────────────┼─────┤
1747 │                                             Never               Count  │  540│
1748 │                                                                 Column │ 7.7%│
1749 │                                                                 %      │     │
1750 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1751
1752                                   Custom Tables
1753 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1754 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1755 │motor vehicle?                                                          │66.9%│
1756 │                                                   Several days a week  │ 1274│
1757 │                                                                        │18.3%│
1758 │                                                   Once a week or less  │  361│
1759 │                                                                        │ 5.2%│
1760 │                                                   Only certain times a │  130│
1761 │                                                   year                 │ 1.9%│
1762 │                                                   Never                │  540│
1763 │                                                                        │ 7.7%│
1764 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1765 ])
1766 AT_CLEANUP
1767
1768 AT_SETUP([CTABLES SLABELS with stacking different summaries])
1769 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1770 AT_DATA([ctables.sps],
1771 [[GET 'nhtsa.sav'.
1772 CTABLES
1773     /VLABELS VARIABLES=ALL DISPLAY=NAME
1774     /TABLE qn1 [COUNT] + qnd1 [MEAN] + qn17 [UCOUNT] BY qns3a
1775     /SLABELS POSITION=ROW.
1776 ]])
1777 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1778                          Custom Tables
1779 ╭─────────────────────────────────────────────────┬───────────╮
1780 │                                                 │   QNS3A   │
1781 │                                                 ├────┬──────┤
1782 │                                                 │Male│Female│
1783 ├─────────────────────────────────────────────────┼────┼──────┤
1784 │QN1  Every day                   Count           │2305│  2362│
1785 │    ╶────────────────────────────────────────────┼────┼──────┤
1786 │     Several days a week         Count           │ 440│   834│
1787 │    ╶────────────────────────────────────────────┼────┼──────┤
1788 │     Once a week or less         Count           │ 125│   236│
1789 │    ╶────────────────────────────────────────────┼────┼──────┤
1790 │     Only certain times a year   Count           │  58│    72│
1791 │    ╶────────────────────────────────────────────┼────┼──────┤
1792 │     Never                       Count           │ 192│   348│
1793 ├─────────────────────────────────────────────────┼────┼──────┤
1794 │qnd1 Mean                                        │  46│    50│
1795 ├─────────────────────────────────────────────────┼────┼──────┤
1796 │QN17 OR, something else          Unweighted Count│   1│     1│
1797 │    ╶────────────────────────────────────────────┼────┼──────┤
1798 │     Beer                        Unweighted Count│ 817│   256│
1799 │    ╶────────────────────────────────────────────┼────┼──────┤
1800 │     Light beer                  Unweighted Count│ 406│   214│
1801 │    ╶────────────────────────────────────────────┼────┼──────┤
1802 │     Wine                        Unweighted Count│ 390│  1028│
1803 │    ╶────────────────────────────────────────────┼────┼──────┤
1804 │     Wine coolers                Unweighted Count│  20│   117│
1805 │    ╶────────────────────────────────────────────┼────┼──────┤
1806 │     Hard liquor or mixed drinks Unweighted Count│ 392│   496│
1807 │    ╶────────────────────────────────────────────┼────┼──────┤
1808 │     Flavored malt drinks        Unweighted Count│  20│    63│
1809 ╰─────────────────────────────────────────────────┴────┴──────╯
1810 ])
1811 AT_CLEANUP
1812
1813 AT_SETUP([CTABLES simple totals])
1814 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1815 AT_DATA([ctables.sps],
1816 [[GET 'nhtsa.sav'.
1817 CTABLES /TABLE=qn17
1818     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1819 DESCRIPTIVES qn18/STATISTICS=MEAN.
1820 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1821     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1822 ]])
1823 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1824                                   Custom Tables
1825 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1826 │                                                                        │Count│
1827 ├────────────────────────────────────────────────────────────────────────┼─────┤
1828 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1829 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1830 │                                                      Light beer        │  620│
1831 │                                                      Wine              │ 1418│
1832 │                                                      Wine coolers      │  137│
1833 │                                                      Hard liquor or    │  888│
1834 │                                                      mixed drinks      │     │
1835 │                                                      Flavored malt     │   83│
1836 │                                                      drinks            │     │
1837 │                                                      Number responding │ 4221│
1838 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1839
1840                              Descriptive Statistics
1841 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1842 │                                                                    │  N │Mean│
1843 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1844 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1845 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1846 │Valid N (listwise)                                                  │6999│    │
1847 │Missing N (listwise)                                                │2781│    │
1848 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1849
1850                                   Custom Tables
1851 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1852 │                                                      │    │     │ Valid│Total│
1853 │                                                      │Mean│Count│   N  │  N  │
1854 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1855 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1856 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1857 │                you usually drink per sitting?        │    │     │      │     │
1858 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1859 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1860 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1861 │                you usually drink per sitting?        │    │     │      │     │
1862 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1863 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1864 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1865 │                you usually drink per sitting?        │    │     │      │     │
1866 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1867 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1868 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1869 │                you usually drink per sitting?        │    │     │      │     │
1870 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1871 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1872 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1873 │                you usually drink per sitting?        │    │     │      │     │
1874 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1875 ])
1876 AT_CLEANUP
1877
1878 AT_SETUP([CTABLES subtotals])
1879 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1880 AT_DATA([ctables.sps],
1881 [[GET 'nhtsa.sav'.
1882 CTABLES /TABLE=qn105ba BY qns1
1883     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1884 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1885     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1886 CTABLES /TABLE=qn105ba BY qns1
1887     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1888     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1889 ]])
1890 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1891                                                       Custom Tables
1892 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1893 │                                                         │ S1. Including yourself, how many members of this household │
1894 │                                                         │                    are age 16 or older?                    │
1895 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1896 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1897 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1898 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1899 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1900 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1901 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1902 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1903 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1904 │                                              likely     │       │       │         │       │        │      │          │
1905 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1906 │                                              unlikely   │       │       │         │       │        │      │          │
1907 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1908 │                                              unlikely   │       │       │         │       │        │      │          │
1909 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1910
1911                                                       Custom Tables
1912 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1913 │                                                        │  S1. Including yourself, how many members of this household │
1914 │                                                        │                     are age 16 or older?                    │
1915 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1916 │                                                        │        │        │        │        │       │        │  6 or  │
1917 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1918 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1919 │                                                        │        │        │        │        │ Column│        │        │
1920 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1921 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1922 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1923 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1924 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1925 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1926 │                                             likely     │        │        │        │        │       │        │        │
1927 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1928 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1929 │                                             unlikely   │        │        │        │        │       │        │        │
1930 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1931 │                                             unlikely   │        │        │        │        │       │        │        │
1932 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1933 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1934
1935                                                       Custom Tables
1936 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1937 │                                                         │ S1. Including yourself, how many members of this household │
1938 │                                                         │                    are age 16 or older?                    │
1939 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1940 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1941 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1942 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1943 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1944 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1945 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1946 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1947 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1948 │                                              likely     │       │       │         │       │        │      │          │
1949 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1950 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1951 │                                              unlikely   │       │       │         │       │        │      │          │
1952 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1953 │                                              unlikely   │       │       │         │       │        │      │          │
1954 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1955 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1956 ])
1957 AT_CLEANUP
1958
1959 AT_SETUP([CTABLES PCOMPUTE])
1960 AT_KEYWORDS([postcompute])
1961 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
1962 AT_DATA([ctables.sps],
1963 [[GET 'nhtsa.sav'.
1964 CTABLES
1965     /PCOMPUTE &x=EXPR([3] + [4])
1966     /PCOMPUTE &y=EXPR([4] + [5])
1967     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1968     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1969     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1970     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1971
1972 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1973 CTABLES
1974     /PCOMPUTE &x=EXPR([3] + [4])
1975     /PCOMPUTE &y=EXPR([4] + [5])
1976     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1977     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1978     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1979     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1980 ]])
1981 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1982                                                                 Custom Tables
1983 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1984 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1985 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1986 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1987 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1988 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1989 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1990 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1991 │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%│
1992 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1993 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1994 │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%│
1995 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1996 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1997 │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%│
1998 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1999 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2000 │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%│
2001 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2002 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2003 │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%│
2004 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2005 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
2006 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
2007
2008                                                                 Custom Tables
2009 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
2010 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
2011 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
2012 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
2013 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
2014 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
2015 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
2016 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
2017 │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%│
2018 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2019 │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%│
2020 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2021 │                               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%│
2022 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2023 │                               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%│
2024 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2025 │                               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%│
2026 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
2027 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
2028 ])
2029 AT_CLEANUP
2030
2031 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
2032 AT_KEYWORDS([postcompute])
2033 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2034 AT_DATA([ctables.sps],
2035 [[GET 'nhtsa.sav'.
2036 CTABLES
2037     /PCOMPUTE &x=EXPR(OTHERNM)
2038     /PCOMPUTE &y=EXPR(MISSING)
2039     /PPROPERTIES &x LABEL='Drivers'
2040     /PPROPERTIES &y LABEL='Missing Values 2'
2041     /TABLE=qn1 BY qns3a
2042     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
2043 ]])
2044 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2045                                               Custom Tables
2046 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
2047 │                                                                                          │S3a. GENDER:│
2048 │                                                                                          ├─────┬──────┤
2049 │                                                                                          │ Male│Female│
2050 │                                                                                          ├─────┼──────┤
2051 │                                                                                          │Count│ Count│
2052 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
2053 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
2054 │                                                                 Several days a week      │  440│   834│
2055 │                                                                 Once a week or less      │  125│   236│
2056 │                                                                 Only certain times a year│   58│    72│
2057 │                                                                 Never                    │  192│   348│
2058 │                                                                 Drivers                  │ 2928│  3504│
2059 │                                                                 Valid Values             │ 3120│  3852│
2060 │                                                                 Don't know               │    3│     5│
2061 │                                                                 Refused                  │    9│    10│
2062 │                                                                 Missing Values           │   12│    15│
2063 │                                                                 Missing Values 2         │   12│    15│
2064 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
2065 ])
2066 AT_CLEANUP
2067
2068 AT_SETUP([CTABLES PCOMPUTE - THRU])
2069 AT_KEYWORDS([postcompute])
2070 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2071 AT_DATA([ctables.sps],
2072 [[GET 'nhtsa.sav'.
2073 CTABLES
2074     /PCOMPUTE &x=EXPR([1 THRU 2])
2075     /PCOMPUTE &y=EXPR([3 THRU 4])
2076     /PCOMPUTE &z=EXPR([5] + MISSING)
2077     /PPROPERTIES &x LABEL='Frequent Drivers'
2078     /PPROPERTIES &y LABEL='Infrequent Drivers'
2079     /PPROPERTIES &z LABEL='Not Drivers or Missing'
2080     /TABLE=qn1 BY qns3a
2081     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
2082 ]])
2083 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
2084                                               Custom Tables
2085 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
2086 │                                                                                          │S3a. GENDER:│
2087 │                                                                                          ├─────┬──────┤
2088 │                                                                                          │ Male│Female│
2089 │                                                                                          ├─────┼──────┤
2090 │                                                                                          │Count│ Count│
2091 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
2092 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
2093 │                                                                 Several days a week      │  440│   834│
2094 │                                                                 Frequent Drivers         │ 2745│  3196│
2095 │                                                                 Once a week or less      │  125│   236│
2096 │                                                                 Only certain times a year│   58│    72│
2097 │                                                                 Infrequent Drivers       │  183│   308│
2098 │                                                                 Drivers                  │ 2928│  3504│
2099 │                                                                 Never                    │  192│   348│
2100 │                                                                 Don't know               │    3│     5│
2101 │                                                                 Refused                  │    9│    10│
2102 │                                                                 Not Drivers or Missing   │  204│   363│
2103 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
2104 ])
2105 AT_CLEANUP
2106
2107 dnl I'm not sure that this is the correct behavior (see
2108 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
2109 dnl but at least this test will notify us if the behavior changes.
2110 AT_SETUP([CTABLES intersecting PCOMPUTEs])
2111 AT_KEYWORDS([PCOMPUTE postcompute])
2112 AT_DATA([ctables.sps],
2113 [[DATA LIST LIST NOTABLE/x y z.
2114 WEIGHT by z.
2115 FORMATS ALL (F1.0).
2116 VARIABLE LEVEL x y (NOMINAL).
2117 BEGIN DATA.
2118 1 4 5
2119 1 5 2
2120 1 6 9
2121 2 4 2
2122 2 5 3
2123 2 6 4
2124 3 4 1
2125 3 5 6
2126 3 6 1
2127 END DATA.
2128
2129 CTABLES
2130     /PCOMPUTE &a = EXPR([1] + [2])
2131     /PCOMPUTE &b = EXPR([2] + [3])
2132     /PCOMPUTE &c = EXPR([4] * [5])
2133     /PCOMPUTE &d = EXPR([5] * [6])
2134     /TABLE x BY y
2135     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
2136     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
2137 ]])
2138 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
2139 [[                   Custom Tables
2140 ╭───────────┬─────────────────────────────────────╮
2141 │           │                  y                  │
2142 │           ├─────┬─────────┬─────┬─────────┬─────┤
2143 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
2144 │           ├─────┼─────────┼─────┼─────────┼─────┤
2145 │           │Count│  Count  │Count│  Count  │Count│
2146 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
2147 │x 1        │    5│       10│    2│       18│    9│
2148 │  [1] + [2]│    7│        .│    5│        .│   13│
2149 │  2        │    2│        6│    3│       12│    4│
2150 │  [2] + [3]│    3│        .│    9│        .│    5│
2151 │  3        │    1│        6│    6│        6│    1│
2152 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
2153 ]])
2154 AT_CLEANUP
2155
2156 AT_SETUP([CTABLES string and date and time])
2157
2158 weight=1
2159 for gender in F M; do
2160     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
2161         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
2162             printf "$weight $gender $month $wkday\n"
2163             weight=$(expr \( $weight + 3 \) % 7 + 2)
2164         done
2165     done
2166 done > ctables.txt
2167
2168 AT_DATA([ctables.sps],
2169 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
2170     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
2171 WEIGHT by w.
2172 VARIABLE LEVEL w (SCALE).
2173 VARIABLE LEVEL gender fmon fday (NOMINAL).
2174 VARIABLE LABEL
2175   gender 'Gender'
2176   fmon 'Favorite month'
2177   fday 'Favorite day of the week'.
2178 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
2179 CTABLES
2180     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
2181     /PPROPERTIES &q2 LABEL='Q2'
2182     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
2183     /PPROPERTIES &weekend LABEL='Weekend'
2184     /TABLE fmon BY gender > fday
2185     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
2186                                 4 THRU 6, &q2,
2187                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
2188                                 OTHERNM, SUBTOTAL='Q4']
2189     /CATEGORIES VARIABLES=gender ['M', 'F']
2190     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
2191     /SLABELS VISIBLE=NO.
2192 ]])
2193 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2194                                               Custom Tables
2195 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
2196 │                  │                                       Gender                                      │
2197 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
2198 │                  │                   Male                  │                  Female                 │
2199 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
2200 │                  │         Favorite day of the week        │         Favorite day of the week        │
2201 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
2202 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
2203 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
2204 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
2205 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2206 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2207 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
2208 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2209 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2210 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
2211 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
2212 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
2213 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
2214 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2215 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
2216 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2217 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2218 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2219 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
2220 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
2221 ])
2222 AT_CLEANUP
2223
2224 AT_SETUP([CTABLES CLABELS])
2225 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2226 AT_DATA([ctables.sps],
2227 [[GET 'nhtsa.sav'.
2228 CTABLES /TABLE AgeGroup BY qns3a.
2229 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
2230 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
2231 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
2232 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
2233 ]])
2234 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
2235              Custom Tables
2236 ╭───────────────────────┬────────────╮
2237 │                       │S3a. GENDER:│
2238 │                       ├─────┬──────┤
2239 │                       │ Male│Female│
2240 │                       ├─────┼──────┤
2241 │                       │Count│ Count│
2242 ├───────────────────────┼─────┼──────┤
2243 │Age group 15 or younger│    0│     0│
2244 │          16 to 25     │  594│   505│
2245 │          26 to 35     │  476│   491│
2246 │          36 to 45     │  489│   548│
2247 │          46 to 55     │  526│   649│
2248 │          56 to 65     │  516│   731│
2249 │          66 or older  │  531│   943│
2250 ╰───────────────────────┴─────┴──────╯
2251
2252                                                       Custom Tables
2253 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
2254 │       │                                                 S3a. GENDER:                                                 │
2255 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
2256 │       │                         Male                         │                         Female                        │
2257 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
2258 │       │  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 │
2259 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
2260 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2261 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
2262 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2263 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
2264 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
2265 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
2266
2267                 Custom Tables
2268 ╭──────────────────────────────┬────────────╮
2269 │                              │S3a. GENDER:│
2270 │                              ├────────────┤
2271 │                              │    Count   │
2272 ├──────────────────────────────┼────────────┤
2273 │Age group 15 or younger Male  │           0│
2274 │                        Female│           0│
2275 │         ╶────────────────────┼────────────┤
2276 │          16 to 25      Male  │         594│
2277 │                        Female│         505│
2278 │         ╶────────────────────┼────────────┤
2279 │          26 to 35      Male  │         476│
2280 │                        Female│         491│
2281 │         ╶────────────────────┼────────────┤
2282 │          36 to 45      Male  │         489│
2283 │                        Female│         548│
2284 │         ╶────────────────────┼────────────┤
2285 │          46 to 55      Male  │         526│
2286 │                        Female│         649│
2287 │         ╶────────────────────┼────────────┤
2288 │          56 to 65      Male  │         516│
2289 │                        Female│         731│
2290 │         ╶────────────────────┼────────────┤
2291 │          66 or older   Male  │         531│
2292 │                        Female│         943│
2293 ╰──────────────────────────────┴────────────╯
2294
2295       Custom Tables
2296 15 or younger
2297 ╭─────────┬────────────╮
2298 │         │S3a. GENDER:│
2299 │         ├─────┬──────┤
2300 │         │ Male│Female│
2301 │         ├─────┼──────┤
2302 │         │Count│ Count│
2303 ├─────────┼─────┼──────┤
2304 │Age group│    0│     0│
2305 ╰─────────┴─────┴──────╯
2306
2307       Custom Tables
2308 16 to 25
2309 ╭─────────┬────────────╮
2310 │         │S3a. GENDER:│
2311 │         ├─────┬──────┤
2312 │         │ Male│Female│
2313 │         ├─────┼──────┤
2314 │         │Count│ Count│
2315 ├─────────┼─────┼──────┤
2316 │Age group│  594│   505│
2317 ╰─────────┴─────┴──────╯
2318
2319       Custom Tables
2320 26 to 35
2321 ╭─────────┬────────────╮
2322 │         │S3a. GENDER:│
2323 │         ├─────┬──────┤
2324 │         │ Male│Female│
2325 │         ├─────┼──────┤
2326 │         │Count│ Count│
2327 ├─────────┼─────┼──────┤
2328 │Age group│  476│   491│
2329 ╰─────────┴─────┴──────╯
2330
2331       Custom Tables
2332 36 to 45
2333 ╭─────────┬────────────╮
2334 │         │S3a. GENDER:│
2335 │         ├─────┬──────┤
2336 │         │ Male│Female│
2337 │         ├─────┼──────┤
2338 │         │Count│ Count│
2339 ├─────────┼─────┼──────┤
2340 │Age group│  489│   548│
2341 ╰─────────┴─────┴──────╯
2342
2343       Custom Tables
2344 46 to 55
2345 ╭─────────┬────────────╮
2346 │         │S3a. GENDER:│
2347 │         ├─────┬──────┤
2348 │         │ Male│Female│
2349 │         ├─────┼──────┤
2350 │         │Count│ Count│
2351 ├─────────┼─────┼──────┤
2352 │Age group│  526│   649│
2353 ╰─────────┴─────┴──────╯
2354
2355       Custom Tables
2356 56 to 65
2357 ╭─────────┬────────────╮
2358 │         │S3a. GENDER:│
2359 │         ├─────┬──────┤
2360 │         │ Male│Female│
2361 │         ├─────┼──────┤
2362 │         │Count│ Count│
2363 ├─────────┼─────┼──────┤
2364 │Age group│  516│   731│
2365 ╰─────────┴─────┴──────╯
2366
2367       Custom Tables
2368 66 or older
2369 ╭─────────┬────────────╮
2370 │         │S3a. GENDER:│
2371 │         ├─────┬──────┤
2372 │         │ Male│Female│
2373 │         ├─────┼──────┤
2374 │         │Count│ Count│
2375 ├─────────┼─────┼──────┤
2376 │Age group│  531│   943│
2377 ╰─────────┴─────┴──────╯
2378
2379              Custom Tables
2380 Male
2381 ╭───────────────────────┬────────────╮
2382 │                       │S3a. GENDER:│
2383 │                       ├────────────┤
2384 │                       │    Count   │
2385 ├───────────────────────┼────────────┤
2386 │Age group 15 or younger│           0│
2387 │          16 to 25     │         594│
2388 │          26 to 35     │         476│
2389 │          36 to 45     │         489│
2390 │          46 to 55     │         526│
2391 │          56 to 65     │         516│
2392 │          66 or older  │         531│
2393 ╰───────────────────────┴────────────╯
2394
2395              Custom Tables
2396 Female
2397 ╭───────────────────────┬────────────╮
2398 │                       │S3a. GENDER:│
2399 │                       ├────────────┤
2400 │                       │    Count   │
2401 ├───────────────────────┼────────────┤
2402 │Age group 15 or younger│           0│
2403 │          16 to 25     │         505│
2404 │          26 to 35     │         491│
2405 │          36 to 45     │         548│
2406 │          46 to 55     │         649│
2407 │          56 to 65     │         731│
2408 │          66 or older  │         943│
2409 ╰───────────────────────┴────────────╯
2410 ])
2411 AT_CLEANUP
2412
2413 AT_SETUP([CTABLES missing values])
2414 AT_DATA([ctables.sps],
2415 [[DATA LIST LIST NOTABLE/x y.
2416 BEGIN DATA.
2417 1 1
2418 1 2
2419 1 3
2420 1 4
2421 1 5
2422 1 .
2423 2 1
2424 2 2
2425 2 3
2426 2 4
2427 2 5
2428 2 .
2429 3 1
2430 3 2
2431 3 3
2432 3 4
2433 3 5
2434 3 .
2435 4 1
2436 4 2
2437 4 3
2438 4 4
2439 4 5
2440 4 .
2441 5 1
2442 5 2
2443 5 3
2444 5 4
2445 5 5
2446 5 .
2447 . 1
2448 . 2
2449 . 3
2450 . 4
2451 . 5
2452 . .
2453 END DATA.
2454 MISSING VALUES x (1, 2) y (2, 3).
2455 VARIABLE LEVEL ALL (NOMINAL).
2456
2457 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2458                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2459     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2460 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2461                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2462     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2463 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2464                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2465     /CATEGORIES VARIABLES=ALL TOTAL=YES
2466     /SLABELS POSITION=ROW.
2467 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2468                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2469     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2470     /SLABELS POSITION=ROW.
2471 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2472                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2473     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2474     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2475     /SLABELS POSITION=ROW.
2476 ]])
2477 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2478                                Custom Tables
2479 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2480 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2481 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2482 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2483 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2484 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2485 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2486 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2487 dnl Note that Column Total N % doesn't add up to 100 because missing
2488 dnl values are included in the total but not shown as a category and this
2489 dnl is expected behavior.
2490
2491                                Custom Tables
2492 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2493 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2494 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2495 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2496 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2497 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2498 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2499 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2500 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2501 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2502 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2503 dnl values are included in the total but not shown as a category and this
2504 dnl is expected behavior.
2505
2506                      Custom Tables
2507 ╭────────────────────────┬───────────────────────────╮
2508 │                        │             y             │
2509 │                        ├──────┬──────┬──────┬──────┤
2510 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2511 ├────────────────────────┼──────┼──────┼──────┼──────┤
2512 │x 3.00  Count           │     1│     1│     1│     3│
2513 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2514 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2515 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2516 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2517 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2518 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2519 │        Valid N         │      │      │      │     3│
2520 │        Total N         │      │      │      │     6│
2521 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2522 │  4.00  Count           │     1│     1│     1│     3│
2523 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2524 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2525 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2526 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2527 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2528 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2529 │        Valid N         │      │      │      │     3│
2530 │        Total N         │      │      │      │     6│
2531 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2532 │  5.00  Count           │     1│     1│     1│     3│
2533 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2534 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2535 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2536 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2537 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2538 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2539 │        Valid N         │      │      │      │     3│
2540 │        Total N         │      │      │      │     6│
2541 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2542 │  Total Count           │     3│     3│     3│     9│
2543 │        Column %        │100.0%│100.0%│100.0%│     .│
2544 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2545 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2546 │        Row %           │     .│     .│     .│     .│
2547 │        Row Valid N %   │     .│     .│     .│     .│
2548 │        Row Total N %   │     .│     .│     .│     .│
2549 │        Valid N         │     3│     3│     3│     9│
2550 │        Total N         │     3│     3│     3│    18│
2551 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2552
2553                             Custom Tables
2554 ╭────────────────────────┬─────────────────────────────────────────╮
2555 │                        │                    y                    │
2556 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2557 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2558 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2559 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2560 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2561 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2562 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2563 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2564 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2565 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2566 │        Valid N         │      │      │      │      │      │     3│
2567 │        Total N         │      │      │      │      │      │     6│
2568 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2569 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2570 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2571 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2572 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2573 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2574 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2575 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2576 │        Valid N         │      │      │      │      │      │     3│
2577 │        Total N         │      │      │      │      │      │     6│
2578 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2579 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2580 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2581 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2582 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2583 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2584 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2585 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2586 │        Valid N         │      │      │      │      │      │     3│
2587 │        Total N         │      │      │      │      │      │     6│
2588 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2589 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2590 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2591 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2592 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2593 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2594 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2595 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2596 │        Valid N         │      │      │      │      │      │     3│
2597 │        Total N         │      │      │      │      │      │     6│
2598 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2599 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2600 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2601 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2602 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2603 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2604 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2605 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2606 │        Valid N         │      │      │      │      │      │     3│
2607 │        Total N         │      │      │      │      │      │     6│
2608 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2609 │  Total Count           │     5│     5│     5│     5│     5│    25│
2610 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2611 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2612 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2613 │        Row %           │     .│     .│     .│     .│     .│     .│
2614 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2615 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2616 │        Valid N         │     5│     0│     0│     5│     5│    15│
2617 │        Total N         │     5│     5│     5│     5│     5│    30│
2618 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2619
2620                         Custom Tables
2621 ╭────────────────────────┬──────────────────────────────────╮
2622 │                        │                 y                │
2623 │                        ├──────┬──────┬──────┬──────┬──────┤
2624 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2625 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2626 │x 1.00  Count           │     1│     1│     1│     1│     4│
2627 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2628 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2629 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2630 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2631 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2632 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2633 │        Valid N         │      │      │      │      │     3│
2634 │        Total N         │      │      │      │      │     6│
2635 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2636 │  2.00  Count           │     1│     1│     1│     1│     4│
2637 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2638 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2639 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2640 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2641 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2642 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2643 │        Valid N         │      │      │      │      │     3│
2644 │        Total N         │      │      │      │      │     6│
2645 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2646 │  3.00  Count           │     1│     1│     1│     1│     4│
2647 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2648 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2649 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2650 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2651 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2652 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2653 │        Valid N         │      │      │      │      │     3│
2654 │        Total N         │      │      │      │      │     6│
2655 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2656 │  4.00  Count           │     1│     1│     1│     1│     4│
2657 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2658 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2659 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2660 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2661 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2662 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2663 │        Valid N         │      │      │      │      │     3│
2664 │        Total N         │      │      │      │      │     6│
2665 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2666 │  Total Count           │     4│     4│     4│     4│    16│
2667 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2668 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2669 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2670 │        Row %           │     .│     .│     .│     .│     .│
2671 │        Row Valid N %   │     .│     .│     .│     .│     .│
2672 │        Row Total N %   │     .│     .│     .│     .│     .│
2673 │        Valid N         │     4│     0│     4│     4│    12│
2674 │        Total N         │     4│     4│     4│     4│    24│
2675 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2676 ])
2677 AT_CLEANUP
2678
2679 AT_SETUP([CTABLES SMISSING=LISTWISE])
2680 AT_KEYWORDS([SMISSING LISTWISE])
2681 AT_DATA([ctables.sps],
2682 [[DATA LIST LIST NOTABLE/x y z.
2683 BEGIN DATA.
2684 1  . 40
2685 1 10 50
2686 1 20 60
2687 1  .  .
2688 1 30  .
2689 END DATA.
2690 VARIABLE LEVEL x (NOMINAL).
2691
2692 CTABLES /TABLE (y + z) > x.
2693 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2694
2695 * The following doesn't come out as listwise because the tables are
2696 separate, not linked by an > operator.
2697 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2698 ]])
2699 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2700   Custom Tables
2701 ╭────────┬─────╮
2702 │        │ Mean│
2703 ├────────┼─────┤
2704 │y x 1.00│20.00│
2705 ├────────┼─────┤
2706 │z x 1.00│50.00│
2707 ╰────────┴─────╯
2708
2709   Custom Tables
2710 ╭────────┬─────╮
2711 │        │ Mean│
2712 ├────────┼─────┤
2713 │y x 1.00│15.00│
2714 ├────────┼─────┤
2715 │z x 1.00│55.00│
2716 ╰────────┴─────╯
2717
2718   Custom Tables
2719 ╭────────┬─────╮
2720 │        │ Mean│
2721 ├────────┼─────┤
2722 │y x 1.00│20.00│
2723 ├────────┼─────┤
2724 │z x 1.00│50.00│
2725 ╰────────┴─────╯
2726 ])
2727 AT_CLEANUP
2728
2729 AT_SETUP([CTABLES VLABELS - variables on different axes])
2730 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2731 AT_DATA([ctables.sps],
2732 [[GET 'nhtsa.sav'.
2733 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2734 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2735 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2736 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2737 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2738 ]])
2739 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2740                                  Custom Tables
2741 ╭────────────────────────────────────────────────────────────────┬────────────╮
2742 │                                                                │S3a. GENDER:│
2743 │                                                                ├─────┬──────┤
2744 │                                                                │ Male│Female│
2745 │                                                                ├─────┼──────┤
2746 │                                                                │Count│ Count│
2747 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2748 │D5a. What would you say is your primary    Cuban                │   13│     7│
2749 │ethnic background?                         Mexican              │  175│   136│
2750 │                                           Spanish              │   20│    28│
2751 │                                           South American       │   21│    13│
2752 │                                           Central American     │   27│    25│
2753 │                                           Puerto Rican, OR     │   37│    41│
2754 │                                           Something else       │   35│    33│
2755 │                                           Multiple - cannot    │    2│     5│
2756 │                                           choose one           │     │      │
2757 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2758
2759                   Custom Tables
2760 ╭──────────────────────────────────┬────────────╮
2761 │                                  │    QNS3A   │
2762 │                                  ├─────┬──────┤
2763 │                                  │ Male│Female│
2764 │                                  ├─────┼──────┤
2765 │                                  │Count│ Count│
2766 ├──────────────────────────────────┼─────┼──────┤
2767 │QND5A Cuban                       │   13│     7│
2768 │      Mexican                     │  175│   136│
2769 │      Spanish                     │   20│    28│
2770 │      South American              │   21│    13│
2771 │      Central American            │   27│    25│
2772 │      Puerto Rican, OR            │   37│    41│
2773 │      Something else              │   35│    33│
2774 │      Multiple - cannot choose one│    2│     5│
2775 ╰──────────────────────────────────┴─────┴──────╯
2776
2777                                  Custom Tables
2778 ╭────────────────────────────────────────────────────────────────┬────────────╮
2779 │                                                                │S3a. GENDER:│
2780 │                                                                ├─────┬──────┤
2781 │                                                                │ Male│Female│
2782 │                                                                ├─────┼──────┤
2783 │                                                                │Count│ Count│
2784 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2785 │D5a. What would you say is your primary    Cuban                │   13│     7│
2786 │ethnic background?                         Mexican              │  175│   136│
2787 │                                           Spanish              │   20│    28│
2788 │                                           South American       │   21│    13│
2789 │                                           Central American     │   27│    25│
2790 │                                           Puerto Rican, OR     │   37│    41│
2791 │                                           Something else       │   35│    33│
2792 │                                           Multiple - cannot    │    2│     5│
2793 │                                           choose one           │     │      │
2794 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2795
2796                                  Custom Tables
2797 ╭────────────────────────────────────────────────────────────┬────────────────╮
2798 │                                                            │   QNS3A S3a.   │
2799 │                                                            │     GENDER:    │
2800 │                                                            ├───────┬────────┤
2801 │                                                            │  Male │ Female │
2802 │                                                            ├───────┼────────┤
2803 │                                                            │ Count │  Count │
2804 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2805 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2806 │primary ethnic background?               Mexican            │    175│     136│
2807 │                                         Spanish            │     20│      28│
2808 │                                         South American     │     21│      13│
2809 │                                         Central American   │     27│      25│
2810 │                                         Puerto Rican, OR   │     37│      41│
2811 │                                         Something else     │     35│      33│
2812 │                                         Multiple - cannot  │      2│       5│
2813 │                                         choose one         │       │        │
2814 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2815
2816                Custom Tables
2817 ╭────────────────────────────┬─────┬──────╮
2818 │                            │ Male│Female│
2819 │                            ├─────┼──────┤
2820 │                            │Count│ Count│
2821 ├────────────────────────────┼─────┼──────┤
2822 │Cuban                       │   13│     7│
2823 │Mexican                     │  175│   136│
2824 │Spanish                     │   20│    28│
2825 │South American              │   21│    13│
2826 │Central American            │   27│    25│
2827 │Puerto Rican, OR            │   37│    41│
2828 │Something else              │   35│    33│
2829 │Multiple - cannot choose one│    2│     5│
2830 ╰────────────────────────────┴─────┴──────╯
2831 ])
2832 AT_CLEANUP
2833
2834 AT_SETUP([CTABLES VLABELS - stacked variables])
2835 AT_KEYWORDS([stack stacking])
2836 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2837 AT_DATA([ctables.sps],
2838 [[GET 'nhtsa.sav'.
2839 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2840 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2841 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2842 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2843 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2844 ]])
2845 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2846                                  Custom Tables
2847 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2848 │                                                                       │Count│
2849 ├───────────────────────────────────────────────────────────────────────┼─────┤
2850 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2851 │background?                                     Mexican                │  311│
2852 │                                                Spanish                │   48│
2853 │                                                South American         │   34│
2854 │                                                Central American       │   52│
2855 │                                                Puerto Rican, OR       │   78│
2856 │                                                Something else         │   68│
2857 │                                                Multiple - cannot      │    7│
2858 │                                                choose one             │     │
2859 ├───────────────────────────────────────────────────────────────────────┼─────┤
2860 │QNS3A                                           Male                   │ 3132│
2861 │                                                Female                 │ 3867│
2862 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2863
2864                   Custom Tables
2865 ╭─────────────────────────────────────────┬─────╮
2866 │                                         │Count│
2867 ├─────────────────────────────────────────┼─────┤
2868 │QND5A        Cuban                       │   20│
2869 │             Mexican                     │  311│
2870 │             Spanish                     │   48│
2871 │             South American              │   34│
2872 │             Central American            │   52│
2873 │             Puerto Rican, OR            │   78│
2874 │             Something else              │   68│
2875 │             Multiple - cannot choose one│    7│
2876 ├─────────────────────────────────────────┼─────┤
2877 │S3a. GENDER: Male                        │ 3132│
2878 │             Female                      │ 3867│
2879 ╰─────────────────────────────────────────┴─────╯
2880
2881                                  Custom Tables
2882 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2883 │                                                                       │Count│
2884 ├───────────────────────────────────────────────────────────────────────┼─────┤
2885 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2886 │background?                                     Mexican                │  311│
2887 │                                                Spanish                │   48│
2888 │                                                South American         │   34│
2889 │                                                Central American       │   52│
2890 │                                                Puerto Rican, OR       │   78│
2891 │                                                Something else         │   68│
2892 │                                                Multiple - cannot      │    7│
2893 │                                                choose one             │     │
2894 ├───────────────────────────────────────────────────────────────────────┼─────┤
2895 │Male                                                                   │ 3132│
2896 ├───────────────────────────────────────────────────────────────────────┼─────┤
2897 │Female                                                                 │ 3867│
2898 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2899
2900             Custom Tables
2901 ╭─────────────────────────────┬─────╮
2902 │                             │Count│
2903 ├─────────────────────────────┼─────┤
2904 │Cuban                        │   20│
2905 ├─────────────────────────────┼─────┤
2906 │Mexican                      │  311│
2907 ├─────────────────────────────┼─────┤
2908 │Spanish                      │   48│
2909 ├─────────────────────────────┼─────┤
2910 │South American               │   34│
2911 ├─────────────────────────────┼─────┤
2912 │Central American             │   52│
2913 ├─────────────────────────────┼─────┤
2914 │Puerto Rican, OR             │   78│
2915 ├─────────────────────────────┼─────┤
2916 │Something else               │   68│
2917 ├─────────────────────────────┼─────┤
2918 │Multiple - cannot choose one │    7│
2919 ├─────────────────────────────┼─────┤
2920 │S3a. GENDER:     Male        │ 3132│
2921 │                 Female      │ 3867│
2922 ╰─────────────────────────────┴─────╯
2923
2924             Custom Tables
2925 ╭────────────────────────────┬─────╮
2926 │                            │Count│
2927 ├────────────────────────────┼─────┤
2928 │Cuban                       │   20│
2929 │Mexican                     │  311│
2930 │Spanish                     │   48│
2931 │South American              │   34│
2932 │Central American            │   52│
2933 │Puerto Rican, OR            │   78│
2934 │Something else              │   68│
2935 │Multiple - cannot choose one│    7│
2936 │Male                        │ 3132│
2937 │Female                      │ 3867│
2938 ╰────────────────────────────┴─────╯
2939 ])
2940 AT_CLEANUP
2941
2942 AT_SETUP([CTABLES VLABELS - nested variables])
2943 AT_KEYWORDS([nest nesting])
2944 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
2945 AT_DATA([ctables.sps],
2946 [[GET 'nhtsa.sav'.
2947 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2948 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2949 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2950 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2951 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2952 ]])
2953 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2954                                  Custom Tables
2955 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2956 │                                                                       │Count│
2957 ├───────────────────────────────────────────────────────────────────────┼─────┤
2958 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2959 │primary ethnic background?                                       Female│    7│
2960 │                                     ╶─────────────────────────────────┼─────┤
2961 │                                      Mexican              QNS3A Male  │  175│
2962 │                                                                 Female│  136│
2963 │                                     ╶─────────────────────────────────┼─────┤
2964 │                                      Spanish              QNS3A Male  │   20│
2965 │                                                                 Female│   28│
2966 │                                     ╶─────────────────────────────────┼─────┤
2967 │                                      South American       QNS3A Male  │   21│
2968 │                                                                 Female│   13│
2969 │                                     ╶─────────────────────────────────┼─────┤
2970 │                                      Central American     QNS3A Male  │   27│
2971 │                                                                 Female│   25│
2972 │                                     ╶─────────────────────────────────┼─────┤
2973 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2974 │                                                                 Female│   41│
2975 │                                     ╶─────────────────────────────────┼─────┤
2976 │                                      Something else       QNS3A Male  │   35│
2977 │                                                                 Female│   33│
2978 │                                     ╶─────────────────────────────────┼─────┤
2979 │                                      Multiple - cannot    QNS3A Male  │    2│
2980 │                                      choose one                 Female│    5│
2981 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2982
2983                          Custom Tables
2984 ╭──────────────────────────────────────────────────────┬─────╮
2985 │                                                      │Count│
2986 ├──────────────────────────────────────────────────────┼─────┤
2987 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2988 │                                                Female│    7│
2989 │     ╶────────────────────────────────────────────────┼─────┤
2990 │      Mexican                      S3a. GENDER: Male  │  175│
2991 │                                                Female│  136│
2992 │     ╶────────────────────────────────────────────────┼─────┤
2993 │      Spanish                      S3a. GENDER: Male  │   20│
2994 │                                                Female│   28│
2995 │     ╶────────────────────────────────────────────────┼─────┤
2996 │      South American               S3a. GENDER: Male  │   21│
2997 │                                                Female│   13│
2998 │     ╶────────────────────────────────────────────────┼─────┤
2999 │      Central American             S3a. GENDER: Male  │   27│
3000 │                                                Female│   25│
3001 │     ╶────────────────────────────────────────────────┼─────┤
3002 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
3003 │                                                Female│   41│
3004 │     ╶────────────────────────────────────────────────┼─────┤
3005 │      Something else               S3a. GENDER: Male  │   35│
3006 │                                                Female│   33│
3007 │     ╶────────────────────────────────────────────────┼─────┤
3008 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
3009 │                                                Female│    5│
3010 ╰──────────────────────────────────────────────────────┴─────╯
3011
3012                                  Custom Tables
3013 ╭───────────────────────────────────────────────────────────────────────┬─────╮
3014 │                                                                       │Count│
3015 ├───────────────────────────────────────────────────────────────────────┼─────┤
3016 │D5a. What would you say is your primary    Cuban                 Male  │   13│
3017 │ethnic background?                                               Female│    7│
3018 │                                          ╶────────────────────────────┼─────┤
3019 │                                           Mexican               Male  │  175│
3020 │                                                                 Female│  136│
3021 │                                          ╶────────────────────────────┼─────┤
3022 │                                           Spanish               Male  │   20│
3023 │                                                                 Female│   28│
3024 │                                          ╶────────────────────────────┼─────┤
3025 │                                           South American        Male  │   21│
3026 │                                                                 Female│   13│
3027 │                                          ╶────────────────────────────┼─────┤
3028 │                                           Central American      Male  │   27│
3029 │                                                                 Female│   25│
3030 │                                          ╶────────────────────────────┼─────┤
3031 │                                           Puerto Rican, OR      Male  │   37│
3032 │                                                                 Female│   41│
3033 │                                          ╶────────────────────────────┼─────┤
3034 │                                           Something else        Male  │   35│
3035 │                                                                 Female│   33│
3036 │                                          ╶────────────────────────────┼─────┤
3037 │                                           Multiple - cannot     Male  │    2│
3038 │                                           choose one            Female│    5│
3039 ╰───────────────────────────────────────────────────────────────────────┴─────╯
3040
3041                       Custom Tables
3042 ╭────────────────────────────────────────────────┬─────╮
3043 │                                                │Count│
3044 ├────────────────────────────────────────────────┼─────┤
3045 │Cuban                        S3a. GENDER: Male  │   13│
3046 │                                          Female│    7│
3047 ├────────────────────────────────────────────────┼─────┤
3048 │Mexican                      S3a. GENDER: Male  │  175│
3049 │                                          Female│  136│
3050 ├────────────────────────────────────────────────┼─────┤
3051 │Spanish                      S3a. GENDER: Male  │   20│
3052 │                                          Female│   28│
3053 ├────────────────────────────────────────────────┼─────┤
3054 │South American               S3a. GENDER: Male  │   21│
3055 │                                          Female│   13│
3056 ├────────────────────────────────────────────────┼─────┤
3057 │Central American             S3a. GENDER: Male  │   27│
3058 │                                          Female│   25│
3059 ├────────────────────────────────────────────────┼─────┤
3060 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
3061 │                                          Female│   41│
3062 ├────────────────────────────────────────────────┼─────┤
3063 │Something else               S3a. GENDER: Male  │   35│
3064 │                                          Female│   33│
3065 ├────────────────────────────────────────────────┼─────┤
3066 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
3067 │                                          Female│    5│
3068 ╰────────────────────────────────────────────────┴─────╯
3069
3070                Custom Tables
3071 ╭───────────────────────────────────┬─────╮
3072 │                                   │Count│
3073 ├───────────────────────────────────┼─────┤
3074 │Cuban                        Male  │   13│
3075 │                             Female│    7│
3076 ├───────────────────────────────────┼─────┤
3077 │Mexican                      Male  │  175│
3078 │                             Female│  136│
3079 ├───────────────────────────────────┼─────┤
3080 │Spanish                      Male  │   20│
3081 │                             Female│   28│
3082 ├───────────────────────────────────┼─────┤
3083 │South American               Male  │   21│
3084 │                             Female│   13│
3085 ├───────────────────────────────────┼─────┤
3086 │Central American             Male  │   27│
3087 │                             Female│   25│
3088 ├───────────────────────────────────┼─────┤
3089 │Puerto Rican, OR             Male  │   37│
3090 │                             Female│   41│
3091 ├───────────────────────────────────┼─────┤
3092 │Something else               Male  │   35│
3093 │                             Female│   33│
3094 ├───────────────────────────────────┼─────┤
3095 │Multiple - cannot choose one Male  │    2│
3096 │                             Female│    5│
3097 ╰───────────────────────────────────┴─────╯
3098 ])
3099 AT_CLEANUP
3100
3101 AT_SETUP([CTABLES FORMAT EMPTY])
3102 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3103 AT_DATA([ctables.sps],
3104 [[GET 'nhtsa.sav'.
3105 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
3106 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
3107 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
3108 ]])
3109 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3110                                  Custom Tables
3111 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3112 │                                             │   D5. ETHNICITY: Are you of   │
3113 │                                             │  Hispanic or Latino origin or │
3114 │                                             │            descent?           │
3115 │                                             ├───────────────┬───────────────┤
3116 │                                             │      Yes      │       No      │
3117 │                                             ├───────────────┼───────────────┤
3118 │                                             │     Count     │     Count     │
3119 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3120 │D5a. What would you say is   Cuban           │             20│              0│
3121 │your primary ethnic          Mexican         │            311│              0│
3122 │background?                  Spanish         │             48│              0│
3123 │                             South American  │             34│              0│
3124 │                             Central American│             52│              0│
3125 │                             Puerto Rican, OR│             78│              0│
3126 │                             Something else  │             68│              0│
3127 │                             Multiple -      │              7│              0│
3128 │                             cannot choose   │               │               │
3129 │                             one             │               │               │
3130 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3131
3132                                  Custom Tables
3133 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3134 │                                             │   D5. ETHNICITY: Are you of   │
3135 │                                             │  Hispanic or Latino origin or │
3136 │                                             │            descent?           │
3137 │                                             ├───────────────┬───────────────┤
3138 │                                             │      Yes      │       No      │
3139 │                                             ├───────────────┼───────────────┤
3140 │                                             │     Count     │     Count     │
3141 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3142 │D5a. What would you say is   Cuban           │             20│               │
3143 │your primary ethnic          Mexican         │            311│               │
3144 │background?                  Spanish         │             48│               │
3145 │                             South American  │             34│               │
3146 │                             Central American│             52│               │
3147 │                             Puerto Rican, OR│             78│               │
3148 │                             Something else  │             68│               │
3149 │                             Multiple -      │              7│               │
3150 │                             cannot choose   │               │               │
3151 │                             one             │               │               │
3152 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3153
3154                                  Custom Tables
3155 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3156 │                                             │   D5. ETHNICITY: Are you of   │
3157 │                                             │  Hispanic or Latino origin or │
3158 │                                             │            descent?           │
3159 │                                             ├───────────────┬───────────────┤
3160 │                                             │      Yes      │       No      │
3161 │                                             ├───────────────┼───────────────┤
3162 │                                             │     Count     │     Count     │
3163 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3164 │D5a. What would you say is   Cuban           │             20│n/a            │
3165 │your primary ethnic          Mexican         │            311│n/a            │
3166 │background?                  Spanish         │             48│n/a            │
3167 │                             South American  │             34│n/a            │
3168 │                             Central American│             52│n/a            │
3169 │                             Puerto Rican, OR│             78│n/a            │
3170 │                             Something else  │             68│n/a            │
3171 │                             Multiple -      │              7│n/a            │
3172 │                             cannot choose   │               │               │
3173 │                             one             │               │               │
3174 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3175 ])
3176 AT_CLEANUP
3177
3178 AT_SETUP([CTABLES FORMAT MISSING])
3179 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3180 AT_DATA([ctables.sps],
3181 [[GET 'nhtsa.sav'.
3182 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
3183 ]])
3184 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3185                                  Custom Tables
3186 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3187 │                                             │   D5. ETHNICITY: Are you of   │
3188 │                                             │  Hispanic or Latino origin or │
3189 │                                             │            descent?           │
3190 │                                             ├───────────────┬───────────────┤
3191 │                                             │      Yes      │       No      │
3192 │                                             ├───────────────┼───────────────┤
3193 │                                             │    Column %   │    Column %   │
3194 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3195 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
3196 │your primary ethnic          Mexican         │          50.3%│(no data)      │
3197 │background?                  Spanish         │           7.8%│(no data)      │
3198 │                             South American  │           5.5%│(no data)      │
3199 │                             Central American│           8.4%│(no data)      │
3200 │                             Puerto Rican, OR│          12.6%│(no data)      │
3201 │                             Something else  │          11.0%│(no data)      │
3202 │                             Multiple -      │           1.1%│(no data)      │
3203 │                             cannot choose   │               │               │
3204 │                             one             │               │               │
3205 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3206 ])
3207 AT_CLEANUP
3208
3209 AT_SETUP([CTABLES HIDESMALLCOUNTS])
3210 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3211 AT_DATA([ctables.sps],
3212 [[GET 'nhtsa.sav'.
3213 CTABLES /TABLE qn38[c][COUNT, COLPCT].
3214 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
3215 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
3216 ]])
3217 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3218                                  Custom Tables
3219 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3220 │                                                              │Count│Column %│
3221 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3222 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3223 │occasion?                                        1            │  491│   34.9%│
3224 │                                                 2            │  462│   32.9%│
3225 │                                                 3            │  229│   16.3%│
3226 │                                                 4            │   82│    5.8%│
3227 │                                                 5            │   56│    4.0%│
3228 │                                                 6            │   32│    2.3%│
3229 │                                                 7            │    9│     .6%│
3230 │                                                 8            │    8│     .6%│
3231 │                                                 9            │    4│     .3%│
3232 │                                                 10           │    6│     .4%│
3233 │                                                 11           │    2│     .1%│
3234 │                                                 12           │    5│     .4%│
3235 │                                                 14           │    1│     .1%│
3236 │                                                 15           │    1│     .1%│
3237 │                                                 18           │    1│     .1%│
3238 │                                                 20           │    4│     .3%│
3239 │                                                 25           │    1│     .1%│
3240 │                                                 30           │    3│     .2%│
3241 │                                                 60           │    1│     .1%│
3242 │                                                 99+          │    0│     .0%│
3243 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3244
3245                                  Custom Tables
3246 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3247 │                                                              │Count│Column %│
3248 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3249 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3250 │occasion?                                        1            │  491│   34.9%│
3251 │                                                 2            │  462│   32.9%│
3252 │                                                 3            │  229│   16.3%│
3253 │                                                 4            │   82│    5.8%│
3254 │                                                 5            │   56│    4.0%│
3255 │                                                 6            │   32│    2.3%│
3256 │                                                 7            │    9│     .6%│
3257 │                                                 8            │    8│     .6%│
3258 │                                                 9            │<5   │     .3%│
3259 │                                                 10           │    6│     .4%│
3260 │                                                 11           │<5   │     .1%│
3261 │                                                 12           │    5│     .4%│
3262 │                                                 14           │<5   │     .1%│
3263 │                                                 15           │<5   │     .1%│
3264 │                                                 18           │<5   │     .1%│
3265 │                                                 20           │<5   │     .3%│
3266 │                                                 25           │<5   │     .1%│
3267 │                                                 30           │<5   │     .2%│
3268 │                                                 60           │<5   │     .1%│
3269 │                                                 99+          │<5   │     .0%│
3270 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3271
3272                                  Custom Tables
3273 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3274 │                                                              │Count│Column %│
3275 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3276 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
3277 │occasion?                                        1            │  491│   34.9%│
3278 │                                                 2            │  462│   32.9%│
3279 │                                                 3            │  229│   16.3%│
3280 │                                                 4            │   82│    5.8%│
3281 │                                                 5            │   56│    4.0%│
3282 │                                                 6            │   32│    2.3%│
3283 │                                                 7            │<10  │     .6%│
3284 │                                                 8            │<10  │     .6%│
3285 │                                                 9            │<10  │     .3%│
3286 │                                                 10           │<10  │     .4%│
3287 │                                                 11           │<10  │     .1%│
3288 │                                                 12           │<10  │     .4%│
3289 │                                                 14           │<10  │     .1%│
3290 │                                                 15           │<10  │     .1%│
3291 │                                                 18           │<10  │     .1%│
3292 │                                                 20           │<10  │     .3%│
3293 │                                                 25           │<10  │     .1%│
3294 │                                                 30           │<10  │     .2%│
3295 │                                                 60           │<10  │     .1%│
3296 │                                                 99+          │<10  │     .0%│
3297 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3298 ])
3299 AT_CLEANUP
3300
3301 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
3302 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3303 AT_DATA([ctables.sps],
3304 [[GET 'nhtsa.sav'.
3305 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
3306 ]])
3307 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
3308  Custom Tables
3309 ╭────────────╮
3310 │S3a. GENDER:│
3311 ├─────┬──────┤
3312 │ Male│Female│
3313 ├─────┼──────┤
3314 │Count│ Count│
3315 ├─────┼──────┤
3316 │ 3132│  3867│
3317 ╰─────┴──────╯
3318 ])
3319 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
3320 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
3321 maximumColumnWidth="192"
3322 minimumColumnWidth="96"
3323 ])
3324 AT_CLEANUP
3325
3326 AT_SETUP([CTABLES special formats])
3327 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
3328 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3329 AT_DATA([ctables.sps],
3330 [[GET 'nhtsa.sav'.
3331 COMPUTE x = qnd3 - 4.
3332 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].
3333 ]])
3334 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3335                            Custom Tables
3336 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
3337 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
3338 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
3339 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
3340 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
3341 ])
3342 AT_CLEANUP
3343
3344 AT_SETUP([CTABLES TITLES])
3345 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3346 AT_DATA([ctables.sps],
3347 [[GET 'nhtsa.sav'.
3348 CTABLES
3349     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3350     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3351     /TITLES TITLE='How often do you drive?' 'second line of title'
3352             CAPTION='Generated )TIME on )DATE'
3353             CORNER=')TABLE'.
3354 ]])
3355 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3356 s&../../..&MM/DD/YY&'], [0], [dnl
3357                             How often do you drive?
3358                               second line of title
3359 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3360 │                                   │               S3a. GENDER:              │
3361 │                                   ├────────────────────┬────────────────────┤
3362 │                                   │        Male        │       Female       │
3363 │                                   ├────────────────────┼────────────────────┤
3364 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3365 │                                   │ you of Hispanic or │ you of Hispanic or │
3366 │                                   │  Latino origin or  │  Latino origin or  │
3367 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3368 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3369 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3370 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3371 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3372 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3373 │Every day                          │      218│      2066│      166│      2175│
3374 │Several days a week                │       44│       391│       45│       782│
3375 │Once a week or less                │       16│       109│       12│       223│
3376 │Only certain times a year          │       15│        41│       11│        61│
3377 │Never                              │       39│       150│       56│       278│
3378 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3379 Generated HH:MM:SS on MM/DD/YY
3380 ])
3381 AT_CLEANUP
3382
3383 AT_SETUP([CTABLES area definitions])
3384 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3385 AT_DATA([ctables.sps],
3386 [[GET 'nhtsa.sav'.
3387 CTABLES
3388     /VLABELS VARIABLES=ALL DISPLAY=NAME
3389     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3390     /SLABELS POSITION=ROW
3391     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3392     /SLABELS POSITION=ROW
3393     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3394     /SLABELS POSITION=ROW.
3395 ]])
3396 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3397                     Custom Tables
3398 Male
3399 ╭─────────────────────────────┬─────────────┬──────╮
3400 │                             │    QND7A    │ QN64B│
3401 │                             ├──────┬──────┼───┬──┤
3402 │                             │  Yes │  No  │   │  │
3403 │                             ├──────┼──────┤   │  │
3404 │                             │ QN86 │ QN86 │   │  │
3405 │                             ├───┬──┼───┬──┤   │  │
3406 │                             │Yes│No│Yes│No│Yes│No│
3407 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3408 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3409 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3410 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3411 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3412 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3413 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3414 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3415 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3416 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3417 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3418 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3419 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3420 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3421 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3422 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3423 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3424
3425                     Custom Tables
3426 Female
3427 ╭─────────────────────────────┬─────────────┬──────╮
3428 │                             │    QND7A    │ QN64B│
3429 │                             ├──────┬──────┼───┬──┤
3430 │                             │  Yes │  No  │   │  │
3431 │                             ├──────┼──────┤   │  │
3432 │                             │ QN86 │ QN86 │   │  │
3433 │                             ├───┬──┼───┬──┤   │  │
3434 │                             │Yes│No│Yes│No│Yes│No│
3435 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3436 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3437 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3438 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3439 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3440 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3441 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3442 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3443 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3444 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3445 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3446 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3447 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3448 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3449 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3450 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3451 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3452
3453                     Custom Tables
3454 Male
3455 ╭──────────────────────────────┬─────────────┬──────╮
3456 │                              │    QND7A    │ QN64B│
3457 │                              ├──────┬──────┼───┬──┤
3458 │                              │  Yes │  No  │   │  │
3459 │                              ├──────┼──────┤   │  │
3460 │                              │ QN86 │ QN86 │   │  │
3461 │                              ├───┬──┼───┬──┤   │  │
3462 │                              │Yes│No│Yes│No│Yes│No│
3463 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3464 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3465 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3466 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3467 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3468 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3469 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3470 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3471 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3472 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3473 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3474 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3475 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3476
3477                     Custom Tables
3478 Female
3479 ╭──────────────────────────────┬─────────────┬──────╮
3480 │                              │    QND7A    │ QN64B│
3481 │                              ├──────┬──────┼───┬──┤
3482 │                              │  Yes │  No  │   │  │
3483 │                              ├──────┼──────┤   │  │
3484 │                              │ QN86 │ QN86 │   │  │
3485 │                              ├───┬──┼───┬──┤   │  │
3486 │                              │Yes│No│Yes│No│Yes│No│
3487 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3488 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3489 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3490 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3491 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3492 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3493 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3494 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3495 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3496 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3497 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3498 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3499 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3500
3501                       Custom Tables
3502 Male
3503 ╭─────────────────────────────────┬─────────────┬──────╮
3504 │                                 │    QND7A    │ QN64B│
3505 │                                 ├──────┬──────┼───┬──┤
3506 │                                 │  Yes │  No  │   │  │
3507 │                                 ├──────┼──────┤   │  │
3508 │                                 │ QN86 │ QN86 │   │  │
3509 │                                 ├───┬──┼───┬──┤   │  │
3510 │                                 │Yes│No│Yes│No│Yes│No│
3511 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3512 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3513 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3514 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3515 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3516 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3517 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3518 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3519 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3520 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3521 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3522 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3523 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3524
3525                       Custom Tables
3526 Female
3527 ╭─────────────────────────────────┬─────────────┬──────╮
3528 │                                 │    QND7A    │ QN64B│
3529 │                                 ├──────┬──────┼───┬──┤
3530 │                                 │  Yes │  No  │   │  │
3531 │                                 ├──────┼──────┤   │  │
3532 │                                 │ QN86 │ QN86 │   │  │
3533 │                                 ├───┬──┼───┬──┤   │  │
3534 │                                 │Yes│No│Yes│No│Yes│No│
3535 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3536 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3537 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3538 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3539 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3540 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3541 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3542 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3543 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3544 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3545 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3546 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3547 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3548 ])
3549 AT_CLEANUP
3550
3551 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3552 AT_KEYWORDS([ROWLABELS OPPOSITE])
3553 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3554 AT_DATA([ctables.sps],
3555 [[GET 'nhtsa.sav'.
3556 CTABLES
3557     /VLABELS VARIABLES=ALL DISPLAY=NAME
3558     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3559     /SLABELS POSITION=ROW
3560     /CLABELS ROWLABELS=OPPOSITE
3561     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3562     /SLABELS POSITION=ROW
3563     /CLABELS ROWLABELS=OPPOSITE
3564     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3565     /SLABELS POSITION=ROW
3566     /CLABELS ROWLABELS=OPPOSITE.
3567 ]])
3568 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3569                                         Custom Tables
3570 Male
3571 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3572 │                                  │                          QN27                         │
3573 │                                  ├───────────────────────────┬───────────────────────────┤
3574 │                                  │            Yes            │             No            │
3575 │                                  ├───────────────────────────┼───────────────────────────┤
3576 │                                  │           QND7A           │           QND7A           │
3577 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3578 │                                  │     Yes     │      No     │     Yes     │      No     │
3579 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3580 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3581 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3582 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3583 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3584 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3585 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3586 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3587 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3588 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3589 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3590 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3591 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3592 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3593 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3594 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3595 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3596 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3597 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3598 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3599 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3600 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3601 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3602
3603                                         Custom Tables
3604 Female
3605 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3606 │                                  │                          QN27                         │
3607 │                                  ├───────────────────────────┬───────────────────────────┤
3608 │                                  │            Yes            │             No            │
3609 │                                  ├───────────────────────────┼───────────────────────────┤
3610 │                                  │           QND7A           │           QND7A           │
3611 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3612 │                                  │     Yes     │      No     │     Yes     │      No     │
3613 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3614 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3615 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3616 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3617 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3618 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3619 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3620 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3621 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3622 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3623 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3624 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3625 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3626 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3627 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3628 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3629 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3630 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3631 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3632 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3633 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3634 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3635 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3636
3637                                         Custom Tables
3638 Male
3639 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3640 │                                   │                          QN27                         │
3641 │                                   ├───────────────────────────┬───────────────────────────┤
3642 │                                   │            Yes            │             No            │
3643 │                                   ├───────────────────────────┼───────────────────────────┤
3644 │                                   │           QND7A           │           QND7A           │
3645 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3646 │                                   │     Yes     │      No     │     Yes     │      No     │
3647 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3648 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3649 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3650 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3651 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3652 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3653 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3654 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3655 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3656 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3657 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3658 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3659 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3660 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3661 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3662 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3663 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3664 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3665 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3666
3667                                         Custom Tables
3668 Female
3669 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3670 │                                   │                          QN27                         │
3671 │                                   ├───────────────────────────┬───────────────────────────┤
3672 │                                   │            Yes            │             No            │
3673 │                                   ├───────────────────────────┼───────────────────────────┤
3674 │                                   │           QND7A           │           QND7A           │
3675 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3676 │                                   │     Yes     │      No     │     Yes     │      No     │
3677 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3678 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3679 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3680 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3681 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3682 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3683 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3684 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3685 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3686 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3687 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3688 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3689 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3690 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3691 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3692 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3693 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3694 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3695 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3696
3697                                           Custom Tables
3698 Male
3699 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3700 │                                      │                          QN27                         │
3701 │                                      ├───────────────────────────┬───────────────────────────┤
3702 │                                      │            Yes            │             No            │
3703 │                                      ├───────────────────────────┼───────────────────────────┤
3704 │                                      │           QND7A           │           QND7A           │
3705 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3706 │                                      │     Yes     │      No     │     Yes     │      No     │
3707 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3708 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3709 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3710 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3711 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3712 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3713 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3714 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3715 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3716 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3717 │              No  QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3718 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3719 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3720 │     No  QN61 Yes QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3721 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3722 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3723 │              No  QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3724 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3725 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3726
3727                                           Custom Tables
3728 Female
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 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3745 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3746 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3747 │              No  QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3748 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3749 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3750 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3751 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3752 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3753 │              No  QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3754 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3755 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3756 ])
3757 AT_CLEANUP
3758
3759 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3760 AT_KEYWORDS([COLLABELS OPPOSITE])
3761 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
3762 AT_DATA([ctables.sps],
3763 [[GET 'nhtsa.sav'.
3764 CTABLES
3765     /VLABELS VARIABLES=ALL DISPLAY=NAME
3766     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3767     /SLABELS POSITION=ROW
3768     /CLABELS COLLABELS=OPPOSITE
3769     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3770     /SLABELS POSITION=ROW
3771     /CLABELS COLLABELS=OPPOSITE
3772     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3773     /SLABELS POSITION=ROW
3774     /CLABELS COLLABELS=OPPOSITE.
3775 ]])
3776 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3777                           Custom Tables
3778 Male
3779 ╭──────────────────────────────────────────┬───────────────────╮
3780 │                                          │        QN27       │
3781 │                                          ├─────────┬─────────┤
3782 │                                          │   Yes   │    No   │
3783 │                                          ├─────────┼─────────┤
3784 │                                          │  QND7A  │  QND7A  │
3785 │                                          ├────┬────┼────┬────┤
3786 │                                          │ Yes│ No │ Yes│ No │
3787 │                                          ├────┼────┼────┼────┤
3788 │                                          │QN86│QN86│QN86│QN86│
3789 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3790 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3791 │                               Layer ID   │   1│   1│   1│   1│
3792 │                               Subtable ID│   1│   1│   2│   2│
3793 │                          ╶───────────────┼────┼────┼────┼────┤
3794 │                           No  Table ID   │   1│   1│   1│   1│
3795 │                               Layer ID   │   1│   1│   1│   1│
3796 │                               Subtable ID│   1│   1│   2│   2│
3797 │                      ╶───────────────────┼────┼────┼────┼────┤
3798 │                       No  Yes Table ID   │   1│   1│   1│   1│
3799 │                               Layer ID   │   1│   1│   1│   1│
3800 │                               Subtable ID│   3│   3│   4│   4│
3801 │                          ╶───────────────┼────┼────┼────┼────┤
3802 │                           No  Table ID   │   1│   1│   1│   1│
3803 │                               Layer ID   │   1│   1│   1│   1│
3804 │                               Subtable ID│   3│   3│   4│   4│
3805 │             ╶────────────────────────────┼────┼────┼────┼────┤
3806 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3807 │                               Layer ID   │   1│   1│   1│   1│
3808 │                               Subtable ID│   5│   5│   6│   6│
3809 │                          ╶───────────────┼────┼────┼────┼────┤
3810 │                           No  Table ID   │   1│   1│   1│   1│
3811 │                               Layer ID   │   1│   1│   1│   1│
3812 │                               Subtable ID│   5│   5│   6│   6│
3813 │                      ╶───────────────────┼────┼────┼────┼────┤
3814 │                       No  Yes Table ID   │   1│   1│   1│   1│
3815 │                               Layer ID   │   1│   1│   1│   1│
3816 │                               Subtable ID│   7│   7│   8│   8│
3817 │                          ╶───────────────┼────┼────┼────┼────┤
3818 │                           No  Table ID   │   1│   1│   1│   1│
3819 │                               Layer ID   │   1│   1│   1│   1│
3820 │                               Subtable ID│   7│   7│   8│   8│
3821 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3822 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3823 │                               Layer ID   │   1│   1│   1│   1│
3824 │                               Subtable ID│   9│   9│  10│  10│
3825 │                          ╶───────────────┼────┼────┼────┼────┤
3826 │                           No  Table ID   │   1│   1│   1│   1│
3827 │                               Layer ID   │   1│   1│   1│   1│
3828 │                               Subtable ID│   9│   9│  10│  10│
3829 │                      ╶───────────────────┼────┼────┼────┼────┤
3830 │                       No  Yes Table ID   │   1│   1│   1│   1│
3831 │                               Layer ID   │   1│   1│   1│   1│
3832 │                               Subtable ID│  11│  11│  12│  12│
3833 │                          ╶───────────────┼────┼────┼────┼────┤
3834 │                           No  Table ID   │   1│   1│   1│   1│
3835 │                               Layer ID   │   1│   1│   1│   1│
3836 │                               Subtable ID│  11│  11│  12│  12│
3837 │             ╶────────────────────────────┼────┼────┼────┼────┤
3838 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3839 │                               Layer ID   │   1│   1│   1│   1│
3840 │                               Subtable ID│  13│  13│  14│  14│
3841 │                          ╶───────────────┼────┼────┼────┼────┤
3842 │                           No  Table ID   │   1│   1│   1│   1│
3843 │                               Layer ID   │   1│   1│   1│   1│
3844 │                               Subtable ID│  13│  13│  14│  14│
3845 │                      ╶───────────────────┼────┼────┼────┼────┤
3846 │                       No  Yes Table ID   │   1│   1│   1│   1│
3847 │                               Layer ID   │   1│   1│   1│   1│
3848 │                               Subtable ID│  15│  15│  16│  16│
3849 │                          ╶───────────────┼────┼────┼────┼────┤
3850 │                           No  Table ID   │   1│   1│   1│   1│
3851 │                               Layer ID   │   1│   1│   1│   1│
3852 │                               Subtable ID│  15│  15│  16│  16│
3853 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3854
3855                           Custom Tables
3856 Female
3857 ╭──────────────────────────────────────────┬───────────────────╮
3858 │                                          │        QN27       │
3859 │                                          ├─────────┬─────────┤
3860 │                                          │   Yes   │    No   │
3861 │                                          ├─────────┼─────────┤
3862 │                                          │  QND7A  │  QND7A  │
3863 │                                          ├────┬────┼────┬────┤
3864 │                                          │ Yes│ No │ Yes│ No │
3865 │                                          ├────┼────┼────┼────┤
3866 │                                          │QN86│QN86│QN86│QN86│
3867 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3868 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3869 │                               Layer ID   │   2│   2│   2│   2│
3870 │                               Subtable ID│  17│  17│  18│  18│
3871 │                          ╶───────────────┼────┼────┼────┼────┤
3872 │                           No  Table ID   │   1│   1│   1│   1│
3873 │                               Layer ID   │   2│   2│   2│   2│
3874 │                               Subtable ID│  17│  17│  18│  18│
3875 │                      ╶───────────────────┼────┼────┼────┼────┤
3876 │                       No  Yes Table ID   │   1│   1│   1│   1│
3877 │                               Layer ID   │   2│   2│   2│   2│
3878 │                               Subtable ID│  19│  19│  20│  20│
3879 │                          ╶───────────────┼────┼────┼────┼────┤
3880 │                           No  Table ID   │   1│   1│   1│   1│
3881 │                               Layer ID   │   2│   2│   2│   2│
3882 │                               Subtable ID│  19│  19│  20│  20│
3883 │             ╶────────────────────────────┼────┼────┼────┼────┤
3884 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3885 │                               Layer ID   │   2│   2│   2│   2│
3886 │                               Subtable ID│  21│  21│  22│  22│
3887 │                          ╶───────────────┼────┼────┼────┼────┤
3888 │                           No  Table ID   │   1│   1│   1│   1│
3889 │                               Layer ID   │   2│   2│   2│   2│
3890 │                               Subtable ID│  21│  21│  22│  22│
3891 │                      ╶───────────────────┼────┼────┼────┼────┤
3892 │                       No  Yes Table ID   │   1│   1│   1│   1│
3893 │                               Layer ID   │   2│   2│   2│   2│
3894 │                               Subtable ID│  23│  23│  24│  24│
3895 │                          ╶───────────────┼────┼────┼────┼────┤
3896 │                           No  Table ID   │   1│   1│   1│   1│
3897 │                               Layer ID   │   2│   2│   2│   2│
3898 │                               Subtable ID│  23│  23│  24│  24│
3899 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3900 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3901 │                               Layer ID   │   2│   2│   2│   2│
3902 │                               Subtable ID│  25│  25│  26│  26│
3903 │                          ╶───────────────┼────┼────┼────┼────┤
3904 │                           No  Table ID   │   1│   1│   1│   1│
3905 │                               Layer ID   │   2│   2│   2│   2│
3906 │                               Subtable ID│  25│  25│  26│  26│
3907 │                      ╶───────────────────┼────┼────┼────┼────┤
3908 │                       No  Yes Table ID   │   1│   1│   1│   1│
3909 │                               Layer ID   │   2│   2│   2│   2│
3910 │                               Subtable ID│  27│  27│  28│  28│
3911 │                          ╶───────────────┼────┼────┼────┼────┤
3912 │                           No  Table ID   │   1│   1│   1│   1│
3913 │                               Layer ID   │   2│   2│   2│   2│
3914 │                               Subtable ID│  27│  27│  28│  28│
3915 │             ╶────────────────────────────┼────┼────┼────┼────┤
3916 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3917 │                               Layer ID   │   2│   2│   2│   2│
3918 │                               Subtable ID│  29│  29│  30│  30│
3919 │                          ╶───────────────┼────┼────┼────┼────┤
3920 │                           No  Table ID   │   1│   1│   1│   1│
3921 │                               Layer ID   │   2│   2│   2│   2│
3922 │                               Subtable ID│  29│  29│  30│  30│
3923 │                      ╶───────────────────┼────┼────┼────┼────┤
3924 │                       No  Yes Table ID   │   1│   1│   1│   1│
3925 │                               Layer ID   │   2│   2│   2│   2│
3926 │                               Subtable ID│  31│  31│  32│  32│
3927 │                          ╶───────────────┼────┼────┼────┼────┤
3928 │                           No  Table ID   │   1│   1│   1│   1│
3929 │                               Layer ID   │   2│   2│   2│   2│
3930 │                               Subtable ID│  31│  31│  32│  32│
3931 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3932
3933                           Custom Tables
3934 Male
3935 ╭───────────────────────────────────────────┬───────────────────╮
3936 │                                           │        QN27       │
3937 │                                           ├─────────┬─────────┤
3938 │                                           │   Yes   │    No   │
3939 │                                           ├─────────┼─────────┤
3940 │                                           │  QND7A  │  QND7A  │
3941 │                                           ├────┬────┼────┬────┤
3942 │                                           │ Yes│ No │ Yes│ No │
3943 │                                           ├────┼────┼────┼────┤
3944 │                                           │QN86│QN86│QN86│QN86│
3945 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3946 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   1│   1│   3│   3│
3947 │                               Layer Row ID│   1│   1│   1│   1│
3948 │                          ╶────────────────┼────┼────┼────┼────┤
3949 │                           No  Row ID      │   2│   2│   4│   4│
3950 │                               Layer Row ID│   2│   2│   2│   2│
3951 │                      ╶────────────────────┼────┼────┼────┼────┤
3952 │                       No  Yes Row ID      │   5│   5│   7│   7│
3953 │                               Layer Row ID│   3│   3│   3│   3│
3954 │                          ╶────────────────┼────┼────┼────┼────┤
3955 │                           No  Row ID      │   6│   6│   8│   8│
3956 │                               Layer Row ID│   4│   4│   4│   4│
3957 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3958 │              No  QN57 Yes Yes Row ID      │   9│   9│  11│  11│
3959 │                               Layer Row ID│   5│   5│   5│   5│
3960 │                          ╶────────────────┼────┼────┼────┼────┤
3961 │                           No  Row ID      │  10│  10│  12│  12│
3962 │                               Layer Row ID│   6│   6│   6│   6│
3963 │                      ╶────────────────────┼────┼────┼────┼────┤
3964 │                       No  Yes Row ID      │  13│  13│  15│  15│
3965 │                               Layer Row ID│   7│   7│   7│   7│
3966 │                          ╶────────────────┼────┼────┼────┼────┤
3967 │                           No  Row ID      │  14│  14│  16│  16│
3968 │                               Layer Row ID│   8│   8│   8│   8│
3969 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3970 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  19│  19│
3971 │                               Layer Row ID│   9│   9│   9│   9│
3972 │                          ╶────────────────┼────┼────┼────┼────┤
3973 │                           No  Row ID      │  18│  18│  20│  20│
3974 │                               Layer Row ID│  10│  10│  10│  10│
3975 │                      ╶────────────────────┼────┼────┼────┼────┤
3976 │                       No  Yes Row ID      │  21│  21│  23│  23│
3977 │                               Layer Row ID│  11│  11│  11│  11│
3978 │                          ╶────────────────┼────┼────┼────┼────┤
3979 │                           No  Row ID      │  22│  22│  24│  24│
3980 │                               Layer Row ID│  12│  12│  12│  12│
3981 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3982 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
3983 │                               Layer Row ID│  13│  13│  13│  13│
3984 │                          ╶────────────────┼────┼────┼────┼────┤
3985 │                           No  Row ID      │  26│  26│  28│  28│
3986 │                               Layer Row ID│  14│  14│  14│  14│
3987 │                      ╶────────────────────┼────┼────┼────┼────┤
3988 │                       No  Yes Row ID      │  29│  29│  31│  31│
3989 │                               Layer Row ID│  15│  15│  15│  15│
3990 │                          ╶────────────────┼────┼────┼────┼────┤
3991 │                           No  Row ID      │  30│  30│  32│  32│
3992 │                               Layer Row ID│  16│  16│  16│  16│
3993 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3994
3995                           Custom Tables
3996 Female
3997 ╭───────────────────────────────────────────┬───────────────────╮
3998 │                                           │        QN27       │
3999 │                                           ├─────────┬─────────┤
4000 │                                           │   Yes   │    No   │
4001 │                                           ├─────────┼─────────┤
4002 │                                           │  QND7A  │  QND7A  │
4003 │                                           ├────┬────┼────┬────┤
4004 │                                           │ Yes│ No │ Yes│ No │
4005 │                                           ├────┼────┼────┼────┤
4006 │                                           │QN86│QN86│QN86│QN86│
4007 ├───────────────────────────────────────────┼────┼────┼────┼────┤
4008 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  33│  33│  35│  35│
4009 │                               Layer Row ID│  17│  17│  17│  17│
4010 │                          ╶────────────────┼────┼────┼────┼────┤
4011 │                           No  Row ID      │  34│  34│  36│  36│
4012 │                               Layer Row ID│  18│  18│  18│  18│
4013 │                      ╶────────────────────┼────┼────┼────┼────┤
4014 │                       No  Yes Row ID      │  37│  37│  39│  39│
4015 │                               Layer Row ID│  19│  19│  19│  19│
4016 │                          ╶────────────────┼────┼────┼────┼────┤
4017 │                           No  Row ID      │  38│  38│  40│  40│
4018 │                               Layer Row ID│  20│  20│  20│  20│
4019 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4020 │              No  QN57 Yes Yes Row ID      │  41│  41│  43│  43│
4021 │                               Layer Row ID│  21│  21│  21│  21│
4022 │                          ╶────────────────┼────┼────┼────┼────┤
4023 │                           No  Row ID      │  42│  42│  44│  44│
4024 │                               Layer Row ID│  22│  22│  22│  22│
4025 │                      ╶────────────────────┼────┼────┼────┼────┤
4026 │                       No  Yes Row ID      │  45│  45│  47│  47│
4027 │                               Layer Row ID│  23│  23│  23│  23│
4028 │                          ╶────────────────┼────┼────┼────┼────┤
4029 │                           No  Row ID      │  46│  46│  48│  48│
4030 │                               Layer Row ID│  24│  24│  24│  24│
4031 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
4032 │     No  QN61 Yes QN57 Yes Yes Row ID      │  49│  49│  51│  51│
4033 │                               Layer Row ID│  25│  25│  25│  25│
4034 │                          ╶────────────────┼────┼────┼────┼────┤
4035 │                           No  Row ID      │  50│  50│  52│  52│
4036 │                               Layer Row ID│  26│  26│  26│  26│
4037 │                      ╶────────────────────┼────┼────┼────┼────┤
4038 │                       No  Yes Row ID      │  53│  53│  55│  55│
4039 │                               Layer Row ID│  27│  27│  27│  27│
4040 │                          ╶────────────────┼────┼────┼────┼────┤
4041 │                           No  Row ID      │  54│  54│  56│  56│
4042 │                               Layer Row ID│  28│  28│  28│  28│
4043 │             ╶─────────────────────────────┼────┼────┼────┼────┤
4044 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
4045 │                               Layer Row ID│  29│  29│  29│  29│
4046 │                          ╶────────────────┼────┼────┼────┼────┤
4047 │                           No  Row ID      │  58│  58│  60│  60│
4048 │                               Layer Row ID│  30│  30│  30│  30│
4049 │                      ╶────────────────────┼────┼────┼────┼────┤
4050 │                       No  Yes Row ID      │  61│  61│  63│  63│
4051 │                               Layer Row ID│  31│  31│  31│  31│
4052 │                          ╶────────────────┼────┼────┼────┼────┤
4053 │                           No  Row ID      │  62│  62│  64│  64│
4054 │                               Layer Row ID│  32│  32│  32│  32│
4055 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
4056
4057                             Custom Tables
4058 Male
4059 ╭──────────────────────────────────────────────┬───────────────────╮
4060 │                                              │        QN27       │
4061 │                                              ├─────────┬─────────┤
4062 │                                              │   Yes   │    No   │
4063 │                                              ├─────────┼─────────┤
4064 │                                              │  QND7A  │  QND7A  │
4065 │                                              ├────┬────┼────┬────┤
4066 │                                              │ Yes│ No │ Yes│ No │
4067 │                                              ├────┼────┼────┼────┤
4068 │                                              │QN86│QN86│QN86│QN86│
4069 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
4070 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
4071 │                               Layer Column ID│   1│   2│   3│   4│
4072 │                          ╶───────────────────┼────┼────┼────┼────┤
4073 │                           No  Column ID      │   1│   2│   3│   4│
4074 │                               Layer Column ID│   1│   2│   3│   4│
4075 │                      ╶───────────────────────┼────┼────┼────┼────┤
4076 │                       No  Yes Column ID      │   5│   6│   7│   8│
4077 │                               Layer Column ID│   1│   2│   3│   4│
4078 │                          ╶───────────────────┼────┼────┼────┼────┤
4079 │                           No  Column ID      │   5│   6│   7│   8│
4080 │                               Layer Column ID│   1│   2│   3│   4│
4081 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4082 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
4083 │                               Layer Column ID│   1│   2│   3│   4│
4084 │                          ╶───────────────────┼────┼────┼────┼────┤
4085 │                           No  Column ID      │   9│  10│  11│  12│
4086 │                               Layer Column ID│   1│   2│   3│   4│
4087 │                      ╶───────────────────────┼────┼────┼────┼────┤
4088 │                       No  Yes Column ID      │  13│  14│  15│  16│
4089 │                               Layer Column ID│   1│   2│   3│   4│
4090 │                          ╶───────────────────┼────┼────┼────┼────┤
4091 │                           No  Column ID      │  13│  14│  15│  16│
4092 │                               Layer Column ID│   1│   2│   3│   4│
4093 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4094 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
4095 │                               Layer Column ID│   1│   2│   3│   4│
4096 │                          ╶───────────────────┼────┼────┼────┼────┤
4097 │                           No  Column ID      │  17│  18│  19│  20│
4098 │                               Layer Column ID│   1│   2│   3│   4│
4099 │                      ╶───────────────────────┼────┼────┼────┼────┤
4100 │                       No  Yes Column ID      │  21│  22│  23│  24│
4101 │                               Layer Column ID│   1│   2│   3│   4│
4102 │                          ╶───────────────────┼────┼────┼────┼────┤
4103 │                           No  Column ID      │  21│  22│  23│  24│
4104 │                               Layer Column ID│   1│   2│   3│   4│
4105 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4106 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
4107 │                               Layer Column ID│   1│   2│   3│   4│
4108 │                          ╶───────────────────┼────┼────┼────┼────┤
4109 │                           No  Column ID      │  25│  26│  27│  28│
4110 │                               Layer Column ID│   1│   2│   3│   4│
4111 │                      ╶───────────────────────┼────┼────┼────┼────┤
4112 │                       No  Yes Column ID      │  29│  30│  31│  32│
4113 │                               Layer Column ID│   1│   2│   3│   4│
4114 │                          ╶───────────────────┼────┼────┼────┼────┤
4115 │                           No  Column ID      │  29│  30│  31│  32│
4116 │                               Layer Column ID│   1│   2│   3│   4│
4117 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4118
4119                             Custom Tables
4120 Female
4121 ╭──────────────────────────────────────────────┬───────────────────╮
4122 │                                              │        QN27       │
4123 │                                              ├─────────┬─────────┤
4124 │                                              │   Yes   │    No   │
4125 │                                              ├─────────┼─────────┤
4126 │                                              │  QND7A  │  QND7A  │
4127 │                                              ├────┬────┼────┬────┤
4128 │                                              │ Yes│ No │ Yes│ No │
4129 │                                              ├────┼────┼────┼────┤
4130 │                                              │QN86│QN86│QN86│QN86│
4131 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
4132 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
4133 │                               Layer Column ID│   5│   6│   7│   8│
4134 │                          ╶───────────────────┼────┼────┼────┼────┤
4135 │                           No  Column ID      │  33│  34│  35│  36│
4136 │                               Layer Column ID│   5│   6│   7│   8│
4137 │                      ╶───────────────────────┼────┼────┼────┼────┤
4138 │                       No  Yes Column ID      │  37│  38│  39│  40│
4139 │                               Layer Column ID│   5│   6│   7│   8│
4140 │                          ╶───────────────────┼────┼────┼────┼────┤
4141 │                           No  Column ID      │  37│  38│  39│  40│
4142 │                               Layer Column ID│   5│   6│   7│   8│
4143 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4144 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
4145 │                               Layer Column ID│   5│   6│   7│   8│
4146 │                          ╶───────────────────┼────┼────┼────┼────┤
4147 │                           No  Column ID      │  41│  42│  43│  44│
4148 │                               Layer Column ID│   5│   6│   7│   8│
4149 │                      ╶───────────────────────┼────┼────┼────┼────┤
4150 │                       No  Yes Column ID      │  45│  46│  47│  48│
4151 │                               Layer Column ID│   5│   6│   7│   8│
4152 │                          ╶───────────────────┼────┼────┼────┼────┤
4153 │                           No  Column ID      │  45│  46│  47│  48│
4154 │                               Layer Column ID│   5│   6│   7│   8│
4155 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4156 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
4157 │                               Layer Column ID│   5│   6│   7│   8│
4158 │                          ╶───────────────────┼────┼────┼────┼────┤
4159 │                           No  Column ID      │  49│  50│  51│  52│
4160 │                               Layer Column ID│   5│   6│   7│   8│
4161 │                      ╶───────────────────────┼────┼────┼────┼────┤
4162 │                       No  Yes Column ID      │  53│  54│  55│  56│
4163 │                               Layer Column ID│   5│   6│   7│   8│
4164 │                          ╶───────────────────┼────┼────┼────┼────┤
4165 │                           No  Column ID      │  53│  54│  55│  56│
4166 │                               Layer Column ID│   5│   6│   7│   8│
4167 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4168 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
4169 │                               Layer Column ID│   5│   6│   7│   8│
4170 │                          ╶───────────────────┼────┼────┼────┼────┤
4171 │                           No  Column ID      │  57│  58│  59│  60│
4172 │                               Layer Column ID│   5│   6│   7│   8│
4173 │                      ╶───────────────────────┼────┼────┼────┼────┤
4174 │                       No  Yes Column ID      │  61│  62│  63│  64│
4175 │                               Layer Column ID│   5│   6│   7│   8│
4176 │                          ╶───────────────────┼────┼────┼────┼────┤
4177 │                           No  Column ID      │  61│  62│  63│  64│
4178 │                               Layer Column ID│   5│   6│   7│   8│
4179 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4180 ])
4181 AT_CLEANUP
4182
4183 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
4184 AT_KEYWORDS([ROWLABELS LAYER])
4185 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
4186 AT_DATA([ctables.sps],
4187 [[GET 'nhtsa.sav'.
4188 CTABLES
4189     /VLABELS VARIABLES=ALL DISPLAY=NAME
4190     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4191     /SLABELS POSITION=ROW
4192     /CLABELS ROWLABELS=LAYER
4193     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4194     /SLABELS POSITION=ROW
4195     /CLABELS ROWLABELS=LAYER
4196     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4197     /SLABELS POSITION=ROW
4198     /CLABELS ROWLABELS=LAYER.
4199 ]])
4200 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4201                           Custom Tables
4202 Male
4203 Yes
4204 ╭──────────────────────────────────┬───────────────────────────╮
4205 │                                  │            QN27           │
4206 │                                  ├─────────────┬─────────────┤
4207 │                                  │     Yes     │      No     │
4208 │                                  ├─────────────┼─────────────┤
4209 │                                  │    QND7A    │    QND7A    │
4210 │                                  ├──────┬──────┼──────┬──────┤
4211 │                                  │  Yes │  No  │  Yes │  No  │
4212 │                                  ├──────┼──────┼──────┼──────┤
4213 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4214 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4215 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4216 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4217 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4218 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4219 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4220 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4221 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4222 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4223 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4224 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4225 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4226 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4227 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4228 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4229 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4230 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4231 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4232 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4233
4234                           Custom Tables
4235 Male
4236 No
4237 ╭──────────────────────────────────┬───────────────────────────╮
4238 │                                  │            QN27           │
4239 │                                  ├─────────────┬─────────────┤
4240 │                                  │     Yes     │      No     │
4241 │                                  ├─────────────┼─────────────┤
4242 │                                  │    QND7A    │    QND7A    │
4243 │                                  ├──────┬──────┼──────┬──────┤
4244 │                                  │  Yes │  No  │  Yes │  No  │
4245 │                                  ├──────┼──────┼──────┼──────┤
4246 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4247 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4248 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4249 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4250 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4251 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4252 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4253 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4254 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4255 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4256 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4257 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4258 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4259 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4260 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4261 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4262 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4263 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4264 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4265 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4266
4267                           Custom Tables
4268 Female
4269 Yes
4270 ╭──────────────────────────────────┬───────────────────────────╮
4271 │                                  │            QN27           │
4272 │                                  ├─────────────┬─────────────┤
4273 │                                  │     Yes     │      No     │
4274 │                                  ├─────────────┼─────────────┤
4275 │                                  │    QND7A    │    QND7A    │
4276 │                                  ├──────┬──────┼──────┬──────┤
4277 │                                  │  Yes │  No  │  Yes │  No  │
4278 │                                  ├──────┼──────┼──────┼──────┤
4279 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4280 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4281 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4282 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4283 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4284 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4285 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4286 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4287 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4288 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4289 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4290 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4291 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4292 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4293 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4294 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4295 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4296 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4297 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4298 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4299
4300                           Custom Tables
4301 Female
4302 No
4303 ╭──────────────────────────────────┬───────────────────────────╮
4304 │                                  │            QN27           │
4305 │                                  ├─────────────┬─────────────┤
4306 │                                  │     Yes     │      No     │
4307 │                                  ├─────────────┼─────────────┤
4308 │                                  │    QND7A    │    QND7A    │
4309 │                                  ├──────┬──────┼──────┬──────┤
4310 │                                  │  Yes │  No  │  Yes │  No  │
4311 │                                  ├──────┼──────┼──────┼──────┤
4312 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4313 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4314 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4315 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4316 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4317 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4318 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4319 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4320 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4321 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4322 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4323 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4324 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4325 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4326 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4327 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4328 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4329 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4330 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4331 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4332
4333                           Custom Tables
4334 Male
4335 Yes
4336 ╭───────────────────────────────────┬───────────────────────────╮
4337 │                                   │            QN27           │
4338 │                                   ├─────────────┬─────────────┤
4339 │                                   │     Yes     │      No     │
4340 │                                   ├─────────────┼─────────────┤
4341 │                                   │    QND7A    │    QND7A    │
4342 │                                   ├──────┬──────┼──────┬──────┤
4343 │                                   │  Yes │  No  │  Yes │  No  │
4344 │                                   ├──────┼──────┼──────┼──────┤
4345 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4346 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4347 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4348 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4349 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4350 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4351 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4352 │              No  QN57 Row ID      │  9│ 9│ 11│11│ 13│13│ 15│15│
4353 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4354 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4355 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 19│19│ 21│21│ 23│23│
4356 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
4357 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4358 │              No  QN57 Row ID      │ 25│25│ 27│27│ 29│29│ 31│31│
4359 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
4360 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4361
4362                           Custom Tables
4363 Male
4364 No
4365 ╭───────────────────────────────────┬───────────────────────────╮
4366 │                                   │            QN27           │
4367 │                                   ├─────────────┬─────────────┤
4368 │                                   │     Yes     │      No     │
4369 │                                   ├─────────────┼─────────────┤
4370 │                                   │    QND7A    │    QND7A    │
4371 │                                   ├──────┬──────┼──────┬──────┤
4372 │                                   │  Yes │  No  │  Yes │  No  │
4373 │                                   ├──────┼──────┼──────┼──────┤
4374 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4375 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4376 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4377 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4378 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4379 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4380 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4381 │              No  QN57 Row ID      │ 10│10│ 12│12│ 14│14│ 16│16│
4382 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4383 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4384 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 20│20│ 22│22│ 24│24│
4385 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4386 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4387 │              No  QN57 Row ID      │ 26│26│ 28│28│ 30│30│ 32│32│
4388 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4389 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4390
4391                           Custom Tables
4392 Female
4393 Yes
4394 ╭───────────────────────────────────┬───────────────────────────╮
4395 │                                   │            QN27           │
4396 │                                   ├─────────────┬─────────────┤
4397 │                                   │     Yes     │      No     │
4398 │                                   ├─────────────┼─────────────┤
4399 │                                   │    QND7A    │    QND7A    │
4400 │                                   ├──────┬──────┼──────┬──────┤
4401 │                                   │  Yes │  No  │  Yes │  No  │
4402 │                                   ├──────┼──────┼──────┼──────┤
4403 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4404 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4405 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4406 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4407 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 39│39│
4408 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4409 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4410 │              No  QN57 Row ID      │ 41│41│ 43│43│ 45│45│ 47│47│
4411 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4412 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4413 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 51│51│ 53│53│ 55│55│
4414 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4415 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4416 │              No  QN57 Row ID      │ 57│57│ 59│59│ 61│61│ 63│63│
4417 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4418 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4419
4420                           Custom Tables
4421 Female
4422 No
4423 ╭───────────────────────────────────┬───────────────────────────╮
4424 │                                   │            QN27           │
4425 │                                   ├─────────────┬─────────────┤
4426 │                                   │     Yes     │      No     │
4427 │                                   ├─────────────┼─────────────┤
4428 │                                   │    QND7A    │    QND7A    │
4429 │                                   ├──────┬──────┼──────┬──────┤
4430 │                                   │  Yes │  No  │  Yes │  No  │
4431 │                                   ├──────┼──────┼──────┼──────┤
4432 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4433 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4434 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4435 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4436 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 40│40│
4437 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4438 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4439 │              No  QN57 Row ID      │ 42│42│ 44│44│ 46│46│ 48│48│
4440 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4441 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4442 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 52│52│ 54│54│ 56│56│
4443 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4444 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4445 │              No  QN57 Row ID      │ 58│58│ 60│60│ 62│62│ 64│64│
4446 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4447 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4448
4449                             Custom Tables
4450 Male
4451 Yes
4452 ╭──────────────────────────────────────┬───────────────────────────╮
4453 │                                      │            QN27           │
4454 │                                      ├─────────────┬─────────────┤
4455 │                                      │     Yes     │      No     │
4456 │                                      ├─────────────┼─────────────┤
4457 │                                      │    QND7A    │    QND7A    │
4458 │                                      ├──────┬──────┼──────┬──────┤
4459 │                                      │  Yes │  No  │  Yes │  No  │
4460 │                                      ├──────┼──────┼──────┼──────┤
4461 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4462 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4463 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4464 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4465 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4466 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4467 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4468 │              No  QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4469 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4470 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4471 │     No  QN61 Yes QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4472 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4473 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4474 │              No  QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4475 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4476 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4477
4478                             Custom Tables
4479 Male
4480 No
4481 ╭──────────────────────────────────────┬───────────────────────────╮
4482 │                                      │            QN27           │
4483 │                                      ├─────────────┬─────────────┤
4484 │                                      │     Yes     │      No     │
4485 │                                      ├─────────────┼─────────────┤
4486 │                                      │    QND7A    │    QND7A    │
4487 │                                      ├──────┬──────┼──────┬──────┤
4488 │                                      │  Yes │  No  │  Yes │  No  │
4489 │                                      ├──────┼──────┼──────┼──────┤
4490 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4491 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4492 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4493 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4494 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4495 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4496 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4497 │              No  QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4498 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4499 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4500 │     No  QN61 Yes QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4501 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4502 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4503 │              No  QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4504 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4505 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4506
4507                             Custom Tables
4508 Female
4509 Yes
4510 ╭──────────────────────────────────────┬───────────────────────────╮
4511 │                                      │            QN27           │
4512 │                                      ├─────────────┬─────────────┤
4513 │                                      │     Yes     │      No     │
4514 │                                      ├─────────────┼─────────────┤
4515 │                                      │    QND7A    │    QND7A    │
4516 │                                      ├──────┬──────┼──────┬──────┤
4517 │                                      │  Yes │  No  │  Yes │  No  │
4518 │                                      ├──────┼──────┼──────┼──────┤
4519 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4520 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4521 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4522 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4523 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4524 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4525 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4526 │              No  QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4527 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4528 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4529 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4530 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4531 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4532 │              No  QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4533 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4534 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4535
4536                             Custom Tables
4537 Female
4538 No
4539 ╭──────────────────────────────────────┬───────────────────────────╮
4540 │                                      │            QN27           │
4541 │                                      ├─────────────┬─────────────┤
4542 │                                      │     Yes     │      No     │
4543 │                                      ├─────────────┼─────────────┤
4544 │                                      │    QND7A    │    QND7A    │
4545 │                                      ├──────┬──────┼──────┬──────┤
4546 │                                      │  Yes │  No  │  Yes │  No  │
4547 │                                      ├──────┼──────┼──────┼──────┤
4548 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4549 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4550 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4551 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4552 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4553 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4554 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4555 │              No  QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4556 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4557 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4558 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4559 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4560 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4561 │              No  QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4562 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4563 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4564 ])
4565 AT_CLEANUP
4566
4567 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4568 AT_KEYWORDS([COLLABELS LAYER])
4569 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
4570 AT_DATA([ctables.sps],
4571 [[GET 'nhtsa.sav'.
4572 CTABLES
4573     /VLABELS VARIABLES=ALL DISPLAY=NAME
4574     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4575     /SLABELS POSITION=ROW
4576     /CLABELS COLLABELS=LAYER
4577     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4578     /SLABELS POSITION=ROW
4579     /CLABELS COLLABELS=LAYER
4580     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4581     /SLABELS POSITION=ROW
4582     /CLABELS COLLABELS=LAYER.
4583 ]])
4584 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4585                         Custom Tables
4586 Male
4587 Yes
4588 ╭──────────────────────────────────────┬───────────────────╮
4589 │                                      │        QN27       │
4590 │                                      ├─────────┬─────────┤
4591 │                                      │   Yes   │    No   │
4592 │                                      ├─────────┼─────────┤
4593 │                                      │  QND7A  │  QND7A  │
4594 │                                      ├────┬────┼────┬────┤
4595 │                                      │ Yes│ No │ Yes│ No │
4596 │                                      ├────┼────┼────┼────┤
4597 │                                      │QN86│QN86│QN86│QN86│
4598 ├──────────────────────────────────────┼────┼────┼────┼────┤
4599 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4600 │                           Layer ID   │   1│   1│   1│   1│
4601 │                           Subtable ID│   1│   1│   3│   3│
4602 │                      ╶───────────────┼────┼────┼────┼────┤
4603 │                       No  Table ID   │   1│   1│   1│   1│
4604 │                           Layer ID   │   1│   1│   1│   1│
4605 │                           Subtable ID│   1│   1│   3│   3│
4606 │             ╶────────────────────────┼────┼────┼────┼────┤
4607 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4608 │                           Layer ID   │   1│   1│   1│   1│
4609 │                           Subtable ID│   5│   5│   7│   7│
4610 │                      ╶───────────────┼────┼────┼────┼────┤
4611 │                       No  Table ID   │   1│   1│   1│   1│
4612 │                           Layer ID   │   1│   1│   1│   1│
4613 │                           Subtable ID│   5│   5│   7│   7│
4614 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4615 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4616 │                           Layer ID   │   1│   1│   1│   1│
4617 │                           Subtable ID│   9│   9│  11│  11│
4618 │                      ╶───────────────┼────┼────┼────┼────┤
4619 │                       No  Table ID   │   1│   1│   1│   1│
4620 │                           Layer ID   │   1│   1│   1│   1│
4621 │                           Subtable ID│   9│   9│  11│  11│
4622 │             ╶────────────────────────┼────┼────┼────┼────┤
4623 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4624 │                           Layer ID   │   1│   1│   1│   1│
4625 │                           Subtable ID│  13│  13│  15│  15│
4626 │                      ╶───────────────┼────┼────┼────┼────┤
4627 │                       No  Table ID   │   1│   1│   1│   1│
4628 │                           Layer ID   │   1│   1│   1│   1│
4629 │                           Subtable ID│  13│  13│  15│  15│
4630 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4631
4632                         Custom Tables
4633 Male
4634 No
4635 ╭──────────────────────────────────────┬───────────────────╮
4636 │                                      │        QN27       │
4637 │                                      ├─────────┬─────────┤
4638 │                                      │   Yes   │    No   │
4639 │                                      ├─────────┼─────────┤
4640 │                                      │  QND7A  │  QND7A  │
4641 │                                      ├────┬────┼────┬────┤
4642 │                                      │ Yes│ No │ Yes│ No │
4643 │                                      ├────┼────┼────┼────┤
4644 │                                      │QN86│QN86│QN86│QN86│
4645 ├──────────────────────────────────────┼────┼────┼────┼────┤
4646 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4647 │                           Layer ID   │   2│   2│   2│   2│
4648 │                           Subtable ID│   2│   2│   4│   4│
4649 │                      ╶───────────────┼────┼────┼────┼────┤
4650 │                       No  Table ID   │   1│   1│   1│   1│
4651 │                           Layer ID   │   2│   2│   2│   2│
4652 │                           Subtable ID│   2│   2│   4│   4│
4653 │             ╶────────────────────────┼────┼────┼────┼────┤
4654 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4655 │                           Layer ID   │   2│   2│   2│   2│
4656 │                           Subtable ID│   6│   6│   8│   8│
4657 │                      ╶───────────────┼────┼────┼────┼────┤
4658 │                       No  Table ID   │   1│   1│   1│   1│
4659 │                           Layer ID   │   2│   2│   2│   2│
4660 │                           Subtable ID│   6│   6│   8│   8│
4661 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4662 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4663 │                           Layer ID   │   2│   2│   2│   2│
4664 │                           Subtable ID│  10│  10│  12│  12│
4665 │                      ╶───────────────┼────┼────┼────┼────┤
4666 │                       No  Table ID   │   1│   1│   1│   1│
4667 │                           Layer ID   │   2│   2│   2│   2│
4668 │                           Subtable ID│  10│  10│  12│  12│
4669 │             ╶────────────────────────┼────┼────┼────┼────┤
4670 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4671 │                           Layer ID   │   2│   2│   2│   2│
4672 │                           Subtable ID│  14│  14│  16│  16│
4673 │                      ╶───────────────┼────┼────┼────┼────┤
4674 │                       No  Table ID   │   1│   1│   1│   1│
4675 │                           Layer ID   │   2│   2│   2│   2│
4676 │                           Subtable ID│  14│  14│  16│  16│
4677 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4678
4679                         Custom Tables
4680 Female
4681 Yes
4682 ╭──────────────────────────────────────┬───────────────────╮
4683 │                                      │        QN27       │
4684 │                                      ├─────────┬─────────┤
4685 │                                      │   Yes   │    No   │
4686 │                                      ├─────────┼─────────┤
4687 │                                      │  QND7A  │  QND7A  │
4688 │                                      ├────┬────┼────┬────┤
4689 │                                      │ Yes│ No │ Yes│ No │
4690 │                                      ├────┼────┼────┼────┤
4691 │                                      │QN86│QN86│QN86│QN86│
4692 ├──────────────────────────────────────┼────┼────┼────┼────┤
4693 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4694 │                           Layer ID   │   3│   3│   3│   3│
4695 │                           Subtable ID│  17│  17│  19│  19│
4696 │                      ╶───────────────┼────┼────┼────┼────┤
4697 │                       No  Table ID   │   1│   1│   1│   1│
4698 │                           Layer ID   │   3│   3│   3│   3│
4699 │                           Subtable ID│  17│  17│  19│  19│
4700 │             ╶────────────────────────┼────┼────┼────┼────┤
4701 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4702 │                           Layer ID   │   3│   3│   3│   3│
4703 │                           Subtable ID│  21│  21│  23│  23│
4704 │                      ╶───────────────┼────┼────┼────┼────┤
4705 │                       No  Table ID   │   1│   1│   1│   1│
4706 │                           Layer ID   │   3│   3│   3│   3│
4707 │                           Subtable ID│  21│  21│  23│  23│
4708 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4709 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4710 │                           Layer ID   │   3│   3│   3│   3│
4711 │                           Subtable ID│  25│  25│  27│  27│
4712 │                      ╶───────────────┼────┼────┼────┼────┤
4713 │                       No  Table ID   │   1│   1│   1│   1│
4714 │                           Layer ID   │   3│   3│   3│   3│
4715 │                           Subtable ID│  25│  25│  27│  27│
4716 │             ╶────────────────────────┼────┼────┼────┼────┤
4717 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4718 │                           Layer ID   │   3│   3│   3│   3│
4719 │                           Subtable ID│  29│  29│  31│  31│
4720 │                      ╶───────────────┼────┼────┼────┼────┤
4721 │                       No  Table ID   │   1│   1│   1│   1│
4722 │                           Layer ID   │   3│   3│   3│   3│
4723 │                           Subtable ID│  29│  29│  31│  31│
4724 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4725
4726                         Custom Tables
4727 Female
4728 No
4729 ╭──────────────────────────────────────┬───────────────────╮
4730 │                                      │        QN27       │
4731 │                                      ├─────────┬─────────┤
4732 │                                      │   Yes   │    No   │
4733 │                                      ├─────────┼─────────┤
4734 │                                      │  QND7A  │  QND7A  │
4735 │                                      ├────┬────┼────┬────┤
4736 │                                      │ Yes│ No │ Yes│ No │
4737 │                                      ├────┼────┼────┼────┤
4738 │                                      │QN86│QN86│QN86│QN86│
4739 ├──────────────────────────────────────┼────┼────┼────┼────┤
4740 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4741 │                           Layer ID   │   4│   4│   4│   4│
4742 │                           Subtable ID│  18│  18│  20│  20│
4743 │                      ╶───────────────┼────┼────┼────┼────┤
4744 │                       No  Table ID   │   1│   1│   1│   1│
4745 │                           Layer ID   │   4│   4│   4│   4│
4746 │                           Subtable ID│  18│  18│  20│  20│
4747 │             ╶────────────────────────┼────┼────┼────┼────┤
4748 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4749 │                           Layer ID   │   4│   4│   4│   4│
4750 │                           Subtable ID│  22│  22│  24│  24│
4751 │                      ╶───────────────┼────┼────┼────┼────┤
4752 │                       No  Table ID   │   1│   1│   1│   1│
4753 │                           Layer ID   │   4│   4│   4│   4│
4754 │                           Subtable ID│  22│  22│  24│  24│
4755 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4756 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4757 │                           Layer ID   │   4│   4│   4│   4│
4758 │                           Subtable ID│  26│  26│  28│  28│
4759 │                      ╶───────────────┼────┼────┼────┼────┤
4760 │                       No  Table ID   │   1│   1│   1│   1│
4761 │                           Layer ID   │   4│   4│   4│   4│
4762 │                           Subtable ID│  26│  26│  28│  28│
4763 │             ╶────────────────────────┼────┼────┼────┼────┤
4764 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4765 │                           Layer ID   │   4│   4│   4│   4│
4766 │                           Subtable ID│  30│  30│  32│  32│
4767 │                      ╶───────────────┼────┼────┼────┼────┤
4768 │                       No  Table ID   │   1│   1│   1│   1│
4769 │                           Layer ID   │   4│   4│   4│   4│
4770 │                           Subtable ID│  30│  30│  32│  32│
4771 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4772
4773                         Custom Tables
4774 Male
4775 Yes
4776 ╭───────────────────────────────────────┬───────────────────╮
4777 │                                       │        QN27       │
4778 │                                       ├─────────┬─────────┤
4779 │                                       │   Yes   │    No   │
4780 │                                       ├─────────┼─────────┤
4781 │                                       │  QND7A  │  QND7A  │
4782 │                                       ├────┬────┼────┬────┤
4783 │                                       │ Yes│ No │ Yes│ No │
4784 │                                       ├────┼────┼────┼────┤
4785 │                                       │QN86│QN86│QN86│QN86│
4786 ├───────────────────────────────────────┼────┼────┼────┼────┤
4787 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4788 │                           Layer Row ID│   1│   1│   1│   1│
4789 │                      ╶────────────────┼────┼────┼────┼────┤
4790 │                       No  Row ID      │   5│   5│   7│   7│
4791 │                           Layer Row ID│   3│   3│   3│   3│
4792 │             ╶─────────────────────────┼────┼────┼────┼────┤
4793 │              No  QN57 Yes Row ID      │   9│   9│  11│  11│
4794 │                           Layer Row ID│   5│   5│   5│   5│
4795 │                      ╶────────────────┼────┼────┼────┼────┤
4796 │                       No  Row ID      │  13│  13│  15│  15│
4797 │                           Layer Row ID│   7│   7│   7│   7│
4798 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4799 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  19│  19│
4800 │                           Layer Row ID│   9│   9│   9│   9│
4801 │                      ╶────────────────┼────┼────┼────┼────┤
4802 │                       No  Row ID      │  21│  21│  23│  23│
4803 │                           Layer Row ID│  11│  11│  11│  11│
4804 │             ╶─────────────────────────┼────┼────┼────┼────┤
4805 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4806 │                           Layer Row ID│  13│  13│  13│  13│
4807 │                      ╶────────────────┼────┼────┼────┼────┤
4808 │                       No  Row ID      │  29│  29│  31│  31│
4809 │                           Layer Row ID│  15│  15│  15│  15│
4810 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4811
4812                         Custom Tables
4813 Male
4814 No
4815 ╭───────────────────────────────────────┬───────────────────╮
4816 │                                       │        QN27       │
4817 │                                       ├─────────┬─────────┤
4818 │                                       │   Yes   │    No   │
4819 │                                       ├─────────┼─────────┤
4820 │                                       │  QND7A  │  QND7A  │
4821 │                                       ├────┬────┼────┬────┤
4822 │                                       │ Yes│ No │ Yes│ No │
4823 │                                       ├────┼────┼────┼────┤
4824 │                                       │QN86│QN86│QN86│QN86│
4825 ├───────────────────────────────────────┼────┼────┼────┼────┤
4826 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4827 │                           Layer Row ID│   2│   2│   2│   2│
4828 │                      ╶────────────────┼────┼────┼────┼────┤
4829 │                       No  Row ID      │   6│   6│   8│   8│
4830 │                           Layer Row ID│   4│   4│   4│   4│
4831 │             ╶─────────────────────────┼────┼────┼────┼────┤
4832 │              No  QN57 Yes Row ID      │  10│  10│  12│  12│
4833 │                           Layer Row ID│   6│   6│   6│   6│
4834 │                      ╶────────────────┼────┼────┼────┼────┤
4835 │                       No  Row ID      │  14│  14│  16│  16│
4836 │                           Layer Row ID│   8│   8│   8│   8│
4837 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4838 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  20│  20│
4839 │                           Layer Row ID│  10│  10│  10│  10│
4840 │                      ╶────────────────┼────┼────┼────┼────┤
4841 │                       No  Row ID      │  22│  22│  24│  24│
4842 │                           Layer Row ID│  12│  12│  12│  12│
4843 │             ╶─────────────────────────┼────┼────┼────┼────┤
4844 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4845 │                           Layer Row ID│  14│  14│  14│  14│
4846 │                      ╶────────────────┼────┼────┼────┼────┤
4847 │                       No  Row ID      │  30│  30│  32│  32│
4848 │                           Layer Row ID│  16│  16│  16│  16│
4849 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4850
4851                         Custom Tables
4852 Female
4853 Yes
4854 ╭───────────────────────────────────────┬───────────────────╮
4855 │                                       │        QN27       │
4856 │                                       ├─────────┬─────────┤
4857 │                                       │   Yes   │    No   │
4858 │                                       ├─────────┼─────────┤
4859 │                                       │  QND7A  │  QND7A  │
4860 │                                       ├────┬────┼────┬────┤
4861 │                                       │ Yes│ No │ Yes│ No │
4862 │                                       ├────┼────┼────┼────┤
4863 │                                       │QN86│QN86│QN86│QN86│
4864 ├───────────────────────────────────────┼────┼────┼────┼────┤
4865 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  35│  35│
4866 │                           Layer Row ID│  17│  17│  17│  17│
4867 │                      ╶────────────────┼────┼────┼────┼────┤
4868 │                       No  Row ID      │  37│  37│  39│  39│
4869 │                           Layer Row ID│  19│  19│  19│  19│
4870 │             ╶─────────────────────────┼────┼────┼────┼────┤
4871 │              No  QN57 Yes Row ID      │  41│  41│  43│  43│
4872 │                           Layer Row ID│  21│  21│  21│  21│
4873 │                      ╶────────────────┼────┼────┼────┼────┤
4874 │                       No  Row ID      │  45│  45│  47│  47│
4875 │                           Layer Row ID│  23│  23│  23│  23│
4876 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4877 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  51│  51│
4878 │                           Layer Row ID│  25│  25│  25│  25│
4879 │                      ╶────────────────┼────┼────┼────┼────┤
4880 │                       No  Row ID      │  53│  53│  55│  55│
4881 │                           Layer Row ID│  27│  27│  27│  27│
4882 │             ╶─────────────────────────┼────┼────┼────┼────┤
4883 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4884 │                           Layer Row ID│  29│  29│  29│  29│
4885 │                      ╶────────────────┼────┼────┼────┼────┤
4886 │                       No  Row ID      │  61│  61│  63│  63│
4887 │                           Layer Row ID│  31│  31│  31│  31│
4888 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4889
4890                         Custom Tables
4891 Female
4892 No
4893 ╭───────────────────────────────────────┬───────────────────╮
4894 │                                       │        QN27       │
4895 │                                       ├─────────┬─────────┤
4896 │                                       │   Yes   │    No   │
4897 │                                       ├─────────┼─────────┤
4898 │                                       │  QND7A  │  QND7A  │
4899 │                                       ├────┬────┼────┬────┤
4900 │                                       │ Yes│ No │ Yes│ No │
4901 │                                       ├────┼────┼────┼────┤
4902 │                                       │QN86│QN86│QN86│QN86│
4903 ├───────────────────────────────────────┼────┼────┼────┼────┤
4904 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  36│  36│
4905 │                           Layer Row ID│  18│  18│  18│  18│
4906 │                      ╶────────────────┼────┼────┼────┼────┤
4907 │                       No  Row ID      │  38│  38│  40│  40│
4908 │                           Layer Row ID│  20│  20│  20│  20│
4909 │             ╶─────────────────────────┼────┼────┼────┼────┤
4910 │              No  QN57 Yes Row ID      │  42│  42│  44│  44│
4911 │                           Layer Row ID│  22│  22│  22│  22│
4912 │                      ╶────────────────┼────┼────┼────┼────┤
4913 │                       No  Row ID      │  46│  46│  48│  48│
4914 │                           Layer Row ID│  24│  24│  24│  24│
4915 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4916 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  52│  52│
4917 │                           Layer Row ID│  26│  26│  26│  26│
4918 │                      ╶────────────────┼────┼────┼────┼────┤
4919 │                       No  Row ID      │  54│  54│  56│  56│
4920 │                           Layer Row ID│  28│  28│  28│  28│
4921 │             ╶─────────────────────────┼────┼────┼────┼────┤
4922 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
4923 │                           Layer Row ID│  30│  30│  30│  30│
4924 │                      ╶────────────────┼────┼────┼────┼────┤
4925 │                       No  Row ID      │  62│  62│  64│  64│
4926 │                           Layer Row ID│  32│  32│  32│  32│
4927 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4928
4929                           Custom Tables
4930 Male
4931 Yes
4932 ╭──────────────────────────────────────────┬───────────────────╮
4933 │                                          │        QN27       │
4934 │                                          ├─────────┬─────────┤
4935 │                                          │   Yes   │    No   │
4936 │                                          ├─────────┼─────────┤
4937 │                                          │  QND7A  │  QND7A  │
4938 │                                          ├────┬────┼────┬────┤
4939 │                                          │ Yes│ No │ Yes│ No │
4940 │                                          ├────┼────┼────┼────┤
4941 │                                          │QN86│QN86│QN86│QN86│
4942 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4943 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   7│
4944 │                           Layer Column ID│   1│   3│   5│   7│
4945 │                      ╶───────────────────┼────┼────┼────┼────┤
4946 │                       No  Column ID      │   1│   3│   5│   7│
4947 │                           Layer Column ID│   1│   3│   5│   7│
4948 │             ╶────────────────────────────┼────┼────┼────┼────┤
4949 │              No  QN57 Yes Column ID      │   9│  11│  13│  15│
4950 │                           Layer Column ID│   1│   3│   5│   7│
4951 │                      ╶───────────────────┼────┼────┼────┼────┤
4952 │                       No  Column ID      │   9│  11│  13│  15│
4953 │                           Layer Column ID│   1│   3│   5│   7│
4954 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4955 │     No  QN61 Yes QN57 Yes Column ID      │  17│  19│  21│  23│
4956 │                           Layer Column ID│   1│   3│   5│   7│
4957 │                      ╶───────────────────┼────┼────┼────┼────┤
4958 │                       No  Column ID      │  17│  19│  21│  23│
4959 │                           Layer Column ID│   1│   3│   5│   7│
4960 │             ╶────────────────────────────┼────┼────┼────┼────┤
4961 │              No  QN57 Yes Column ID      │  25│  27│  29│  31│
4962 │                           Layer Column ID│   1│   3│   5│   7│
4963 │                      ╶───────────────────┼────┼────┼────┼────┤
4964 │                       No  Column ID      │  25│  27│  29│  31│
4965 │                           Layer Column ID│   1│   3│   5│   7│
4966 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4967
4968                           Custom Tables
4969 Male
4970 No
4971 ╭──────────────────────────────────────────┬───────────────────╮
4972 │                                          │        QN27       │
4973 │                                          ├─────────┬─────────┤
4974 │                                          │   Yes   │    No   │
4975 │                                          ├─────────┼─────────┤
4976 │                                          │  QND7A  │  QND7A  │
4977 │                                          ├────┬────┼────┬────┤
4978 │                                          │ Yes│ No │ Yes│ No │
4979 │                                          ├────┼────┼────┼────┤
4980 │                                          │QN86│QN86│QN86│QN86│
4981 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4982 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   8│
4983 │                           Layer Column ID│   2│   4│   6│   8│
4984 │                      ╶───────────────────┼────┼────┼────┼────┤
4985 │                       No  Column ID      │   2│   4│   6│   8│
4986 │                           Layer Column ID│   2│   4│   6│   8│
4987 │             ╶────────────────────────────┼────┼────┼────┼────┤
4988 │              No  QN57 Yes Column ID      │  10│  12│  14│  16│
4989 │                           Layer Column ID│   2│   4│   6│   8│
4990 │                      ╶───────────────────┼────┼────┼────┼────┤
4991 │                       No  Column ID      │  10│  12│  14│  16│
4992 │                           Layer Column ID│   2│   4│   6│   8│
4993 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4994 │     No  QN61 Yes QN57 Yes Column ID      │  18│  20│  22│  24│
4995 │                           Layer Column ID│   2│   4│   6│   8│
4996 │                      ╶───────────────────┼────┼────┼────┼────┤
4997 │                       No  Column ID      │  18│  20│  22│  24│
4998 │                           Layer Column ID│   2│   4│   6│   8│
4999 │             ╶────────────────────────────┼────┼────┼────┼────┤
5000 │              No  QN57 Yes Column ID      │  26│  28│  30│  32│
5001 │                           Layer Column ID│   2│   4│   6│   8│
5002 │                      ╶───────────────────┼────┼────┼────┼────┤
5003 │                       No  Column ID      │  26│  28│  30│  32│
5004 │                           Layer Column ID│   2│   4│   6│   8│
5005 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5006
5007                           Custom Tables
5008 Female
5009 Yes
5010 ╭──────────────────────────────────────────┬───────────────────╮
5011 │                                          │        QN27       │
5012 │                                          ├─────────┬─────────┤
5013 │                                          │   Yes   │    No   │
5014 │                                          ├─────────┼─────────┤
5015 │                                          │  QND7A  │  QND7A  │
5016 │                                          ├────┬────┼────┬────┤
5017 │                                          │ Yes│ No │ Yes│ No │
5018 │                                          ├────┼────┼────┼────┤
5019 │                                          │QN86│QN86│QN86│QN86│
5020 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5021 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  37│  39│
5022 │                           Layer Column ID│   9│  11│  13│  15│
5023 │                      ╶───────────────────┼────┼────┼────┼────┤
5024 │                       No  Column ID      │  33│  35│  37│  39│
5025 │                           Layer Column ID│   9│  11│  13│  15│
5026 │             ╶────────────────────────────┼────┼────┼────┼────┤
5027 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
5028 │                           Layer Column ID│   9│  11│  13│  15│
5029 │                      ╶───────────────────┼────┼────┼────┼────┤
5030 │                       No  Column ID      │  41│  43│  45│  47│
5031 │                           Layer Column ID│   9│  11│  13│  15│
5032 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5033 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  53│  55│
5034 │                           Layer Column ID│   9│  11│  13│  15│
5035 │                      ╶───────────────────┼────┼────┼────┼────┤
5036 │                       No  Column ID      │  49│  51│  53│  55│
5037 │                           Layer Column ID│   9│  11│  13│  15│
5038 │             ╶────────────────────────────┼────┼────┼────┼────┤
5039 │              No  QN57 Yes Column ID      │  57│  59│  61│  63│
5040 │                           Layer Column ID│   9│  11│  13│  15│
5041 │                      ╶───────────────────┼────┼────┼────┼────┤
5042 │                       No  Column ID      │  57│  59│  61│  63│
5043 │                           Layer Column ID│   9│  11│  13│  15│
5044 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5045
5046                           Custom Tables
5047 Female
5048 No
5049 ╭──────────────────────────────────────────┬───────────────────╮
5050 │                                          │        QN27       │
5051 │                                          ├─────────┬─────────┤
5052 │                                          │   Yes   │    No   │
5053 │                                          ├─────────┼─────────┤
5054 │                                          │  QND7A  │  QND7A  │
5055 │                                          ├────┬────┼────┬────┤
5056 │                                          │ Yes│ No │ Yes│ No │
5057 │                                          ├────┼────┼────┼────┤
5058 │                                          │QN86│QN86│QN86│QN86│
5059 ├──────────────────────────────────────────┼────┼────┼────┼────┤
5060 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  38│  40│
5061 │                           Layer Column ID│  10│  12│  14│  16│
5062 │                      ╶───────────────────┼────┼────┼────┼────┤
5063 │                       No  Column ID      │  34│  36│  38│  40│
5064 │                           Layer Column ID│  10│  12│  14│  16│
5065 │             ╶────────────────────────────┼────┼────┼────┼────┤
5066 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
5067 │                           Layer Column ID│  10│  12│  14│  16│
5068 │                      ╶───────────────────┼────┼────┼────┼────┤
5069 │                       No  Column ID      │  42│  44│  46│  48│
5070 │                           Layer Column ID│  10│  12│  14│  16│
5071 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
5072 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  54│  56│
5073 │                           Layer Column ID│  10│  12│  14│  16│
5074 │                      ╶───────────────────┼────┼────┼────┼────┤
5075 │                       No  Column ID      │  50│  52│  54│  56│
5076 │                           Layer Column ID│  10│  12│  14│  16│
5077 │             ╶────────────────────────────┼────┼────┼────┼────┤
5078 │              No  QN57 Yes Column ID      │  58│  60│  62│  64│
5079 │                           Layer Column ID│  10│  12│  14│  16│
5080 │                      ╶───────────────────┼────┼────┼────┼────┤
5081 │                       No  Column ID      │  58│  60│  62│  64│
5082 │                           Layer Column ID│  10│  12│  14│  16│
5083 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
5084 ])
5085 AT_CLEANUP
5086
5087 AT_SETUP([CTABLES categorical summary functions])
5088 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5089 AT_DATA([ctables.sps],
5090 [[GET 'nhtsa.sav'.
5091 CTABLES
5092     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
5093     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
5094     /SLABELS POSITION=ROW.
5095 ]])
5096 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5097                                                       Custom Tables
5098 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
5099 │                 │                     D5a. What would you say is your primary ethnic background?                     │
5100 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
5101 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
5102 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
5103 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
5104 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5105 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
5106 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
5107 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
5108 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5109 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5110 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
5111 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5112 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5113 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
5114 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
5115 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5116 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
5117 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
5118 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
5119 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5120 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5121 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
5122 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5123 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5124 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
5125 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
5126 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5127 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
5128 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
5129 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
5130 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5131 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5132 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
5133 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5134 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5135 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
5136 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
5137 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5138 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
5139 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
5140 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
5141 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5142 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5143 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
5144 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5145 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5146 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
5147 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
5148 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
5149 ])
5150 AT_CLEANUP
5151
5152 AT_SETUP([CTABLES scale summary functions])
5153 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5154 AT_DATA([ctables.sps],
5155 [[GET 'nhtsa.sav'.
5156 SET TVAR=NAME.
5157
5158 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5159   CTABLES later, to make the results easier to verify.
5160 SPLIT FILE BY REGION.
5161 FREQUENCIES
5162     qn19a
5163     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5164     /FORMAT NOTABLE /MISSING=INCLUDE.
5165 SPLIT FILE OFF.
5166
5167 CTABLES
5168     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5169     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
5170     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
5171     /SLABELS POSITION=ROW
5172     /CLABELS ROWLABELS=OPPOSITE.
5173 ]])
5174 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5175                    Statistics
5176 ╭─────────┬───────────────────────────────────╮
5177 │         │               REGION              │
5178 │         ├────────┬────────┬────────┬────────┤
5179 │         │   NE   │   MW   │    S   │    W   │
5180 │         ├────────┼────────┼────────┼────────┤
5181 │         │  QN19A │  QN19A │  QN19A │  QN19A │
5182 ├─────────┼────────┼────────┼────────┼────────┤
5183 │N Valid  │     936│    1019│    1276│     950│
5184 │  Missing│     473│     635│    1114│     596│
5185 ├─────────┼────────┼────────┼────────┼────────┤
5186 │Mean     │   19.33│   19.83│   20.29│   19.87│
5187 ├─────────┼────────┼────────┼────────┼────────┤
5188 │S.E. Mean│     .14│     .16│     .18│     .17│
5189 ├─────────┼────────┼────────┼────────┼────────┤
5190 │Median   │   18.00│   19.00│   19.00│   19.00│
5191 ├─────────┼────────┼────────┼────────┼────────┤
5192 │Mode     │   18.00│   18.00│   18.00│   18.00│
5193 ├─────────┼────────┼────────┼────────┼────────┤
5194 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
5195 ├─────────┼────────┼────────┼────────┼────────┤
5196 │Variance │   19.41│   26.47│   41.43│   27.59│
5197 ├─────────┼────────┼────────┼────────┼────────┤
5198 │Range    │   59.00│   71.00│   75.00│   61.00│
5199 ├─────────┼────────┼────────┼────────┼────────┤
5200 │Minimum  │     .00│    4.00│    4.00│    4.00│
5201 ├─────────┼────────┼────────┼────────┼────────┤
5202 │Maximum  │   59.00│   75.00│   79.00│   65.00│
5203 ├─────────┼────────┼────────┼────────┼────────┤
5204 │Sum      │18092.00│20206.00│25886.00│18877.00│
5205 ╰─────────┴────────┴────────┴────────┴────────╯
5206
5207                          Custom Tables
5208 ╭────────────────────────┬────────┬────────┬────────┬────────╮
5209 │                        │   NE   │   MW   │    S   │    W   │
5210 ├────────────────────────┼────────┼────────┼────────┼────────┤
5211 │REGION Valid N          │     936│    1019│    1276│     950│
5212 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
5213 │       Mean             │   19.33│   19.83│   20.29│   19.87│
5214 │       Std Error of Mean│     .14│     .16│     .18│     .17│
5215 │       Median           │   18.00│   19.00│   19.00│   19.00│
5216 │       Mode             │   18.00│   18.00│   18.00│   18.00│
5217 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
5218 │       Variance         │   19.41│   26.47│   41.43│   27.59│
5219 │       Range            │   59.00│   71.00│   75.00│   61.00│
5220 │       Minimum          │     .00│    4.00│    4.00│    4.00│
5221 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
5222 │       Sum              │18092.00│20206.00│25886.00│18877.00│
5223 │       Count            │    1409│    1654│    2390│    1546│
5224 │       Total N          │    1409│    1654│    2390│    1546│
5225 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
5226 ╰────────────────────────┴────────┴────────┴────────┴────────╯
5227 ])
5228 AT_CLEANUP
5229
5230 AT_SETUP([CTABLES scale summary functions - weighting])
5231 weight=1
5232 c=10
5233 for a in 1 2 9; do
5234     for b in 3 4 9; do
5235         for n in 1 2 3 4 5 6 7 8 9 10; do
5236             if test $c -lt 15; then
5237                 cval=.
5238             else
5239                 cval=$c
5240             fi
5241             printf "$weight $a $b $cval\n"
5242             weight=$(expr \( $weight + 3 \) % 7 + 2)
5243             c=$(expr \( $c + 13 \) % 29 + 7)
5244         done
5245     done
5246 done > ctables.txt
5247
5248 AT_DATA([analysis.sps],
5249 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5250   CTABLES later, to make the results easier to verify.
5251 SPLIT FILE BY a b.
5252 FREQUENCIES
5253     c
5254     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5255     /FORMAT NOTABLE /MISSING=INCLUDE.
5256 SPLIT FILE OFF.
5257
5258 CTABLES
5259     /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
5260     /SLABELS POSITION=ROW
5261     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5262 ]])
5263
5264 AT_DATA([ctables.sps],
5265 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
5266     /w (F5.0) a b c (f2.0).
5267 VAR LEVEL w c (SCALE) a b (NOMINAL).
5268 MISSING VALUES a b (9).
5269
5270 INCLUDE 'analysis.sps'.
5271
5272 WEIGHT BY w.
5273 INCLUDE 'analysis.sps'.
5274
5275 * Same as original analysis using unweighted versions of summaries.
5276 CTABLES
5277     /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
5278     /SLABELS POSITION=ROW
5279     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5280 ]])
5281 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5282                                 Statistics
5283 ╭─────────┬──────────────────────────────────────────────────────────────╮
5284 │         │                               a                              │
5285 │         ├────────────────────┬────────────────────┬────────────────────┤
5286 │         │          1         │          2         │          9         │
5287 │         ├────────────────────┼────────────────────┼────────────────────┤
5288 │         │          b         │          b         │          b         │
5289 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5290 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5291 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5292 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
5293 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5294 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5295 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
5296 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5297 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5298 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5299 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5300 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5301 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5302 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5303 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5304 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5305 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5306 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5307 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5308 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5309 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5310 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5311 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5312 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5313 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5314 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5315 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5316 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5317
5318                                     Custom Tables
5319 ╭───────────────────┬──────────────────────────────────────────────────────────────╮
5320 │                   │                               a                              │
5321 │                   ├────────────────────┬────────────────────┬────────────────────┤
5322 │                   │          1         │          2         │          9         │
5323 │                   ├────────────────────┼────────────────────┼────────────────────┤
5324 │                   │          b         │          b         │          b         │
5325 │                   ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5326 │                   │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5327 ├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5328 │c Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5329 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5330 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5331 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5332 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5333 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5334 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5335 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5336 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5337 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5338 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5339 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5340 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5341 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5342 │  Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5343 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5344
5345                                   Statistics
5346 ╭─────────┬─────────────────────────────────────────────────────────────────╮
5347 │         │                                a                                │
5348 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
5349 │         │          1          │          2          │          9          │
5350 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
5351 │         │          b          │          b          │          b          │
5352 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5353 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5354 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5355 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
5356 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5357 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5358 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
5359 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5360 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5361 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5362 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5363 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5364 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5365 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5366 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5367 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5368 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5369 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5370 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5371 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5372 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5373 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5374 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5375 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5376 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5377 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5378 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5379 ╰─────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5380
5381                                      Custom Tables
5382 ╭───────────────────┬─────────────────────────────────────────────────────────────────╮
5383 │                   │                                a                                │
5384 │                   ├─────────────────────┬─────────────────────┬─────────────────────┤
5385 │                   │          1          │          2          │          9          │
5386 │                   ├─────────────────────┼─────────────────────┼─────────────────────┤
5387 │                   │          b          │          b          │          b          │
5388 │                   ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5389 │                   │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5390 ├───────────────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5391 │c Valid N          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5392 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5393 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5394 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5395 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5396 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5397 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5398 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5399 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5400 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5401 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5402 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5403 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5404 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5405 │  Layer Row Sum %  │  13.3%│ 10.3%│ 11.3%│  8.9%│  12.6%│ 11.5%│  9.8%│  9.9%│  12.4%│
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 Unweighted Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5419 │  Unweighted Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5420 │  Unweighted Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5421 │  Unweighted Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5422 │  Unweighted Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5423 │  Unweighted Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5424 │  Unweighted Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5425 │  Unweighted Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5426 │  Unweighted Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5427 │  Unweighted Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5428 │  Unweighted Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5429 │  Unweighted Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5430 ╰──────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5431 ])
5432 AT_CLEANUP
5433
5434 AT_SETUP([CTABLES hidden scale VLABELS])
5435 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5436 AT_DATA([ctables.sps],
5437 [[GET 'nhtsa.sav'.
5438 CTABLES
5439     /TABLE region BY qn19a + qn35
5440     /SLABELS POSITION=ROW.
5441 CTABLES
5442     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5443     /TABLE region BY qn19a + qn35
5444     /SLABELS POSITION=ROW.
5445 CTABLES
5446     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5447     /TABLE region BY qn19a + qn35
5448     /SLABELS POSITION=ROW.
5449
5450 * This one in particular caused a crash because no categories were
5451   created on the column axis, so passing in 0 for the index was still
5452   too big for that number of categories.  It was fixed by creating a
5453   name-only category for each variable despite the "NONE" request,
5454   then hiding the entire dimension's labels if all its labels were
5455   set to "NONE".
5456 CTABLES
5457     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5458     /TABLE region BY qn19a + qn35
5459     /SLABELS POSITION=ROW.
5460 ]])
5461 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5462                                  Custom Tables
5463 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5464 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5465 │              │   when you first starting  │   many times have you driven a  │
5466 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5467 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5468 │              │      sips of alcohol.      │            beverages?           │
5469 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5470 │Region NE Mean│                       19.33│                                2│
5471 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5472 │       MW Mean│                       19.83│                                2│
5473 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5474 │       S  Mean│                       20.29│                                2│
5475 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5476 │       W  Mean│                       19.87│                                2│
5477 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5478
5479                                  Custom Tables
5480 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5481 │              │     │  35. In the past thirty days, how many times have you  │
5482 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5483 │              │QN19A│                  alcoholic beverages?                  │
5484 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5485 │Region NE Mean│19.33│                                                       2│
5486 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5487 │       MW Mean│19.83│                                                       2│
5488 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5489 │       S  Mean│20.29│                                                       2│
5490 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5491 │       W  Mean│19.87│                                                       2│
5492 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5493
5494                                  Custom Tables
5495 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5496 │              │   19a. About how old were you when you first starting   │    │
5497 │              │  drinking alcohol, not counting small tastes or sips of │    │
5498 │              │                         alcohol.                        │qn35│
5499 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5500 │Region NE Mean│                                                    19.33│   2│
5501 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5502 │       MW Mean│                                                    19.83│   2│
5503 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5504 │       S  Mean│                                                    20.29│   2│
5505 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5506 │       W  Mean│                                                    19.87│   2│
5507 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5508
5509       Custom Tables
5510 ╭──────────────┬───────╮
5511 │Region NE Mean│19.33 2│
5512 │      ╶───────┼───────┤
5513 │       MW Mean│19.83 2│
5514 │      ╶───────┼───────┤
5515 │       S  Mean│20.29 2│
5516 │      ╶───────┼───────┤
5517 │       W  Mean│19.87 2│
5518 ╰──────────────┴───────╯
5519 ])
5520 AT_CLEANUP
5521
5522 AT_SETUP([CTABLES with SPLIT FILE])
5523 AT_CHECK([ln $top_srcdir/tests/language/commands/nhtsa.sav . || cp $top_srcdir/tests/language/commands/nhtsa.sav .])
5524 AT_DATA([ctables.sps],
5525 [[GET 'nhtsa.sav'.
5526
5527 SORT CASES BY qns3a.
5528
5529 CTABLES /TABLE qn105ba.
5530
5531 * Layered split has no effect on output.
5532 SPLIT FILE BY qns3a.
5533 CTABLES /TABLE qn105ba.
5534
5535 * Add column variable qns3a to compare against separate splits.
5536 CTABLES /TABLE qn105ba BY qns3a.
5537
5538 * Separate splits are truly output separately.
5539 SPLIT FILE SEPARATE BY qns3a.
5540 CTABLES /TABLE qn105ba.
5541 ]])
5542 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5543                                   Custom Tables
5544 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5545 │                                                                        │Count│
5546 ├────────────────────────────────────────────────────────────────────────┼─────┤
5547 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5548 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5549 │                                                            Very likely │ 1502│
5550 │                                                            Somewhat    │ 2763│
5551 │                                                            likely      │     │
5552 │                                                            Somewhat    │ 1307│
5553 │                                                            unlikely    │     │
5554 │                                                            Very        │  609│
5555 │                                                            unlikely    │     │
5556 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5557
5558                                   Custom Tables
5559 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5560 │                                                                        │Count│
5561 ├────────────────────────────────────────────────────────────────────────┼─────┤
5562 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5563 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5564 │                                                            Very likely │ 1502│
5565 │                                                            Somewhat    │ 2763│
5566 │                                                            likely      │     │
5567 │                                                            Somewhat    │ 1307│
5568 │                                                            unlikely    │     │
5569 │                                                            Very        │  609│
5570 │                                                            unlikely    │     │
5571 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5572
5573                                   Custom Tables
5574 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5575 │                                                                 │S3a. GENDER:│
5576 │                                                                 ├─────┬──────┤
5577 │                                                                 │ Male│Female│
5578 │                                                                 ├─────┼──────┤
5579 │                                                                 │Count│ Count│
5580 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5581 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5582 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5583 │the police?                                          Very likely │  660│   842│
5584 │                                                     Somewhat    │ 1174│  1589│
5585 │                                                     likely      │     │      │
5586 │                                                     Somewhat    │  640│   667│
5587 │                                                     unlikely    │     │      │
5588 │                                                     Very        │  311│   298│
5589 │                                                     unlikely    │     │      │
5590 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5591
5592     Split Values
5593 ╭────────────┬─────╮
5594 │Variable    │Value│
5595 ├────────────┼─────┤
5596 │S3a. GENDER:│Male │
5597 ╰────────────┴─────╯
5598
5599                                   Custom Tables
5600 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5601 │                                                                        │Count│
5602 ├────────────────────────────────────────────────────────────────────────┼─────┤
5603 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5604 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5605 │                                                            Very likely │  660│
5606 │                                                            Somewhat    │ 1174│
5607 │                                                            likely      │     │
5608 │                                                            Somewhat    │  640│
5609 │                                                            unlikely    │     │
5610 │                                                            Very        │  311│
5611 │                                                            unlikely    │     │
5612 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5613
5614      Split Values
5615 ╭────────────┬──────╮
5616 │Variable    │ Value│
5617 ├────────────┼──────┤
5618 │S3a. GENDER:│Female│
5619 ╰────────────┴──────╯
5620
5621                                   Custom Tables
5622 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5623 │                                                                        │Count│
5624 ├────────────────────────────────────────────────────────────────────────┼─────┤
5625 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5626 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5627 │                                                            Very likely │  842│
5628 │                                                            Somewhat    │ 1589│
5629 │                                                            likely      │     │
5630 │                                                            Somewhat    │  667│
5631 │                                                            unlikely    │     │
5632 │                                                            Very        │  298│
5633 │                                                            unlikely    │     │
5634 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5635 ])
5636 AT_CLEANUP
5637
5638 AT_SETUP([CTABLES variable level inference])
5639 AT_DATA([data.txt], [dnl
5640 dnl n1 has 10 unique small values -> nominal.
5641 dnl n2 has 23 unique small values -> nominal.
5642 dnl n3 is all missing -> nominal.
5643 dnl s1 has 24 unique small values -> scale.
5644 dnl s2 has one negative value -> scale.
5645 dnl s3 has one non-integer value -> scale.
5646 dnl s4 has no valid values less than 10 -> scale.
5647 dnl s5 has no valid values less than 10,000 -> scale.
5648 1  1  . 1  1  1    10 10001
5649 2  2  . 2  2  2    11 10002
5650 3  3  . 3  3  3    12 10003
5651 4  4  . 4  4  4    13 10004
5652 5  5  . 5  5  5    14 10005
5653 6  6  . 6  6  6    15 10006
5654 7  7  . 7  7  7    16 10007
5655 8  8  . 8  8  8    17 10008
5656 9  9  . 9  9  9    18 10009
5657 10 10 . 10 10 10.5 19 110000
5658 1  11 . 11 -1 1    11 10001
5659 2  12 . 12 2  2    12 10002
5660 3  13 . 13 3  3    13 10003
5661 4  14 . 14 4  4    14 10004
5662 5  15 . 15 5  5    15 10005
5663 6  16 . 16 6  6    16 10006
5664 7  17 . 17 7  7    17 10007
5665 8  18 . 18 8  8    18 10008
5666 9  19 . 19 9  9    19 10009
5667 1  20 . 20 1  1    20 10001
5668 2  21 . 21 2  2    21 10002
5669 3  22 . 22 3  3    22 10003
5670 4  23 . 23 4  4    23 10004
5671 5  23 . 24 5  5    24 10005
5672 6  23 . 24 6  6    25 10006
5673 ])
5674
5675 AT_DATA([ctables.sps], [dnl
5676 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5677
5678 * Nominal formats (copied from data that will default to scale).
5679 COMPUTE n4=s1.
5680 COMPUTE n5=s1.
5681 FORMATS n4(WKDAY5) n5(MONTH5).
5682
5683 * Scale formats (copied from data that will default to nominal).
5684 COMPUTE s6=n1.
5685 COMPUTE s7=n1.
5686 COMPUTE s8=n1.
5687 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5688
5689 STRING string(A8).
5690
5691 DISPLAY DICTIONARY.
5692 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5693 DISPLAY DICTIONARY.
5694 ])
5695
5696 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5697                                     Variables
5698 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5699 │      │        │  Measurement │     │     │         │            │            │
5700 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5701 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5702 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5703 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5704 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5705 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5706 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5707 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5708 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5709 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5710 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5711 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5712 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5713 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5714 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5715 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5716 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5717
5718         Custom Tables
5719 ╭────────────┬─────┬────────╮
5720 │            │Count│  Mean  │
5721 ├────────────┼─────┼────────┤
5722 │n1     1.00 │    3│        │
5723 │       2.00 │    3│        │
5724 │       3.00 │    3│        │
5725 │       4.00 │    3│        │
5726 │       5.00 │    3│        │
5727 │       6.00 │    3│        │
5728 │       7.00 │    2│        │
5729 │       8.00 │    2│        │
5730 │       9.00 │    2│        │
5731 │       10.00│    1│        │
5732 ├────────────┼─────┼────────┤
5733 │n2     1.00 │    1│        │
5734 │       2.00 │    1│        │
5735 │       3.00 │    1│        │
5736 │       4.00 │    1│        │
5737 │       5.00 │    1│        │
5738 │       6.00 │    1│        │
5739 │       7.00 │    1│        │
5740 │       8.00 │    1│        │
5741 │       9.00 │    1│        │
5742 │       10.00│    1│        │
5743 │       11.00│    1│        │
5744 │       12.00│    1│        │
5745 │       13.00│    1│        │
5746 │       14.00│    1│        │
5747 │       15.00│    1│        │
5748 │       16.00│    1│        │
5749 │       17.00│    1│        │
5750 │       18.00│    1│        │
5751 │       19.00│    1│        │
5752 │       20.00│    1│        │
5753 │       21.00│    1│        │
5754 │       22.00│    1│        │
5755 │       23.00│    3│        │
5756 ├────────────┼─────┼────────┤
5757 │string      │   25│        │
5758 ├────────────┼─────┼────────┤
5759 │s1          │     │   12.96│
5760 ├────────────┼─────┼────────┤
5761 │s2          │     │    4.76│
5762 ├────────────┼─────┼────────┤
5763 │s3          │     │    4.86│
5764 ├────────────┼─────┼────────┤
5765 │s4          │     │   16.60│
5766 ├────────────┼─────┼────────┤
5767 │s5          │     │14004.44│
5768 ╰────────────┴─────┴────────╯
5769
5770                                     Variables
5771 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5772 │      │        │  Measurement │     │     │         │            │            │
5773 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5774 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5775 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5776 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5777 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5778 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5779 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5780 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5781 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5782 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5783 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5784 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5785 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5786 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5787 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5788 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5789 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5790 ])
5791 AT_CLEANUP