examples: Rename variables for nhtsa example to give them better names.
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Known bugs:
4 dnl TOTAL interaction with PCOMPUTE, e.g. the following
5 dnl CTABLES
6 dnl     /PCOMPUTE &all_drivers=EXPR([1 THRU 2] + [3 THRU 4])
7 dnl     /PPROPERTIES &all_drivers LABEL='All Drivers'
8 dnl     /PCOMPUTE &pct_not_drivers=EXPR([5] / ([1 THRU 2] + [3 THRU 4] + [5]) * 100)
9 dnl     /PPROPERTIES &pct_not_drivers LABEL='% Not Drivers' FORMAT=COUNT PCT40.1
10 dnl     /TABLE=qn1 BY qns3a
11 dnl     /CATEGORIES VARIABLES=qns3a TOTAL=YES
12 dnl     /CATEGORIES VARIABLES=qn1 [1 THRU 2, SUBTOTAL='Frequent Drivers',
13 dnl                                3 THRU 4, SUBTOTAL='Infrequent Drivers',
14 dnl                                &all_drivers, 5, &pct_not_drivers,
15 dnl                                MISSING, SUBTOTAL='Not Drivers or Missing'].
16 dnl yields gaps in the Total column:
17 dnl ╭─────────────────────────────────────────────────────────────────────────┬──────────────────╮
18 dnl │                                                                         │   S3a. GENDER:   │
19 dnl │                                                                         ├─────┬──────┬─────┤
20 dnl │                                                                         │ Male│Female│Total│
21 dnl │                                                                         ├─────┼──────┼─────┤
22 dnl │                                                                         │Count│ Count│Count│
23 dnl ├─────────────────────────────────────────────────────────────────────────┼─────┼──────┼─────┤
24 dnl │ 1. How often do you usually drive a car or other   Every day            │ 2305│  2362│ 4667│
25 dnl │motor vehicle?                                      Several days a week  │  440│   834│ 1274│
26 dnl │                                                    Frequent Drivers     │ 2745│  3196│     │
27 dnl │                                                    Once a week or less  │  125│   236│  361│
28 dnl │                                                    Only certain times a │   58│    72│  130│
29 dnl │                                                    year                 │     │      │     │
30 dnl │                                                    Infrequent Drivers   │  183│   308│     │
31 dnl │                                                    All Drivers          │ 2928│  3504│     │
32 dnl │                                                    Never                │  192│   348│  540│
33 dnl │                                                    % Not Drivers        │ 6.2%│  9.0%│     │
34 dnl │                                                    Don't know           │    3│     5│    8│
35 dnl │                                                    Refused              │    9│    10│   19│
36 dnl │                                                    Not Drivers or       │  204│   363│     │
37 dnl │                                                    Missing              │     │      │     │
38 dnl ╰─────────────────────────────────────────────────────────────────────────┴─────┴──────┴─────╯
39 dnl Features not yet implemented:
40 dnl - Multiple response sets
41 dnl - MRSETS subcommand.
42 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
43 dnl - SIGTEST
44 dnl - COMPARETEST
45 dnl - Summary functions:
46 dnl   * .LCL and .UCL suffixes.
47 dnl   * .SE suffixes.
48 dnl - CATEGORIES:
49 dnl   * Data-dependent sorting.
50
51 AT_SETUP([CTABLES parsing])
52 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/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 sorting categories])
1238 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1239 AT_DATA([ctables.sps],
1240 [[GET 'nhtsa.sav'.
1241 IF (QND5A=6) QND5A=-1.
1242 IF (QND5A=5) QND5A=-2.
1243 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1244         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1245         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1246         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1247 ]])
1248 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1249                                   Custom Tables
1250 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1251 │                                                                        │Count│
1252 ├────────────────────────────────────────────────────────────────────────┼─────┤
1253 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1254 │background?                                     -1.00                   │   78│
1255 │                                                Cuban                   │   20│
1256 │                                                Mexican                 │  311│
1257 │                                                Spanish                 │   48│
1258 │                                                South American          │   34│
1259 │                                                Central American        │    0│
1260 │                                                Puerto Rican, OR        │    0│
1261 │                                                Something else          │   68│
1262 │                                                Multiple - cannot choose│    7│
1263 │                                                one                     │     │
1264 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1265
1266                                   Custom Tables
1267 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1268 │                                                                        │Count│
1269 ├────────────────────────────────────────────────────────────────────────┼─────┤
1270 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1271 │background?                                     one                     │     │
1272 │                                                Something else          │   68│
1273 │                                                Puerto Rican, OR        │    0│
1274 │                                                Central American        │    0│
1275 │                                                South American          │   34│
1276 │                                                Spanish                 │   48│
1277 │                                                Mexican                 │  311│
1278 │                                                Cuban                   │   20│
1279 │                                                -1.00                   │   78│
1280 │                                                -2.00                   │   52│
1281 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1282
1283                                   Custom Tables
1284 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1285 │                                                                        │Count│
1286 ├────────────────────────────────────────────────────────────────────────┼─────┤
1287 │D5a. What would you say is your primary ethnic  Central American        │    0│
1288 │background?                                     Cuban                   │   20│
1289 │                                                Mexican                 │  311│
1290 │                                                Multiple - cannot choose│    7│
1291 │                                                one                     │     │
1292 │                                                Puerto Rican, OR        │    0│
1293 │                                                Something else          │   68│
1294 │                                                South American          │   34│
1295 │                                                Spanish                 │   48│
1296 │                                                -2.00                   │   52│
1297 │                                                -1.00                   │   78│
1298 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1299
1300                                   Custom Tables
1301 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1302 │                                                                        │Count│
1303 ├────────────────────────────────────────────────────────────────────────┼─────┤
1304 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1305 │background?                                     South American          │   34│
1306 │                                                Something else          │   68│
1307 │                                                Puerto Rican, OR        │    0│
1308 │                                                Multiple - cannot choose│    7│
1309 │                                                one                     │     │
1310 │                                                Mexican                 │  311│
1311 │                                                Cuban                   │   20│
1312 │                                                Central American        │    0│
1313 │                                                -1.00                   │   78│
1314 │                                                -2.00                   │   52│
1315 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1316 ])
1317 AT_CLEANUP
1318
1319 AT_SETUP([CTABLES simple nesting])
1320 AT_KEYWORDS([nest nested])
1321 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1322 AT_DATA([ctables.sps],
1323 [[GET 'nhtsa.sav'.
1324 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1325   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1326 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1327   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1328   /CLABELS ROW=OPPOSITE.
1329 ]])
1330 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1331                                   Custom Tables
1332 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1333 │                                                                 │     │ Table│
1334 │                                                                 │Count│   %  │
1335 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1336 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1337 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1338 │drive safely will A. Get stopped by                        Total │  700│   10%│
1339 │the police?                           ╶──────────────────────────┼─────┼──────┤
1340 │                                       Very       S3a.     Male  │  660│   10%│
1341 │                                       likely     GENDER:  Female│  842│   12%│
1342 │                                                           Total │ 1502│   22%│
1343 │                                      ╶──────────────────────────┼─────┼──────┤
1344 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1345 │                                       likely     GENDER:  Female│ 1589│   23%│
1346 │                                                           Total │ 2763│   40%│
1347 │                                      ╶──────────────────────────┼─────┼──────┤
1348 │                                       Somewhat   S3a.     Male  │  640│    9%│
1349 │                                       unlikely   GENDER:  Female│  667│   10%│
1350 │                                                           Total │ 1307│   19%│
1351 │                                      ╶──────────────────────────┼─────┼──────┤
1352 │                                       Very       S3a.     Male  │  311│    5%│
1353 │                                       unlikely   GENDER:  Female│  298│    4%│
1354 │                                                           Total │  609│    9%│
1355 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1356 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1357 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1358 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1359 │                                      ╶──────────────────────────┼─────┼──────┤
1360 │                                       Very       S3a.     Male  │ 1104│   16%│
1361 │                                       likely     GENDER:  Female│ 1715│   25%│
1362 │                                                           Total │ 2819│   41%│
1363 │                                      ╶──────────────────────────┼─────┼──────┤
1364 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1365 │                                       likely     GENDER:  Female│ 1214│   18%│
1366 │                                                           Total │ 2417│   35%│
1367 │                                      ╶──────────────────────────┼─────┼──────┤
1368 │                                       Somewhat   S3a.     Male  │  262│    4%│
1369 │                                       unlikely   GENDER:  Female│  168│    2%│
1370 │                                                           Total │  430│    6%│
1371 │                                      ╶──────────────────────────┼─────┼──────┤
1372 │                                       Very       S3a.     Male  │   81│    1%│
1373 │                                       unlikely   GENDER:  Female│   59│    1%│
1374 │                                                           Total │  140│    2%│
1375 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1376 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1377 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1378 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1379 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1380 │                                       Very       S3a.     Male  │  988│   14%│
1381 │                                       likely     GENDER:  Female│ 1049│   15%│
1382 │                                                           Total │ 2037│   30%│
1383 │                                      ╶──────────────────────────┼─────┼──────┤
1384 │                                       Somewhat   S3a.     Male  │  822│   12%│
1385 │                                       likely     GENDER:  Female│ 1210│   18%│
1386 │                                                           Total │ 2032│   30%│
1387 │                                      ╶──────────────────────────┼─────┼──────┤
1388 │                                       Somewhat   S3a.     Male  │  446│    7%│
1389 │                                       unlikely   GENDER:  Female│  548│    8%│
1390 │                                                           Total │  994│   15%│
1391 │                                      ╶──────────────────────────┼─────┼──────┤
1392 │                                       Very       S3a.     Male  │  268│    4%│
1393 │                                       unlikely   GENDER:  Female│  354│    5%│
1394 │                                                           Total │  622│    9%│
1395 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1396 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1397 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1398 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1399 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1400 │                                       Very       S3a.     Male  │  805│   12%│
1401 │                                       likely     GENDER:  Female│ 1029│   15%│
1402 │                                                           Total │ 1834│   27%│
1403 │                                      ╶──────────────────────────┼─────┼──────┤
1404 │                                       Somewhat   S3a.     Male  │  975│   14%│
1405 │                                       likely     GENDER:  Female│ 1332│   19%│
1406 │                                                           Total │ 2307│   34%│
1407 │                                      ╶──────────────────────────┼─────┼──────┤
1408 │                                       Somewhat   S3a.     Male  │  535│    8%│
1409 │                                       unlikely   GENDER:  Female│  560│    8%│
1410 │                                                           Total │ 1095│   16%│
1411 │                                      ╶──────────────────────────┼─────┼──────┤
1412 │                                       Very       S3a.     Male  │  270│    4%│
1413 │                                       unlikely   GENDER:  Female│  279│    4%│
1414 │                                                           Total │  549│    8%│
1415 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1416
1417                                   Custom Tables
1418 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1419 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1420 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1421 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1422 │                                 │        │ Table│         │         │        │
1423 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1424 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1425 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1426 │GENDER:        is it that drivers│        │      │         │         │        │
1427 │               who have had too  │        │      │         │         │        │
1428 │               much to drink to  │        │      │         │         │        │
1429 │               drive safely will │        │      │         │         │        │
1430 │               A. Get stopped by │        │      │         │         │        │
1431 │               the police?       │        │      │         │         │        │
1432 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1433 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1434 │               is it that drivers│        │      │         │         │        │
1435 │               who have had too  │        │      │         │         │        │
1436 │               much to drink to  │        │      │         │         │        │
1437 │               drive safely will │        │      │         │         │        │
1438 │               A. Get stopped by │        │      │         │         │        │
1439 │               the police?       │        │      │         │         │        │
1440 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1441 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1442 │               is it that drivers│        │      │         │         │        │
1443 │               who have had too  │        │      │         │         │        │
1444 │               much to drink to  │        │      │         │         │        │
1445 │               drive safely will │        │      │         │         │        │
1446 │               A. Get stopped by │        │      │         │         │        │
1447 │               the police?       │        │      │         │         │        │
1448 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1449 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1450 │GENDER:        is it that drivers│        │      │         │         │        │
1451 │               who have had too  │        │      │         │         │        │
1452 │               much to drink to  │        │      │         │         │        │
1453 │               drive safely will │        │      │         │         │        │
1454 │               B. Have an        │        │      │         │         │        │
1455 │               accident?         │        │      │         │         │        │
1456 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1457 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1458 │               is it that drivers│        │      │         │         │        │
1459 │               who have had too  │        │      │         │         │        │
1460 │               much to drink to  │        │      │         │         │        │
1461 │               drive safely will │        │      │         │         │        │
1462 │               B. Have an        │        │      │         │         │        │
1463 │               accident?         │        │      │         │         │        │
1464 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1465 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1466 │               is it that drivers│        │      │         │         │        │
1467 │               who have had too  │        │      │         │         │        │
1468 │               much to drink to  │        │      │         │         │        │
1469 │               drive safely will │        │      │         │         │        │
1470 │               B. Have an        │        │      │         │         │        │
1471 │               accident?         │        │      │         │         │        │
1472 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1473 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1474 │GENDER:        is it that drivers│        │      │         │         │        │
1475 │               who have had too  │        │      │         │         │        │
1476 │               much to drink to  │        │      │         │         │        │
1477 │               drive safely will │        │      │         │         │        │
1478 │               C. Be convicted   │        │      │         │         │        │
1479 │               for drunk driving?│        │      │         │         │        │
1480 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1481 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1482 │               is it that drivers│        │      │         │         │        │
1483 │               who have had too  │        │      │         │         │        │
1484 │               much to drink to  │        │      │         │         │        │
1485 │               drive safely will │        │      │         │         │        │
1486 │               C. Be convicted   │        │      │         │         │        │
1487 │               for drunk driving?│        │      │         │         │        │
1488 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1489 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1490 │               is it that drivers│        │      │         │         │        │
1491 │               who have had too  │        │      │         │         │        │
1492 │               much to drink to  │        │      │         │         │        │
1493 │               drive safely will │        │      │         │         │        │
1494 │               C. Be convicted   │        │      │         │         │        │
1495 │               for drunk driving?│        │      │         │         │        │
1496 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1497 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1498 │GENDER:        is it that drivers│        │      │         │         │        │
1499 │               who have had too  │        │      │         │         │        │
1500 │               much to drink to  │        │      │         │         │        │
1501 │               drive safely will │        │      │         │         │        │
1502 │               D. Be arrested for│        │      │         │         │        │
1503 │               drunk driving?    │        │      │         │         │        │
1504 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1505 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1506 │               is it that drivers│        │      │         │         │        │
1507 │               who have had too  │        │      │         │         │        │
1508 │               much to drink to  │        │      │         │         │        │
1509 │               drive safely will │        │      │         │         │        │
1510 │               D. Be arrested for│        │      │         │         │        │
1511 │               drunk driving?    │        │      │         │         │        │
1512 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1513 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1514 │               is it that drivers│        │      │         │         │        │
1515 │               who have had too  │        │      │         │         │        │
1516 │               much to drink to  │        │      │         │         │        │
1517 │               drive safely will │        │      │         │         │        │
1518 │               D. Be arrested for│        │      │         │         │        │
1519 │               drunk driving?    │        │      │         │         │        │
1520 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1521 ])
1522 AT_CLEANUP
1523
1524 AT_SETUP([CTABLES nesting and scale variables])
1525 AT_KEYWORDS([nest nested])
1526 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1527 AT_DATA([ctables.sps],
1528 [[GET 'nhtsa.sav'.
1529 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1530 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1531 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1532   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1533 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1534 ]])
1535 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1536                                   Custom Tables
1537 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1538 │                                                                 │S3a. GENDER:│
1539 │                                                                 ├─────┬──────┤
1540 │                                                                 │ Male│Female│
1541 │                                                                 ├─────┼──────┤
1542 │                                                                 │ Mean│ Mean │
1543 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1544 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1545 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1546 │                                                  week           │     │      │
1547 │                                                  Once a week or │   44│    54│
1548 │                                                  less           │     │      │
1549 │                                                  Only certain   │   34│    41│
1550 │                                                  times a year   │     │      │
1551 │                                                  Never          │   39│    55│
1552 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1553
1554                                   Custom Tables
1555 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1556 │                                                         │Minimum│Maximum│Mean│
1557 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1558 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1559 │What is  GENDER:         months, has there been a        │       │       │    │
1560 │your                     time when you felt you          │       │       │    │
1561 │age?                     should cut down on your      No │     16│     86│  46│
1562 │                         drinking?                       │       │       │    │
1563 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1564 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1565 │                         months, has there been a        │       │       │    │
1566 │                         time when you felt you          │       │       │    │
1567 │                         should cut down on your      No │     16│     86│  48│
1568 │                         drinking?                       │       │       │    │
1569 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1570 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1571 │What is  GENDER:         months, has there been a        │       │       │    │
1572 │your                     time when people criticized  No │     16│     86│  46│
1573 │age?                     your drinking?                  │       │       │    │
1574 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1575 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1576 │                         months, has there been a        │       │       │    │
1577 │                         time when people criticized  No │     16│     86│  48│
1578 │                         your drinking?                  │       │       │    │
1579 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1580
1581                                   Custom Tables
1582 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1583 │                             │S1. Including yourself, how many members of this│
1584 │                             │         household are age 16 or older?         │
1585 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1586 │                             │      │      │      │      │      │      │ 6 or │
1587 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1588 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1589 │                             │Column│Column│Column│Column│Column│Column│Column│
1590 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1591 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1592 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1593 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1594 │SOURCE:     likely           │      │      │      │      │      │      │      │
1595 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1596 │            that     likely  │      │      │      │      │      │      │      │
1597 │            drivers          │      │      │      │      │      │      │      │
1598 │            who have         │      │      │      │      │      │      │      │
1599 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1600 │            much to  likely  │      │      │      │      │      │      │      │
1601 │            drink to         │      │      │      │      │      │      │      │
1602 │            drive            │      │      │      │      │      │      │      │
1603 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1604 │            will A.  unlikely│      │      │      │      │      │      │      │
1605 │            Get              │      │      │      │      │      │      │      │
1606 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1607 │            by the   unlikely│      │      │      │      │      │      │      │
1608 │            police?          │      │      │      │      │      │      │      │
1609 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1610
1611                                   Custom Tables
1612 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1613 │                                                              │    │    Std   │
1614 │                                                              │Mean│ Deviation│
1615 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1616 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1617 │group           typical month did you have one or more        │    │          │
1618 │                alcoholic beverages to drink?                 │    │          │
1619 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1620 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1621 │                typical month did you have one or more        │    │          │
1622 │                alcoholic beverages to drink?                 │    │          │
1623 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1624 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1625 │                typical month did you have one or more        │    │          │
1626 │                alcoholic beverages to drink?                 │    │          │
1627 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1628 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1629 │                typical month did you have one or more        │    │          │
1630 │                alcoholic beverages to drink?                 │    │          │
1631 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1632 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1633 │                typical month did you have one or more        │    │          │
1634 │                alcoholic beverages to drink?                 │    │          │
1635 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1636 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1637 │       older    typical month did you have one or more        │    │          │
1638 │                alcoholic beverages to drink?                 │    │          │
1639 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1640 ])
1641 AT_CLEANUP
1642
1643
1644 AT_SETUP([CTABLES SLABELS])
1645 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1646 AT_DATA([ctables.sps],
1647 [[GET 'nhtsa.sav'.
1648 CTABLES /TABLE qn1 [COUNT COLPCT].
1649 CTABLES /TABLE qn1 [COUNT COLPCT]
1650     /SLABELS POSITION=ROW.
1651 CTABLES /TABLE qn1 [COUNT COLPCT]
1652     /SLABELS POSITION=ROW VISIBLE=NO.
1653 ]])
1654 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1655                                   Custom Tables
1656 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1657 │                                                                │     │ Column│
1658 │                                                                │Count│   %   │
1659 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1660 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1661 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1662 │                                             Once a week or less│  361│   5.2%│
1663 │                                             Only certain times │  130│   1.9%│
1664 │                                             a year             │     │       │
1665 │                                             Never              │  540│   7.7%│
1666 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1667
1668                                   Custom Tables
1669 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1670 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1671 │other motor vehicle?                                             Column │66.9%│
1672 │                                                                 %      │     │
1673 │                                            ╶───────────────────────────┼─────┤
1674 │                                             Several days a week Count  │ 1274│
1675 │                                                                 Column │18.3%│
1676 │                                                                 %      │     │
1677 │                                            ╶───────────────────────────┼─────┤
1678 │                                             Once a week or less Count  │  361│
1679 │                                                                 Column │ 5.2%│
1680 │                                                                 %      │     │
1681 │                                            ╶───────────────────────────┼─────┤
1682 │                                             Only certain times  Count  │  130│
1683 │                                             a year              Column │ 1.9%│
1684 │                                                                 %      │     │
1685 │                                            ╶───────────────────────────┼─────┤
1686 │                                             Never               Count  │  540│
1687 │                                                                 Column │ 7.7%│
1688 │                                                                 %      │     │
1689 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1690
1691                                   Custom Tables
1692 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1693 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1694 │motor vehicle?                                                          │66.9%│
1695 │                                                   Several days a week  │ 1274│
1696 │                                                                        │18.3%│
1697 │                                                   Once a week or less  │  361│
1698 │                                                                        │ 5.2%│
1699 │                                                   Only certain times a │  130│
1700 │                                                   year                 │ 1.9%│
1701 │                                                   Never                │  540│
1702 │                                                                        │ 7.7%│
1703 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1704 ])
1705 AT_CLEANUP
1706
1707 AT_SETUP([CTABLES simple totals])
1708 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1709 AT_DATA([ctables.sps],
1710 [[GET 'nhtsa.sav'.
1711 CTABLES /TABLE=qn17
1712     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1713 DESCRIPTIVES qn18/STATISTICS=MEAN.
1714 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1715     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1716 ]])
1717 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1718                                   Custom Tables
1719 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1720 │                                                                        │Count│
1721 ├────────────────────────────────────────────────────────────────────────┼─────┤
1722 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1723 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1724 │                                                      Light beer        │  620│
1725 │                                                      Wine              │ 1418│
1726 │                                                      Wine coolers      │  137│
1727 │                                                      Hard liquor or    │  888│
1728 │                                                      mixed drinks      │     │
1729 │                                                      Flavored malt     │   83│
1730 │                                                      drinks            │     │
1731 │                                                      Number responding │ 4221│
1732 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1733
1734                              Descriptive Statistics
1735 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1736 │                                                                    │  N │Mean│
1737 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1738 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1739 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1740 │Valid N (listwise)                                                  │6999│    │
1741 │Missing N (listwise)                                                │2781│    │
1742 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1743
1744                                   Custom Tables
1745 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1746 │                                                      │    │     │ Valid│Total│
1747 │                                                      │Mean│Count│   N  │  N  │
1748 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1749 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1750 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1751 │                you usually drink per sitting?        │    │     │      │     │
1752 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1753 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1754 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1755 │                you usually drink per sitting?        │    │     │      │     │
1756 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1757 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1758 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1759 │                you usually drink per sitting?        │    │     │      │     │
1760 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1761 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1762 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1763 │                you usually drink per sitting?        │    │     │      │     │
1764 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1765 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1766 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1767 │                you usually drink per sitting?        │    │     │      │     │
1768 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1769 ])
1770 AT_CLEANUP
1771
1772 AT_SETUP([CTABLES subtotals])
1773 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1774 AT_DATA([ctables.sps],
1775 [[GET 'nhtsa.sav'.
1776 CTABLES /TABLE=qn105ba BY qns1
1777     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1778 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1779     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1780 CTABLES /TABLE=qn105ba BY qns1
1781     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1782     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1783 ]])
1784 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1785                                                       Custom Tables
1786 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1787 │                                                         │ S1. Including yourself, how many members of this household │
1788 │                                                         │                    are age 16 or older?                    │
1789 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1790 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1791 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1792 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1793 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1794 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1795 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1796 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1797 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1798 │                                              likely     │       │       │         │       │        │      │          │
1799 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1800 │                                              unlikely   │       │       │         │       │        │      │          │
1801 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1802 │                                              unlikely   │       │       │         │       │        │      │          │
1803 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1804
1805                                                       Custom Tables
1806 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1807 │                                                        │  S1. Including yourself, how many members of this household │
1808 │                                                        │                     are age 16 or older?                    │
1809 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1810 │                                                        │        │        │        │        │       │        │  6 or  │
1811 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1812 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1813 │                                                        │        │        │        │        │ Column│        │        │
1814 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1815 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1816 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1817 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1818 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1819 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1820 │                                             likely     │        │        │        │        │       │        │        │
1821 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1822 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1823 │                                             unlikely   │        │        │        │        │       │        │        │
1824 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1825 │                                             unlikely   │        │        │        │        │       │        │        │
1826 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1827 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1828
1829                                                       Custom Tables
1830 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1831 │                                                         │ S1. Including yourself, how many members of this household │
1832 │                                                         │                    are age 16 or older?                    │
1833 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1834 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1835 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1836 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1837 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1838 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1839 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1840 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1841 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1842 │                                              likely     │       │       │         │       │        │      │          │
1843 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1844 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1845 │                                              unlikely   │       │       │         │       │        │      │          │
1846 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1847 │                                              unlikely   │       │       │         │       │        │      │          │
1848 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1849 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1850 ])
1851 AT_CLEANUP
1852
1853 AT_SETUP([CTABLES PCOMPUTE])
1854 AT_KEYWORDS([postcompute])
1855 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1856 AT_DATA([ctables.sps],
1857 [[GET 'nhtsa.sav'.
1858 CTABLES
1859     /PCOMPUTE &x=EXPR([3] + [4])
1860     /PCOMPUTE &y=EXPR([4] + [5])
1861     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1862     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1863     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1864     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1865
1866 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1867 CTABLES
1868     /PCOMPUTE &x=EXPR([3] + [4])
1869     /PCOMPUTE &y=EXPR([4] + [5])
1870     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1871     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1872     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1873     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1874 ]])
1875 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1876                                                                 Custom Tables
1877 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1878 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1879 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1880 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1881 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1882 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1883 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1884 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1885 │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%│
1886 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1887 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1888 │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%│
1889 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1890 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1891 │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%│
1892 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1893 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1894 │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%│
1895 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1896 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1897 │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%│
1898 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1899 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1900 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1901
1902                                                                 Custom Tables
1903 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1904 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1905 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1906 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1907 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1908 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1909 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1910 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1911 │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%│
1912 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1913 │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%│
1914 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1915 │                               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%│
1916 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1917 │                               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%│
1918 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1919 │                               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%│
1920 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1921 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1922 ])
1923 AT_CLEANUP
1924
1925 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1926 AT_KEYWORDS([postcompute])
1927 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1928 AT_DATA([ctables.sps],
1929 [[GET 'nhtsa.sav'.
1930 CTABLES
1931     /PCOMPUTE &x=EXPR(OTHERNM)
1932     /PCOMPUTE &y=EXPR(MISSING)
1933     /PPROPERTIES &x LABEL='Drivers'
1934     /PPROPERTIES &y LABEL='Missing Values 2'
1935     /TABLE=qn1 BY qns3a
1936     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1937 ]])
1938 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1939                                               Custom Tables
1940 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1941 │                                                                                          │S3a. GENDER:│
1942 │                                                                                          ├─────┬──────┤
1943 │                                                                                          │ Male│Female│
1944 │                                                                                          ├─────┼──────┤
1945 │                                                                                          │Count│ Count│
1946 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1947 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1948 │                                                                 Several days a week      │  440│   834│
1949 │                                                                 Once a week or less      │  125│   236│
1950 │                                                                 Only certain times a year│   58│    72│
1951 │                                                                 Never                    │  192│   348│
1952 │                                                                 Drivers                  │ 2928│  3504│
1953 │                                                                 Valid Values             │ 3120│  3852│
1954 │                                                                 Don't know               │    3│     5│
1955 │                                                                 Refused                  │    9│    10│
1956 │                                                                 Missing Values           │   12│    15│
1957 │                                                                 Missing Values 2         │   12│    15│
1958 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1959 ])
1960 AT_CLEANUP
1961
1962 AT_SETUP([CTABLES PCOMPUTE - THRU])
1963 AT_KEYWORDS([postcompute])
1964 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
1965 AT_DATA([ctables.sps],
1966 [[GET 'nhtsa.sav'.
1967 CTABLES
1968     /PCOMPUTE &x=EXPR([1 THRU 2])
1969     /PCOMPUTE &y=EXPR([3 THRU 4])
1970     /PCOMPUTE &z=EXPR([5] + MISSING)
1971     /PPROPERTIES &x LABEL='Frequent Drivers'
1972     /PPROPERTIES &y LABEL='Infrequent Drivers'
1973     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1974     /TABLE=qn1 BY qns3a
1975     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1976 ]])
1977 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1978                                               Custom Tables
1979 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1980 │                                                                                          │S3a. GENDER:│
1981 │                                                                                          ├─────┬──────┤
1982 │                                                                                          │ Male│Female│
1983 │                                                                                          ├─────┼──────┤
1984 │                                                                                          │Count│ Count│
1985 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1986 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1987 │                                                                 Several days a week      │  440│   834│
1988 │                                                                 Frequent Drivers         │ 2745│  3196│
1989 │                                                                 Once a week or less      │  125│   236│
1990 │                                                                 Only certain times a year│   58│    72│
1991 │                                                                 Infrequent Drivers       │  183│   308│
1992 │                                                                 Drivers                  │ 2928│  3504│
1993 │                                                                 Never                    │  192│   348│
1994 │                                                                 Don't know               │    3│     5│
1995 │                                                                 Refused                  │    9│    10│
1996 │                                                                 Not Drivers or Missing   │  204│   363│
1997 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1998 ])
1999 AT_CLEANUP
2000
2001 dnl I'm not sure that this is the correct behavior (see
2002 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
2003 dnl but at least this test will notify us if the behavior changes.
2004 AT_SETUP([CTABLES intersecting PCOMPUTEs])
2005 AT_KEYWORDS([PCOMPUTE postcompute])
2006 AT_DATA([ctables.sps],
2007 [[DATA LIST LIST NOTABLE/x y z.
2008 WEIGHT by z.
2009 FORMATS ALL (F1.0).
2010 VARIABLE LEVEL x y (NOMINAL).
2011 BEGIN DATA.
2012 1 4 5
2013 1 5 2
2014 1 6 9
2015 2 4 2
2016 2 5 3
2017 2 6 4
2018 3 4 1
2019 3 5 6
2020 3 6 1
2021 END DATA.
2022
2023 CTABLES
2024     /PCOMPUTE &a = EXPR([1] + [2])
2025     /PCOMPUTE &b = EXPR([2] + [3])
2026     /PCOMPUTE &c = EXPR([4] * [5])
2027     /PCOMPUTE &d = EXPR([5] * [6])
2028     /TABLE x BY y
2029     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
2030     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
2031 ]])
2032 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
2033 [[                   Custom Tables
2034 ╭───────────┬─────────────────────────────────────╮
2035 │           │                  y                  │
2036 │           ├─────┬─────────┬─────┬─────────┬─────┤
2037 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
2038 │           ├─────┼─────────┼─────┼─────────┼─────┤
2039 │           │Count│  Count  │Count│  Count  │Count│
2040 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
2041 │x 1        │    5│       10│    2│       18│    9│
2042 │  [1] + [2]│    7│        .│    5│        .│   13│
2043 │  2        │    2│        6│    3│       12│    4│
2044 │  [2] + [3]│    3│        .│    9│        .│    5│
2045 │  3        │    1│        6│    6│        6│    1│
2046 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
2047 ]])
2048 AT_CLEANUP
2049
2050 AT_SETUP([CTABLES string and date and time])
2051
2052 weight=1
2053 for gender in F M; do
2054     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
2055         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
2056             printf "$weight $gender $month $wkday\n"
2057             weight=$(expr \( $weight + 3 \) % 7 + 2)
2058         done
2059     done
2060 done > ctables.txt
2061
2062 AT_DATA([ctables.sps],
2063 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
2064     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
2065 WEIGHT by w.
2066 VARIABLE LEVEL w (SCALE).
2067 VARIABLE LEVEL gender fmon fday (NOMINAL).
2068 VARIABLE LABEL
2069   gender 'Gender'
2070   fmon 'Favorite month'
2071   fday 'Favorite day of the week'.
2072 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
2073 CTABLES
2074     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
2075     /PPROPERTIES &q2 LABEL='Q2'
2076     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
2077     /PPROPERTIES &weekend LABEL='Weekend'
2078     /TABLE fmon BY gender > fday
2079     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
2080                                 4 THRU 6, &q2,
2081                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
2082                                 OTHERNM, SUBTOTAL='Q4']
2083     /CATEGORIES VARIABLES=gender ['M', 'F']
2084     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
2085     /SLABELS VISIBLE=NO.
2086 ]])
2087 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2088                                               Custom Tables
2089 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
2090 │                  │                                       Gender                                      │
2091 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
2092 │                  │                   Male                  │                  Female                 │
2093 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
2094 │                  │         Favorite day of the week        │         Favorite day of the week        │
2095 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
2096 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
2097 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
2098 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
2099 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2100 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2101 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
2102 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2103 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2104 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
2105 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
2106 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
2107 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
2108 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2109 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
2110 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2111 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2112 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2113 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
2114 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
2115 ])
2116 AT_CLEANUP
2117
2118 AT_SETUP([CTABLES CLABELS])
2119 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
2120 AT_DATA([ctables.sps],
2121 [[GET 'nhtsa.sav'.
2122 CTABLES /TABLE AgeGroup BY qns3a.
2123 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
2124 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
2125 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
2126 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
2127 ]])
2128 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
2129              Custom Tables
2130 ╭───────────────────────┬────────────╮
2131 │                       │S3a. GENDER:│
2132 │                       ├─────┬──────┤
2133 │                       │ Male│Female│
2134 │                       ├─────┼──────┤
2135 │                       │Count│ Count│
2136 ├───────────────────────┼─────┼──────┤
2137 │Age group 15 or younger│    0│     0│
2138 │          16 to 25     │  594│   505│
2139 │          26 to 35     │  476│   491│
2140 │          36 to 45     │  489│   548│
2141 │          46 to 55     │  526│   649│
2142 │          56 to 65     │  516│   731│
2143 │          66 or older  │  531│   943│
2144 ╰───────────────────────┴─────┴──────╯
2145
2146                                                       Custom Tables
2147 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
2148 │       │                                                 S3a. GENDER:                                                 │
2149 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
2150 │       │                         Male                         │                         Female                        │
2151 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
2152 │       │  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 │
2153 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
2154 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2155 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
2156 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2157 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
2158 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
2159 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
2160
2161                 Custom Tables
2162 ╭──────────────────────────────┬────────────╮
2163 │                              │S3a. GENDER:│
2164 │                              ├────────────┤
2165 │                              │    Count   │
2166 ├──────────────────────────────┼────────────┤
2167 │Age group 15 or younger Male  │           0│
2168 │                        Female│           0│
2169 │         ╶────────────────────┼────────────┤
2170 │          16 to 25      Male  │         594│
2171 │                        Female│         505│
2172 │         ╶────────────────────┼────────────┤
2173 │          26 to 35      Male  │         476│
2174 │                        Female│         491│
2175 │         ╶────────────────────┼────────────┤
2176 │          36 to 45      Male  │         489│
2177 │                        Female│         548│
2178 │         ╶────────────────────┼────────────┤
2179 │          46 to 55      Male  │         526│
2180 │                        Female│         649│
2181 │         ╶────────────────────┼────────────┤
2182 │          56 to 65      Male  │         516│
2183 │                        Female│         731│
2184 │         ╶────────────────────┼────────────┤
2185 │          66 or older   Male  │         531│
2186 │                        Female│         943│
2187 ╰──────────────────────────────┴────────────╯
2188
2189       Custom Tables
2190 15 or younger
2191 ╭─────────┬────────────╮
2192 │         │S3a. GENDER:│
2193 │         ├─────┬──────┤
2194 │         │ Male│Female│
2195 │         ├─────┼──────┤
2196 │         │Count│ Count│
2197 ├─────────┼─────┼──────┤
2198 │Age group│    0│     0│
2199 ╰─────────┴─────┴──────╯
2200
2201       Custom Tables
2202 16 to 25
2203 ╭─────────┬────────────╮
2204 │         │S3a. GENDER:│
2205 │         ├─────┬──────┤
2206 │         │ Male│Female│
2207 │         ├─────┼──────┤
2208 │         │Count│ Count│
2209 ├─────────┼─────┼──────┤
2210 │Age group│  594│   505│
2211 ╰─────────┴─────┴──────╯
2212
2213       Custom Tables
2214 26 to 35
2215 ╭─────────┬────────────╮
2216 │         │S3a. GENDER:│
2217 │         ├─────┬──────┤
2218 │         │ Male│Female│
2219 │         ├─────┼──────┤
2220 │         │Count│ Count│
2221 ├─────────┼─────┼──────┤
2222 │Age group│  476│   491│
2223 ╰─────────┴─────┴──────╯
2224
2225       Custom Tables
2226 36 to 45
2227 ╭─────────┬────────────╮
2228 │         │S3a. GENDER:│
2229 │         ├─────┬──────┤
2230 │         │ Male│Female│
2231 │         ├─────┼──────┤
2232 │         │Count│ Count│
2233 ├─────────┼─────┼──────┤
2234 │Age group│  489│   548│
2235 ╰─────────┴─────┴──────╯
2236
2237       Custom Tables
2238 46 to 55
2239 ╭─────────┬────────────╮
2240 │         │S3a. GENDER:│
2241 │         ├─────┬──────┤
2242 │         │ Male│Female│
2243 │         ├─────┼──────┤
2244 │         │Count│ Count│
2245 ├─────────┼─────┼──────┤
2246 │Age group│  526│   649│
2247 ╰─────────┴─────┴──────╯
2248
2249       Custom Tables
2250 56 to 65
2251 ╭─────────┬────────────╮
2252 │         │S3a. GENDER:│
2253 │         ├─────┬──────┤
2254 │         │ Male│Female│
2255 │         ├─────┼──────┤
2256 │         │Count│ Count│
2257 ├─────────┼─────┼──────┤
2258 │Age group│  516│   731│
2259 ╰─────────┴─────┴──────╯
2260
2261       Custom Tables
2262 66 or older
2263 ╭─────────┬────────────╮
2264 │         │S3a. GENDER:│
2265 │         ├─────┬──────┤
2266 │         │ Male│Female│
2267 │         ├─────┼──────┤
2268 │         │Count│ Count│
2269 ├─────────┼─────┼──────┤
2270 │Age group│  531│   943│
2271 ╰─────────┴─────┴──────╯
2272
2273              Custom Tables
2274 Male
2275 ╭───────────────────────┬────────────╮
2276 │                       │S3a. GENDER:│
2277 │                       ├────────────┤
2278 │                       │    Count   │
2279 ├───────────────────────┼────────────┤
2280 │Age group 15 or younger│           0│
2281 │          16 to 25     │         594│
2282 │          26 to 35     │         476│
2283 │          36 to 45     │         489│
2284 │          46 to 55     │         526│
2285 │          56 to 65     │         516│
2286 │          66 or older  │         531│
2287 ╰───────────────────────┴────────────╯
2288
2289              Custom Tables
2290 Female
2291 ╭───────────────────────┬────────────╮
2292 │                       │S3a. GENDER:│
2293 │                       ├────────────┤
2294 │                       │    Count   │
2295 ├───────────────────────┼────────────┤
2296 │Age group 15 or younger│           0│
2297 │          16 to 25     │         505│
2298 │          26 to 35     │         491│
2299 │          36 to 45     │         548│
2300 │          46 to 55     │         649│
2301 │          56 to 65     │         731│
2302 │          66 or older  │         943│
2303 ╰───────────────────────┴────────────╯
2304 ])
2305 AT_CLEANUP
2306
2307 AT_SETUP([CTABLES missing values])
2308 AT_DATA([ctables.sps],
2309 [[DATA LIST LIST NOTABLE/x y.
2310 BEGIN DATA.
2311 1 1
2312 1 2
2313 1 3
2314 1 4
2315 1 5
2316 1 .
2317 2 1
2318 2 2
2319 2 3
2320 2 4
2321 2 5
2322 2 .
2323 3 1
2324 3 2
2325 3 3
2326 3 4
2327 3 5
2328 3 .
2329 4 1
2330 4 2
2331 4 3
2332 4 4
2333 4 5
2334 4 .
2335 5 1
2336 5 2
2337 5 3
2338 5 4
2339 5 5
2340 5 .
2341 . 1
2342 . 2
2343 . 3
2344 . 4
2345 . 5
2346 . .
2347 END DATA.
2348 MISSING VALUES x (1, 2) y (2, 3).
2349 VARIABLE LEVEL ALL (NOMINAL).
2350
2351 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2352                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2353     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2354 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2355                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2356     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2357 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2358                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2359     /CATEGORIES VARIABLES=ALL TOTAL=YES
2360     /SLABELS POSITION=ROW.
2361 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2362                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2363     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2364     /SLABELS POSITION=ROW.
2365 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2366                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2367     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2368     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2369     /SLABELS POSITION=ROW.
2370 ]])
2371 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2372                                Custom Tables
2373 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2374 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2375 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2376 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2377 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2378 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2379 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2380 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2381 dnl Note that Column Total N % doesn't add up to 100 because missing
2382 dnl values are included in the total but not shown as a category and this
2383 dnl is expected behavior.
2384
2385                                Custom Tables
2386 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2387 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2388 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2389 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2390 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2391 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2392 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2393 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2394 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2395 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2396 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2397 dnl values are included in the total but not shown as a category and this
2398 dnl is expected behavior.
2399
2400                      Custom Tables
2401 ╭────────────────────────┬───────────────────────────╮
2402 │                        │             y             │
2403 │                        ├──────┬──────┬──────┬──────┤
2404 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2405 ├────────────────────────┼──────┼──────┼──────┼──────┤
2406 │x 3.00  Count           │     1│     1│     1│     3│
2407 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2408 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2409 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2410 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2411 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2412 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2413 │        Valid N         │      │      │      │     3│
2414 │        Total N         │      │      │      │     6│
2415 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2416 │  4.00  Count           │     1│     1│     1│     3│
2417 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2418 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2419 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2420 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2421 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2422 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2423 │        Valid N         │      │      │      │     3│
2424 │        Total N         │      │      │      │     6│
2425 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2426 │  5.00  Count           │     1│     1│     1│     3│
2427 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2428 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2429 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2430 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2431 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2432 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2433 │        Valid N         │      │      │      │     3│
2434 │        Total N         │      │      │      │     6│
2435 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2436 │  Total Count           │     3│     3│     3│     9│
2437 │        Column %        │100.0%│100.0%│100.0%│     .│
2438 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2439 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2440 │        Row %           │     .│     .│     .│     .│
2441 │        Row Valid N %   │     .│     .│     .│     .│
2442 │        Row Total N %   │     .│     .│     .│     .│
2443 │        Valid N         │     3│     3│     3│     9│
2444 │        Total N         │     3│     3│     3│    18│
2445 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2446
2447                             Custom Tables
2448 ╭────────────────────────┬─────────────────────────────────────────╮
2449 │                        │                    y                    │
2450 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2451 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2452 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2453 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2454 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2455 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2456 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2457 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2458 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2459 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2460 │        Valid N         │      │      │      │      │      │     3│
2461 │        Total N         │      │      │      │      │      │     6│
2462 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2463 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2464 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2465 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2466 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2467 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2468 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2469 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2470 │        Valid N         │      │      │      │      │      │     3│
2471 │        Total N         │      │      │      │      │      │     6│
2472 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2473 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2474 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2475 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2476 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2477 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2478 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2479 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2480 │        Valid N         │      │      │      │      │      │     3│
2481 │        Total N         │      │      │      │      │      │     6│
2482 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2483 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2484 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2485 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2486 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2487 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2488 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2489 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2490 │        Valid N         │      │      │      │      │      │     3│
2491 │        Total N         │      │      │      │      │      │     6│
2492 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2493 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2494 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2495 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2496 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2497 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2498 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2499 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2500 │        Valid N         │      │      │      │      │      │     3│
2501 │        Total N         │      │      │      │      │      │     6│
2502 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2503 │  Total Count           │     5│     5│     5│     5│     5│    25│
2504 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2505 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2506 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2507 │        Row %           │     .│     .│     .│     .│     .│     .│
2508 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2509 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2510 │        Valid N         │     5│     0│     0│     5│     5│    15│
2511 │        Total N         │     5│     5│     5│     5│     5│    30│
2512 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2513
2514                         Custom Tables
2515 ╭────────────────────────┬──────────────────────────────────╮
2516 │                        │                 y                │
2517 │                        ├──────┬──────┬──────┬──────┬──────┤
2518 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2519 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2520 │x 1.00  Count           │     1│     1│     1│     1│     4│
2521 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2522 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2523 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2524 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2525 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2526 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2527 │        Valid N         │      │      │      │      │     3│
2528 │        Total N         │      │      │      │      │     6│
2529 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2530 │  2.00  Count           │     1│     1│     1│     1│     4│
2531 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2532 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2533 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2534 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2535 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2536 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2537 │        Valid N         │      │      │      │      │     3│
2538 │        Total N         │      │      │      │      │     6│
2539 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2540 │  3.00  Count           │     1│     1│     1│     1│     4│
2541 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2542 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2543 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2544 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2545 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2546 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2547 │        Valid N         │      │      │      │      │     3│
2548 │        Total N         │      │      │      │      │     6│
2549 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2550 │  4.00  Count           │     1│     1│     1│     1│     4│
2551 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2552 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2553 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2554 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2555 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2556 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2557 │        Valid N         │      │      │      │      │     3│
2558 │        Total N         │      │      │      │      │     6│
2559 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2560 │  Total Count           │     4│     4│     4│     4│    16│
2561 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2562 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2563 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2564 │        Row %           │     .│     .│     .│     .│     .│
2565 │        Row Valid N %   │     .│     .│     .│     .│     .│
2566 │        Row Total N %   │     .│     .│     .│     .│     .│
2567 │        Valid N         │     4│     0│     4│     4│    12│
2568 │        Total N         │     4│     4│     4│     4│    24│
2569 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2570 ])
2571 AT_CLEANUP
2572
2573 AT_SETUP([CTABLES SMISSING=LISTWISE])
2574 AT_KEYWORDS([SMISSING LISTWISE])
2575 AT_DATA([ctables.sps],
2576 [[DATA LIST LIST NOTABLE/x y z.
2577 BEGIN DATA.
2578 1  . 40
2579 1 10 50
2580 1 20 60
2581 1  .  .
2582 1 30  .
2583 END DATA.
2584 VARIABLE LEVEL x (NOMINAL).
2585
2586 CTABLES /TABLE (y + z) > x.
2587 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2588
2589 * The following doesn't come out as listwise because the tables are
2590 separate, not linked by an > operator.
2591 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2592 ]])
2593 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2594   Custom Tables
2595 ╭────────┬─────╮
2596 │        │ Mean│
2597 ├────────┼─────┤
2598 │y x 1.00│20.00│
2599 ├────────┼─────┤
2600 │z x 1.00│50.00│
2601 ╰────────┴─────╯
2602
2603   Custom Tables
2604 ╭────────┬─────╮
2605 │        │ Mean│
2606 ├────────┼─────┤
2607 │y x 1.00│15.00│
2608 ├────────┼─────┤
2609 │z x 1.00│55.00│
2610 ╰────────┴─────╯
2611
2612   Custom Tables
2613 ╭────────┬─────╮
2614 │        │ Mean│
2615 ├────────┼─────┤
2616 │y x 1.00│20.00│
2617 ├────────┼─────┤
2618 │z x 1.00│50.00│
2619 ╰────────┴─────╯
2620 ])
2621 AT_CLEANUP
2622
2623 AT_SETUP([CTABLES VLABELS - variables on different axes])
2624 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
2625 AT_DATA([ctables.sps],
2626 [[GET 'nhtsa.sav'.
2627 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2628 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2629 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2630 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2631 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2632 ]])
2633 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2634                                  Custom Tables
2635 ╭────────────────────────────────────────────────────────────────┬────────────╮
2636 │                                                                │S3a. GENDER:│
2637 │                                                                ├─────┬──────┤
2638 │                                                                │ Male│Female│
2639 │                                                                ├─────┼──────┤
2640 │                                                                │Count│ Count│
2641 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2642 │D5a. What would you say is your primary    Cuban                │   13│     7│
2643 │ethnic background?                         Mexican              │  175│   136│
2644 │                                           Spanish              │   20│    28│
2645 │                                           South American       │   21│    13│
2646 │                                           Central American     │   27│    25│
2647 │                                           Puerto Rican, OR     │   37│    41│
2648 │                                           Something else       │   35│    33│
2649 │                                           Multiple - cannot    │    2│     5│
2650 │                                           choose one           │     │      │
2651 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2652
2653                   Custom Tables
2654 ╭──────────────────────────────────┬────────────╮
2655 │                                  │    QNS3A   │
2656 │                                  ├─────┬──────┤
2657 │                                  │ Male│Female│
2658 │                                  ├─────┼──────┤
2659 │                                  │Count│ Count│
2660 ├──────────────────────────────────┼─────┼──────┤
2661 │QND5A Cuban                       │   13│     7│
2662 │      Mexican                     │  175│   136│
2663 │      Spanish                     │   20│    28│
2664 │      South American              │   21│    13│
2665 │      Central American            │   27│    25│
2666 │      Puerto Rican, OR            │   37│    41│
2667 │      Something else              │   35│    33│
2668 │      Multiple - cannot choose one│    2│     5│
2669 ╰──────────────────────────────────┴─────┴──────╯
2670
2671                                  Custom Tables
2672 ╭────────────────────────────────────────────────────────────────┬────────────╮
2673 │                                                                │S3a. GENDER:│
2674 │                                                                ├─────┬──────┤
2675 │                                                                │ Male│Female│
2676 │                                                                ├─────┼──────┤
2677 │                                                                │Count│ Count│
2678 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2679 │D5a. What would you say is your primary    Cuban                │   13│     7│
2680 │ethnic background?                         Mexican              │  175│   136│
2681 │                                           Spanish              │   20│    28│
2682 │                                           South American       │   21│    13│
2683 │                                           Central American     │   27│    25│
2684 │                                           Puerto Rican, OR     │   37│    41│
2685 │                                           Something else       │   35│    33│
2686 │                                           Multiple - cannot    │    2│     5│
2687 │                                           choose one           │     │      │
2688 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2689
2690                                  Custom Tables
2691 ╭────────────────────────────────────────────────────────────┬────────────────╮
2692 │                                                            │   QNS3A S3a.   │
2693 │                                                            │     GENDER:    │
2694 │                                                            ├───────┬────────┤
2695 │                                                            │  Male │ Female │
2696 │                                                            ├───────┼────────┤
2697 │                                                            │ Count │  Count │
2698 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2699 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2700 │primary ethnic background?               Mexican            │    175│     136│
2701 │                                         Spanish            │     20│      28│
2702 │                                         South American     │     21│      13│
2703 │                                         Central American   │     27│      25│
2704 │                                         Puerto Rican, OR   │     37│      41│
2705 │                                         Something else     │     35│      33│
2706 │                                         Multiple - cannot  │      2│       5│
2707 │                                         choose one         │       │        │
2708 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2709
2710                Custom Tables
2711 ╭────────────────────────────┬─────┬──────╮
2712 │                            │ Male│Female│
2713 │                            ├─────┼──────┤
2714 │                            │Count│ Count│
2715 ├────────────────────────────┼─────┼──────┤
2716 │Cuban                       │   13│     7│
2717 │Mexican                     │  175│   136│
2718 │Spanish                     │   20│    28│
2719 │South American              │   21│    13│
2720 │Central American            │   27│    25│
2721 │Puerto Rican, OR            │   37│    41│
2722 │Something else              │   35│    33│
2723 │Multiple - cannot choose one│    2│     5│
2724 ╰────────────────────────────┴─────┴──────╯
2725 ])
2726 AT_CLEANUP
2727
2728 AT_SETUP([CTABLES VLABELS - stacked variables])
2729 AT_KEYWORDS([stack stacking])
2730 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
2731 AT_DATA([ctables.sps],
2732 [[GET 'nhtsa.sav'.
2733 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2734 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2735 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2736 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2737 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2738 ]])
2739 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2740                                  Custom Tables
2741 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2742 │                                                                       │Count│
2743 ├───────────────────────────────────────────────────────────────────────┼─────┤
2744 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2745 │background?                                     Mexican                │  311│
2746 │                                                Spanish                │   48│
2747 │                                                South American         │   34│
2748 │                                                Central American       │   52│
2749 │                                                Puerto Rican, OR       │   78│
2750 │                                                Something else         │   68│
2751 │                                                Multiple - cannot      │    7│
2752 │                                                choose one             │     │
2753 ├───────────────────────────────────────────────────────────────────────┼─────┤
2754 │QNS3A                                           Male                   │ 3132│
2755 │                                                Female                 │ 3867│
2756 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2757
2758                   Custom Tables
2759 ╭─────────────────────────────────────────┬─────╮
2760 │                                         │Count│
2761 ├─────────────────────────────────────────┼─────┤
2762 │QND5A        Cuban                       │   20│
2763 │             Mexican                     │  311│
2764 │             Spanish                     │   48│
2765 │             South American              │   34│
2766 │             Central American            │   52│
2767 │             Puerto Rican, OR            │   78│
2768 │             Something else              │   68│
2769 │             Multiple - cannot choose one│    7│
2770 ├─────────────────────────────────────────┼─────┤
2771 │S3a. GENDER: Male                        │ 3132│
2772 │             Female                      │ 3867│
2773 ╰─────────────────────────────────────────┴─────╯
2774
2775                                  Custom Tables
2776 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2777 │                                                                       │Count│
2778 ├───────────────────────────────────────────────────────────────────────┼─────┤
2779 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2780 │background?                                     Mexican                │  311│
2781 │                                                Spanish                │   48│
2782 │                                                South American         │   34│
2783 │                                                Central American       │   52│
2784 │                                                Puerto Rican, OR       │   78│
2785 │                                                Something else         │   68│
2786 │                                                Multiple - cannot      │    7│
2787 │                                                choose one             │     │
2788 ├───────────────────────────────────────────────────────────────────────┼─────┤
2789 │Male                                                                   │ 3132│
2790 ├───────────────────────────────────────────────────────────────────────┼─────┤
2791 │Female                                                                 │ 3867│
2792 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2793
2794             Custom Tables
2795 ╭─────────────────────────────┬─────╮
2796 │                             │Count│
2797 ├─────────────────────────────┼─────┤
2798 │Cuban                        │   20│
2799 ├─────────────────────────────┼─────┤
2800 │Mexican                      │  311│
2801 ├─────────────────────────────┼─────┤
2802 │Spanish                      │   48│
2803 ├─────────────────────────────┼─────┤
2804 │South American               │   34│
2805 ├─────────────────────────────┼─────┤
2806 │Central American             │   52│
2807 ├─────────────────────────────┼─────┤
2808 │Puerto Rican, OR             │   78│
2809 ├─────────────────────────────┼─────┤
2810 │Something else               │   68│
2811 ├─────────────────────────────┼─────┤
2812 │Multiple - cannot choose one │    7│
2813 ├─────────────────────────────┼─────┤
2814 │S3a. GENDER:     Male        │ 3132│
2815 │                 Female      │ 3867│
2816 ╰─────────────────────────────┴─────╯
2817
2818             Custom Tables
2819 ╭────────────────────────────┬─────╮
2820 │                            │Count│
2821 ├────────────────────────────┼─────┤
2822 │Cuban                       │   20│
2823 │Mexican                     │  311│
2824 │Spanish                     │   48│
2825 │South American              │   34│
2826 │Central American            │   52│
2827 │Puerto Rican, OR            │   78│
2828 │Something else              │   68│
2829 │Multiple - cannot choose one│    7│
2830 │Male                        │ 3132│
2831 │Female                      │ 3867│
2832 ╰────────────────────────────┴─────╯
2833 ])
2834 AT_CLEANUP
2835
2836 AT_SETUP([CTABLES VLABELS - nested variables])
2837 AT_KEYWORDS([nest nesting])
2838 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
2839 AT_DATA([ctables.sps],
2840 [[GET 'nhtsa.sav'.
2841 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2842 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2843 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2844 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2845 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2846 ]])
2847 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2848                                  Custom Tables
2849 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2850 │                                                                       │Count│
2851 ├───────────────────────────────────────────────────────────────────────┼─────┤
2852 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2853 │primary ethnic background?                                       Female│    7│
2854 │                                     ╶─────────────────────────────────┼─────┤
2855 │                                      Mexican              QNS3A Male  │  175│
2856 │                                                                 Female│  136│
2857 │                                     ╶─────────────────────────────────┼─────┤
2858 │                                      Spanish              QNS3A Male  │   20│
2859 │                                                                 Female│   28│
2860 │                                     ╶─────────────────────────────────┼─────┤
2861 │                                      South American       QNS3A Male  │   21│
2862 │                                                                 Female│   13│
2863 │                                     ╶─────────────────────────────────┼─────┤
2864 │                                      Central American     QNS3A Male  │   27│
2865 │                                                                 Female│   25│
2866 │                                     ╶─────────────────────────────────┼─────┤
2867 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2868 │                                                                 Female│   41│
2869 │                                     ╶─────────────────────────────────┼─────┤
2870 │                                      Something else       QNS3A Male  │   35│
2871 │                                                                 Female│   33│
2872 │                                     ╶─────────────────────────────────┼─────┤
2873 │                                      Multiple - cannot    QNS3A Male  │    2│
2874 │                                      choose one                 Female│    5│
2875 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2876
2877                          Custom Tables
2878 ╭──────────────────────────────────────────────────────┬─────╮
2879 │                                                      │Count│
2880 ├──────────────────────────────────────────────────────┼─────┤
2881 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2882 │                                                Female│    7│
2883 │     ╶────────────────────────────────────────────────┼─────┤
2884 │      Mexican                      S3a. GENDER: Male  │  175│
2885 │                                                Female│  136│
2886 │     ╶────────────────────────────────────────────────┼─────┤
2887 │      Spanish                      S3a. GENDER: Male  │   20│
2888 │                                                Female│   28│
2889 │     ╶────────────────────────────────────────────────┼─────┤
2890 │      South American               S3a. GENDER: Male  │   21│
2891 │                                                Female│   13│
2892 │     ╶────────────────────────────────────────────────┼─────┤
2893 │      Central American             S3a. GENDER: Male  │   27│
2894 │                                                Female│   25│
2895 │     ╶────────────────────────────────────────────────┼─────┤
2896 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2897 │                                                Female│   41│
2898 │     ╶────────────────────────────────────────────────┼─────┤
2899 │      Something else               S3a. GENDER: Male  │   35│
2900 │                                                Female│   33│
2901 │     ╶────────────────────────────────────────────────┼─────┤
2902 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2903 │                                                Female│    5│
2904 ╰──────────────────────────────────────────────────────┴─────╯
2905
2906                                  Custom Tables
2907 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2908 │                                                                       │Count│
2909 ├───────────────────────────────────────────────────────────────────────┼─────┤
2910 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2911 │ethnic background?                                               Female│    7│
2912 │                                          ╶────────────────────────────┼─────┤
2913 │                                           Mexican               Male  │  175│
2914 │                                                                 Female│  136│
2915 │                                          ╶────────────────────────────┼─────┤
2916 │                                           Spanish               Male  │   20│
2917 │                                                                 Female│   28│
2918 │                                          ╶────────────────────────────┼─────┤
2919 │                                           South American        Male  │   21│
2920 │                                                                 Female│   13│
2921 │                                          ╶────────────────────────────┼─────┤
2922 │                                           Central American      Male  │   27│
2923 │                                                                 Female│   25│
2924 │                                          ╶────────────────────────────┼─────┤
2925 │                                           Puerto Rican, OR      Male  │   37│
2926 │                                                                 Female│   41│
2927 │                                          ╶────────────────────────────┼─────┤
2928 │                                           Something else        Male  │   35│
2929 │                                                                 Female│   33│
2930 │                                          ╶────────────────────────────┼─────┤
2931 │                                           Multiple - cannot     Male  │    2│
2932 │                                           choose one            Female│    5│
2933 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2934
2935                       Custom Tables
2936 ╭────────────────────────────────────────────────┬─────╮
2937 │                                                │Count│
2938 ├────────────────────────────────────────────────┼─────┤
2939 │Cuban                        S3a. GENDER: Male  │   13│
2940 │                                          Female│    7│
2941 ├────────────────────────────────────────────────┼─────┤
2942 │Mexican                      S3a. GENDER: Male  │  175│
2943 │                                          Female│  136│
2944 ├────────────────────────────────────────────────┼─────┤
2945 │Spanish                      S3a. GENDER: Male  │   20│
2946 │                                          Female│   28│
2947 ├────────────────────────────────────────────────┼─────┤
2948 │South American               S3a. GENDER: Male  │   21│
2949 │                                          Female│   13│
2950 ├────────────────────────────────────────────────┼─────┤
2951 │Central American             S3a. GENDER: Male  │   27│
2952 │                                          Female│   25│
2953 ├────────────────────────────────────────────────┼─────┤
2954 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2955 │                                          Female│   41│
2956 ├────────────────────────────────────────────────┼─────┤
2957 │Something else               S3a. GENDER: Male  │   35│
2958 │                                          Female│   33│
2959 ├────────────────────────────────────────────────┼─────┤
2960 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2961 │                                          Female│    5│
2962 ╰────────────────────────────────────────────────┴─────╯
2963
2964                Custom Tables
2965 ╭───────────────────────────────────┬─────╮
2966 │                                   │Count│
2967 ├───────────────────────────────────┼─────┤
2968 │Cuban                        Male  │   13│
2969 │                             Female│    7│
2970 ├───────────────────────────────────┼─────┤
2971 │Mexican                      Male  │  175│
2972 │                             Female│  136│
2973 ├───────────────────────────────────┼─────┤
2974 │Spanish                      Male  │   20│
2975 │                             Female│   28│
2976 ├───────────────────────────────────┼─────┤
2977 │South American               Male  │   21│
2978 │                             Female│   13│
2979 ├───────────────────────────────────┼─────┤
2980 │Central American             Male  │   27│
2981 │                             Female│   25│
2982 ├───────────────────────────────────┼─────┤
2983 │Puerto Rican, OR             Male  │   37│
2984 │                             Female│   41│
2985 ├───────────────────────────────────┼─────┤
2986 │Something else               Male  │   35│
2987 │                             Female│   33│
2988 ├───────────────────────────────────┼─────┤
2989 │Multiple - cannot choose one Male  │    2│
2990 │                             Female│    5│
2991 ╰───────────────────────────────────┴─────╯
2992 ])
2993 AT_CLEANUP
2994
2995 AT_SETUP([CTABLES FORMAT EMPTY])
2996 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
2997 AT_DATA([ctables.sps],
2998 [[GET 'nhtsa.sav'.
2999 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
3000 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
3001 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
3002 ]])
3003 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3004                                  Custom Tables
3005 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3006 │                                             │   D5. ETHNICITY: Are you of   │
3007 │                                             │  Hispanic or Latino origin or │
3008 │                                             │            descent?           │
3009 │                                             ├───────────────┬───────────────┤
3010 │                                             │      Yes      │       No      │
3011 │                                             ├───────────────┼───────────────┤
3012 │                                             │     Count     │     Count     │
3013 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3014 │D5a. What would you say is   Cuban           │             20│              0│
3015 │your primary ethnic          Mexican         │            311│              0│
3016 │background?                  Spanish         │             48│              0│
3017 │                             South American  │             34│              0│
3018 │                             Central American│             52│              0│
3019 │                             Puerto Rican, OR│             78│              0│
3020 │                             Something else  │             68│              0│
3021 │                             Multiple -      │              7│              0│
3022 │                             cannot choose   │               │               │
3023 │                             one             │               │               │
3024 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3025
3026                                  Custom Tables
3027 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3028 │                                             │   D5. ETHNICITY: Are you of   │
3029 │                                             │  Hispanic or Latino origin or │
3030 │                                             │            descent?           │
3031 │                                             ├───────────────┬───────────────┤
3032 │                                             │      Yes      │       No      │
3033 │                                             ├───────────────┼───────────────┤
3034 │                                             │     Count     │     Count     │
3035 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3036 │D5a. What would you say is   Cuban           │             20│               │
3037 │your primary ethnic          Mexican         │            311│               │
3038 │background?                  Spanish         │             48│               │
3039 │                             South American  │             34│               │
3040 │                             Central American│             52│               │
3041 │                             Puerto Rican, OR│             78│               │
3042 │                             Something else  │             68│               │
3043 │                             Multiple -      │              7│               │
3044 │                             cannot choose   │               │               │
3045 │                             one             │               │               │
3046 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3047
3048                                  Custom Tables
3049 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3050 │                                             │   D5. ETHNICITY: Are you of   │
3051 │                                             │  Hispanic or Latino origin or │
3052 │                                             │            descent?           │
3053 │                                             ├───────────────┬───────────────┤
3054 │                                             │      Yes      │       No      │
3055 │                                             ├───────────────┼───────────────┤
3056 │                                             │     Count     │     Count     │
3057 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3058 │D5a. What would you say is   Cuban           │             20│n/a            │
3059 │your primary ethnic          Mexican         │            311│n/a            │
3060 │background?                  Spanish         │             48│n/a            │
3061 │                             South American  │             34│n/a            │
3062 │                             Central American│             52│n/a            │
3063 │                             Puerto Rican, OR│             78│n/a            │
3064 │                             Something else  │             68│n/a            │
3065 │                             Multiple -      │              7│n/a            │
3066 │                             cannot choose   │               │               │
3067 │                             one             │               │               │
3068 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3069 ])
3070 AT_CLEANUP
3071
3072 AT_SETUP([CTABLES FORMAT MISSING])
3073 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3074 AT_DATA([ctables.sps],
3075 [[GET 'nhtsa.sav'.
3076 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
3077 ]])
3078 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3079                                  Custom Tables
3080 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3081 │                                             │   D5. ETHNICITY: Are you of   │
3082 │                                             │  Hispanic or Latino origin or │
3083 │                                             │            descent?           │
3084 │                                             ├───────────────┬───────────────┤
3085 │                                             │      Yes      │       No      │
3086 │                                             ├───────────────┼───────────────┤
3087 │                                             │    Column %   │    Column %   │
3088 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3089 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
3090 │your primary ethnic          Mexican         │          50.3%│(no data)      │
3091 │background?                  Spanish         │           7.8%│(no data)      │
3092 │                             South American  │           5.5%│(no data)      │
3093 │                             Central American│           8.4%│(no data)      │
3094 │                             Puerto Rican, OR│          12.6%│(no data)      │
3095 │                             Something else  │          11.0%│(no data)      │
3096 │                             Multiple -      │           1.1%│(no data)      │
3097 │                             cannot choose   │               │               │
3098 │                             one             │               │               │
3099 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3100 ])
3101 AT_CLEANUP
3102
3103 AT_SETUP([CTABLES HIDESMALLCOUNTS])
3104 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3105 AT_DATA([ctables.sps],
3106 [[GET 'nhtsa.sav'.
3107 CTABLES /TABLE qn38[c][COUNT, COLPCT].
3108 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
3109 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
3110 ]])
3111 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3112                                  Custom Tables
3113 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3114 │                                                              │Count│Column %│
3115 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3116 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3117 │occasion?                                        1            │  491│   34.9%│
3118 │                                                 2            │  462│   32.9%│
3119 │                                                 3            │  229│   16.3%│
3120 │                                                 4            │   82│    5.8%│
3121 │                                                 5            │   56│    4.0%│
3122 │                                                 6            │   32│    2.3%│
3123 │                                                 7            │    9│     .6%│
3124 │                                                 8            │    8│     .6%│
3125 │                                                 9            │    4│     .3%│
3126 │                                                 10           │    6│     .4%│
3127 │                                                 11           │    2│     .1%│
3128 │                                                 12           │    5│     .4%│
3129 │                                                 14           │    1│     .1%│
3130 │                                                 15           │    1│     .1%│
3131 │                                                 18           │    1│     .1%│
3132 │                                                 20           │    4│     .3%│
3133 │                                                 25           │    1│     .1%│
3134 │                                                 30           │    3│     .2%│
3135 │                                                 60           │    1│     .1%│
3136 │                                                 99+          │    0│     .0%│
3137 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3138
3139                                  Custom Tables
3140 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3141 │                                                              │Count│Column %│
3142 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3143 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3144 │occasion?                                        1            │  491│   34.9%│
3145 │                                                 2            │  462│   32.9%│
3146 │                                                 3            │  229│   16.3%│
3147 │                                                 4            │   82│    5.8%│
3148 │                                                 5            │   56│    4.0%│
3149 │                                                 6            │   32│    2.3%│
3150 │                                                 7            │    9│     .6%│
3151 │                                                 8            │    8│     .6%│
3152 │                                                 9            │<5   │     .3%│
3153 │                                                 10           │    6│     .4%│
3154 │                                                 11           │<5   │     .1%│
3155 │                                                 12           │    5│     .4%│
3156 │                                                 14           │<5   │     .1%│
3157 │                                                 15           │<5   │     .1%│
3158 │                                                 18           │<5   │     .1%│
3159 │                                                 20           │<5   │     .3%│
3160 │                                                 25           │<5   │     .1%│
3161 │                                                 30           │<5   │     .2%│
3162 │                                                 60           │<5   │     .1%│
3163 │                                                 99+          │<5   │     .0%│
3164 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3165
3166                                  Custom Tables
3167 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3168 │                                                              │Count│Column %│
3169 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3170 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
3171 │occasion?                                        1            │  491│   34.9%│
3172 │                                                 2            │  462│   32.9%│
3173 │                                                 3            │  229│   16.3%│
3174 │                                                 4            │   82│    5.8%│
3175 │                                                 5            │   56│    4.0%│
3176 │                                                 6            │   32│    2.3%│
3177 │                                                 7            │<10  │     .6%│
3178 │                                                 8            │<10  │     .6%│
3179 │                                                 9            │<10  │     .3%│
3180 │                                                 10           │<10  │     .4%│
3181 │                                                 11           │<10  │     .1%│
3182 │                                                 12           │<10  │     .4%│
3183 │                                                 14           │<10  │     .1%│
3184 │                                                 15           │<10  │     .1%│
3185 │                                                 18           │<10  │     .1%│
3186 │                                                 20           │<10  │     .3%│
3187 │                                                 25           │<10  │     .1%│
3188 │                                                 30           │<10  │     .2%│
3189 │                                                 60           │<10  │     .1%│
3190 │                                                 99+          │<10  │     .0%│
3191 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3192 ])
3193 AT_CLEANUP
3194
3195 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
3196 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3197 AT_DATA([ctables.sps],
3198 [[GET 'nhtsa.sav'.
3199 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
3200 ]])
3201 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
3202  Custom Tables
3203 ╭────────────╮
3204 │S3a. GENDER:│
3205 ├─────┬──────┤
3206 │ Male│Female│
3207 ├─────┼──────┤
3208 │Count│ Count│
3209 ├─────┼──────┤
3210 │ 3132│  3867│
3211 ╰─────┴──────╯
3212 ])
3213 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
3214 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
3215 maximumColumnWidth="192"
3216 minimumColumnWidth="96"
3217 ])
3218 AT_CLEANUP
3219
3220 AT_SETUP([CTABLES special formats])
3221 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
3222 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3223 AT_DATA([ctables.sps],
3224 [[GET 'nhtsa.sav'.
3225 COMPUTE x = qnd3 - 4.
3226 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].
3227 ]])
3228 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3229                            Custom Tables
3230 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
3231 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
3232 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
3233 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
3234 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
3235 ])
3236 AT_CLEANUP
3237
3238 AT_SETUP([CTABLES TITLES])
3239 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3240 AT_DATA([ctables.sps],
3241 [[GET 'nhtsa.sav'.
3242 CTABLES
3243     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3244     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3245     /TITLES TITLE='How often do you drive?'
3246             CAPTION='Generated )TIME on )DATE'
3247             CORNER=')TABLE'.
3248 ]])
3249 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3250 s&../../..&MM/DD/YY&'], [0], [dnl
3251                             How often do you drive?
3252 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3253 │                                   │               S3a. GENDER:              │
3254 │                                   ├────────────────────┬────────────────────┤
3255 │                                   │        Male        │       Female       │
3256 │                                   ├────────────────────┼────────────────────┤
3257 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3258 │                                   │ you of Hispanic or │ you of Hispanic or │
3259 │                                   │  Latino origin or  │  Latino origin or  │
3260 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3261 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3262 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3263 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3264 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3265 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3266 │Every day                          │      218│      2066│      166│      2175│
3267 │Several days a week                │       44│       391│       45│       782│
3268 │Once a week or less                │       16│       109│       12│       223│
3269 │Only certain times a year          │       15│        41│       11│        61│
3270 │Never                              │       39│       150│       56│       278│
3271 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3272 Generated HH:MM:SS on MM/DD/YY
3273 ])
3274 AT_CLEANUP
3275
3276 AT_SETUP([CTABLES area definitions])
3277 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3278 AT_DATA([ctables.sps],
3279 [[GET 'nhtsa.sav'.
3280 CTABLES
3281     /VLABELS VARIABLES=ALL DISPLAY=NAME
3282     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3283     /SLABELS POSITION=ROW
3284     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3285     /SLABELS POSITION=ROW
3286     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3287     /SLABELS POSITION=ROW.
3288 ]])
3289 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3290                     Custom Tables
3291 Male
3292 ╭─────────────────────────────┬─────────────┬──────╮
3293 │                             │    QND7A    │ QN64B│
3294 │                             ├──────┬──────┼───┬──┤
3295 │                             │  Yes │  No  │   │  │
3296 │                             ├──────┼──────┤   │  │
3297 │                             │ QN86 │ QN86 │   │  │
3298 │                             ├───┬──┼───┬──┤   │  │
3299 │                             │Yes│No│Yes│No│Yes│No│
3300 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3301 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3302 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3303 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3304 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3305 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3306 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3307 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3308 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3309 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3310 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3311 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3312 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3313 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3314 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3315 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3316 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3317
3318                     Custom Tables
3319 Female
3320 ╭─────────────────────────────┬─────────────┬──────╮
3321 │                             │    QND7A    │ QN64B│
3322 │                             ├──────┬──────┼───┬──┤
3323 │                             │  Yes │  No  │   │  │
3324 │                             ├──────┼──────┤   │  │
3325 │                             │ QN86 │ QN86 │   │  │
3326 │                             ├───┬──┼───┬──┤   │  │
3327 │                             │Yes│No│Yes│No│Yes│No│
3328 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3329 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3330 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3331 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3332 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3333 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3334 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3335 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3336 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3337 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3338 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3339 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3340 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3341 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3342 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3343 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3344 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3345
3346                     Custom Tables
3347 Male
3348 ╭──────────────────────────────┬─────────────┬──────╮
3349 │                              │    QND7A    │ QN64B│
3350 │                              ├──────┬──────┼───┬──┤
3351 │                              │  Yes │  No  │   │  │
3352 │                              ├──────┼──────┤   │  │
3353 │                              │ QN86 │ QN86 │   │  │
3354 │                              ├───┬──┼───┬──┤   │  │
3355 │                              │Yes│No│Yes│No│Yes│No│
3356 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3357 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3358 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3359 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3360 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3361 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3362 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3363 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3364 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3365 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3366 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3367 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3368 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3369
3370                     Custom Tables
3371 Female
3372 ╭──────────────────────────────┬─────────────┬──────╮
3373 │                              │    QND7A    │ QN64B│
3374 │                              ├──────┬──────┼───┬──┤
3375 │                              │  Yes │  No  │   │  │
3376 │                              ├──────┼──────┤   │  │
3377 │                              │ QN86 │ QN86 │   │  │
3378 │                              ├───┬──┼───┬──┤   │  │
3379 │                              │Yes│No│Yes│No│Yes│No│
3380 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3381 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3382 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3383 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3384 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3385 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3386 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3387 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3388 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3389 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3390 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3391 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3392 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3393
3394                       Custom Tables
3395 Male
3396 ╭─────────────────────────────────┬─────────────┬──────╮
3397 │                                 │    QND7A    │ QN64B│
3398 │                                 ├──────┬──────┼───┬──┤
3399 │                                 │  Yes │  No  │   │  │
3400 │                                 ├──────┼──────┤   │  │
3401 │                                 │ QN86 │ QN86 │   │  │
3402 │                                 ├───┬──┼───┬──┤   │  │
3403 │                                 │Yes│No│Yes│No│Yes│No│
3404 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3405 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3406 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3407 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3408 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3409 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3410 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3411 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3412 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3413 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3414 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3415 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3416 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3417
3418                       Custom Tables
3419 Female
3420 ╭─────────────────────────────────┬─────────────┬──────╮
3421 │                                 │    QND7A    │ QN64B│
3422 │                                 ├──────┬──────┼───┬──┤
3423 │                                 │  Yes │  No  │   │  │
3424 │                                 ├──────┼──────┤   │  │
3425 │                                 │ QN86 │ QN86 │   │  │
3426 │                                 ├───┬──┼───┬──┤   │  │
3427 │                                 │Yes│No│Yes│No│Yes│No│
3428 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3429 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3430 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3431 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3432 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3433 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3434 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3435 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3436 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3437 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3438 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3439 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3440 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3441 ])
3442 AT_CLEANUP
3443
3444 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3445 AT_KEYWORDS([ROWLABELS OPPOSITE])
3446 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3447 AT_DATA([ctables.sps],
3448 [[GET 'nhtsa.sav'.
3449 CTABLES
3450     /VLABELS VARIABLES=ALL DISPLAY=NAME
3451     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3452     /SLABELS POSITION=ROW
3453     /CLABELS ROWLABELS=OPPOSITE
3454     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3455     /SLABELS POSITION=ROW
3456     /CLABELS ROWLABELS=OPPOSITE
3457     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3458     /SLABELS POSITION=ROW
3459     /CLABELS ROWLABELS=OPPOSITE.
3460 ]])
3461 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3462                                         Custom Tables
3463 Male
3464 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3465 │                                  │                          QN27                         │
3466 │                                  ├───────────────────────────┬───────────────────────────┤
3467 │                                  │            Yes            │             No            │
3468 │                                  ├───────────────────────────┼───────────────────────────┤
3469 │                                  │           QND7A           │           QND7A           │
3470 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3471 │                                  │     Yes     │      No     │     Yes     │      No     │
3472 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3473 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3474 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3475 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3476 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3477 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3478 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3479 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3480 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3481 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3482 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3483 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3484 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3485 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3486 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3487 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3488 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3489 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3490 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3491 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3492 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3493 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3494 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3495
3496                                         Custom Tables
3497 Female
3498 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3499 │                                  │                          QN27                         │
3500 │                                  ├───────────────────────────┬───────────────────────────┤
3501 │                                  │            Yes            │             No            │
3502 │                                  ├───────────────────────────┼───────────────────────────┤
3503 │                                  │           QND7A           │           QND7A           │
3504 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3505 │                                  │     Yes     │      No     │     Yes     │      No     │
3506 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3507 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3508 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3509 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3510 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3511 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3512 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3513 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3514 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3515 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3516 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3517 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3518 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3519 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3520 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3521 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3522 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3523 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3524 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3525 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3526 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3527 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3528 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3529
3530                                         Custom Tables
3531 Male
3532 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3533 │                                   │                          QN27                         │
3534 │                                   ├───────────────────────────┬───────────────────────────┤
3535 │                                   │            Yes            │             No            │
3536 │                                   ├───────────────────────────┼───────────────────────────┤
3537 │                                   │           QND7A           │           QND7A           │
3538 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3539 │                                   │     Yes     │      No     │     Yes     │      No     │
3540 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3541 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3542 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3543 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3544 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3545 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3546 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3547 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3548 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3549 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3550 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3551 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3552 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3553 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3554 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3555 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3556 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3557 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3558 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3559
3560                                         Custom Tables
3561 Female
3562 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3563 │                                   │                          QN27                         │
3564 │                                   ├───────────────────────────┬───────────────────────────┤
3565 │                                   │            Yes            │             No            │
3566 │                                   ├───────────────────────────┼───────────────────────────┤
3567 │                                   │           QND7A           │           QND7A           │
3568 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3569 │                                   │     Yes     │      No     │     Yes     │      No     │
3570 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3571 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3572 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3573 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3574 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3575 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3576 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3577 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3578 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3579 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3580 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3581 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3582 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3583 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3584 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3585 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3586 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3587 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3588 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3589
3590                                           Custom Tables
3591 Male
3592 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3593 │                                      │                          QN27                         │
3594 │                                      ├───────────────────────────┬───────────────────────────┤
3595 │                                      │            Yes            │             No            │
3596 │                                      ├───────────────────────────┼───────────────────────────┤
3597 │                                      │           QND7A           │           QND7A           │
3598 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3599 │                                      │     Yes     │      No     │     Yes     │      No     │
3600 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3601 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3602 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3603 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3604 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3605 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3606 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3607 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3608 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3609 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3610 │              No  QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3611 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3612 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3613 │     No  QN61 Yes QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3614 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3615 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3616 │              No  QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3617 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3618 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3619
3620                                           Custom Tables
3621 Female
3622 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3623 │                                      │                          QN27                         │
3624 │                                      ├───────────────────────────┬───────────────────────────┤
3625 │                                      │            Yes            │             No            │
3626 │                                      ├───────────────────────────┼───────────────────────────┤
3627 │                                      │           QND7A           │           QND7A           │
3628 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3629 │                                      │     Yes     │      No     │     Yes     │      No     │
3630 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3631 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3632 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3633 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3634 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3635 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3636 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3637 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3638 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3639 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3640 │              No  QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3641 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3642 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3643 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3644 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3645 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3646 │              No  QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3647 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3648 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3649 ])
3650 AT_CLEANUP
3651
3652 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3653 AT_KEYWORDS([COLLABELS OPPOSITE])
3654 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
3655 AT_DATA([ctables.sps],
3656 [[GET 'nhtsa.sav'.
3657 CTABLES
3658     /VLABELS VARIABLES=ALL DISPLAY=NAME
3659     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3660     /SLABELS POSITION=ROW
3661     /CLABELS COLLABELS=OPPOSITE
3662     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3663     /SLABELS POSITION=ROW
3664     /CLABELS COLLABELS=OPPOSITE
3665     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3666     /SLABELS POSITION=ROW
3667     /CLABELS COLLABELS=OPPOSITE.
3668 ]])
3669 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3670                           Custom Tables
3671 Male
3672 ╭──────────────────────────────────────────┬───────────────────╮
3673 │                                          │        QN27       │
3674 │                                          ├─────────┬─────────┤
3675 │                                          │   Yes   │    No   │
3676 │                                          ├─────────┼─────────┤
3677 │                                          │  QND7A  │  QND7A  │
3678 │                                          ├────┬────┼────┬────┤
3679 │                                          │ Yes│ No │ Yes│ No │
3680 │                                          ├────┼────┼────┼────┤
3681 │                                          │QN86│QN86│QN86│QN86│
3682 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3683 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3684 │                               Layer ID   │   1│   1│   1│   1│
3685 │                               Subtable ID│   1│   1│   2│   2│
3686 │                          ╶───────────────┼────┼────┼────┼────┤
3687 │                           No  Table ID   │   1│   1│   1│   1│
3688 │                               Layer ID   │   1│   1│   1│   1│
3689 │                               Subtable ID│   1│   1│   2│   2│
3690 │                      ╶───────────────────┼────┼────┼────┼────┤
3691 │                       No  Yes Table ID   │   1│   1│   1│   1│
3692 │                               Layer ID   │   1│   1│   1│   1│
3693 │                               Subtable ID│   3│   3│   4│   4│
3694 │                          ╶───────────────┼────┼────┼────┼────┤
3695 │                           No  Table ID   │   1│   1│   1│   1│
3696 │                               Layer ID   │   1│   1│   1│   1│
3697 │                               Subtable ID│   3│   3│   4│   4│
3698 │             ╶────────────────────────────┼────┼────┼────┼────┤
3699 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3700 │                               Layer ID   │   1│   1│   1│   1│
3701 │                               Subtable ID│   5│   5│   6│   6│
3702 │                          ╶───────────────┼────┼────┼────┼────┤
3703 │                           No  Table ID   │   1│   1│   1│   1│
3704 │                               Layer ID   │   1│   1│   1│   1│
3705 │                               Subtable ID│   5│   5│   6│   6│
3706 │                      ╶───────────────────┼────┼────┼────┼────┤
3707 │                       No  Yes Table ID   │   1│   1│   1│   1│
3708 │                               Layer ID   │   1│   1│   1│   1│
3709 │                               Subtable ID│   7│   7│   8│   8│
3710 │                          ╶───────────────┼────┼────┼────┼────┤
3711 │                           No  Table ID   │   1│   1│   1│   1│
3712 │                               Layer ID   │   1│   1│   1│   1│
3713 │                               Subtable ID│   7│   7│   8│   8│
3714 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3715 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3716 │                               Layer ID   │   1│   1│   1│   1│
3717 │                               Subtable ID│   9│   9│  10│  10│
3718 │                          ╶───────────────┼────┼────┼────┼────┤
3719 │                           No  Table ID   │   1│   1│   1│   1│
3720 │                               Layer ID   │   1│   1│   1│   1│
3721 │                               Subtable ID│   9│   9│  10│  10│
3722 │                      ╶───────────────────┼────┼────┼────┼────┤
3723 │                       No  Yes Table ID   │   1│   1│   1│   1│
3724 │                               Layer ID   │   1│   1│   1│   1│
3725 │                               Subtable ID│  11│  11│  12│  12│
3726 │                          ╶───────────────┼────┼────┼────┼────┤
3727 │                           No  Table ID   │   1│   1│   1│   1│
3728 │                               Layer ID   │   1│   1│   1│   1│
3729 │                               Subtable ID│  11│  11│  12│  12│
3730 │             ╶────────────────────────────┼────┼────┼────┼────┤
3731 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3732 │                               Layer ID   │   1│   1│   1│   1│
3733 │                               Subtable ID│  13│  13│  14│  14│
3734 │                          ╶───────────────┼────┼────┼────┼────┤
3735 │                           No  Table ID   │   1│   1│   1│   1│
3736 │                               Layer ID   │   1│   1│   1│   1│
3737 │                               Subtable ID│  13│  13│  14│  14│
3738 │                      ╶───────────────────┼────┼────┼────┼────┤
3739 │                       No  Yes Table ID   │   1│   1│   1│   1│
3740 │                               Layer ID   │   1│   1│   1│   1│
3741 │                               Subtable ID│  15│  15│  16│  16│
3742 │                          ╶───────────────┼────┼────┼────┼────┤
3743 │                           No  Table ID   │   1│   1│   1│   1│
3744 │                               Layer ID   │   1│   1│   1│   1│
3745 │                               Subtable ID│  15│  15│  16│  16│
3746 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3747
3748                           Custom Tables
3749 Female
3750 ╭──────────────────────────────────────────┬───────────────────╮
3751 │                                          │        QN27       │
3752 │                                          ├─────────┬─────────┤
3753 │                                          │   Yes   │    No   │
3754 │                                          ├─────────┼─────────┤
3755 │                                          │  QND7A  │  QND7A  │
3756 │                                          ├────┬────┼────┬────┤
3757 │                                          │ Yes│ No │ Yes│ No │
3758 │                                          ├────┼────┼────┼────┤
3759 │                                          │QN86│QN86│QN86│QN86│
3760 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3761 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3762 │                               Layer ID   │   2│   2│   2│   2│
3763 │                               Subtable ID│  17│  17│  18│  18│
3764 │                          ╶───────────────┼────┼────┼────┼────┤
3765 │                           No  Table ID   │   1│   1│   1│   1│
3766 │                               Layer ID   │   2│   2│   2│   2│
3767 │                               Subtable ID│  17│  17│  18│  18│
3768 │                      ╶───────────────────┼────┼────┼────┼────┤
3769 │                       No  Yes Table ID   │   1│   1│   1│   1│
3770 │                               Layer ID   │   2│   2│   2│   2│
3771 │                               Subtable ID│  19│  19│  20│  20│
3772 │                          ╶───────────────┼────┼────┼────┼────┤
3773 │                           No  Table ID   │   1│   1│   1│   1│
3774 │                               Layer ID   │   2│   2│   2│   2│
3775 │                               Subtable ID│  19│  19│  20│  20│
3776 │             ╶────────────────────────────┼────┼────┼────┼────┤
3777 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3778 │                               Layer ID   │   2│   2│   2│   2│
3779 │                               Subtable ID│  21│  21│  22│  22│
3780 │                          ╶───────────────┼────┼────┼────┼────┤
3781 │                           No  Table ID   │   1│   1│   1│   1│
3782 │                               Layer ID   │   2│   2│   2│   2│
3783 │                               Subtable ID│  21│  21│  22│  22│
3784 │                      ╶───────────────────┼────┼────┼────┼────┤
3785 │                       No  Yes Table ID   │   1│   1│   1│   1│
3786 │                               Layer ID   │   2│   2│   2│   2│
3787 │                               Subtable ID│  23│  23│  24│  24│
3788 │                          ╶───────────────┼────┼────┼────┼────┤
3789 │                           No  Table ID   │   1│   1│   1│   1│
3790 │                               Layer ID   │   2│   2│   2│   2│
3791 │                               Subtable ID│  23│  23│  24│  24│
3792 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3793 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3794 │                               Layer ID   │   2│   2│   2│   2│
3795 │                               Subtable ID│  25│  25│  26│  26│
3796 │                          ╶───────────────┼────┼────┼────┼────┤
3797 │                           No  Table ID   │   1│   1│   1│   1│
3798 │                               Layer ID   │   2│   2│   2│   2│
3799 │                               Subtable ID│  25│  25│  26│  26│
3800 │                      ╶───────────────────┼────┼────┼────┼────┤
3801 │                       No  Yes Table ID   │   1│   1│   1│   1│
3802 │                               Layer ID   │   2│   2│   2│   2│
3803 │                               Subtable ID│  27│  27│  28│  28│
3804 │                          ╶───────────────┼────┼────┼────┼────┤
3805 │                           No  Table ID   │   1│   1│   1│   1│
3806 │                               Layer ID   │   2│   2│   2│   2│
3807 │                               Subtable ID│  27│  27│  28│  28│
3808 │             ╶────────────────────────────┼────┼────┼────┼────┤
3809 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3810 │                               Layer ID   │   2│   2│   2│   2│
3811 │                               Subtable ID│  29│  29│  30│  30│
3812 │                          ╶───────────────┼────┼────┼────┼────┤
3813 │                           No  Table ID   │   1│   1│   1│   1│
3814 │                               Layer ID   │   2│   2│   2│   2│
3815 │                               Subtable ID│  29│  29│  30│  30│
3816 │                      ╶───────────────────┼────┼────┼────┼────┤
3817 │                       No  Yes Table ID   │   1│   1│   1│   1│
3818 │                               Layer ID   │   2│   2│   2│   2│
3819 │                               Subtable ID│  31│  31│  32│  32│
3820 │                          ╶───────────────┼────┼────┼────┼────┤
3821 │                           No  Table ID   │   1│   1│   1│   1│
3822 │                               Layer ID   │   2│   2│   2│   2│
3823 │                               Subtable ID│  31│  31│  32│  32│
3824 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3825
3826                           Custom Tables
3827 Male
3828 ╭───────────────────────────────────────────┬───────────────────╮
3829 │                                           │        QN27       │
3830 │                                           ├─────────┬─────────┤
3831 │                                           │   Yes   │    No   │
3832 │                                           ├─────────┼─────────┤
3833 │                                           │  QND7A  │  QND7A  │
3834 │                                           ├────┬────┼────┬────┤
3835 │                                           │ Yes│ No │ Yes│ No │
3836 │                                           ├────┼────┼────┼────┤
3837 │                                           │QN86│QN86│QN86│QN86│
3838 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3839 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   1│   1│   3│   3│
3840 │                               Layer Row ID│   1│   1│   1│   1│
3841 │                          ╶────────────────┼────┼────┼────┼────┤
3842 │                           No  Row ID      │   2│   2│   4│   4│
3843 │                               Layer Row ID│   2│   2│   2│   2│
3844 │                      ╶────────────────────┼────┼────┼────┼────┤
3845 │                       No  Yes Row ID      │   5│   5│   7│   7│
3846 │                               Layer Row ID│   3│   3│   3│   3│
3847 │                          ╶────────────────┼────┼────┼────┼────┤
3848 │                           No  Row ID      │   6│   6│   8│   8│
3849 │                               Layer Row ID│   4│   4│   4│   4│
3850 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3851 │              No  QN57 Yes Yes Row ID      │   9│   9│  11│  11│
3852 │                               Layer Row ID│   5│   5│   5│   5│
3853 │                          ╶────────────────┼────┼────┼────┼────┤
3854 │                           No  Row ID      │  10│  10│  12│  12│
3855 │                               Layer Row ID│   6│   6│   6│   6│
3856 │                      ╶────────────────────┼────┼────┼────┼────┤
3857 │                       No  Yes Row ID      │  13│  13│  15│  15│
3858 │                               Layer Row ID│   7│   7│   7│   7│
3859 │                          ╶────────────────┼────┼────┼────┼────┤
3860 │                           No  Row ID      │  14│  14│  16│  16│
3861 │                               Layer Row ID│   8│   8│   8│   8│
3862 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3863 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  19│  19│
3864 │                               Layer Row ID│   9│   9│   9│   9│
3865 │                          ╶────────────────┼────┼────┼────┼────┤
3866 │                           No  Row ID      │  18│  18│  20│  20│
3867 │                               Layer Row ID│  10│  10│  10│  10│
3868 │                      ╶────────────────────┼────┼────┼────┼────┤
3869 │                       No  Yes Row ID      │  21│  21│  23│  23│
3870 │                               Layer Row ID│  11│  11│  11│  11│
3871 │                          ╶────────────────┼────┼────┼────┼────┤
3872 │                           No  Row ID      │  22│  22│  24│  24│
3873 │                               Layer Row ID│  12│  12│  12│  12│
3874 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3875 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
3876 │                               Layer Row ID│  13│  13│  13│  13│
3877 │                          ╶────────────────┼────┼────┼────┼────┤
3878 │                           No  Row ID      │  26│  26│  28│  28│
3879 │                               Layer Row ID│  14│  14│  14│  14│
3880 │                      ╶────────────────────┼────┼────┼────┼────┤
3881 │                       No  Yes Row ID      │  29│  29│  31│  31│
3882 │                               Layer Row ID│  15│  15│  15│  15│
3883 │                          ╶────────────────┼────┼────┼────┼────┤
3884 │                           No  Row ID      │  30│  30│  32│  32│
3885 │                               Layer Row ID│  16│  16│  16│  16│
3886 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3887
3888                           Custom Tables
3889 Female
3890 ╭───────────────────────────────────────────┬───────────────────╮
3891 │                                           │        QN27       │
3892 │                                           ├─────────┬─────────┤
3893 │                                           │   Yes   │    No   │
3894 │                                           ├─────────┼─────────┤
3895 │                                           │  QND7A  │  QND7A  │
3896 │                                           ├────┬────┼────┬────┤
3897 │                                           │ Yes│ No │ Yes│ No │
3898 │                                           ├────┼────┼────┼────┤
3899 │                                           │QN86│QN86│QN86│QN86│
3900 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3901 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  33│  33│  35│  35│
3902 │                               Layer Row ID│  17│  17│  17│  17│
3903 │                          ╶────────────────┼────┼────┼────┼────┤
3904 │                           No  Row ID      │  34│  34│  36│  36│
3905 │                               Layer Row ID│  18│  18│  18│  18│
3906 │                      ╶────────────────────┼────┼────┼────┼────┤
3907 │                       No  Yes Row ID      │  37│  37│  39│  39│
3908 │                               Layer Row ID│  19│  19│  19│  19│
3909 │                          ╶────────────────┼────┼────┼────┼────┤
3910 │                           No  Row ID      │  38│  38│  40│  40│
3911 │                               Layer Row ID│  20│  20│  20│  20│
3912 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3913 │              No  QN57 Yes Yes Row ID      │  41│  41│  43│  43│
3914 │                               Layer Row ID│  21│  21│  21│  21│
3915 │                          ╶────────────────┼────┼────┼────┼────┤
3916 │                           No  Row ID      │  42│  42│  44│  44│
3917 │                               Layer Row ID│  22│  22│  22│  22│
3918 │                      ╶────────────────────┼────┼────┼────┼────┤
3919 │                       No  Yes Row ID      │  45│  45│  47│  47│
3920 │                               Layer Row ID│  23│  23│  23│  23│
3921 │                          ╶────────────────┼────┼────┼────┼────┤
3922 │                           No  Row ID      │  46│  46│  48│  48│
3923 │                               Layer Row ID│  24│  24│  24│  24│
3924 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3925 │     No  QN61 Yes QN57 Yes Yes Row ID      │  49│  49│  51│  51│
3926 │                               Layer Row ID│  25│  25│  25│  25│
3927 │                          ╶────────────────┼────┼────┼────┼────┤
3928 │                           No  Row ID      │  50│  50│  52│  52│
3929 │                               Layer Row ID│  26│  26│  26│  26│
3930 │                      ╶────────────────────┼────┼────┼────┼────┤
3931 │                       No  Yes Row ID      │  53│  53│  55│  55│
3932 │                               Layer Row ID│  27│  27│  27│  27│
3933 │                          ╶────────────────┼────┼────┼────┼────┤
3934 │                           No  Row ID      │  54│  54│  56│  56│
3935 │                               Layer Row ID│  28│  28│  28│  28│
3936 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3937 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
3938 │                               Layer Row ID│  29│  29│  29│  29│
3939 │                          ╶────────────────┼────┼────┼────┼────┤
3940 │                           No  Row ID      │  58│  58│  60│  60│
3941 │                               Layer Row ID│  30│  30│  30│  30│
3942 │                      ╶────────────────────┼────┼────┼────┼────┤
3943 │                       No  Yes Row ID      │  61│  61│  63│  63│
3944 │                               Layer Row ID│  31│  31│  31│  31│
3945 │                          ╶────────────────┼────┼────┼────┼────┤
3946 │                           No  Row ID      │  62│  62│  64│  64│
3947 │                               Layer Row ID│  32│  32│  32│  32│
3948 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3949
3950                             Custom Tables
3951 Male
3952 ╭──────────────────────────────────────────────┬───────────────────╮
3953 │                                              │        QN27       │
3954 │                                              ├─────────┬─────────┤
3955 │                                              │   Yes   │    No   │
3956 │                                              ├─────────┼─────────┤
3957 │                                              │  QND7A  │  QND7A  │
3958 │                                              ├────┬────┼────┬────┤
3959 │                                              │ Yes│ No │ Yes│ No │
3960 │                                              ├────┼────┼────┼────┤
3961 │                                              │QN86│QN86│QN86│QN86│
3962 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3963 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
3964 │                               Layer Column ID│   1│   2│   3│   4│
3965 │                          ╶───────────────────┼────┼────┼────┼────┤
3966 │                           No  Column ID      │   1│   2│   3│   4│
3967 │                               Layer Column ID│   1│   2│   3│   4│
3968 │                      ╶───────────────────────┼────┼────┼────┼────┤
3969 │                       No  Yes Column ID      │   5│   6│   7│   8│
3970 │                               Layer Column ID│   1│   2│   3│   4│
3971 │                          ╶───────────────────┼────┼────┼────┼────┤
3972 │                           No  Column ID      │   5│   6│   7│   8│
3973 │                               Layer Column ID│   1│   2│   3│   4│
3974 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3975 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
3976 │                               Layer Column ID│   1│   2│   3│   4│
3977 │                          ╶───────────────────┼────┼────┼────┼────┤
3978 │                           No  Column ID      │   9│  10│  11│  12│
3979 │                               Layer Column ID│   1│   2│   3│   4│
3980 │                      ╶───────────────────────┼────┼────┼────┼────┤
3981 │                       No  Yes Column ID      │  13│  14│  15│  16│
3982 │                               Layer Column ID│   1│   2│   3│   4│
3983 │                          ╶───────────────────┼────┼────┼────┼────┤
3984 │                           No  Column ID      │  13│  14│  15│  16│
3985 │                               Layer Column ID│   1│   2│   3│   4│
3986 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3987 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
3988 │                               Layer Column ID│   1│   2│   3│   4│
3989 │                          ╶───────────────────┼────┼────┼────┼────┤
3990 │                           No  Column ID      │  17│  18│  19│  20│
3991 │                               Layer Column ID│   1│   2│   3│   4│
3992 │                      ╶───────────────────────┼────┼────┼────┼────┤
3993 │                       No  Yes Column ID      │  21│  22│  23│  24│
3994 │                               Layer Column ID│   1│   2│   3│   4│
3995 │                          ╶───────────────────┼────┼────┼────┼────┤
3996 │                           No  Column ID      │  21│  22│  23│  24│
3997 │                               Layer Column ID│   1│   2│   3│   4│
3998 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3999 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
4000 │                               Layer Column ID│   1│   2│   3│   4│
4001 │                          ╶───────────────────┼────┼────┼────┼────┤
4002 │                           No  Column ID      │  25│  26│  27│  28│
4003 │                               Layer Column ID│   1│   2│   3│   4│
4004 │                      ╶───────────────────────┼────┼────┼────┼────┤
4005 │                       No  Yes Column ID      │  29│  30│  31│  32│
4006 │                               Layer Column ID│   1│   2│   3│   4│
4007 │                          ╶───────────────────┼────┼────┼────┼────┤
4008 │                           No  Column ID      │  29│  30│  31│  32│
4009 │                               Layer Column ID│   1│   2│   3│   4│
4010 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4011
4012                             Custom Tables
4013 Female
4014 ╭──────────────────────────────────────────────┬───────────────────╮
4015 │                                              │        QN27       │
4016 │                                              ├─────────┬─────────┤
4017 │                                              │   Yes   │    No   │
4018 │                                              ├─────────┼─────────┤
4019 │                                              │  QND7A  │  QND7A  │
4020 │                                              ├────┬────┼────┬────┤
4021 │                                              │ Yes│ No │ Yes│ No │
4022 │                                              ├────┼────┼────┼────┤
4023 │                                              │QN86│QN86│QN86│QN86│
4024 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
4025 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
4026 │                               Layer Column ID│   5│   6│   7│   8│
4027 │                          ╶───────────────────┼────┼────┼────┼────┤
4028 │                           No  Column ID      │  33│  34│  35│  36│
4029 │                               Layer Column ID│   5│   6│   7│   8│
4030 │                      ╶───────────────────────┼────┼────┼────┼────┤
4031 │                       No  Yes Column ID      │  37│  38│  39│  40│
4032 │                               Layer Column ID│   5│   6│   7│   8│
4033 │                          ╶───────────────────┼────┼────┼────┼────┤
4034 │                           No  Column ID      │  37│  38│  39│  40│
4035 │                               Layer Column ID│   5│   6│   7│   8│
4036 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4037 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
4038 │                               Layer Column ID│   5│   6│   7│   8│
4039 │                          ╶───────────────────┼────┼────┼────┼────┤
4040 │                           No  Column ID      │  41│  42│  43│  44│
4041 │                               Layer Column ID│   5│   6│   7│   8│
4042 │                      ╶───────────────────────┼────┼────┼────┼────┤
4043 │                       No  Yes Column ID      │  45│  46│  47│  48│
4044 │                               Layer Column ID│   5│   6│   7│   8│
4045 │                          ╶───────────────────┼────┼────┼────┼────┤
4046 │                           No  Column ID      │  45│  46│  47│  48│
4047 │                               Layer Column ID│   5│   6│   7│   8│
4048 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4049 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
4050 │                               Layer Column ID│   5│   6│   7│   8│
4051 │                          ╶───────────────────┼────┼────┼────┼────┤
4052 │                           No  Column ID      │  49│  50│  51│  52│
4053 │                               Layer Column ID│   5│   6│   7│   8│
4054 │                      ╶───────────────────────┼────┼────┼────┼────┤
4055 │                       No  Yes Column ID      │  53│  54│  55│  56│
4056 │                               Layer Column ID│   5│   6│   7│   8│
4057 │                          ╶───────────────────┼────┼────┼────┼────┤
4058 │                           No  Column ID      │  53│  54│  55│  56│
4059 │                               Layer Column ID│   5│   6│   7│   8│
4060 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4061 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
4062 │                               Layer Column ID│   5│   6│   7│   8│
4063 │                          ╶───────────────────┼────┼────┼────┼────┤
4064 │                           No  Column ID      │  57│  58│  59│  60│
4065 │                               Layer Column ID│   5│   6│   7│   8│
4066 │                      ╶───────────────────────┼────┼────┼────┼────┤
4067 │                       No  Yes Column ID      │  61│  62│  63│  64│
4068 │                               Layer Column ID│   5│   6│   7│   8│
4069 │                          ╶───────────────────┼────┼────┼────┼────┤
4070 │                           No  Column ID      │  61│  62│  63│  64│
4071 │                               Layer Column ID│   5│   6│   7│   8│
4072 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4073 ])
4074 AT_CLEANUP
4075
4076 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
4077 AT_KEYWORDS([ROWLABELS LAYER])
4078 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
4079 AT_DATA([ctables.sps],
4080 [[GET 'nhtsa.sav'.
4081 CTABLES
4082     /VLABELS VARIABLES=ALL DISPLAY=NAME
4083     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4084     /SLABELS POSITION=ROW
4085     /CLABELS ROWLABELS=LAYER
4086     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4087     /SLABELS POSITION=ROW
4088     /CLABELS ROWLABELS=LAYER
4089     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4090     /SLABELS POSITION=ROW
4091     /CLABELS ROWLABELS=LAYER.
4092 ]])
4093 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4094                           Custom Tables
4095 Male
4096 Yes
4097 ╭──────────────────────────────────┬───────────────────────────╮
4098 │                                  │            QN27           │
4099 │                                  ├─────────────┬─────────────┤
4100 │                                  │     Yes     │      No     │
4101 │                                  ├─────────────┼─────────────┤
4102 │                                  │    QND7A    │    QND7A    │
4103 │                                  ├──────┬──────┼──────┬──────┤
4104 │                                  │  Yes │  No  │  Yes │  No  │
4105 │                                  ├──────┼──────┼──────┼──────┤
4106 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4107 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4108 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4109 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4110 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4111 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4112 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4113 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4114 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4115 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4116 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4117 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4118 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4119 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4120 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4121 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4122 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4123 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4124 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4125 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4126
4127                           Custom Tables
4128 Male
4129 No
4130 ╭──────────────────────────────────┬───────────────────────────╮
4131 │                                  │            QN27           │
4132 │                                  ├─────────────┬─────────────┤
4133 │                                  │     Yes     │      No     │
4134 │                                  ├─────────────┼─────────────┤
4135 │                                  │    QND7A    │    QND7A    │
4136 │                                  ├──────┬──────┼──────┬──────┤
4137 │                                  │  Yes │  No  │  Yes │  No  │
4138 │                                  ├──────┼──────┼──────┼──────┤
4139 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4140 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4141 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4142 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4143 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4144 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4145 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4146 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4147 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4148 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4149 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4150 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4151 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4152 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4153 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4154 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4155 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4156 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4157 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4158 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4159
4160                           Custom Tables
4161 Female
4162 Yes
4163 ╭──────────────────────────────────┬───────────────────────────╮
4164 │                                  │            QN27           │
4165 │                                  ├─────────────┬─────────────┤
4166 │                                  │     Yes     │      No     │
4167 │                                  ├─────────────┼─────────────┤
4168 │                                  │    QND7A    │    QND7A    │
4169 │                                  ├──────┬──────┼──────┬──────┤
4170 │                                  │  Yes │  No  │  Yes │  No  │
4171 │                                  ├──────┼──────┼──────┼──────┤
4172 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4173 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4174 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4175 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4176 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4177 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4178 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4179 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4180 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4181 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4182 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4183 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4184 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4185 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4186 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4187 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4188 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4189 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4190 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4191 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4192
4193                           Custom Tables
4194 Female
4195 No
4196 ╭──────────────────────────────────┬───────────────────────────╮
4197 │                                  │            QN27           │
4198 │                                  ├─────────────┬─────────────┤
4199 │                                  │     Yes     │      No     │
4200 │                                  ├─────────────┼─────────────┤
4201 │                                  │    QND7A    │    QND7A    │
4202 │                                  ├──────┬──────┼──────┬──────┤
4203 │                                  │  Yes │  No  │  Yes │  No  │
4204 │                                  ├──────┼──────┼──────┼──────┤
4205 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4206 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4207 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4208 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4209 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4210 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4211 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4212 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4213 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4214 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4215 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4216 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4217 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4218 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4219 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4220 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4221 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4222 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4223 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4224 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4225
4226                           Custom Tables
4227 Male
4228 Yes
4229 ╭───────────────────────────────────┬───────────────────────────╮
4230 │                                   │            QN27           │
4231 │                                   ├─────────────┬─────────────┤
4232 │                                   │     Yes     │      No     │
4233 │                                   ├─────────────┼─────────────┤
4234 │                                   │    QND7A    │    QND7A    │
4235 │                                   ├──────┬──────┼──────┬──────┤
4236 │                                   │  Yes │  No  │  Yes │  No  │
4237 │                                   ├──────┼──────┼──────┼──────┤
4238 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4239 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4240 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4241 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4242 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4243 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4244 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4245 │              No  QN57 Row ID      │  9│ 9│ 11│11│ 13│13│ 15│15│
4246 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4247 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4248 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 19│19│ 21│21│ 23│23│
4249 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
4250 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4251 │              No  QN57 Row ID      │ 25│25│ 27│27│ 29│29│ 31│31│
4252 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
4253 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4254
4255                           Custom Tables
4256 Male
4257 No
4258 ╭───────────────────────────────────┬───────────────────────────╮
4259 │                                   │            QN27           │
4260 │                                   ├─────────────┬─────────────┤
4261 │                                   │     Yes     │      No     │
4262 │                                   ├─────────────┼─────────────┤
4263 │                                   │    QND7A    │    QND7A    │
4264 │                                   ├──────┬──────┼──────┬──────┤
4265 │                                   │  Yes │  No  │  Yes │  No  │
4266 │                                   ├──────┼──────┼──────┼──────┤
4267 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4268 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4269 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4270 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4271 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4272 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4273 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4274 │              No  QN57 Row ID      │ 10│10│ 12│12│ 14│14│ 16│16│
4275 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4276 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4277 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 20│20│ 22│22│ 24│24│
4278 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4279 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4280 │              No  QN57 Row ID      │ 26│26│ 28│28│ 30│30│ 32│32│
4281 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4282 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4283
4284                           Custom Tables
4285 Female
4286 Yes
4287 ╭───────────────────────────────────┬───────────────────────────╮
4288 │                                   │            QN27           │
4289 │                                   ├─────────────┬─────────────┤
4290 │                                   │     Yes     │      No     │
4291 │                                   ├─────────────┼─────────────┤
4292 │                                   │    QND7A    │    QND7A    │
4293 │                                   ├──────┬──────┼──────┬──────┤
4294 │                                   │  Yes │  No  │  Yes │  No  │
4295 │                                   ├──────┼──────┼──────┼──────┤
4296 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4297 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4298 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4299 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4300 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 39│39│
4301 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4302 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4303 │              No  QN57 Row ID      │ 41│41│ 43│43│ 45│45│ 47│47│
4304 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4305 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4306 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 51│51│ 53│53│ 55│55│
4307 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4308 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4309 │              No  QN57 Row ID      │ 57│57│ 59│59│ 61│61│ 63│63│
4310 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4311 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4312
4313                           Custom Tables
4314 Female
4315 No
4316 ╭───────────────────────────────────┬───────────────────────────╮
4317 │                                   │            QN27           │
4318 │                                   ├─────────────┬─────────────┤
4319 │                                   │     Yes     │      No     │
4320 │                                   ├─────────────┼─────────────┤
4321 │                                   │    QND7A    │    QND7A    │
4322 │                                   ├──────┬──────┼──────┬──────┤
4323 │                                   │  Yes │  No  │  Yes │  No  │
4324 │                                   ├──────┼──────┼──────┼──────┤
4325 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4326 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4327 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4328 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4329 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 40│40│
4330 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4331 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4332 │              No  QN57 Row ID      │ 42│42│ 44│44│ 46│46│ 48│48│
4333 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4334 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4335 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 52│52│ 54│54│ 56│56│
4336 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4337 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4338 │              No  QN57 Row ID      │ 58│58│ 60│60│ 62│62│ 64│64│
4339 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4340 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4341
4342                             Custom Tables
4343 Male
4344 Yes
4345 ╭──────────────────────────────────────┬───────────────────────────╮
4346 │                                      │            QN27           │
4347 │                                      ├─────────────┬─────────────┤
4348 │                                      │     Yes     │      No     │
4349 │                                      ├─────────────┼─────────────┤
4350 │                                      │    QND7A    │    QND7A    │
4351 │                                      ├──────┬──────┼──────┬──────┤
4352 │                                      │  Yes │  No  │  Yes │  No  │
4353 │                                      ├──────┼──────┼──────┼──────┤
4354 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4355 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4356 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4357 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4358 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4359 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4360 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4361 │              No  QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4362 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4363 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4364 │     No  QN61 Yes QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4365 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4366 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4367 │              No  QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4368 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4369 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4370
4371                             Custom Tables
4372 Male
4373 No
4374 ╭──────────────────────────────────────┬───────────────────────────╮
4375 │                                      │            QN27           │
4376 │                                      ├─────────────┬─────────────┤
4377 │                                      │     Yes     │      No     │
4378 │                                      ├─────────────┼─────────────┤
4379 │                                      │    QND7A    │    QND7A    │
4380 │                                      ├──────┬──────┼──────┬──────┤
4381 │                                      │  Yes │  No  │  Yes │  No  │
4382 │                                      ├──────┼──────┼──────┼──────┤
4383 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4384 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4385 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4386 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4387 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4388 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4389 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4390 │              No  QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4391 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4392 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4393 │     No  QN61 Yes QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4394 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4395 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4396 │              No  QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4397 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4398 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4399
4400                             Custom Tables
4401 Female
4402 Yes
4403 ╭──────────────────────────────────────┬───────────────────────────╮
4404 │                                      │            QN27           │
4405 │                                      ├─────────────┬─────────────┤
4406 │                                      │     Yes     │      No     │
4407 │                                      ├─────────────┼─────────────┤
4408 │                                      │    QND7A    │    QND7A    │
4409 │                                      ├──────┬──────┼──────┬──────┤
4410 │                                      │  Yes │  No  │  Yes │  No  │
4411 │                                      ├──────┼──────┼──────┼──────┤
4412 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4413 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4414 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4415 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4416 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4417 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4418 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4419 │              No  QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4420 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4421 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4422 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4423 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4424 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4425 │              No  QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4426 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4427 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4428
4429                             Custom Tables
4430 Female
4431 No
4432 ╭──────────────────────────────────────┬───────────────────────────╮
4433 │                                      │            QN27           │
4434 │                                      ├─────────────┬─────────────┤
4435 │                                      │     Yes     │      No     │
4436 │                                      ├─────────────┼─────────────┤
4437 │                                      │    QND7A    │    QND7A    │
4438 │                                      ├──────┬──────┼──────┬──────┤
4439 │                                      │  Yes │  No  │  Yes │  No  │
4440 │                                      ├──────┼──────┼──────┼──────┤
4441 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4442 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4443 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4444 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4445 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4446 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4447 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4448 │              No  QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4449 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4450 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4451 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4452 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4453 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4454 │              No  QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4455 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4456 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4457 ])
4458 AT_CLEANUP
4459
4460 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4461 AT_KEYWORDS([COLLABELS LAYER])
4462 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
4463 AT_DATA([ctables.sps],
4464 [[GET 'nhtsa.sav'.
4465 CTABLES
4466     /VLABELS VARIABLES=ALL DISPLAY=NAME
4467     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4468     /SLABELS POSITION=ROW
4469     /CLABELS COLLABELS=LAYER
4470     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4471     /SLABELS POSITION=ROW
4472     /CLABELS COLLABELS=LAYER
4473     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4474     /SLABELS POSITION=ROW
4475     /CLABELS COLLABELS=LAYER.
4476 ]])
4477 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4478                         Custom Tables
4479 Male
4480 Yes
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 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4493 │                           Layer ID   │   1│   1│   1│   1│
4494 │                           Subtable ID│   1│   1│   3│   3│
4495 │                      ╶───────────────┼────┼────┼────┼────┤
4496 │                       No  Table ID   │   1│   1│   1│   1│
4497 │                           Layer ID   │   1│   1│   1│   1│
4498 │                           Subtable ID│   1│   1│   3│   3│
4499 │             ╶────────────────────────┼────┼────┼────┼────┤
4500 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4501 │                           Layer ID   │   1│   1│   1│   1│
4502 │                           Subtable ID│   5│   5│   7│   7│
4503 │                      ╶───────────────┼────┼────┼────┼────┤
4504 │                       No  Table ID   │   1│   1│   1│   1│
4505 │                           Layer ID   │   1│   1│   1│   1│
4506 │                           Subtable ID│   5│   5│   7│   7│
4507 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4508 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4509 │                           Layer ID   │   1│   1│   1│   1│
4510 │                           Subtable ID│   9│   9│  11│  11│
4511 │                      ╶───────────────┼────┼────┼────┼────┤
4512 │                       No  Table ID   │   1│   1│   1│   1│
4513 │                           Layer ID   │   1│   1│   1│   1│
4514 │                           Subtable ID│   9│   9│  11│  11│
4515 │             ╶────────────────────────┼────┼────┼────┼────┤
4516 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4517 │                           Layer ID   │   1│   1│   1│   1│
4518 │                           Subtable ID│  13│  13│  15│  15│
4519 │                      ╶───────────────┼────┼────┼────┼────┤
4520 │                       No  Table ID   │   1│   1│   1│   1│
4521 │                           Layer ID   │   1│   1│   1│   1│
4522 │                           Subtable ID│  13│  13│  15│  15│
4523 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4524
4525                         Custom Tables
4526 Male
4527 No
4528 ╭──────────────────────────────────────┬───────────────────╮
4529 │                                      │        QN27       │
4530 │                                      ├─────────┬─────────┤
4531 │                                      │   Yes   │    No   │
4532 │                                      ├─────────┼─────────┤
4533 │                                      │  QND7A  │  QND7A  │
4534 │                                      ├────┬────┼────┬────┤
4535 │                                      │ Yes│ No │ Yes│ No │
4536 │                                      ├────┼────┼────┼────┤
4537 │                                      │QN86│QN86│QN86│QN86│
4538 ├──────────────────────────────────────┼────┼────┼────┼────┤
4539 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4540 │                           Layer ID   │   2│   2│   2│   2│
4541 │                           Subtable ID│   2│   2│   4│   4│
4542 │                      ╶───────────────┼────┼────┼────┼────┤
4543 │                       No  Table ID   │   1│   1│   1│   1│
4544 │                           Layer ID   │   2│   2│   2│   2│
4545 │                           Subtable ID│   2│   2│   4│   4│
4546 │             ╶────────────────────────┼────┼────┼────┼────┤
4547 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4548 │                           Layer ID   │   2│   2│   2│   2│
4549 │                           Subtable ID│   6│   6│   8│   8│
4550 │                      ╶───────────────┼────┼────┼────┼────┤
4551 │                       No  Table ID   │   1│   1│   1│   1│
4552 │                           Layer ID   │   2│   2│   2│   2│
4553 │                           Subtable ID│   6│   6│   8│   8│
4554 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4555 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4556 │                           Layer ID   │   2│   2│   2│   2│
4557 │                           Subtable ID│  10│  10│  12│  12│
4558 │                      ╶───────────────┼────┼────┼────┼────┤
4559 │                       No  Table ID   │   1│   1│   1│   1│
4560 │                           Layer ID   │   2│   2│   2│   2│
4561 │                           Subtable ID│  10│  10│  12│  12│
4562 │             ╶────────────────────────┼────┼────┼────┼────┤
4563 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4564 │                           Layer ID   │   2│   2│   2│   2│
4565 │                           Subtable ID│  14│  14│  16│  16│
4566 │                      ╶───────────────┼────┼────┼────┼────┤
4567 │                       No  Table ID   │   1│   1│   1│   1│
4568 │                           Layer ID   │   2│   2│   2│   2│
4569 │                           Subtable ID│  14│  14│  16│  16│
4570 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4571
4572                         Custom Tables
4573 Female
4574 Yes
4575 ╭──────────────────────────────────────┬───────────────────╮
4576 │                                      │        QN27       │
4577 │                                      ├─────────┬─────────┤
4578 │                                      │   Yes   │    No   │
4579 │                                      ├─────────┼─────────┤
4580 │                                      │  QND7A  │  QND7A  │
4581 │                                      ├────┬────┼────┬────┤
4582 │                                      │ Yes│ No │ Yes│ No │
4583 │                                      ├────┼────┼────┼────┤
4584 │                                      │QN86│QN86│QN86│QN86│
4585 ├──────────────────────────────────────┼────┼────┼────┼────┤
4586 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4587 │                           Layer ID   │   3│   3│   3│   3│
4588 │                           Subtable ID│  17│  17│  19│  19│
4589 │                      ╶───────────────┼────┼────┼────┼────┤
4590 │                       No  Table ID   │   1│   1│   1│   1│
4591 │                           Layer ID   │   3│   3│   3│   3│
4592 │                           Subtable ID│  17│  17│  19│  19│
4593 │             ╶────────────────────────┼────┼────┼────┼────┤
4594 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4595 │                           Layer ID   │   3│   3│   3│   3│
4596 │                           Subtable ID│  21│  21│  23│  23│
4597 │                      ╶───────────────┼────┼────┼────┼────┤
4598 │                       No  Table ID   │   1│   1│   1│   1│
4599 │                           Layer ID   │   3│   3│   3│   3│
4600 │                           Subtable ID│  21│  21│  23│  23│
4601 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4602 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4603 │                           Layer ID   │   3│   3│   3│   3│
4604 │                           Subtable ID│  25│  25│  27│  27│
4605 │                      ╶───────────────┼────┼────┼────┼────┤
4606 │                       No  Table ID   │   1│   1│   1│   1│
4607 │                           Layer ID   │   3│   3│   3│   3│
4608 │                           Subtable ID│  25│  25│  27│  27│
4609 │             ╶────────────────────────┼────┼────┼────┼────┤
4610 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4611 │                           Layer ID   │   3│   3│   3│   3│
4612 │                           Subtable ID│  29│  29│  31│  31│
4613 │                      ╶───────────────┼────┼────┼────┼────┤
4614 │                       No  Table ID   │   1│   1│   1│   1│
4615 │                           Layer ID   │   3│   3│   3│   3│
4616 │                           Subtable ID│  29│  29│  31│  31│
4617 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4618
4619                         Custom Tables
4620 Female
4621 No
4622 ╭──────────────────────────────────────┬───────────────────╮
4623 │                                      │        QN27       │
4624 │                                      ├─────────┬─────────┤
4625 │                                      │   Yes   │    No   │
4626 │                                      ├─────────┼─────────┤
4627 │                                      │  QND7A  │  QND7A  │
4628 │                                      ├────┬────┼────┬────┤
4629 │                                      │ Yes│ No │ Yes│ No │
4630 │                                      ├────┼────┼────┼────┤
4631 │                                      │QN86│QN86│QN86│QN86│
4632 ├──────────────────────────────────────┼────┼────┼────┼────┤
4633 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4634 │                           Layer ID   │   4│   4│   4│   4│
4635 │                           Subtable ID│  18│  18│  20│  20│
4636 │                      ╶───────────────┼────┼────┼────┼────┤
4637 │                       No  Table ID   │   1│   1│   1│   1│
4638 │                           Layer ID   │   4│   4│   4│   4│
4639 │                           Subtable ID│  18│  18│  20│  20│
4640 │             ╶────────────────────────┼────┼────┼────┼────┤
4641 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4642 │                           Layer ID   │   4│   4│   4│   4│
4643 │                           Subtable ID│  22│  22│  24│  24│
4644 │                      ╶───────────────┼────┼────┼────┼────┤
4645 │                       No  Table ID   │   1│   1│   1│   1│
4646 │                           Layer ID   │   4│   4│   4│   4│
4647 │                           Subtable ID│  22│  22│  24│  24│
4648 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4649 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4650 │                           Layer ID   │   4│   4│   4│   4│
4651 │                           Subtable ID│  26│  26│  28│  28│
4652 │                      ╶───────────────┼────┼────┼────┼────┤
4653 │                       No  Table ID   │   1│   1│   1│   1│
4654 │                           Layer ID   │   4│   4│   4│   4│
4655 │                           Subtable ID│  26│  26│  28│  28│
4656 │             ╶────────────────────────┼────┼────┼────┼────┤
4657 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4658 │                           Layer ID   │   4│   4│   4│   4│
4659 │                           Subtable ID│  30│  30│  32│  32│
4660 │                      ╶───────────────┼────┼────┼────┼────┤
4661 │                       No  Table ID   │   1│   1│   1│   1│
4662 │                           Layer ID   │   4│   4│   4│   4│
4663 │                           Subtable ID│  30│  30│  32│  32│
4664 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4665
4666                         Custom Tables
4667 Male
4668 Yes
4669 ╭───────────────────────────────────────┬───────────────────╮
4670 │                                       │        QN27       │
4671 │                                       ├─────────┬─────────┤
4672 │                                       │   Yes   │    No   │
4673 │                                       ├─────────┼─────────┤
4674 │                                       │  QND7A  │  QND7A  │
4675 │                                       ├────┬────┼────┬────┤
4676 │                                       │ Yes│ No │ Yes│ No │
4677 │                                       ├────┼────┼────┼────┤
4678 │                                       │QN86│QN86│QN86│QN86│
4679 ├───────────────────────────────────────┼────┼────┼────┼────┤
4680 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4681 │                           Layer Row ID│   1│   1│   1│   1│
4682 │                      ╶────────────────┼────┼────┼────┼────┤
4683 │                       No  Row ID      │   5│   5│   7│   7│
4684 │                           Layer Row ID│   3│   3│   3│   3│
4685 │             ╶─────────────────────────┼────┼────┼────┼────┤
4686 │              No  QN57 Yes Row ID      │   9│   9│  11│  11│
4687 │                           Layer Row ID│   5│   5│   5│   5│
4688 │                      ╶────────────────┼────┼────┼────┼────┤
4689 │                       No  Row ID      │  13│  13│  15│  15│
4690 │                           Layer Row ID│   7│   7│   7│   7│
4691 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4692 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  19│  19│
4693 │                           Layer Row ID│   9│   9│   9│   9│
4694 │                      ╶────────────────┼────┼────┼────┼────┤
4695 │                       No  Row ID      │  21│  21│  23│  23│
4696 │                           Layer Row ID│  11│  11│  11│  11│
4697 │             ╶─────────────────────────┼────┼────┼────┼────┤
4698 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4699 │                           Layer Row ID│  13│  13│  13│  13│
4700 │                      ╶────────────────┼────┼────┼────┼────┤
4701 │                       No  Row ID      │  29│  29│  31│  31│
4702 │                           Layer Row ID│  15│  15│  15│  15│
4703 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4704
4705                         Custom Tables
4706 Male
4707 No
4708 ╭───────────────────────────────────────┬───────────────────╮
4709 │                                       │        QN27       │
4710 │                                       ├─────────┬─────────┤
4711 │                                       │   Yes   │    No   │
4712 │                                       ├─────────┼─────────┤
4713 │                                       │  QND7A  │  QND7A  │
4714 │                                       ├────┬────┼────┬────┤
4715 │                                       │ Yes│ No │ Yes│ No │
4716 │                                       ├────┼────┼────┼────┤
4717 │                                       │QN86│QN86│QN86│QN86│
4718 ├───────────────────────────────────────┼────┼────┼────┼────┤
4719 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4720 │                           Layer Row ID│   2│   2│   2│   2│
4721 │                      ╶────────────────┼────┼────┼────┼────┤
4722 │                       No  Row ID      │   6│   6│   8│   8│
4723 │                           Layer Row ID│   4│   4│   4│   4│
4724 │             ╶─────────────────────────┼────┼────┼────┼────┤
4725 │              No  QN57 Yes Row ID      │  10│  10│  12│  12│
4726 │                           Layer Row ID│   6│   6│   6│   6│
4727 │                      ╶────────────────┼────┼────┼────┼────┤
4728 │                       No  Row ID      │  14│  14│  16│  16│
4729 │                           Layer Row ID│   8│   8│   8│   8│
4730 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4731 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  20│  20│
4732 │                           Layer Row ID│  10│  10│  10│  10│
4733 │                      ╶────────────────┼────┼────┼────┼────┤
4734 │                       No  Row ID      │  22│  22│  24│  24│
4735 │                           Layer Row ID│  12│  12│  12│  12│
4736 │             ╶─────────────────────────┼────┼────┼────┼────┤
4737 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4738 │                           Layer Row ID│  14│  14│  14│  14│
4739 │                      ╶────────────────┼────┼────┼────┼────┤
4740 │                       No  Row ID      │  30│  30│  32│  32│
4741 │                           Layer Row ID│  16│  16│  16│  16│
4742 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4743
4744                         Custom Tables
4745 Female
4746 Yes
4747 ╭───────────────────────────────────────┬───────────────────╮
4748 │                                       │        QN27       │
4749 │                                       ├─────────┬─────────┤
4750 │                                       │   Yes   │    No   │
4751 │                                       ├─────────┼─────────┤
4752 │                                       │  QND7A  │  QND7A  │
4753 │                                       ├────┬────┼────┬────┤
4754 │                                       │ Yes│ No │ Yes│ No │
4755 │                                       ├────┼────┼────┼────┤
4756 │                                       │QN86│QN86│QN86│QN86│
4757 ├───────────────────────────────────────┼────┼────┼────┼────┤
4758 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  35│  35│
4759 │                           Layer Row ID│  17│  17│  17│  17│
4760 │                      ╶────────────────┼────┼────┼────┼────┤
4761 │                       No  Row ID      │  37│  37│  39│  39│
4762 │                           Layer Row ID│  19│  19│  19│  19│
4763 │             ╶─────────────────────────┼────┼────┼────┼────┤
4764 │              No  QN57 Yes Row ID      │  41│  41│  43│  43│
4765 │                           Layer Row ID│  21│  21│  21│  21│
4766 │                      ╶────────────────┼────┼────┼────┼────┤
4767 │                       No  Row ID      │  45│  45│  47│  47│
4768 │                           Layer Row ID│  23│  23│  23│  23│
4769 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4770 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  51│  51│
4771 │                           Layer Row ID│  25│  25│  25│  25│
4772 │                      ╶────────────────┼────┼────┼────┼────┤
4773 │                       No  Row ID      │  53│  53│  55│  55│
4774 │                           Layer Row ID│  27│  27│  27│  27│
4775 │             ╶─────────────────────────┼────┼────┼────┼────┤
4776 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4777 │                           Layer Row ID│  29│  29│  29│  29│
4778 │                      ╶────────────────┼────┼────┼────┼────┤
4779 │                       No  Row ID      │  61│  61│  63│  63│
4780 │                           Layer Row ID│  31│  31│  31│  31│
4781 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4782
4783                         Custom Tables
4784 Female
4785 No
4786 ╭───────────────────────────────────────┬───────────────────╮
4787 │                                       │        QN27       │
4788 │                                       ├─────────┬─────────┤
4789 │                                       │   Yes   │    No   │
4790 │                                       ├─────────┼─────────┤
4791 │                                       │  QND7A  │  QND7A  │
4792 │                                       ├────┬────┼────┬────┤
4793 │                                       │ Yes│ No │ Yes│ No │
4794 │                                       ├────┼────┼────┼────┤
4795 │                                       │QN86│QN86│QN86│QN86│
4796 ├───────────────────────────────────────┼────┼────┼────┼────┤
4797 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  36│  36│
4798 │                           Layer Row ID│  18│  18│  18│  18│
4799 │                      ╶────────────────┼────┼────┼────┼────┤
4800 │                       No  Row ID      │  38│  38│  40│  40│
4801 │                           Layer Row ID│  20│  20│  20│  20│
4802 │             ╶─────────────────────────┼────┼────┼────┼────┤
4803 │              No  QN57 Yes Row ID      │  42│  42│  44│  44│
4804 │                           Layer Row ID│  22│  22│  22│  22│
4805 │                      ╶────────────────┼────┼────┼────┼────┤
4806 │                       No  Row ID      │  46│  46│  48│  48│
4807 │                           Layer Row ID│  24│  24│  24│  24│
4808 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4809 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  52│  52│
4810 │                           Layer Row ID│  26│  26│  26│  26│
4811 │                      ╶────────────────┼────┼────┼────┼────┤
4812 │                       No  Row ID      │  54│  54│  56│  56│
4813 │                           Layer Row ID│  28│  28│  28│  28│
4814 │             ╶─────────────────────────┼────┼────┼────┼────┤
4815 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
4816 │                           Layer Row ID│  30│  30│  30│  30│
4817 │                      ╶────────────────┼────┼────┼────┼────┤
4818 │                       No  Row ID      │  62│  62│  64│  64│
4819 │                           Layer Row ID│  32│  32│  32│  32│
4820 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4821
4822                           Custom Tables
4823 Male
4824 Yes
4825 ╭──────────────────────────────────────────┬───────────────────╮
4826 │                                          │        QN27       │
4827 │                                          ├─────────┬─────────┤
4828 │                                          │   Yes   │    No   │
4829 │                                          ├─────────┼─────────┤
4830 │                                          │  QND7A  │  QND7A  │
4831 │                                          ├────┬────┼────┬────┤
4832 │                                          │ Yes│ No │ Yes│ No │
4833 │                                          ├────┼────┼────┼────┤
4834 │                                          │QN86│QN86│QN86│QN86│
4835 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4836 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   7│
4837 │                           Layer Column ID│   1│   3│   5│   7│
4838 │                      ╶───────────────────┼────┼────┼────┼────┤
4839 │                       No  Column ID      │   1│   3│   5│   7│
4840 │                           Layer Column ID│   1│   3│   5│   7│
4841 │             ╶────────────────────────────┼────┼────┼────┼────┤
4842 │              No  QN57 Yes Column ID      │   9│  11│  13│  15│
4843 │                           Layer Column ID│   1│   3│   5│   7│
4844 │                      ╶───────────────────┼────┼────┼────┼────┤
4845 │                       No  Column ID      │   9│  11│  13│  15│
4846 │                           Layer Column ID│   1│   3│   5│   7│
4847 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4848 │     No  QN61 Yes QN57 Yes Column ID      │  17│  19│  21│  23│
4849 │                           Layer Column ID│   1│   3│   5│   7│
4850 │                      ╶───────────────────┼────┼────┼────┼────┤
4851 │                       No  Column ID      │  17│  19│  21│  23│
4852 │                           Layer Column ID│   1│   3│   5│   7│
4853 │             ╶────────────────────────────┼────┼────┼────┼────┤
4854 │              No  QN57 Yes Column ID      │  25│  27│  29│  31│
4855 │                           Layer Column ID│   1│   3│   5│   7│
4856 │                      ╶───────────────────┼────┼────┼────┼────┤
4857 │                       No  Column ID      │  25│  27│  29│  31│
4858 │                           Layer Column ID│   1│   3│   5│   7│
4859 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4860
4861                           Custom Tables
4862 Male
4863 No
4864 ╭──────────────────────────────────────────┬───────────────────╮
4865 │                                          │        QN27       │
4866 │                                          ├─────────┬─────────┤
4867 │                                          │   Yes   │    No   │
4868 │                                          ├─────────┼─────────┤
4869 │                                          │  QND7A  │  QND7A  │
4870 │                                          ├────┬────┼────┬────┤
4871 │                                          │ Yes│ No │ Yes│ No │
4872 │                                          ├────┼────┼────┼────┤
4873 │                                          │QN86│QN86│QN86│QN86│
4874 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4875 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   8│
4876 │                           Layer Column ID│   2│   4│   6│   8│
4877 │                      ╶───────────────────┼────┼────┼────┼────┤
4878 │                       No  Column ID      │   2│   4│   6│   8│
4879 │                           Layer Column ID│   2│   4│   6│   8│
4880 │             ╶────────────────────────────┼────┼────┼────┼────┤
4881 │              No  QN57 Yes Column ID      │  10│  12│  14│  16│
4882 │                           Layer Column ID│   2│   4│   6│   8│
4883 │                      ╶───────────────────┼────┼────┼────┼────┤
4884 │                       No  Column ID      │  10│  12│  14│  16│
4885 │                           Layer Column ID│   2│   4│   6│   8│
4886 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4887 │     No  QN61 Yes QN57 Yes Column ID      │  18│  20│  22│  24│
4888 │                           Layer Column ID│   2│   4│   6│   8│
4889 │                      ╶───────────────────┼────┼────┼────┼────┤
4890 │                       No  Column ID      │  18│  20│  22│  24│
4891 │                           Layer Column ID│   2│   4│   6│   8│
4892 │             ╶────────────────────────────┼────┼────┼────┼────┤
4893 │              No  QN57 Yes Column ID      │  26│  28│  30│  32│
4894 │                           Layer Column ID│   2│   4│   6│   8│
4895 │                      ╶───────────────────┼────┼────┼────┼────┤
4896 │                       No  Column ID      │  26│  28│  30│  32│
4897 │                           Layer Column ID│   2│   4│   6│   8│
4898 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4899
4900                           Custom Tables
4901 Female
4902 Yes
4903 ╭──────────────────────────────────────────┬───────────────────╮
4904 │                                          │        QN27       │
4905 │                                          ├─────────┬─────────┤
4906 │                                          │   Yes   │    No   │
4907 │                                          ├─────────┼─────────┤
4908 │                                          │  QND7A  │  QND7A  │
4909 │                                          ├────┬────┼────┬────┤
4910 │                                          │ Yes│ No │ Yes│ No │
4911 │                                          ├────┼────┼────┼────┤
4912 │                                          │QN86│QN86│QN86│QN86│
4913 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4914 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  37│  39│
4915 │                           Layer Column ID│   9│  11│  13│  15│
4916 │                      ╶───────────────────┼────┼────┼────┼────┤
4917 │                       No  Column ID      │  33│  35│  37│  39│
4918 │                           Layer Column ID│   9│  11│  13│  15│
4919 │             ╶────────────────────────────┼────┼────┼────┼────┤
4920 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
4921 │                           Layer Column ID│   9│  11│  13│  15│
4922 │                      ╶───────────────────┼────┼────┼────┼────┤
4923 │                       No  Column ID      │  41│  43│  45│  47│
4924 │                           Layer Column ID│   9│  11│  13│  15│
4925 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4926 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  53│  55│
4927 │                           Layer Column ID│   9│  11│  13│  15│
4928 │                      ╶───────────────────┼────┼────┼────┼────┤
4929 │                       No  Column ID      │  49│  51│  53│  55│
4930 │                           Layer Column ID│   9│  11│  13│  15│
4931 │             ╶────────────────────────────┼────┼────┼────┼────┤
4932 │              No  QN57 Yes Column ID      │  57│  59│  61│  63│
4933 │                           Layer Column ID│   9│  11│  13│  15│
4934 │                      ╶───────────────────┼────┼────┼────┼────┤
4935 │                       No  Column ID      │  57│  59│  61│  63│
4936 │                           Layer Column ID│   9│  11│  13│  15│
4937 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4938
4939                           Custom Tables
4940 Female
4941 No
4942 ╭──────────────────────────────────────────┬───────────────────╮
4943 │                                          │        QN27       │
4944 │                                          ├─────────┬─────────┤
4945 │                                          │   Yes   │    No   │
4946 │                                          ├─────────┼─────────┤
4947 │                                          │  QND7A  │  QND7A  │
4948 │                                          ├────┬────┼────┬────┤
4949 │                                          │ Yes│ No │ Yes│ No │
4950 │                                          ├────┼────┼────┼────┤
4951 │                                          │QN86│QN86│QN86│QN86│
4952 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4953 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  38│  40│
4954 │                           Layer Column ID│  10│  12│  14│  16│
4955 │                      ╶───────────────────┼────┼────┼────┼────┤
4956 │                       No  Column ID      │  34│  36│  38│  40│
4957 │                           Layer Column ID│  10│  12│  14│  16│
4958 │             ╶────────────────────────────┼────┼────┼────┼────┤
4959 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
4960 │                           Layer Column ID│  10│  12│  14│  16│
4961 │                      ╶───────────────────┼────┼────┼────┼────┤
4962 │                       No  Column ID      │  42│  44│  46│  48│
4963 │                           Layer Column ID│  10│  12│  14│  16│
4964 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4965 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  54│  56│
4966 │                           Layer Column ID│  10│  12│  14│  16│
4967 │                      ╶───────────────────┼────┼────┼────┼────┤
4968 │                       No  Column ID      │  50│  52│  54│  56│
4969 │                           Layer Column ID│  10│  12│  14│  16│
4970 │             ╶────────────────────────────┼────┼────┼────┼────┤
4971 │              No  QN57 Yes Column ID      │  58│  60│  62│  64│
4972 │                           Layer Column ID│  10│  12│  14│  16│
4973 │                      ╶───────────────────┼────┼────┼────┼────┤
4974 │                       No  Column ID      │  58│  60│  62│  64│
4975 │                           Layer Column ID│  10│  12│  14│  16│
4976 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4977 ])
4978 AT_CLEANUP
4979
4980 AT_SETUP([CTABLES categorical summary functions])
4981 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
4982 AT_DATA([ctables.sps],
4983 [[GET 'nhtsa.sav'.
4984 CTABLES
4985     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
4986     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
4987     /SLABELS POSITION=ROW.
4988 ]])
4989 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4990                                                       Custom Tables
4991 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
4992 │                 │                     D5a. What would you say is your primary ethnic background?                     │
4993 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
4994 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
4995 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
4996 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
4997 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4998 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
4999 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
5000 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
5001 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5002 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5003 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
5004 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5005 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5006 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
5007 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
5008 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5009 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
5010 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
5011 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
5012 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5013 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5014 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
5015 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5016 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5017 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
5018 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
5019 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5020 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
5021 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
5022 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
5023 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5024 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5025 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
5026 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5027 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5028 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
5029 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
5030 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5031 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
5032 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
5033 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
5034 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5035 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5036 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
5037 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5038 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5039 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
5040 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
5041 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
5042 ])
5043 AT_CLEANUP
5044
5045 AT_SETUP([CTABLES scale summary functions])
5046 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
5047 AT_DATA([ctables.sps],
5048 [[GET 'nhtsa.sav'.
5049 SET TVAR=NAME.
5050
5051 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5052   CTABLES later, to make the results easier to verify.
5053 SPLIT FILE BY REGION.
5054 FREQUENCIES
5055     qn19a
5056     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5057     /FORMAT NOTABLE /MISSING=INCLUDE.
5058 SPLIT FILE OFF.
5059
5060 CTABLES
5061     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5062     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
5063     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
5064     /SLABELS POSITION=ROW
5065     /CLABELS ROWLABELS=OPPOSITE.
5066 ]])
5067 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5068                    Statistics
5069 ╭─────────┬───────────────────────────────────╮
5070 │         │               REGION              │
5071 │         ├────────┬────────┬────────┬────────┤
5072 │         │   NE   │   MW   │    S   │    W   │
5073 │         ├────────┼────────┼────────┼────────┤
5074 │         │  QN19A │  QN19A │  QN19A │  QN19A │
5075 ├─────────┼────────┼────────┼────────┼────────┤
5076 │N Valid  │     936│    1019│    1276│     950│
5077 │  Missing│     473│     635│    1114│     596│
5078 ├─────────┼────────┼────────┼────────┼────────┤
5079 │Mean     │   19.33│   19.83│   20.29│   19.87│
5080 ├─────────┼────────┼────────┼────────┼────────┤
5081 │S.E. Mean│     .14│     .16│     .18│     .17│
5082 ├─────────┼────────┼────────┼────────┼────────┤
5083 │Median   │   18.00│   19.00│   19.00│   19.00│
5084 ├─────────┼────────┼────────┼────────┼────────┤
5085 │Mode     │   18.00│   18.00│   18.00│   18.00│
5086 ├─────────┼────────┼────────┼────────┼────────┤
5087 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
5088 ├─────────┼────────┼────────┼────────┼────────┤
5089 │Variance │   19.41│   26.47│   41.43│   27.59│
5090 ├─────────┼────────┼────────┼────────┼────────┤
5091 │Range    │   59.00│   71.00│   75.00│   61.00│
5092 ├─────────┼────────┼────────┼────────┼────────┤
5093 │Minimum  │     .00│    4.00│    4.00│    4.00│
5094 ├─────────┼────────┼────────┼────────┼────────┤
5095 │Maximum  │   59.00│   75.00│   79.00│   65.00│
5096 ├─────────┼────────┼────────┼────────┼────────┤
5097 │Sum      │18092.00│20206.00│25886.00│18877.00│
5098 ╰─────────┴────────┴────────┴────────┴────────╯
5099
5100                          Custom Tables
5101 ╭────────────────────────┬────────┬────────┬────────┬────────╮
5102 │                        │   NE   │   MW   │    S   │    W   │
5103 ├────────────────────────┼────────┼────────┼────────┼────────┤
5104 │REGION Valid N          │     936│    1019│    1276│     950│
5105 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
5106 │       Mean             │   19.33│   19.83│   20.29│   19.87│
5107 │       Std Error of Mean│     .14│     .16│     .18│     .17│
5108 │       Median           │   18.00│   19.00│   19.00│   19.00│
5109 │       Mode             │   18.00│   18.00│   18.00│   18.00│
5110 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
5111 │       Variance         │   19.41│   26.47│   41.43│   27.59│
5112 │       Range            │   59.00│   71.00│   75.00│   61.00│
5113 │       Minimum          │     .00│    4.00│    4.00│    4.00│
5114 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
5115 │       Sum              │18092.00│20206.00│25886.00│18877.00│
5116 │       Count            │    1409│    1654│    2390│    1546│
5117 │       Total N          │    1409│    1654│    2390│    1546│
5118 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
5119 ╰────────────────────────┴────────┴────────┴────────┴────────╯
5120 ])
5121 AT_CLEANUP
5122
5123 AT_SETUP([CTABLES scale summary functions - weighting])
5124 weight=1
5125 c=10
5126 for a in 1 2 9; do
5127     for b in 3 4 9; do
5128         for n in 1 2 3 4 5 6 7 8 9 10; do
5129             if test $c -lt 15; then
5130                 cval=.
5131             else
5132                 cval=$c
5133             fi
5134             printf "$weight $a $b $cval\n"
5135             weight=$(expr \( $weight + 3 \) % 7 + 2)
5136             c=$(expr \( $c + 13 \) % 29 + 7)
5137         done
5138     done
5139 done > ctables.txt
5140
5141 AT_DATA([analysis.sps],
5142 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5143   CTABLES later, to make the results easier to verify.
5144 SPLIT FILE BY a b.
5145 FREQUENCIES
5146     c
5147     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5148     /FORMAT NOTABLE /MISSING=INCLUDE.
5149 SPLIT FILE OFF.
5150
5151 CTABLES
5152     /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
5153     /SLABELS POSITION=ROW
5154     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5155 ]])
5156
5157 AT_DATA([ctables.sps],
5158 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
5159     /w (F5.0) a b c (f2.0).
5160 VAR LEVEL w c (SCALE) a b (NOMINAL).
5161 MISSING VALUES a b (9).
5162
5163 INCLUDE 'analysis.sps'.
5164
5165 WEIGHT BY w.
5166 INCLUDE 'analysis.sps'.
5167
5168 * Same as original analysis using unweighted versions of summaries.
5169 CTABLES
5170     /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
5171     /SLABELS POSITION=ROW
5172     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5173 ]])
5174 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5175                                 Statistics
5176 ╭─────────┬──────────────────────────────────────────────────────────────╮
5177 │         │                               a                              │
5178 │         ├────────────────────┬────────────────────┬────────────────────┤
5179 │         │          1         │          2         │          9         │
5180 │         ├────────────────────┼────────────────────┼────────────────────┤
5181 │         │          b         │          b         │          b         │
5182 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5183 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5184 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5185 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
5186 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5187 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5188 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
5189 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5190 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5191 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5192 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5193 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5194 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5195 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5196 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5197 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5198 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5199 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5200 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5201 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5202 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5203 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5204 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5205 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5206 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5207 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5208 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5209 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5210
5211                                     Custom Tables
5212 ╭───────────────────┬──────────────────────────────────────────────────────────────╮
5213 │                   │                               a                              │
5214 │                   ├────────────────────┬────────────────────┬────────────────────┤
5215 │                   │          1         │          2         │          9         │
5216 │                   ├────────────────────┼────────────────────┼────────────────────┤
5217 │                   │          b         │          b         │          b         │
5218 │                   ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5219 │                   │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5220 ├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5221 │c Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5222 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5223 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5224 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5225 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5226 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5227 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5228 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5229 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5230 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5231 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5232 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5233 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5234 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5235 │  Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5236 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5237
5238                                   Statistics
5239 ╭─────────┬─────────────────────────────────────────────────────────────────╮
5240 │         │                                a                                │
5241 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
5242 │         │          1          │          2          │          9          │
5243 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
5244 │         │          b          │          b          │          b          │
5245 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5246 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5247 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5248 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
5249 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5250 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5251 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
5252 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5253 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5254 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5255 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5256 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5257 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5258 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5259 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5260 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5261 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5262 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5263 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5264 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5265 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5266 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5267 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5268 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5269 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5270 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5271 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5272 ╰─────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5273
5274                                      Custom Tables
5275 ╭───────────────────┬─────────────────────────────────────────────────────────────────╮
5276 │                   │                                a                                │
5277 │                   ├─────────────────────┬─────────────────────┬─────────────────────┤
5278 │                   │          1          │          2          │          9          │
5279 │                   ├─────────────────────┼─────────────────────┼─────────────────────┤
5280 │                   │          b          │          b          │          b          │
5281 │                   ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5282 │                   │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5283 ├───────────────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5284 │c Valid N          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5285 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5286 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5287 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5288 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5289 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5290 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5291 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5292 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5293 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5294 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5295 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5296 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5297 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5298 │  Layer Row Sum %  │  13.3%│ 10.3%│ 11.3%│  8.9%│  12.6%│ 11.5%│  9.8%│  9.9%│  12.4%│
5299 ╰───────────────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5300
5301                                          Custom Tables
5302 ╭──────────────────────────────┬──────────────────────────────────────────────────────────────╮
5303 │                              │                               a                              │
5304 │                              ├────────────────────┬────────────────────┬────────────────────┤
5305 │                              │          1         │          2         │          9         │
5306 │                              ├────────────────────┼────────────────────┼────────────────────┤
5307 │                              │          b         │          b         │          b         │
5308 │                              ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5309 │                              │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5310 ├──────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5311 │c Unweighted Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5312 │  Unweighted Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5313 │  Unweighted Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5314 │  Unweighted Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5315 │  Unweighted Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5316 │  Unweighted Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5317 │  Unweighted Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5318 │  Unweighted Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5319 │  Unweighted Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5320 │  Unweighted Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5321 │  Unweighted Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5322 │  Unweighted Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5323 ╰──────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5324 ])
5325 AT_CLEANUP
5326
5327 AT_SETUP([CTABLES hidden scale VLABELS])
5328 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
5329 AT_DATA([ctables.sps],
5330 [[GET 'nhtsa.sav'.
5331 CTABLES
5332     /TABLE region BY qn19a + qn35
5333     /SLABELS POSITION=ROW.
5334 CTABLES
5335     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5336     /TABLE region BY qn19a + qn35
5337     /SLABELS POSITION=ROW.
5338 CTABLES
5339     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5340     /TABLE region BY qn19a + qn35
5341     /SLABELS POSITION=ROW.
5342
5343 * This one in particular caused a crash because no categories were
5344   created on the column axis, so passing in 0 for the index was still
5345   too big for that number of categories.  It was fixed by creating a
5346   name-only category for each variable despite the "NONE" request,
5347   then hiding the entire dimension's labels if all its labels were
5348   set to "NONE".
5349 CTABLES
5350     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5351     /TABLE region BY qn19a + qn35
5352     /SLABELS POSITION=ROW.
5353 ]])
5354 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5355                                  Custom Tables
5356 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5357 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5358 │              │   when you first starting  │   many times have you driven a  │
5359 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5360 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5361 │              │      sips of alcohol.      │            beverages?           │
5362 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5363 │Region NE Mean│                       19.33│                                2│
5364 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5365 │       MW Mean│                       19.83│                                2│
5366 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5367 │       S  Mean│                       20.29│                                2│
5368 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5369 │       W  Mean│                       19.87│                                2│
5370 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5371
5372                                  Custom Tables
5373 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5374 │              │     │  35. In the past thirty days, how many times have you  │
5375 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5376 │              │QN19A│                  alcoholic beverages?                  │
5377 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5378 │Region NE Mean│19.33│                                                       2│
5379 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5380 │       MW Mean│19.83│                                                       2│
5381 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5382 │       S  Mean│20.29│                                                       2│
5383 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5384 │       W  Mean│19.87│                                                       2│
5385 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5386
5387                                  Custom Tables
5388 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5389 │              │   19a. About how old were you when you first starting   │    │
5390 │              │  drinking alcohol, not counting small tastes or sips of │    │
5391 │              │                         alcohol.                        │qn35│
5392 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5393 │Region NE Mean│                                                    19.33│   2│
5394 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5395 │       MW Mean│                                                    19.83│   2│
5396 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5397 │       S  Mean│                                                    20.29│   2│
5398 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5399 │       W  Mean│                                                    19.87│   2│
5400 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5401
5402       Custom Tables
5403 ╭──────────────┬───────╮
5404 │Region NE Mean│19.33 2│
5405 │      ╶───────┼───────┤
5406 │       MW Mean│19.83 2│
5407 │      ╶───────┼───────┤
5408 │       S  Mean│20.29 2│
5409 │      ╶───────┼───────┤
5410 │       W  Mean│19.87 2│
5411 ╰──────────────┴───────╯
5412 ])
5413 AT_CLEANUP
5414
5415 AT_SETUP([CTABLES with SPLIT FILE])
5416 AT_CHECK([ln $top_srcdir/tests/language/stats/nhtsa.sav . || cp $top_srcdir/tests/language/stats/nhtsa.sav .])
5417 AT_DATA([ctables.sps],
5418 [[GET 'nhtsa.sav'.
5419
5420 SORT CASES BY qns3a.
5421
5422 CTABLES /TABLE qn105ba.
5423
5424 * Layered split has no effect on output.
5425 SPLIT FILE BY qns3a.
5426 CTABLES /TABLE qn105ba.
5427
5428 * Add column variable qns3a to compare against separate splits.
5429 CTABLES /TABLE qn105ba BY qns3a.
5430
5431 * Separate splits are truly output separately.
5432 SPLIT FILE SEPARATE BY qns3a.
5433 CTABLES /TABLE qn105ba.
5434 ]])
5435 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5436                                   Custom Tables
5437 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5438 │                                                                        │Count│
5439 ├────────────────────────────────────────────────────────────────────────┼─────┤
5440 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5441 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5442 │                                                            Very likely │ 1502│
5443 │                                                            Somewhat    │ 2763│
5444 │                                                            likely      │     │
5445 │                                                            Somewhat    │ 1307│
5446 │                                                            unlikely    │     │
5447 │                                                            Very        │  609│
5448 │                                                            unlikely    │     │
5449 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5450
5451                                   Custom Tables
5452 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5453 │                                                                        │Count│
5454 ├────────────────────────────────────────────────────────────────────────┼─────┤
5455 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5456 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5457 │                                                            Very likely │ 1502│
5458 │                                                            Somewhat    │ 2763│
5459 │                                                            likely      │     │
5460 │                                                            Somewhat    │ 1307│
5461 │                                                            unlikely    │     │
5462 │                                                            Very        │  609│
5463 │                                                            unlikely    │     │
5464 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5465
5466                                   Custom Tables
5467 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5468 │                                                                 │S3a. GENDER:│
5469 │                                                                 ├─────┬──────┤
5470 │                                                                 │ Male│Female│
5471 │                                                                 ├─────┼──────┤
5472 │                                                                 │Count│ Count│
5473 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5474 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5475 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5476 │the police?                                          Very likely │  660│   842│
5477 │                                                     Somewhat    │ 1174│  1589│
5478 │                                                     likely      │     │      │
5479 │                                                     Somewhat    │  640│   667│
5480 │                                                     unlikely    │     │      │
5481 │                                                     Very        │  311│   298│
5482 │                                                     unlikely    │     │      │
5483 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5484
5485     Split Values
5486 ╭────────────┬─────╮
5487 │Variable    │Value│
5488 ├────────────┼─────┤
5489 │S3a. GENDER:│Male │
5490 ╰────────────┴─────╯
5491
5492                                   Custom Tables
5493 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5494 │                                                                        │Count│
5495 ├────────────────────────────────────────────────────────────────────────┼─────┤
5496 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5497 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5498 │                                                            Very likely │  660│
5499 │                                                            Somewhat    │ 1174│
5500 │                                                            likely      │     │
5501 │                                                            Somewhat    │  640│
5502 │                                                            unlikely    │     │
5503 │                                                            Very        │  311│
5504 │                                                            unlikely    │     │
5505 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5506
5507      Split Values
5508 ╭────────────┬──────╮
5509 │Variable    │ Value│
5510 ├────────────┼──────┤
5511 │S3a. GENDER:│Female│
5512 ╰────────────┴──────╯
5513
5514                                   Custom Tables
5515 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5516 │                                                                        │Count│
5517 ├────────────────────────────────────────────────────────────────────────┼─────┤
5518 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5519 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5520 │                                                            Very likely │  842│
5521 │                                                            Somewhat    │ 1589│
5522 │                                                            likely      │     │
5523 │                                                            Somewhat    │  667│
5524 │                                                            unlikely    │     │
5525 │                                                            Very        │  298│
5526 │                                                            unlikely    │     │
5527 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5528 ])
5529 AT_CLEANUP
5530
5531 AT_SETUP([CTABLES variable level inference])
5532 AT_DATA([data.txt], [dnl
5533 dnl n1 has 10 unique small values -> nominal.
5534 dnl n2 has 23 unique small values -> nominal.
5535 dnl n3 is all missing -> nominal.
5536 dnl s1 has 24 unique small values -> scale.
5537 dnl s2 has one negative value -> scale.
5538 dnl s3 has one non-integer value -> scale.
5539 dnl s4 has no valid values less than 10 -> scale.
5540 dnl s5 has no valid values less than 10,000 -> scale.
5541 1  1  . 1  1  1    10 10001
5542 2  2  . 2  2  2    11 10002
5543 3  3  . 3  3  3    12 10003
5544 4  4  . 4  4  4    13 10004
5545 5  5  . 5  5  5    14 10005
5546 6  6  . 6  6  6    15 10006
5547 7  7  . 7  7  7    16 10007
5548 8  8  . 8  8  8    17 10008
5549 9  9  . 9  9  9    18 10009
5550 10 10 . 10 10 10.5 19 110000
5551 1  11 . 11 -1 1    11 10001
5552 2  12 . 12 2  2    12 10002
5553 3  13 . 13 3  3    13 10003
5554 4  14 . 14 4  4    14 10004
5555 5  15 . 15 5  5    15 10005
5556 6  16 . 16 6  6    16 10006
5557 7  17 . 17 7  7    17 10007
5558 8  18 . 18 8  8    18 10008
5559 9  19 . 19 9  9    19 10009
5560 1  20 . 20 1  1    20 10001
5561 2  21 . 21 2  2    21 10002
5562 3  22 . 22 3  3    22 10003
5563 4  23 . 23 4  4    23 10004
5564 5  23 . 24 5  5    24 10005
5565 6  23 . 24 6  6    25 10006
5566 ])
5567
5568 AT_DATA([ctables.sps], [dnl
5569 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5570
5571 * Nominal formats (copied from data that will default to scale).
5572 COMPUTE n4=s1.
5573 COMPUTE n5=s1.
5574 FORMATS n4(WKDAY5) n5(MONTH5).
5575
5576 * Scale formats (copied from data that will default to nominal).
5577 COMPUTE s6=n1.
5578 COMPUTE s7=n1.
5579 COMPUTE s8=n1.
5580 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5581
5582 STRING string(A8).
5583
5584 DISPLAY DICTIONARY.
5585 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5586 DISPLAY DICTIONARY.
5587 ])
5588
5589 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5590                                     Variables
5591 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5592 │      │        │  Measurement │     │     │         │            │            │
5593 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5594 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5595 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5596 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5597 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5598 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5599 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5600 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5601 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5602 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5603 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5604 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5605 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5606 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5607 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5608 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5609 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5610
5611         Custom Tables
5612 ╭────────────┬─────┬────────╮
5613 │            │Count│  Mean  │
5614 ├────────────┼─────┼────────┤
5615 │n1     1.00 │    3│        │
5616 │       2.00 │    3│        │
5617 │       3.00 │    3│        │
5618 │       4.00 │    3│        │
5619 │       5.00 │    3│        │
5620 │       6.00 │    3│        │
5621 │       7.00 │    2│        │
5622 │       8.00 │    2│        │
5623 │       9.00 │    2│        │
5624 │       10.00│    1│        │
5625 ├────────────┼─────┼────────┤
5626 │n2     1.00 │    1│        │
5627 │       2.00 │    1│        │
5628 │       3.00 │    1│        │
5629 │       4.00 │    1│        │
5630 │       5.00 │    1│        │
5631 │       6.00 │    1│        │
5632 │       7.00 │    1│        │
5633 │       8.00 │    1│        │
5634 │       9.00 │    1│        │
5635 │       10.00│    1│        │
5636 │       11.00│    1│        │
5637 │       12.00│    1│        │
5638 │       13.00│    1│        │
5639 │       14.00│    1│        │
5640 │       15.00│    1│        │
5641 │       16.00│    1│        │
5642 │       17.00│    1│        │
5643 │       18.00│    1│        │
5644 │       19.00│    1│        │
5645 │       20.00│    1│        │
5646 │       21.00│    1│        │
5647 │       22.00│    1│        │
5648 │       23.00│    3│        │
5649 ├────────────┼─────┼────────┤
5650 │string      │   25│        │
5651 ├────────────┼─────┼────────┤
5652 │s1          │     │   12.96│
5653 ├────────────┼─────┼────────┤
5654 │s2          │     │    4.76│
5655 ├────────────┼─────┼────────┤
5656 │s3          │     │    4.86│
5657 ├────────────┼─────┼────────┤
5658 │s4          │     │   16.60│
5659 ├────────────┼─────┼────────┤
5660 │s5          │     │14004.44│
5661 ╰────────────┴─────┴────────╯
5662
5663                                     Variables
5664 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5665 │      │        │  Measurement │     │     │         │            │            │
5666 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5667 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5668 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5669 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5670 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5671 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5672 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5673 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5674 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5675 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5676 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5677 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5678 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5679 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5680 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5681 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5682 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5683 ])
5684 AT_CLEANUP