5bc111787c9428b56d9b1ed60a9b5cf345159911
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Known bugs:
4 dnl TOTAL interaction with PCOMPUTE, e.g. the following
5 dnl CTABLES
6 dnl     /PCOMPUTE &all_drivers=EXPR([1 THRU 2] + [3 THRU 4])
7 dnl     /PPROPERTIES &all_drivers LABEL='All Drivers'
8 dnl     /PCOMPUTE &pct_not_drivers=EXPR([5] / ([1 THRU 2] + [3 THRU 4] + [5]) * 100)
9 dnl     /PPROPERTIES &pct_not_drivers LABEL='% Not Drivers' FORMAT=COUNT PCT40.1
10 dnl     /TABLE=qn1 BY qns3a
11 dnl     /CATEGORIES VARIABLES=qns3a TOTAL=YES
12 dnl     /CATEGORIES VARIABLES=qn1 [1 THRU 2, SUBTOTAL='Frequent Drivers',
13 dnl                                3 THRU 4, SUBTOTAL='Infrequent Drivers',
14 dnl                                &all_drivers, 5, &pct_not_drivers,
15 dnl                                MISSING, SUBTOTAL='Not Drivers or Missing'].
16 dnl yields gaps in the Total column:
17 dnl ╭─────────────────────────────────────────────────────────────────────────┬──────────────────╮
18 dnl │                                                                         │   S3a. GENDER:   │
19 dnl │                                                                         ├─────┬──────┬─────┤
20 dnl │                                                                         │ Male│Female│Total│
21 dnl │                                                                         ├─────┼──────┼─────┤
22 dnl │                                                                         │Count│ Count│Count│
23 dnl ├─────────────────────────────────────────────────────────────────────────┼─────┼──────┼─────┤
24 dnl │ 1. How often do you usually drive a car or other   Every day            │ 2305│  2362│ 4667│
25 dnl │motor vehicle?                                      Several days a week  │  440│   834│ 1274│
26 dnl │                                                    Frequent Drivers     │ 2745│  3196│     │
27 dnl │                                                    Once a week or less  │  125│   236│  361│
28 dnl │                                                    Only certain times a │   58│    72│  130│
29 dnl │                                                    year                 │     │      │     │
30 dnl │                                                    Infrequent Drivers   │  183│   308│     │
31 dnl │                                                    All Drivers          │ 2928│  3504│     │
32 dnl │                                                    Never                │  192│   348│  540│
33 dnl │                                                    % Not Drivers        │ 6.2%│  9.0%│     │
34 dnl │                                                    Don't know           │    3│     5│    8│
35 dnl │                                                    Refused              │    9│    10│   19│
36 dnl │                                                    Not Drivers or       │  204│   363│     │
37 dnl │                                                    Missing              │     │      │     │
38 dnl ╰─────────────────────────────────────────────────────────────────────────┴─────┴──────┴─────╯
39 dnl Features not yet implemented:
40 dnl - Multiple response sets
41 dnl - MRSETS subcommand.
42 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
43 dnl - SIGTEST
44 dnl - COMPARETEST
45 dnl - Summary functions:
46 dnl   * .LCL and .UCL suffixes.
47 dnl   * .SE suffixes.
48 dnl - CATEGORIES:
49 dnl   * Data-dependent sorting.
50
51 AT_SETUP([CTABLES parsing])
52 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
53 AT_DATA([ctables.sps],
54 [[GET 'nhtsa.sav'.
55 CTABLES
56     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
57     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
58     /FORMAT UNITS=CM EMPTY="(-)"
59     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
60     /VLABELS VARIABLES=qn17 DISPLAY=NAME
61     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
62     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
63     /VLABELS VARIABLES=qn20 DISPLAY=NONE
64     /MRSETS COUNTDUPLICATES=NO
65     /MRSETS COUNTDUPLICATES=YES
66     /SMISSING VARIABLE
67     /SMISSING LISTWISE
68     /WEIGHT VARIABLE=qns3a
69     /HIDESMALLCOUNTS
70     /HIDESMALLCOUNTS COUNT=10
71     /TABLE qnsa1
72     /SLABELS POSITION=COLUMN VISIBLE=YES
73     /SLABELS VISIBLE=NO POSITION=ROW
74     /SLABELS POSITION=LAYER
75     /CLABELS AUTO
76     /CLABELS ROWLABELS=OPPOSITE
77     /CRITERIA CILEVEL=50
78     /CATEGORIES VARIABLES=qn1 qn17
79                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
80                 POSITION=BEFORE EMPTY=INCLUDE.
81 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
82 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
83 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
84 ]])
85 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
86          Custom Tables
87 Count
88 ╭───────────────────┬────┬────╮
89 │                   │ RDD│CELL│
90 ├───────────────────┼────┼────┤
91 │Sa1. SAMPLE SOURCE:│5392│1607│
92 ╰───────────────────┴────┴────╯
93
94        Custom Tables
95 RDD
96 ╭───────────────────┬─────╮
97 │                   │Count│
98 ├───────────────────┼─────┤
99 │Sa1. SAMPLE SOURCE:│ 5392│
100 ╰───────────────────┴─────╯
101
102           Custom Tables
103 ╭────────────────────────┬─────╮
104 │                        │Count│
105 ├────────────────────────┼─────┤
106 │Sa1. SAMPLE SOURCE: RDD │ 5392│
107 │                    CELL│ 1607│
108 ╰────────────────────────┴─────╯
109
110           Custom Tables
111 ╭────────────────────────┬─────╮
112 │                        │Count│
113 ├────────────────────────┼─────┤
114 │Sa1. SAMPLE SOURCE: RDD │ 5392│
115 │                    CELL│ 1607│
116 ╰────────────────────────┴─────╯
117 ])
118 AT_CLEANUP
119
120 AT_SETUP([CTABLES parsing - negative])
121 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
122 AT_DATA([ctables.sps],
123 [[GET 'nhtsa.sav'.
124 CTABLES.
125 CTABLES /FORMAT MINCOLWIDTH='foo'.
126 CTABLES /TABLE qn1 [**].
127 CTABLES /TABLE qn1 [NOTAFUNCTION].
128 CTABLES /TABLE (qn1.
129 CTABLES /TABLE **.
130 CTABLES /TABLE NOTAVAR.
131 STRING string(A8).
132 CTABLES /TABLE string[S].
133 CTABLES /TABLE qn1 [PTILE 101].
134 CTABLES /TABLE qn1 [MEAN F0.1].
135 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
136 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
137 CTABLES /TABLE qn1 [MEAN TOTALS].
138 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
142 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
143 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
144 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
145 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
146 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
147 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
148 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
149 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
150 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
151 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
152 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
153 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
154 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
155 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
156 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
157 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
158 CTABLES /PCOMPUTE &k=EXPR([LO **]).
159 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
160 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
161 CTABLES /PCOMPUTE &k=EXPR([1**]).
162 CTABLES /PCOMPUTE &k=EXPR((1x)).
163 CTABLES /PCOMPUTE **k.
164 CTABLES /PCOMPUTE &1.
165 CTABLES /PCOMPUTE &k**.
166 CTABLES /PCOMPUTE &k=**.
167 CTABLES /PCOMPUTE &k=EXPR**.
168 CTABLES /PCOMPUTE &k=EXPR(1x).
169 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
170 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
171 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
172 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
173 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
174 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
175 CTABLES /FORMAT EMPTY=**.
176 CTABLES /FORMAT MISSING=**.
177 CTABLES /FORMAT **.
178 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
179 CTABLES /VLABELS **.
180 CTABLES /VLABELS VARIABLES=NOTAVAR.
181 CTABLES /VLABELS VARIABLES=qn1 **.
182 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
183 CTABLES /MRSETS **.
184 CTABLES /MRSETS COUNTDUPLICATES=**.
185 CTABLES /SMISSING **.
186 CTABLES /WEIGHT **.
187 CTABLES /WEIGHT VARIABLE=NOTAVAR.
188 CTABLES /HIDESMALLCOUNTS COUNT=1.
189 CTABLES /QUUX.
190 CTABLES /HIDESMALLCOUNTS COUNT=2.
191 CTABLES /TABLE qn1**.
192 CTABLES /TABLE qn1 /SLABELS POSITION=**.
193 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
194 CTABLES /TABLE qn1 /SLABELS **.
195 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
196 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
197 CTABLES /TABLE qn1 /CLABELS **.
198 CTABLES /TABLE qn1 /CRITERIA **.
199 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
200 CTABLES /TABLE qn1 /TITLES **.
201 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
202 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
203 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
204 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
205 CTABLES /TABLE qn1 /SIGTEST **.
206 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
207 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
208 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
209 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
210 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
211 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
212 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
213 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
214 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
215 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
216 CTABLES /TABLE qn1 /COMPARETEST **.
217 CTABLES /TABLE qn1 /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: error: CTABLES: Output format F0.1 specifies width 0, but F
266 requires a width between 1 and 40.
267
268 ctables.sps:13.26-13.36: error: CTABLES: Output format NEGPAREN requires width 2
269 or greater.
270    13 | CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
271       |                          ^~~~~~~~~~~
272
273 ctables.sps:14.26-14.36: error: CTABLES: Output format NEGPAREN requires width
274 greater than decimals.
275    14 | CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
276       |                          ^~~~~~~~~~~
277
278 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
279 scale variables.
280    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
281       |                     ^~~~
282
283 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
284    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
285       |                ^~~
286
287 ctables.sps:15.32: error: CTABLES: Syntax error expecting `@<:@'.
288    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
289       |                                ^
290
291 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
292 scale variables.
293    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
294       |                     ^~~~
295
296 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
297    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
298       |                ^~~
299
300 ctables.sps:16.40: error: CTABLES: Syntax error expecting `@:>@'.
301    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
302       |                                        ^
303
304 ctables.sps:17.56: error: CTABLES: Syntax error expecting string.
305    17 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
306       |                                                        ^
307
308 ctables.sps:18.50-18.51: error: CTABLES: Syntax error expecting THRU.
309    18 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
310       |                                                  ^~
311
312 ctables.sps:19.55: error: CTABLES: Syntax error expecting number.
313    19 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
314       |                                                       ^
315
316 ctables.sps:20.54-20.55: error: CTABLES: Syntax error expecting number.
317    20 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
318       |                                                      ^~
319
320 ctables.sps:21.56-21.57: error: CTABLES: Syntax error expecting string.
321    21 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
322       |                                                        ^~
323
324 ctables.sps:22.48-22.49: error: CTABLES: Syntax error expecting identifier.
325    22 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
326       |                                                ^~
327
328 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
329    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
330       |                                               ^~
331
332 ctables.sps:24.61-24.63: error: CTABLES: Syntax error expecting number between 0
333 and 100 for PTILE.
334    24 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
335       |                                                             ^~~
336
337 ctables.sps:25.58: error: CTABLES: Syntax error expecting `@:}@'.
338    25 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
339       |                                                          ^
340
341 ctables.sps:26.54: error: CTABLES: Syntax error expecting `@{:@'.
342    26 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
343       |                                                      ^
344
345 ctables.sps:27.54-27.55: error: CTABLES: Syntax error expecting INCLUDE or
346 EXCLUDE.
347    27 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
348       |                                                      ^~
349
350 ctables.sps:28.52-28.53: error: CTABLES: Syntax error expecting YES or NO.
351    28 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
352       |                                                    ^~
353
354 ctables.sps:29.52-29.53: error: CTABLES: Syntax error expecting string.
355    29 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
356       |                                                    ^~
357
358 ctables.sps:30.55-30.56: error: CTABLES: Syntax error expecting BEFORE or AFTER.
359    30 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
360       |                                                       ^~
361
362 ctables.sps:31.52-31.53: error: CTABLES: Syntax error expecting INCLUDE or
363 EXCLUDE.
364    31 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
365       |                                                    ^~
366
367 ctables.sps:32.46-32.47: error: CTABLES: Syntax error expecting ORDER, KEY,
368 MISSING, TOTAL, LABEL, POSITION, or EMPTY.
369    32 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
370       |                                              ^~
371
372 ctables.sps:33.54-33.55: error: CTABLES: Syntax error expecting TOTAL, LABEL,
373 POSITION, or EMPTY.
374    33 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
375       |                                                      ^~
376
377 ctables.sps:34.36: error: CTABLES: Syntax error expecting positive integer for
378 SUBTOTAL.
379    34 | CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
380       |                                    ^
381
382 ctables.sps:35.37-35.38: error: CTABLES: Syntax error expecting `@:>@'.
383    35 | CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
384       |                                     ^~
385
386 ctables.sps:36.31-36.32: error: CTABLES: Syntax error expecting THRU.
387    36 | CTABLES /PCOMPUTE &k=EXPR([LO **]).
388       |                               ^~
389
390 ctables.sps:37.36-37.37: error: CTABLES: Syntax error expecting number.
391    37 | CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
392       |                                    ^~
393
394 ctables.sps:38.35-38.36: error: CTABLES: Syntax error expecting number.
395    38 | CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
396       |                                   ^~
397
398 ctables.sps:39.29-39.30: error: CTABLES: Syntax error expecting `@:>@'.
399    39 | CTABLES /PCOMPUTE &k=EXPR([1**]).
400       |                             ^~
401
402 ctables.sps:40.29: error: CTABLES: Syntax error expecting `@:}@'.
403    40 | CTABLES /PCOMPUTE &k=EXPR((1x)).
404       |                             ^
405
406 ctables.sps:41.19-41.20: error: CTABLES: Syntax error expecting &.
407    41 | CTABLES /PCOMPUTE **k.
408       |                   ^~
409
410 ctables.sps:42.20: error: CTABLES: Syntax error expecting identifier.
411    42 | CTABLES /PCOMPUTE &1.
412       |                    ^
413
414 ctables.sps:43.21-43.22: error: CTABLES: Syntax error expecting `='.
415    43 | CTABLES /PCOMPUTE &k**.
416       |                     ^~
417
418 ctables.sps:44.22-44.23: error: CTABLES: Syntax error expecting EXPR.
419    44 | CTABLES /PCOMPUTE &k=**.
420       |                      ^~
421
422 ctables.sps:45.26-45.27: error: CTABLES: Syntax error expecting `@{:@'.
423    45 | CTABLES /PCOMPUTE &k=EXPR**.
424       |                          ^~
425
426 ctables.sps:46.28: error: CTABLES: Syntax error expecting `@:}@'.
427    46 | CTABLES /PCOMPUTE &k=EXPR(1x).
428       |                            ^
429
430 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
431 the previous definition.
432    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
433       |                               ^~~~~~~~~~~~~~~~~~~
434
435 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
436    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
437       |          ^~~~~~~~~~~~~~~~~~~
438
439 ctables.sps:47.50: error: CTABLES: Syntax error expecting `/'.
440    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
441       |                                                  ^
442
443 ctables.sps:48.53-48.64: error: CTABLES: Syntax error expecting summary function
444 name.
445    48 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
446       |                                                     ^~~~~~~~~~~~
447
448 ctables.sps:49.59-49.60: error: CTABLES: Syntax error expecting number between 0
449 and 100 for PTILE.
450    49 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
451       |                                                           ^~
452
453 ctables.sps:50.52-50.53: error: CTABLES: Syntax error expecting string.
454    50 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
455       |                                                    ^~
456
457 ctables.sps:51.61-51.62: error: CTABLES: Syntax error expecting YES or NO.
458    51 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
459       |                                                             ^~
460
461 ctables.sps:52.46-52.47: error: CTABLES: Syntax error expecting LABEL, FORMAT,
462 or HIDESOURCECATS.
463    52 | CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
464       |                                              ^~
465
466 ctables.sps:53.23-53.24: error: CTABLES: Syntax error expecting string.
467    53 | CTABLES /FORMAT EMPTY=**.
468       |                       ^~
469
470 ctables.sps:54.25-54.26: error: CTABLES: Syntax error expecting string.
471    54 | CTABLES /FORMAT MISSING=**.
472       |                         ^~
473
474 ctables.sps:55.17-55.18: error: CTABLES: Syntax error expecting MINCOLWIDTH,
475 MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
476    55 | CTABLES /FORMAT **.
477       |                 ^~
478
479 ctables.sps:56.17-56.45: error: CTABLES: MINCOLWIDTH must not be greater than
480 MAXCOLWIDTH.
481    56 | CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
482       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
483
484 ctables.sps:57.18-57.19: error: CTABLES: Syntax error expecting VARIABLES.
485    57 | CTABLES /VLABELS **.
486       |                  ^~
487
488 ctables.sps:58.28-58.34: error: CTABLES: NOTAVAR is not a variable name.
489    58 | CTABLES /VLABELS VARIABLES=NOTAVAR.
490       |                            ^~~~~~~
491
492 ctables.sps:59.32-59.33: error: CTABLES: Syntax error expecting DISPLAY.
493    59 | CTABLES /VLABELS VARIABLES=qn1 **.
494       |                                ^~
495
496 ctables.sps:60.40-60.41: error: CTABLES: Syntax error expecting DEFAULT, NAME,
497 LABEL, BOTH, or NONE.
498    60 | CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
499       |                                        ^~
500
501 ctables.sps:61.17-61.18: error: CTABLES: Syntax error expecting COUNTDUPLICATES.
502    61 | CTABLES /MRSETS **.
503       |                 ^~
504
505 ctables.sps:62.33-62.34: error: CTABLES: Syntax error expecting YES or NO.
506    62 | CTABLES /MRSETS COUNTDUPLICATES=**.
507       |                                 ^~
508
509 ctables.sps:63.19-63.20: error: CTABLES: Syntax error expecting VARIABLE or
510 LISTWISE.
511    63 | CTABLES /SMISSING **.
512       |                   ^~
513
514 ctables.sps:64.17-64.18: error: CTABLES: Syntax error expecting VARIABLE.
515    64 | CTABLES /WEIGHT **.
516       |                 ^~
517
518 ctables.sps:65.26-65.32: error: CTABLES: NOTAVAR is not a variable name.
519    65 | CTABLES /WEIGHT VARIABLE=NOTAVAR.
520       |                          ^~~~~~~
521
522 ctables.sps:66.32: error: CTABLES: Syntax error expecting integer 2 or greater
523 for HIDESMALLCOUNTS COUNT.
524    66 | CTABLES /HIDESMALLCOUNTS COUNT=1.
525       |                                ^
526
527 ctables.sps:67.10-67.13: error: CTABLES: Syntax error expecting one of the
528 following: FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
529 HIDESMALLCOUNTS, TABLE.
530    67 | CTABLES /QUUX.
531       |          ^~~~
532
533 ctables.sps:68.33: error: CTABLES: Syntax error expecting `/'.
534    68 | CTABLES /HIDESMALLCOUNTS COUNT=2.
535       |                                 ^
536
537 ctables.sps:69.19-69.20: error: CTABLES: Syntax error expecting `/'.
538    69 | CTABLES /TABLE qn1**.
539       |                   ^~
540
541 ctables.sps:70.38-70.39: error: CTABLES: Syntax error expecting COLUMN, ROW, or
542 LAYER.
543    70 | CTABLES /TABLE qn1 /SLABELS POSITION=**.
544       |                                      ^~
545
546 ctables.sps:71.37-71.38: error: CTABLES: Syntax error expecting YES or NO.
547    71 | CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
548       |                                     ^~
549
550 ctables.sps:72.29-72.30: error: CTABLES: Syntax error expecting POSITION or
551 VISIBLE.
552    72 | CTABLES /TABLE qn1 /SLABELS **.
553       |                             ^~
554
555 ctables.sps:73.39-73.40: error: CTABLES: Syntax error expecting OPPOSITE or
556 LAYER.
557    73 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
558       |                                       ^~
559
560 ctables.sps:74.39-74.40: error: CTABLES: Syntax error expecting OPPOSITE or
561 LAYER.
562    74 | CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
563       |                                       ^~
564
565 ctables.sps:75.29-75.30: error: CTABLES: Syntax error expecting AUTO, ROWLABELS,
566 or COLLABELS.
567    75 | CTABLES /TABLE qn1 /CLABELS **.
568       |                             ^~
569
570 ctables.sps:76.30-76.31: error: CTABLES: Syntax error expecting CILEVEL.
571    76 | CTABLES /TABLE qn1 /CRITERIA **.
572       |                              ^~
573
574 ctables.sps:77.38-77.40: error: CTABLES: Syntax error expecting number in
575 @<:@0,100@:}@ for CILEVEL.
576    77 | CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
577       |                                      ^~~
578
579 ctables.sps:78.28-78.29: error: CTABLES: Syntax error expecting CAPTION, CORNER,
580 or TITLE.
581    78 | CTABLES /TABLE qn1 /TITLES **.
582       |                            ^~
583
584 ctables.sps:79.34-79.35: error: CTABLES: Syntax error expecting CHISQUARE.
585    79 | CTABLES /TABLE qn1 /SIGTEST TYPE=**.
586       |                                  ^~
587
588 ctables.sps:80.35-80.36: error: CTABLES: Syntax error expecting number in @<:@0,1@:}@
589 for ALPHA.
590    80 | CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
591       |                                   ^~
592
593 ctables.sps:81.43-81.44: error: CTABLES: Syntax error expecting YES or NO.
594    81 | CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
595       |                                           ^~
596
597 ctables.sps:82.40-82.41: error: CTABLES: Syntax error expecting ALLVISIBLE or
598 SUBTOTALS.
599    82 | CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
600       |                                        ^~
601
602 ctables.sps:83.29-83.30: error: CTABLES: Syntax error expecting TYPE, ALPHA,
603 INCLUDEMRSETS, or CATEGORIES.
604    83 | CTABLES /TABLE qn1 /SIGTEST **.
605       |                             ^~
606
607 ctables.sps:84.38-84.39: error: CTABLES: Syntax error expecting PROP or MEAN.
608    84 | CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
609       |                                      ^~
610
611 ctables.sps:85.39-85.40: error: CTABLES: Syntax error expecting number in (0,1)
612 for ALPHA.
613    85 | CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
614       |                                       ^~
615
616 ctables.sps:86.39: error: CTABLES: Syntax error expecting number in (0,1) for
617 ALPHA.
618    86 | CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
619       |                                       ^
620
621 ctables.sps:87.40-87.41: error: CTABLES: Syntax error expecting BONFERRONI, BH,
622 or NONE.
623    87 | CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
624       |                                        ^~
625
626 ctables.sps:88.47-88.48: error: CTABLES: Syntax error expecting YES or NO.
627    88 | CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
628       |                                               ^~
629
630 ctables.sps:89.47-89.48: error: CTABLES: Syntax error expecting ALLCATS or
631 TESTEDCATS.
632    89 | CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
633       |                                               ^~
634
635 ctables.sps:90.44-90.45: error: CTABLES: Syntax error expecting ALLVISIBLE or
636 SUBTOTALS.
637    90 | CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
638       |                                            ^~
639
640 ctables.sps:91.39-91.40: error: CTABLES: Syntax error expecting YES or NO.
641    91 | CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
642       |                                       ^~
643
644 ctables.sps:92.39-92.40: error: CTABLES: Syntax error expecting APA or SIMPLE.
645    92 | CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
646       |                                       ^~
647
648 ctables.sps:93.41-93.42: error: CTABLES: Syntax error expecting YES or NO.
649    93 | CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
650       |                                         ^~
651
652 ctables.sps:94.33-94.34: error: CTABLES: Syntax error expecting one of the
653 following: TYPE, ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE,
654 STYLE, SHOWSIG.
655    94 | CTABLES /TABLE qn1 /COMPARETEST **.
656       |                                 ^~
657
658 ctables.sps:95.21-95.26: error: CTABLES: Syntax error expecting TABLE, SLABELS,
659 CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
660    95 | CTABLES /TABLE qn1 /FORMAT.
661       |                     ^~~~~~
662
663 ctables.sps:95.21-95.26: note: CTABLES: This subcommand must appear before
664 TABLE.
665    95 | CTABLES /TABLE qn1 /FORMAT.
666       |                     ^~~~~~
667
668 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
669 specified.
670
671 ctables.sps:96.21-96.46: note: CTABLES: This is the first specification.
672    96 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS
673 COLLABELS=OPPOSITE.
674       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
675
676 ctables.sps:96.49-96.74: note: CTABLES: This is the second specification.
677    96 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS
678 COLLABELS=OPPOSITE.
679       |
680 ^~~~~~~~~~~~~~~~~~~~~~~~~~
681
682 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
683    97 | CTABLES /TABLE qn20 > qnd1.
684       |                ^~~~~~~~~~~
685
686 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
687    97 | CTABLES /TABLE qn20 > qnd1.
688       |                ^~~~
689
690 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
691    97 | CTABLES /TABLE qn20 > qnd1.
692       |                       ^~~~
693
694 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
695 categorical variables at the innermost nesting level.
696    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
697       |                ^~~~~~~~~~~~~~~~~~~~
698
699 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
700 summary.
701    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
702       |                ^~~
703
704 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
705 specification as format DATETIME: Day (123) must be between 1 and 31..
706   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
707       |                                                    ^~~~~
708 ]])
709 AT_CLEANUP
710
711 AT_SETUP([CTABLES parsing - more negative])
712 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
713 AT_DATA([ctables.sps],
714 [[GET 'nhtsa.sav'.
715 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
716 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
717 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
718
719 STRING string(A8).
720 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
721 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
722
723 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
724
725 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
726 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
727 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
728 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
729
730 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
731 CTABLES /PCOMPUTE &x=EXPR([**]).
732 CTABLES /PCOMPUTE &x=EXPR(**).
733
734 CTABLES /TABLE.
735
736 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
737
738 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
739
740 CTABLES /TABLE $mrset.
741
742 CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
743 CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
744
745 CTABLES /TABLE qn113 [COUNT.UCL].
746
747 CTABLES /TABLE qn1 /CATEGORIES **.
748
749 CTABLES /TITLES.
750 ]])
751 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [1],
752 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a category not included in the category list.
753     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
754       |                                                                            ^~~
755
756 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
757     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
758       |                            ^~~~~~~~
759
760 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the list of categories here.
761     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
762       |                                                                            ^~~~
763
764 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a category not included in the category list.
765     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
766       |                                                                         ^~~
767
768 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
769     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
770       |                            ^~~~~
771
772 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the variable's CATEGORIES specification.
773
774 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of SUBTOTAL or HSUBTOTAL, so references from
775 computed categories must refer to subtotals by position, e.g. SUBTOTAL[1].
776     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
777       |                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~
778
779 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a position.
780     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
781       |                            ^~~~~~~~
782
783 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be applied only to string variables, but this
784 subcommand tries to apply it to numeric variable QN1.
785     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
786       |                                               ^~~~~~~~
787
788 ctables.sps:8.53: error: CTABLES: This category specification may be applied only to numeric variables, but this
789 subcommand tries to apply it to string variable string.
790     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
791       |                                                     ^
792
793 ctables.sps:10.74-10.86: error: CTABLES: Data-dependent sorting is not implemented.
794    10 | CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
795       |                                                                          ^~~~~~~~~~~~~
796
797 ctables.sps:12: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
798 moved must be categorical, but qnd1 is scale.
799
800 ctables.sps:12.22-12.47: note: CTABLES: This syntax moves category labels to another axis.
801    12 | CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
802       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
803
804 ctables.sps:13: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
805 moved must all have the same width, but QN1 has width 0 and string has width 8.
806
807 ctables.sps:13.30-13.55: note: CTABLES: This syntax moves category labels to another axis.
808    13 | CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
809       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
810
811 ctables.sps:14: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
812 moved must all have the same value labels, but QN1 and QNSA1 have different value labels.
813
814 ctables.sps:14.29-14.54: note: CTABLES: This syntax moves category labels to another axis.
815    14 | CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
816       |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
817
818 ctables.sps:15: error: CTABLES: To move category labels from one axis to another, the variables whose labels are to be
819 moved must all have the same category specifications, but QN105BA and QN105BB have different category specifications.
820
821 ctables.sps:15.35-15.60: note: CTABLES: This syntax moves category labels to another axis.
822    15 | CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
823       |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
824
825 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is left-associative: `a**b**c' equals
826 `(a**b)**c', not `a**(b**c)'.  To disable this warning, insert parentheses.
827    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
828       |                           ^~~~~~~
829
830 ctables.sps:17.35: error: CTABLES: Syntax error expecting `/'.
831    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
832       |                                   ^
833
834 ctables.sps:18.28-18.29: error: CTABLES: Syntax error.
835    18 | CTABLES /PCOMPUTE &x=EXPR([**]).
836       |                            ^~
837
838 ctables.sps:19.27-19.28: error: CTABLES: Syntax error.
839    19 | CTABLES /PCOMPUTE &x=EXPR(**).
840       |                           ^~
841
842 ctables.sps:21.15: error: CTABLES: At least one variable must be specified.
843    21 | CTABLES /TABLE.
844       |               ^
845
846 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
847
848 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a summary.
849    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
850       |                                                  ^~~~~
851
852 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a summary.
853    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
854       |                ^~~~~
855
856 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a summary.
857    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
858       |                                 ^~~~~
859
860 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
861 explicitly specify one.
862    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
863       |                                 ^~~~~
864
865 ctables.sps:25.46-25.63: error: CTABLES: Data-dependent sorting is not implemented.
866    25 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 50).
867       |                                              ^~~~~~~~~~~~~~~~~~
868
869 ctables.sps:27.16-27.21: error: CTABLES: Multiple response set support not implemented.
870    27 | CTABLES /TABLE $mrset.
871       |                ^~~~~~
872
873 ctables.sps:29.23-29.44: error: CTABLES: Support for SIGTEST not yet implemented.
874    29 | CTABLES /TABLE qn113 /SIGTEST TYPE=CHISQUARE.
875       |                       ^~~~~~~~~~~~~~~~~~~~~~
876
877 ctables.sps:30.23-30.43: error: CTABLES: Support for COMPARETEST not yet implemented.
878    30 | CTABLES /TABLE qn113 /COMPARETEST TYPE=PROP.
879       |                       ^~~~~~~~~~~~~~~~~~~~~
880
881 ctables.sps:32.23-32.31: error: CTABLES: Support for LCL, UCL, and SE summary functions is not yet implemented.
882    32 | CTABLES /TABLE qn113 [COUNT.UCL].
883       |                       ^~~~~~~~~
884
885 ctables.sps:34.32-34.33: error: CTABLES: Syntax error expecting VARIABLES.
886    34 | CTABLES /TABLE qn1 /CATEGORIES **.
887       |                                ^~
888
889 ctables.sps:36.10-36.15: error: CTABLES: Syntax error expecting one of the following: FORMAT, VLABELS, MRSETS, SMISSING,
890 PCOMPUTE, PPROPERTIES, WEIGHT, HIDESMALLCOUNTS, TABLE.
891    36 | CTABLES /TITLES.
892       |          ^~~~~~
893
894 ctables.sps:36.10-36.15: note: CTABLES: TABLE must appear before this subcommand.
895    36 | CTABLES /TITLES.
896       |          ^~~~~~
897 ]])
898 AT_CLEANUP
899
900 AT_SETUP([CTABLES one categorical variable])
901 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
902 AT_DATA([ctables.sps],
903 [[GET 'nhtsa.sav'.
904 CTABLES /TABLE qn1.
905 CTABLES /TABLE BY qn1.
906 CTABLES /TABLE BY BY qn1.
907 ]])
908 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
909                                   Custom Tables
910 ╭────────────────────────────────────────────────────────────────────────┬─────╮
911 │                                                                        │Count│
912 ├────────────────────────────────────────────────────────────────────────┼─────┤
913 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
914 │motor vehicle?                                     Several days a week  │ 1274│
915 │                                                   Once a week or less  │  361│
916 │                                                   Only certain times a │  130│
917 │                                                   year                 │     │
918 │                                                   Never                │  540│
919 ╰────────────────────────────────────────────────────────────────────────┴─────╯
920
921                                   Custom Tables
922 ╭──────────────────────────────────────────────────────────────────────────────╮
923 │        1. How often do you usually drive a car or other motor vehicle?       │
924 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
925 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
926 │Every day│       week       │       less       │          year          │Never│
927 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
928 │  Count  │       Count      │       Count      │          Count         │Count│
929 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
930 │     4667│              1274│               361│                     130│  540│
931 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
932
933 Custom Tables
934 Every day
935 ╭─────╮
936 │Count│
937 ├─────┤
938 │ 4667│
939 ╰─────╯
940 ])
941 AT_CLEANUP
942
943 AT_SETUP([CTABLES one string variable])
944 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
945 AT_DATA([ctables.sps],
946 [[GET 'nhtsa.sav'.
947 STRING licensed(A8).
948 MISSING VALUES licensed('DontKnow', 'Refused').
949 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
950 CTABLES /TABLE licensed.
951 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
952 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
953 * Notice that the string matching is case-sensitive.
954 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
955 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
956 CTABLES
957     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
958     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
959     /TABLE licensed
960     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
961 CTABLES
962     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
963     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
964     /TABLE licensed
965     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
966 ]])
967 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
968     Custom Tables
969 ╭────────────┬─────╮
970 │            │Count│
971 ├────────────┼─────┤
972 │licensed No │  572│
973 │         Yes│ 6379│
974 ╰────────────┴─────╯
975
976           Custom Tables
977 ╭─────────────────┬─────┬───────╮
978 │                 │Count│Valid N│
979 ├─────────────────┼─────┼───────┤
980 │licensed DontKnow│    4│       │
981 │         No      │  572│       │
982 │         Refused │   44│       │
983 │         Yes     │ 6379│       │
984 │         Total   │ 6999│   6951│
985 ╰─────────────────┴─────┴───────╯
986
987      Custom Tables
988 ╭──────────────┬─────╮
989 │              │Count│
990 ├──────────────┼─────┤
991 │licensed Yes  │ 6379│
992 │         No   │  572│
993 │         Total│ 6951│
994 ╰──────────────┴─────╯
995
996      Custom Tables
997 ╭──────────────┬─────╮
998 │              │Count│
999 ├──────────────┼─────┤
1000 │licensed Yes  │ 6379│
1001 │         no   │    0│
1002 │         Total│ 6379│
1003 ╰──────────────┴─────╯
1004
1005       Custom Tables
1006 ╭────────────────┬─────╮
1007 │                │Count│
1008 ├────────────────┼─────┤
1009 │licensed No     │  572│
1010 │         Refused│   44│
1011 │         Yes    │ 6379│
1012 │         Total  │ 6995│
1013 ╰────────────────┴─────╯
1014
1015       Custom Tables
1016 ╭────────────────┬─────╮
1017 │                │Count│
1018 ├────────────────┼─────┤
1019 │licensed Yes    │ 6379│
1020 │         Not Yes│  620│
1021 ╰────────────────┴─────╯
1022
1023       Custom Tables
1024 ╭────────────────┬─────╮
1025 │                │Count│
1026 ├────────────────┼─────┤
1027 │licensed Yes    │ 6379│
1028 │         Not Yes│  620│
1029 ╰────────────────┴─────╯
1030 ])
1031 AT_CLEANUP
1032
1033 AT_SETUP([CTABLES one scale variable])
1034 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1035 AT_DATA([ctables.sps],
1036 [[GET 'nhtsa.sav'.
1037 DESCRIPTIVES qnd1.
1038 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
1039 CTABLES /TABLE BY qnd1.
1040 CTABLES /TABLE BY BY qnd1.
1041 ]])
1042 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1043                        Descriptive Statistics
1044 ╭──────────────────────────┬────┬─────┬───────┬───────┬───────────╮
1045 │                          │  N │ Mean│Std Dev│Minimum│  Maximum  │
1046 ├──────────────────────────┼────┼─────┼───────┼───────┼───────────┤
1047 │D1. AGE: What is your age?│6930│48.26│  19.01│     16│86 or older│
1048 │Valid N (listwise)        │6999│     │       │       │           │
1049 │Missing N (listwise)      │  69│     │       │       │           │
1050 ╰──────────────────────────┴────┴─────┴───────┴───────┴───────────╯
1051
1052                                   Custom Tables
1053 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
1054 │                      │     │       │       │    │     Std    │       │       │
1055 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
1056 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
1057 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
1058 │age?                  │     │       │       │    │            │       │       │
1059 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
1060
1061         Custom Tables
1062 ╭──────────────────────────╮
1063 │D1. AGE: What is your age?│
1064 ├──────────────────────────┤
1065 │           Mean           │
1066 ├──────────────────────────┤
1067 │                        48│
1068 ╰──────────────────────────╯
1069
1070 Custom Tables
1071 D1. AGE: What is your age?
1072 ╭────╮
1073 │Mean│
1074 ├────┤
1075 │  48│
1076 ╰────╯
1077 ])
1078 AT_CLEANUP
1079
1080 AT_SETUP([CTABLES simple stacking])
1081 AT_KEYWORDS([stack stacked])
1082 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1083 AT_DATA([ctables.sps],
1084 [[GET 'nhtsa.sav'.
1085 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
1086 ]])
1087 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1088                                   Custom Tables
1089 ╭───────────────────────────────────────────────────────────────┬──────────────╮
1090 │                                                               │ S3a. GENDER: │
1091 │                                                               ├──────┬───────┤
1092 │                                                               │ Male │ Female│
1093 │                                                               ├──────┼───────┤
1094 │                                                               │Column│ Column│
1095 │                                                               │   %  │   %   │
1096 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1097 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
1098 │too much to drink to drive safely will A. Get      certain     │      │       │
1099 │stopped by the police?                             Very likely │   21%│    22%│
1100 │                                                   Somewhat    │   38%│    42%│
1101 │                                                   likely      │      │       │
1102 │                                                   Somewhat    │   21%│    18%│
1103 │                                                   unlikely    │      │       │
1104 │                                                   Very        │   10%│     8%│
1105 │                                                   unlikely    │      │       │
1106 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1107 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
1108 │too much to drink to drive safely will B. Have an  certain     │      │       │
1109 │accident?                                          Very likely │   36%│    45%│
1110 │                                                   Somewhat    │   39%│    32%│
1111 │                                                   likely      │      │       │
1112 │                                                   Somewhat    │    9%│     4%│
1113 │                                                   unlikely    │      │       │
1114 │                                                   Very        │    3%│     2%│
1115 │                                                   unlikely    │      │       │
1116 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1117 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
1118 │too much to drink to drive safely will C. Be       certain     │      │       │
1119 │convicted for drunk driving?                       Very likely │   32%│    28%│
1120 │                                                   Somewhat    │   27%│    32%│
1121 │                                                   likely      │      │       │
1122 │                                                   Somewhat    │   15%│    15%│
1123 │                                                   unlikely    │      │       │
1124 │                                                   Very        │    9%│     9%│
1125 │                                                   unlikely    │      │       │
1126 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
1127 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
1128 │too much to drink to drive safely will D. Be       certain     │      │       │
1129 │arrested for drunk driving?                        Very likely │   26%│    27%│
1130 │                                                   Somewhat    │   32%│    35%│
1131 │                                                   likely      │      │       │
1132 │                                                   Somewhat    │   17%│    15%│
1133 │                                                   unlikely    │      │       │
1134 │                                                   Very        │    9%│     7%│
1135 │                                                   unlikely    │      │       │
1136 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
1137 ])
1138 AT_CLEANUP
1139
1140 AT_SETUP([CTABLES show or hide empty categories])
1141 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1142 AT_DATA([ctables.sps],
1143 [[GET 'nhtsa.sav'.
1144 IF (qn105ba = 2) qn105ba = 1.
1145 IF (qns3a = 1) qns3a = 2.
1146 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
1147 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1148     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
1149 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1150     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
1151 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
1152     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
1153 ]])
1154 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1155                                   Custom Tables
1156 ╭──────────────────────────────────────────────────────────────┬───────────────╮
1157 │                                                              │  S3a. GENDER: │
1158 │                                                              ├───────┬───────┤
1159 │                                                              │  Male │ Female│
1160 │                                                              ├───────┼───────┤
1161 │                                                              │ Column│ Column│
1162 │                                                              │   %   │   %   │
1163 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
1164 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
1165 │too much to drink to drive safely will A. Get      certain    │       │       │
1166 │stopped by the police?                             Very likely│      .│     0%│
1167 │                                                   Somewhat   │      .│    40%│
1168 │                                                   likely     │       │       │
1169 │                                                   Somewhat   │      .│    19%│
1170 │                                                   unlikely   │       │       │
1171 │                                                   Very       │      .│     9%│
1172 │                                                   unlikely   │       │       │
1173 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
1174
1175                                   Custom Tables
1176 ╭──────────────────────────────────────────────────────────────┬───────────────╮
1177 │                                                              │  S3a. GENDER: │
1178 │                                                              ├───────┬───────┤
1179 │                                                              │  Male │ Female│
1180 │                                                              ├───────┼───────┤
1181 │                                                              │ Column│ Column│
1182 │                                                              │   %   │   %   │
1183 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
1184 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
1185 │too much to drink to drive safely will A. Get      certain    │       │       │
1186 │stopped by the police?                             Somewhat   │      .│    40%│
1187 │                                                   likely     │       │       │
1188 │                                                   Somewhat   │      .│    19%│
1189 │                                                   unlikely   │       │       │
1190 │                                                   Very       │      .│     9%│
1191 │                                                   unlikely   │       │       │
1192 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
1193
1194                                   Custom Tables
1195 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1196 │                                                                    │   S3a.  │
1197 │                                                                    │ GENDER: │
1198 │                                                                    ├─────────┤
1199 │                                                                    │  Female │
1200 │                                                                    ├─────────┤
1201 │                                                                    │ Column %│
1202 ├────────────────────────────────────────────────────────────────────┼─────────┤
1203 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1204 │much to drink to drive safely will A. Get stopped by    certain     │         │
1205 │the police?                                             Very likely │       0%│
1206 │                                                        Somewhat    │      40%│
1207 │                                                        likely      │         │
1208 │                                                        Somewhat    │      19%│
1209 │                                                        unlikely    │         │
1210 │                                                        Very        │       9%│
1211 │                                                        unlikely    │         │
1212 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1213
1214                                   Custom Tables
1215 ╭────────────────────────────────────────────────────────────────────┬─────────╮
1216 │                                                                    │   S3a.  │
1217 │                                                                    │ GENDER: │
1218 │                                                                    ├─────────┤
1219 │                                                                    │  Female │
1220 │                                                                    ├─────────┤
1221 │                                                                    │ Column %│
1222 ├────────────────────────────────────────────────────────────────────┼─────────┤
1223 │105b. How likely is it that drivers who have had too    Almost      │      32%│
1224 │much to drink to drive safely will A. Get stopped by    certain     │         │
1225 │the police?                                             Somewhat    │      40%│
1226 │                                                        likely      │         │
1227 │                                                        Somewhat    │      19%│
1228 │                                                        unlikely    │         │
1229 │                                                        Very        │       9%│
1230 │                                                        unlikely    │         │
1231 ╰────────────────────────────────────────────────────────────────────┴─────────╯
1232 ])
1233 AT_CLEANUP
1234
1235 AT_SETUP([CTABLES sorting categories])
1236 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1237 AT_DATA([ctables.sps],
1238 [[GET 'nhtsa.sav'.
1239 IF (QND5A=6) QND5A=-1.
1240 IF (QND5A=5) QND5A=-2.
1241 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1242         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1243         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1244         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1245 ]])
1246 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1247                                   Custom Tables
1248 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1249 │                                                                        │Count│
1250 ├────────────────────────────────────────────────────────────────────────┼─────┤
1251 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1252 │background?                                     -1.00                   │   78│
1253 │                                                Cuban                   │   20│
1254 │                                                Mexican                 │  311│
1255 │                                                Spanish                 │   48│
1256 │                                                South American          │   34│
1257 │                                                Central American        │    0│
1258 │                                                Puerto Rican, OR        │    0│
1259 │                                                Something else          │   68│
1260 │                                                Multiple - cannot choose│    7│
1261 │                                                one                     │     │
1262 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1263
1264                                   Custom Tables
1265 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1266 │                                                                        │Count│
1267 ├────────────────────────────────────────────────────────────────────────┼─────┤
1268 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1269 │background?                                     one                     │     │
1270 │                                                Something else          │   68│
1271 │                                                Puerto Rican, OR        │    0│
1272 │                                                Central American        │    0│
1273 │                                                South American          │   34│
1274 │                                                Spanish                 │   48│
1275 │                                                Mexican                 │  311│
1276 │                                                Cuban                   │   20│
1277 │                                                -1.00                   │   78│
1278 │                                                -2.00                   │   52│
1279 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1280
1281                                   Custom Tables
1282 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1283 │                                                                        │Count│
1284 ├────────────────────────────────────────────────────────────────────────┼─────┤
1285 │D5a. What would you say is your primary ethnic  Central American        │    0│
1286 │background?                                     Cuban                   │   20│
1287 │                                                Mexican                 │  311│
1288 │                                                Multiple - cannot choose│    7│
1289 │                                                one                     │     │
1290 │                                                Puerto Rican, OR        │    0│
1291 │                                                Something else          │   68│
1292 │                                                South American          │   34│
1293 │                                                Spanish                 │   48│
1294 │                                                -2.00                   │   52│
1295 │                                                -1.00                   │   78│
1296 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1297
1298                                   Custom Tables
1299 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1300 │                                                                        │Count│
1301 ├────────────────────────────────────────────────────────────────────────┼─────┤
1302 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1303 │background?                                     South American          │   34│
1304 │                                                Something else          │   68│
1305 │                                                Puerto Rican, OR        │    0│
1306 │                                                Multiple - cannot choose│    7│
1307 │                                                one                     │     │
1308 │                                                Mexican                 │  311│
1309 │                                                Cuban                   │   20│
1310 │                                                Central American        │    0│
1311 │                                                -1.00                   │   78│
1312 │                                                -2.00                   │   52│
1313 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1314 ])
1315 AT_CLEANUP
1316
1317 AT_SETUP([CTABLES simple nesting])
1318 AT_KEYWORDS([nest nested])
1319 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1320 AT_DATA([ctables.sps],
1321 [[GET 'nhtsa.sav'.
1322 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1323   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1324 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1325   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1326   /CLABELS ROW=OPPOSITE.
1327 ]])
1328 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1329                                   Custom Tables
1330 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1331 │                                                                 │     │ Table│
1332 │                                                                 │Count│   %  │
1333 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1334 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1335 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1336 │drive safely will A. Get stopped by                        Total │  700│   10%│
1337 │the police?                           ╶──────────────────────────┼─────┼──────┤
1338 │                                       Very       S3a.     Male  │  660│   10%│
1339 │                                       likely     GENDER:  Female│  842│   12%│
1340 │                                                           Total │ 1502│   22%│
1341 │                                      ╶──────────────────────────┼─────┼──────┤
1342 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1343 │                                       likely     GENDER:  Female│ 1589│   23%│
1344 │                                                           Total │ 2763│   40%│
1345 │                                      ╶──────────────────────────┼─────┼──────┤
1346 │                                       Somewhat   S3a.     Male  │  640│    9%│
1347 │                                       unlikely   GENDER:  Female│  667│   10%│
1348 │                                                           Total │ 1307│   19%│
1349 │                                      ╶──────────────────────────┼─────┼──────┤
1350 │                                       Very       S3a.     Male  │  311│    5%│
1351 │                                       unlikely   GENDER:  Female│  298│    4%│
1352 │                                                           Total │  609│    9%│
1353 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1354 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1355 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1356 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1357 │                                      ╶──────────────────────────┼─────┼──────┤
1358 │                                       Very       S3a.     Male  │ 1104│   16%│
1359 │                                       likely     GENDER:  Female│ 1715│   25%│
1360 │                                                           Total │ 2819│   41%│
1361 │                                      ╶──────────────────────────┼─────┼──────┤
1362 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1363 │                                       likely     GENDER:  Female│ 1214│   18%│
1364 │                                                           Total │ 2417│   35%│
1365 │                                      ╶──────────────────────────┼─────┼──────┤
1366 │                                       Somewhat   S3a.     Male  │  262│    4%│
1367 │                                       unlikely   GENDER:  Female│  168│    2%│
1368 │                                                           Total │  430│    6%│
1369 │                                      ╶──────────────────────────┼─────┼──────┤
1370 │                                       Very       S3a.     Male  │   81│    1%│
1371 │                                       unlikely   GENDER:  Female│   59│    1%│
1372 │                                                           Total │  140│    2%│
1373 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1374 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1375 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1376 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1377 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1378 │                                       Very       S3a.     Male  │  988│   14%│
1379 │                                       likely     GENDER:  Female│ 1049│   15%│
1380 │                                                           Total │ 2037│   30%│
1381 │                                      ╶──────────────────────────┼─────┼──────┤
1382 │                                       Somewhat   S3a.     Male  │  822│   12%│
1383 │                                       likely     GENDER:  Female│ 1210│   18%│
1384 │                                                           Total │ 2032│   30%│
1385 │                                      ╶──────────────────────────┼─────┼──────┤
1386 │                                       Somewhat   S3a.     Male  │  446│    7%│
1387 │                                       unlikely   GENDER:  Female│  548│    8%│
1388 │                                                           Total │  994│   15%│
1389 │                                      ╶──────────────────────────┼─────┼──────┤
1390 │                                       Very       S3a.     Male  │  268│    4%│
1391 │                                       unlikely   GENDER:  Female│  354│    5%│
1392 │                                                           Total │  622│    9%│
1393 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1394 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1395 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1396 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1397 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1398 │                                       Very       S3a.     Male  │  805│   12%│
1399 │                                       likely     GENDER:  Female│ 1029│   15%│
1400 │                                                           Total │ 1834│   27%│
1401 │                                      ╶──────────────────────────┼─────┼──────┤
1402 │                                       Somewhat   S3a.     Male  │  975│   14%│
1403 │                                       likely     GENDER:  Female│ 1332│   19%│
1404 │                                                           Total │ 2307│   34%│
1405 │                                      ╶──────────────────────────┼─────┼──────┤
1406 │                                       Somewhat   S3a.     Male  │  535│    8%│
1407 │                                       unlikely   GENDER:  Female│  560│    8%│
1408 │                                                           Total │ 1095│   16%│
1409 │                                      ╶──────────────────────────┼─────┼──────┤
1410 │                                       Very       S3a.     Male  │  270│    4%│
1411 │                                       unlikely   GENDER:  Female│  279│    4%│
1412 │                                                           Total │  549│    8%│
1413 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1414
1415                                   Custom Tables
1416 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1417 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1418 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1419 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1420 │                                 │        │ Table│         │         │        │
1421 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1422 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1423 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1424 │GENDER:        is it that drivers│        │      │         │         │        │
1425 │               who have had too  │        │      │         │         │        │
1426 │               much to drink to  │        │      │         │         │        │
1427 │               drive safely will │        │      │         │         │        │
1428 │               A. Get stopped by │        │      │         │         │        │
1429 │               the police?       │        │      │         │         │        │
1430 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1431 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1432 │               is it that drivers│        │      │         │         │        │
1433 │               who have had too  │        │      │         │         │        │
1434 │               much to drink to  │        │      │         │         │        │
1435 │               drive safely will │        │      │         │         │        │
1436 │               A. Get stopped by │        │      │         │         │        │
1437 │               the police?       │        │      │         │         │        │
1438 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1439 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1440 │               is it that drivers│        │      │         │         │        │
1441 │               who have had too  │        │      │         │         │        │
1442 │               much to drink to  │        │      │         │         │        │
1443 │               drive safely will │        │      │         │         │        │
1444 │               A. Get stopped by │        │      │         │         │        │
1445 │               the police?       │        │      │         │         │        │
1446 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1447 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1448 │GENDER:        is it that drivers│        │      │         │         │        │
1449 │               who have had too  │        │      │         │         │        │
1450 │               much to drink to  │        │      │         │         │        │
1451 │               drive safely will │        │      │         │         │        │
1452 │               B. Have an        │        │      │         │         │        │
1453 │               accident?         │        │      │         │         │        │
1454 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1455 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1456 │               is it that drivers│        │      │         │         │        │
1457 │               who have had too  │        │      │         │         │        │
1458 │               much to drink to  │        │      │         │         │        │
1459 │               drive safely will │        │      │         │         │        │
1460 │               B. Have an        │        │      │         │         │        │
1461 │               accident?         │        │      │         │         │        │
1462 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1463 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1464 │               is it that drivers│        │      │         │         │        │
1465 │               who have had too  │        │      │         │         │        │
1466 │               much to drink to  │        │      │         │         │        │
1467 │               drive safely will │        │      │         │         │        │
1468 │               B. Have an        │        │      │         │         │        │
1469 │               accident?         │        │      │         │         │        │
1470 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1471 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1472 │GENDER:        is it that drivers│        │      │         │         │        │
1473 │               who have had too  │        │      │         │         │        │
1474 │               much to drink to  │        │      │         │         │        │
1475 │               drive safely will │        │      │         │         │        │
1476 │               C. Be convicted   │        │      │         │         │        │
1477 │               for drunk driving?│        │      │         │         │        │
1478 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1479 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1480 │               is it that drivers│        │      │         │         │        │
1481 │               who have had too  │        │      │         │         │        │
1482 │               much to drink to  │        │      │         │         │        │
1483 │               drive safely will │        │      │         │         │        │
1484 │               C. Be convicted   │        │      │         │         │        │
1485 │               for drunk driving?│        │      │         │         │        │
1486 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1487 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1488 │               is it that drivers│        │      │         │         │        │
1489 │               who have had too  │        │      │         │         │        │
1490 │               much to drink to  │        │      │         │         │        │
1491 │               drive safely will │        │      │         │         │        │
1492 │               C. Be convicted   │        │      │         │         │        │
1493 │               for drunk driving?│        │      │         │         │        │
1494 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1495 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1496 │GENDER:        is it that drivers│        │      │         │         │        │
1497 │               who have had too  │        │      │         │         │        │
1498 │               much to drink to  │        │      │         │         │        │
1499 │               drive safely will │        │      │         │         │        │
1500 │               D. Be arrested for│        │      │         │         │        │
1501 │               drunk driving?    │        │      │         │         │        │
1502 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1503 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1504 │               is it that drivers│        │      │         │         │        │
1505 │               who have had too  │        │      │         │         │        │
1506 │               much to drink to  │        │      │         │         │        │
1507 │               drive safely will │        │      │         │         │        │
1508 │               D. Be arrested for│        │      │         │         │        │
1509 │               drunk driving?    │        │      │         │         │        │
1510 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1511 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1512 │               is it that drivers│        │      │         │         │        │
1513 │               who have had too  │        │      │         │         │        │
1514 │               much to drink to  │        │      │         │         │        │
1515 │               drive safely will │        │      │         │         │        │
1516 │               D. Be arrested for│        │      │         │         │        │
1517 │               drunk driving?    │        │      │         │         │        │
1518 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1519 ])
1520 AT_CLEANUP
1521
1522 AT_SETUP([CTABLES nesting and scale variables])
1523 AT_KEYWORDS([nest nested])
1524 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1525 AT_DATA([ctables.sps],
1526 [[GET 'nhtsa.sav'.
1527 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1528 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1529 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1530   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1531 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1532 ]])
1533 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1534                                   Custom Tables
1535 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1536 │                                                                 │S3a. GENDER:│
1537 │                                                                 ├─────┬──────┤
1538 │                                                                 │ Male│Female│
1539 │                                                                 ├─────┼──────┤
1540 │                                                                 │ Mean│ Mean │
1541 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1542 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1543 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1544 │                                                  week           │     │      │
1545 │                                                  Once a week or │   44│    54│
1546 │                                                  less           │     │      │
1547 │                                                  Only certain   │   34│    41│
1548 │                                                  times a year   │     │      │
1549 │                                                  Never          │   39│    55│
1550 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1551
1552                                   Custom Tables
1553 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1554 │                                                         │Minimum│Maximum│Mean│
1555 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1556 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1557 │What is  GENDER:         months, has there been a        │       │       │    │
1558 │your                     time when you felt you          │       │       │    │
1559 │age?                     should cut down on your      No │     16│     86│  46│
1560 │                         drinking?                       │       │       │    │
1561 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1562 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1563 │                         months, has there been a        │       │       │    │
1564 │                         time when you felt you          │       │       │    │
1565 │                         should cut down on your      No │     16│     86│  48│
1566 │                         drinking?                       │       │       │    │
1567 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1568 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1569 │What is  GENDER:         months, has there been a        │       │       │    │
1570 │your                     time when people criticized  No │     16│     86│  46│
1571 │age?                     your drinking?                  │       │       │    │
1572 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1573 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1574 │                         months, has there been a        │       │       │    │
1575 │                         time when people criticized  No │     16│     86│  48│
1576 │                         your drinking?                  │       │       │    │
1577 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1578
1579                                   Custom Tables
1580 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1581 │                             │S1. Including yourself, how many members of this│
1582 │                             │         household are age 16 or older?         │
1583 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1584 │                             │      │      │      │      │      │      │ 6 or │
1585 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1586 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1587 │                             │Column│Column│Column│Column│Column│Column│Column│
1588 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1589 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1590 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1591 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1592 │SOURCE:     likely           │      │      │      │      │      │      │      │
1593 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1594 │            that     likely  │      │      │      │      │      │      │      │
1595 │            drivers          │      │      │      │      │      │      │      │
1596 │            who have         │      │      │      │      │      │      │      │
1597 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1598 │            much to  likely  │      │      │      │      │      │      │      │
1599 │            drink to         │      │      │      │      │      │      │      │
1600 │            drive            │      │      │      │      │      │      │      │
1601 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1602 │            will A.  unlikely│      │      │      │      │      │      │      │
1603 │            Get              │      │      │      │      │      │      │      │
1604 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1605 │            by the   unlikely│      │      │      │      │      │      │      │
1606 │            police?          │      │      │      │      │      │      │      │
1607 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1608
1609                                   Custom Tables
1610 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1611 │                                                              │    │    Std   │
1612 │                                                              │Mean│ Deviation│
1613 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1614 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1615 │group           typical month did you have one or more        │    │          │
1616 │                alcoholic beverages to drink?                 │    │          │
1617 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1618 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1619 │                typical month did you have one or more        │    │          │
1620 │                alcoholic beverages to drink?                 │    │          │
1621 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1622 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1623 │                typical month did you have one or more        │    │          │
1624 │                alcoholic beverages to drink?                 │    │          │
1625 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1626 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1627 │                typical month did you have one or more        │    │          │
1628 │                alcoholic beverages to drink?                 │    │          │
1629 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1630 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1631 │                typical month did you have one or more        │    │          │
1632 │                alcoholic beverages to drink?                 │    │          │
1633 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1634 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1635 │       older    typical month did you have one or more        │    │          │
1636 │                alcoholic beverages to drink?                 │    │          │
1637 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1638 ])
1639 AT_CLEANUP
1640
1641
1642 AT_SETUP([CTABLES SLABELS])
1643 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1644 AT_DATA([ctables.sps],
1645 [[GET 'nhtsa.sav'.
1646 CTABLES /TABLE qn1 [COUNT COLPCT].
1647 CTABLES /TABLE qn1 [COUNT COLPCT]
1648     /SLABELS POSITION=ROW.
1649 CTABLES /TABLE qn1 [COUNT COLPCT]
1650     /SLABELS POSITION=ROW VISIBLE=NO.
1651 ]])
1652 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1653                                   Custom Tables
1654 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1655 │                                                                │     │ Column│
1656 │                                                                │Count│   %   │
1657 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1658 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1659 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1660 │                                             Once a week or less│  361│   5.2%│
1661 │                                             Only certain times │  130│   1.9%│
1662 │                                             a year             │     │       │
1663 │                                             Never              │  540│   7.7%│
1664 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1665
1666                                   Custom Tables
1667 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1668 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1669 │other motor vehicle?                                             Column │66.9%│
1670 │                                                                 %      │     │
1671 │                                            ╶───────────────────────────┼─────┤
1672 │                                             Several days a week Count  │ 1274│
1673 │                                                                 Column │18.3%│
1674 │                                                                 %      │     │
1675 │                                            ╶───────────────────────────┼─────┤
1676 │                                             Once a week or less Count  │  361│
1677 │                                                                 Column │ 5.2%│
1678 │                                                                 %      │     │
1679 │                                            ╶───────────────────────────┼─────┤
1680 │                                             Only certain times  Count  │  130│
1681 │                                             a year              Column │ 1.9%│
1682 │                                                                 %      │     │
1683 │                                            ╶───────────────────────────┼─────┤
1684 │                                             Never               Count  │  540│
1685 │                                                                 Column │ 7.7%│
1686 │                                                                 %      │     │
1687 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1688
1689                                   Custom Tables
1690 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1691 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1692 │motor vehicle?                                                          │66.9%│
1693 │                                                   Several days a week  │ 1274│
1694 │                                                                        │18.3%│
1695 │                                                   Once a week or less  │  361│
1696 │                                                                        │ 5.2%│
1697 │                                                   Only certain times a │  130│
1698 │                                                   year                 │ 1.9%│
1699 │                                                   Never                │  540│
1700 │                                                                        │ 7.7%│
1701 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1702 ])
1703 AT_CLEANUP
1704
1705 AT_SETUP([CTABLES simple totals])
1706 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1707 AT_DATA([ctables.sps],
1708 [[GET 'nhtsa.sav'.
1709 CTABLES /TABLE=qn17
1710     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1711 DESCRIPTIVES qn18/STATISTICS=MEAN.
1712 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1713     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1714 ]])
1715 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1716                                   Custom Tables
1717 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1718 │                                                                        │Count│
1719 ├────────────────────────────────────────────────────────────────────────┼─────┤
1720 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1721 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1722 │                                                      Light beer        │  620│
1723 │                                                      Wine              │ 1418│
1724 │                                                      Wine coolers      │  137│
1725 │                                                      Hard liquor or    │  888│
1726 │                                                      mixed drinks      │     │
1727 │                                                      Flavored malt     │   83│
1728 │                                                      drinks            │     │
1729 │                                                      Number responding │ 4221│
1730 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1731
1732                              Descriptive Statistics
1733 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1734 │                                                                    │  N │Mean│
1735 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1736 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1737 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1738 │Valid N (listwise)                                                  │6999│    │
1739 │Missing N (listwise)                                                │2781│    │
1740 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1741
1742                                   Custom Tables
1743 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1744 │                                                      │    │     │ Valid│Total│
1745 │                                                      │Mean│Count│   N  │  N  │
1746 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1747 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1748 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1749 │                you usually drink per sitting?        │    │     │      │     │
1750 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1751 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1752 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1753 │                you usually drink per sitting?        │    │     │      │     │
1754 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1755 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1756 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1757 │                you usually drink per sitting?        │    │     │      │     │
1758 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1759 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1760 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1761 │                you usually drink per sitting?        │    │     │      │     │
1762 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1763 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1764 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1765 │                you usually drink per sitting?        │    │     │      │     │
1766 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1767 ])
1768 AT_CLEANUP
1769
1770 AT_SETUP([CTABLES subtotals])
1771 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1772 AT_DATA([ctables.sps],
1773 [[GET 'nhtsa.sav'.
1774 CTABLES /TABLE=qn105ba BY qns1
1775     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1776 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1777     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1778 CTABLES /TABLE=qn105ba BY qns1
1779     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1780     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1781 ]])
1782 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1783                                                       Custom Tables
1784 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1785 │                                                         │ S1. Including yourself, how many members of this household │
1786 │                                                         │                    are age 16 or older?                    │
1787 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1788 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1789 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1790 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1791 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1792 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1793 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1794 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1795 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1796 │                                              likely     │       │       │         │       │        │      │          │
1797 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1798 │                                              unlikely   │       │       │         │       │        │      │          │
1799 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1800 │                                              unlikely   │       │       │         │       │        │      │          │
1801 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1802
1803                                                       Custom Tables
1804 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1805 │                                                        │  S1. Including yourself, how many members of this household │
1806 │                                                        │                     are age 16 or older?                    │
1807 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1808 │                                                        │        │        │        │        │       │        │  6 or  │
1809 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1810 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1811 │                                                        │        │        │        │        │ Column│        │        │
1812 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1813 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1814 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1815 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1816 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1817 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1818 │                                             likely     │        │        │        │        │       │        │        │
1819 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1820 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1821 │                                             unlikely   │        │        │        │        │       │        │        │
1822 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1823 │                                             unlikely   │        │        │        │        │       │        │        │
1824 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1825 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1826
1827                                                       Custom Tables
1828 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1829 │                                                         │ S1. Including yourself, how many members of this household │
1830 │                                                         │                    are age 16 or older?                    │
1831 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1832 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1833 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1834 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1835 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1836 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1837 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1838 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1839 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1840 │                                              likely     │       │       │         │       │        │      │          │
1841 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1842 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1843 │                                              unlikely   │       │       │         │       │        │      │          │
1844 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1845 │                                              unlikely   │       │       │         │       │        │      │          │
1846 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1847 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1848 ])
1849 AT_CLEANUP
1850
1851 AT_SETUP([CTABLES PCOMPUTE])
1852 AT_KEYWORDS([postcompute])
1853 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1854 AT_DATA([ctables.sps],
1855 [[GET 'nhtsa.sav'.
1856 CTABLES
1857     /PCOMPUTE &x=EXPR([3] + [4])
1858     /PCOMPUTE &y=EXPR([4] + [5])
1859     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1860     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1861     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1862     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1863
1864 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1865 CTABLES
1866     /PCOMPUTE &x=EXPR([3] + [4])
1867     /PCOMPUTE &y=EXPR([4] + [5])
1868     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1869     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1870     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1871     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1872 ]])
1873 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1874                                                                 Custom Tables
1875 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1876 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1877 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1878 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1879 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1880 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1881 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1882 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1883 │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%│
1884 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1885 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1886 │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%│
1887 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1888 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1889 │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%│
1890 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1891 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1892 │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%│
1893 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1894 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1895 │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%│
1896 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1897 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1898 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1899
1900                                                                 Custom Tables
1901 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1902 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1903 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1904 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1905 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1906 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1907 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1908 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1909 │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%│
1910 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1911 │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%│
1912 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1913 │                               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%│
1914 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1915 │                               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%│
1916 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1917 │                               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%│
1918 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1919 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1920 ])
1921 AT_CLEANUP
1922
1923 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1924 AT_KEYWORDS([postcompute])
1925 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1926 AT_DATA([ctables.sps],
1927 [[GET 'nhtsa.sav'.
1928 CTABLES
1929     /PCOMPUTE &x=EXPR(OTHERNM)
1930     /PCOMPUTE &y=EXPR(MISSING)
1931     /PPROPERTIES &x LABEL='Drivers'
1932     /PPROPERTIES &y LABEL='Missing Values 2'
1933     /TABLE=qn1 BY qns3a
1934     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1935 ]])
1936 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1937                                               Custom Tables
1938 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1939 │                                                                                          │S3a. GENDER:│
1940 │                                                                                          ├─────┬──────┤
1941 │                                                                                          │ Male│Female│
1942 │                                                                                          ├─────┼──────┤
1943 │                                                                                          │Count│ Count│
1944 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1945 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1946 │                                                                 Several days a week      │  440│   834│
1947 │                                                                 Once a week or less      │  125│   236│
1948 │                                                                 Only certain times a year│   58│    72│
1949 │                                                                 Never                    │  192│   348│
1950 │                                                                 Drivers                  │ 2928│  3504│
1951 │                                                                 Valid Values             │ 3120│  3852│
1952 │                                                                 Don't know               │    3│     5│
1953 │                                                                 Refused                  │    9│    10│
1954 │                                                                 Missing Values           │   12│    15│
1955 │                                                                 Missing Values 2         │   12│    15│
1956 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1957 ])
1958 AT_CLEANUP
1959
1960 AT_SETUP([CTABLES PCOMPUTE - THRU])
1961 AT_KEYWORDS([postcompute])
1962 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1963 AT_DATA([ctables.sps],
1964 [[GET 'nhtsa.sav'.
1965 CTABLES
1966     /PCOMPUTE &x=EXPR([1 THRU 2])
1967     /PCOMPUTE &y=EXPR([3 THRU 4])
1968     /PCOMPUTE &z=EXPR([5] + MISSING)
1969     /PPROPERTIES &x LABEL='Frequent Drivers'
1970     /PPROPERTIES &y LABEL='Infrequent Drivers'
1971     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1972     /TABLE=qn1 BY qns3a
1973     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1974 ]])
1975 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1976                                               Custom Tables
1977 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1978 │                                                                                          │S3a. GENDER:│
1979 │                                                                                          ├─────┬──────┤
1980 │                                                                                          │ Male│Female│
1981 │                                                                                          ├─────┼──────┤
1982 │                                                                                          │Count│ Count│
1983 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1984 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1985 │                                                                 Several days a week      │  440│   834│
1986 │                                                                 Frequent Drivers         │ 2745│  3196│
1987 │                                                                 Once a week or less      │  125│   236│
1988 │                                                                 Only certain times a year│   58│    72│
1989 │                                                                 Infrequent Drivers       │  183│   308│
1990 │                                                                 Drivers                  │ 2928│  3504│
1991 │                                                                 Never                    │  192│   348│
1992 │                                                                 Don't know               │    3│     5│
1993 │                                                                 Refused                  │    9│    10│
1994 │                                                                 Not Drivers or Missing   │  204│   363│
1995 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1996 ])
1997 AT_CLEANUP
1998
1999 dnl I'm not sure that this is the correct behavior (see
2000 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
2001 dnl but at least this test will notify us if the behavior changes.
2002 AT_SETUP([CTABLES intersecting PCOMPUTEs])
2003 AT_KEYWORDS([PCOMPUTE postcompute])
2004 AT_DATA([ctables.sps],
2005 [[DATA LIST LIST NOTABLE/x y z.
2006 WEIGHT by z.
2007 FORMATS ALL (F1.0).
2008 VARIABLE LEVEL x y (NOMINAL).
2009 BEGIN DATA.
2010 1 4 5
2011 1 5 2
2012 1 6 9
2013 2 4 2
2014 2 5 3
2015 2 6 4
2016 3 4 1
2017 3 5 6
2018 3 6 1
2019 END DATA.
2020
2021 CTABLES
2022     /PCOMPUTE &a = EXPR([1] + [2])
2023     /PCOMPUTE &b = EXPR([2] + [3])
2024     /PCOMPUTE &c = EXPR([4] * [5])
2025     /PCOMPUTE &d = EXPR([5] * [6])
2026     /TABLE x BY y
2027     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
2028     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
2029 ]])
2030 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
2031 [[                   Custom Tables
2032 ╭───────────┬─────────────────────────────────────╮
2033 │           │                  y                  │
2034 │           ├─────┬─────────┬─────┬─────────┬─────┤
2035 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
2036 │           ├─────┼─────────┼─────┼─────────┼─────┤
2037 │           │Count│  Count  │Count│  Count  │Count│
2038 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
2039 │x 1        │    5│       10│    2│       18│    9│
2040 │  [1] + [2]│    7│        .│    5│        .│   13│
2041 │  2        │    2│        6│    3│       12│    4│
2042 │  [2] + [3]│    3│        .│    9│        .│    5│
2043 │  3        │    1│        6│    6│        6│    1│
2044 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
2045 ]])
2046 AT_CLEANUP
2047
2048 AT_SETUP([CTABLES string and date and time])
2049
2050 weight=1
2051 for gender in F M; do
2052     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
2053         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
2054             printf "$weight $gender $month $wkday\n"
2055             weight=$(expr \( $weight + 3 \) % 7 + 2)
2056         done
2057     done
2058 done > ctables.txt
2059
2060 AT_DATA([ctables.sps],
2061 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
2062     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
2063 WEIGHT by w.
2064 VARIABLE LEVEL w (SCALE).
2065 VARIABLE LEVEL gender fmon fday (NOMINAL).
2066 VARIABLE LABEL
2067   gender 'Gender'
2068   fmon 'Favorite month'
2069   fday 'Favorite day of the week'.
2070 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
2071 CTABLES
2072     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
2073     /PPROPERTIES &q2 LABEL='Q2'
2074     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
2075     /PPROPERTIES &weekend LABEL='Weekend'
2076     /TABLE fmon BY gender > fday
2077     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
2078                                 4 THRU 6, &q2,
2079                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
2080                                 OTHERNM, SUBTOTAL='Q4']
2081     /CATEGORIES VARIABLES=gender ['M', 'F']
2082     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
2083     /SLABELS VISIBLE=NO.
2084 ]])
2085 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2086                                               Custom Tables
2087 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
2088 │                  │                                       Gender                                      │
2089 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
2090 │                  │                   Male                  │                  Female                 │
2091 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
2092 │                  │         Favorite day of the week        │         Favorite day of the week        │
2093 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
2094 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
2095 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
2096 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
2097 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2098 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2099 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
2100 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2101 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2102 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
2103 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
2104 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
2105 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
2106 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
2107 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
2108 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
2109 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
2110 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
2111 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
2112 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
2113 ])
2114 AT_CLEANUP
2115
2116 AT_SETUP([CTABLES CLABELS])
2117 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2118 AT_DATA([ctables.sps],
2119 [[GET 'nhtsa.sav'.
2120 CTABLES /TABLE AgeGroup BY qns3a.
2121 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
2122 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
2123 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
2124 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
2125 ]])
2126 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
2127              Custom Tables
2128 ╭───────────────────────┬────────────╮
2129 │                       │S3a. GENDER:│
2130 │                       ├─────┬──────┤
2131 │                       │ Male│Female│
2132 │                       ├─────┼──────┤
2133 │                       │Count│ Count│
2134 ├───────────────────────┼─────┼──────┤
2135 │Age group 15 or younger│    0│     0│
2136 │          16 to 25     │  594│   505│
2137 │          26 to 35     │  476│   491│
2138 │          36 to 45     │  489│   548│
2139 │          46 to 55     │  526│   649│
2140 │          56 to 65     │  516│   731│
2141 │          66 or older  │  531│   943│
2142 ╰───────────────────────┴─────┴──────╯
2143
2144                                                       Custom Tables
2145 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
2146 │       │                                                 S3a. GENDER:                                                 │
2147 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
2148 │       │                         Male                         │                         Female                        │
2149 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
2150 │       │  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 │
2151 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
2152 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2153 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
2154 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
2155 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
2156 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
2157 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
2158
2159                 Custom Tables
2160 ╭──────────────────────────────┬────────────╮
2161 │                              │S3a. GENDER:│
2162 │                              ├────────────┤
2163 │                              │    Count   │
2164 ├──────────────────────────────┼────────────┤
2165 │Age group 15 or younger Male  │           0│
2166 │                        Female│           0│
2167 │         ╶────────────────────┼────────────┤
2168 │          16 to 25      Male  │         594│
2169 │                        Female│         505│
2170 │         ╶────────────────────┼────────────┤
2171 │          26 to 35      Male  │         476│
2172 │                        Female│         491│
2173 │         ╶────────────────────┼────────────┤
2174 │          36 to 45      Male  │         489│
2175 │                        Female│         548│
2176 │         ╶────────────────────┼────────────┤
2177 │          46 to 55      Male  │         526│
2178 │                        Female│         649│
2179 │         ╶────────────────────┼────────────┤
2180 │          56 to 65      Male  │         516│
2181 │                        Female│         731│
2182 │         ╶────────────────────┼────────────┤
2183 │          66 or older   Male  │         531│
2184 │                        Female│         943│
2185 ╰──────────────────────────────┴────────────╯
2186
2187       Custom Tables
2188 15 or younger
2189 ╭─────────┬────────────╮
2190 │         │S3a. GENDER:│
2191 │         ├─────┬──────┤
2192 │         │ Male│Female│
2193 │         ├─────┼──────┤
2194 │         │Count│ Count│
2195 ├─────────┼─────┼──────┤
2196 │Age group│    0│     0│
2197 ╰─────────┴─────┴──────╯
2198
2199       Custom Tables
2200 16 to 25
2201 ╭─────────┬────────────╮
2202 │         │S3a. GENDER:│
2203 │         ├─────┬──────┤
2204 │         │ Male│Female│
2205 │         ├─────┼──────┤
2206 │         │Count│ Count│
2207 ├─────────┼─────┼──────┤
2208 │Age group│  594│   505│
2209 ╰─────────┴─────┴──────╯
2210
2211       Custom Tables
2212 26 to 35
2213 ╭─────────┬────────────╮
2214 │         │S3a. GENDER:│
2215 │         ├─────┬──────┤
2216 │         │ Male│Female│
2217 │         ├─────┼──────┤
2218 │         │Count│ Count│
2219 ├─────────┼─────┼──────┤
2220 │Age group│  476│   491│
2221 ╰─────────┴─────┴──────╯
2222
2223       Custom Tables
2224 36 to 45
2225 ╭─────────┬────────────╮
2226 │         │S3a. GENDER:│
2227 │         ├─────┬──────┤
2228 │         │ Male│Female│
2229 │         ├─────┼──────┤
2230 │         │Count│ Count│
2231 ├─────────┼─────┼──────┤
2232 │Age group│  489│   548│
2233 ╰─────────┴─────┴──────╯
2234
2235       Custom Tables
2236 46 to 55
2237 ╭─────────┬────────────╮
2238 │         │S3a. GENDER:│
2239 │         ├─────┬──────┤
2240 │         │ Male│Female│
2241 │         ├─────┼──────┤
2242 │         │Count│ Count│
2243 ├─────────┼─────┼──────┤
2244 │Age group│  526│   649│
2245 ╰─────────┴─────┴──────╯
2246
2247       Custom Tables
2248 56 to 65
2249 ╭─────────┬────────────╮
2250 │         │S3a. GENDER:│
2251 │         ├─────┬──────┤
2252 │         │ Male│Female│
2253 │         ├─────┼──────┤
2254 │         │Count│ Count│
2255 ├─────────┼─────┼──────┤
2256 │Age group│  516│   731│
2257 ╰─────────┴─────┴──────╯
2258
2259       Custom Tables
2260 66 or older
2261 ╭─────────┬────────────╮
2262 │         │S3a. GENDER:│
2263 │         ├─────┬──────┤
2264 │         │ Male│Female│
2265 │         ├─────┼──────┤
2266 │         │Count│ Count│
2267 ├─────────┼─────┼──────┤
2268 │Age group│  531│   943│
2269 ╰─────────┴─────┴──────╯
2270
2271              Custom Tables
2272 Male
2273 ╭───────────────────────┬────────────╮
2274 │                       │S3a. GENDER:│
2275 │                       ├────────────┤
2276 │                       │    Count   │
2277 ├───────────────────────┼────────────┤
2278 │Age group 15 or younger│           0│
2279 │          16 to 25     │         594│
2280 │          26 to 35     │         476│
2281 │          36 to 45     │         489│
2282 │          46 to 55     │         526│
2283 │          56 to 65     │         516│
2284 │          66 or older  │         531│
2285 ╰───────────────────────┴────────────╯
2286
2287              Custom Tables
2288 Female
2289 ╭───────────────────────┬────────────╮
2290 │                       │S3a. GENDER:│
2291 │                       ├────────────┤
2292 │                       │    Count   │
2293 ├───────────────────────┼────────────┤
2294 │Age group 15 or younger│           0│
2295 │          16 to 25     │         505│
2296 │          26 to 35     │         491│
2297 │          36 to 45     │         548│
2298 │          46 to 55     │         649│
2299 │          56 to 65     │         731│
2300 │          66 or older  │         943│
2301 ╰───────────────────────┴────────────╯
2302 ])
2303 AT_CLEANUP
2304
2305 AT_SETUP([CTABLES missing values])
2306 AT_DATA([ctables.sps],
2307 [[DATA LIST LIST NOTABLE/x y.
2308 BEGIN DATA.
2309 1 1
2310 1 2
2311 1 3
2312 1 4
2313 1 5
2314 1 .
2315 2 1
2316 2 2
2317 2 3
2318 2 4
2319 2 5
2320 2 .
2321 3 1
2322 3 2
2323 3 3
2324 3 4
2325 3 5
2326 3 .
2327 4 1
2328 4 2
2329 4 3
2330 4 4
2331 4 5
2332 4 .
2333 5 1
2334 5 2
2335 5 3
2336 5 4
2337 5 5
2338 5 .
2339 . 1
2340 . 2
2341 . 3
2342 . 4
2343 . 5
2344 . .
2345 END DATA.
2346 MISSING VALUES x (1, 2) y (2, 3).
2347 VARIABLE LEVEL ALL (NOMINAL).
2348
2349 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2350                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2351     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2352 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2353                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2354     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2355 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2356                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2357     /CATEGORIES VARIABLES=ALL TOTAL=YES
2358     /SLABELS POSITION=ROW.
2359 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2360                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2361     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2362     /SLABELS POSITION=ROW.
2363 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2364                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2365     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2366     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2367     /SLABELS POSITION=ROW.
2368 ]])
2369 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2370                                Custom Tables
2371 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2372 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2373 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2374 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2375 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2376 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2377 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2378 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2379 dnl Note that Column Total N % doesn't add up to 100 because missing
2380 dnl values are included in the total but not shown as a category and this
2381 dnl is expected behavior.
2382
2383                                Custom Tables
2384 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2385 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2386 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2387 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2388 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2389 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2390 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2391 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2392 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2393 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2394 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2395 dnl values are included in the total but not shown as a category and this
2396 dnl is expected behavior.
2397
2398                      Custom Tables
2399 ╭────────────────────────┬───────────────────────────╮
2400 │                        │             y             │
2401 │                        ├──────┬──────┬──────┬──────┤
2402 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2403 ├────────────────────────┼──────┼──────┼──────┼──────┤
2404 │x 3.00  Count           │     1│     1│     1│     3│
2405 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2406 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2407 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2408 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2409 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2410 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2411 │        Valid N         │      │      │      │     3│
2412 │        Total N         │      │      │      │     6│
2413 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2414 │  4.00  Count           │     1│     1│     1│     3│
2415 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2416 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2417 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2418 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2419 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2420 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2421 │        Valid N         │      │      │      │     3│
2422 │        Total N         │      │      │      │     6│
2423 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2424 │  5.00  Count           │     1│     1│     1│     3│
2425 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2426 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2427 │        Column Total N %│ 33.3%│ 33.3%│ 33.3%│     .│
2428 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2429 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2430 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2431 │        Valid N         │      │      │      │     3│
2432 │        Total N         │      │      │      │     6│
2433 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2434 │  Total Count           │     3│     3│     3│     9│
2435 │        Column %        │100.0%│100.0%│100.0%│     .│
2436 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2437 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2438 │        Row %           │     .│     .│     .│     .│
2439 │        Row Valid N %   │     .│     .│     .│     .│
2440 │        Row Total N %   │     .│     .│     .│     .│
2441 │        Valid N         │     3│     3│     3│     9│
2442 │        Total N         │     3│     3│     3│    18│
2443 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2444
2445                             Custom Tables
2446 ╭────────────────────────┬─────────────────────────────────────────╮
2447 │                        │                    y                    │
2448 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2449 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2450 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2451 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2452 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2453 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2454 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2455 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2456 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2457 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2458 │        Valid N         │      │      │      │      │      │     3│
2459 │        Total N         │      │      │      │      │      │     6│
2460 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2461 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2462 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2463 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2464 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2465 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2466 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2467 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2468 │        Valid N         │      │      │      │      │      │     3│
2469 │        Total N         │      │      │      │      │      │     6│
2470 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2471 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2472 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2473 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2474 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2475 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2476 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2477 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2478 │        Valid N         │      │      │      │      │      │     3│
2479 │        Total N         │      │      │      │      │      │     6│
2480 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2481 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2482 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2483 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2484 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2485 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2486 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2487 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2488 │        Valid N         │      │      │      │      │      │     3│
2489 │        Total N         │      │      │      │      │      │     6│
2490 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2491 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2492 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2493 │        Column Valid N %│ 20.0%│     .│     .│ 20.0%│ 20.0%│     .│
2494 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2495 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2496 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2497 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2498 │        Valid N         │      │      │      │      │      │     3│
2499 │        Total N         │      │      │      │      │      │     6│
2500 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2501 │  Total Count           │     5│     5│     5│     5│     5│    25│
2502 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2503 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2504 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2505 │        Row %           │     .│     .│     .│     .│     .│     .│
2506 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2507 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2508 │        Valid N         │     5│     0│     0│     5│     5│    15│
2509 │        Total N         │     5│     5│     5│     5│     5│    30│
2510 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2511
2512                         Custom Tables
2513 ╭────────────────────────┬──────────────────────────────────╮
2514 │                        │                 y                │
2515 │                        ├──────┬──────┬──────┬──────┬──────┤
2516 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2517 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2518 │x 1.00  Count           │     1│     1│     1│     1│     4│
2519 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2520 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2521 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2522 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2523 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2524 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2525 │        Valid N         │      │      │      │      │     3│
2526 │        Total N         │      │      │      │      │     6│
2527 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2528 │  2.00  Count           │     1│     1│     1│     1│     4│
2529 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2530 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2531 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2532 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2533 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2534 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2535 │        Valid N         │      │      │      │      │     3│
2536 │        Total N         │      │      │      │      │     6│
2537 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2538 │  3.00  Count           │     1│     1│     1│     1│     4│
2539 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2540 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2541 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2542 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2543 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2544 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2545 │        Valid N         │      │      │      │      │     3│
2546 │        Total N         │      │      │      │      │     6│
2547 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2548 │  4.00  Count           │     1│     1│     1│     1│     4│
2549 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2550 │        Column Valid N %│ 25.0%│     .│ 25.0%│ 25.0%│     .│
2551 │        Column Total N %│ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2552 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2553 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2554 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2555 │        Valid N         │      │      │      │      │     3│
2556 │        Total N         │      │      │      │      │     6│
2557 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2558 │  Total Count           │     4│     4│     4│     4│    16│
2559 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2560 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2561 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2562 │        Row %           │     .│     .│     .│     .│     .│
2563 │        Row Valid N %   │     .│     .│     .│     .│     .│
2564 │        Row Total N %   │     .│     .│     .│     .│     .│
2565 │        Valid N         │     4│     0│     4│     4│    12│
2566 │        Total N         │     4│     4│     4│     4│    24│
2567 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2568 ])
2569 AT_CLEANUP
2570
2571 AT_SETUP([CTABLES SMISSING=LISTWISE])
2572 AT_KEYWORDS([SMISSING LISTWISE])
2573 AT_DATA([ctables.sps],
2574 [[DATA LIST LIST NOTABLE/x y z.
2575 BEGIN DATA.
2576 1  . 40
2577 1 10 50
2578 1 20 60
2579 1  .  .
2580 1 30  .
2581 END DATA.
2582 VARIABLE LEVEL x (NOMINAL).
2583
2584 CTABLES /TABLE (y + z) > x.
2585 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2586
2587 * The following doesn't come out as listwise because the tables are
2588 separate, not linked by an > operator.
2589 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2590 ]])
2591 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2592   Custom Tables
2593 ╭────────┬─────╮
2594 │        │ Mean│
2595 ├────────┼─────┤
2596 │y x 1.00│20.00│
2597 ├────────┼─────┤
2598 │z x 1.00│50.00│
2599 ╰────────┴─────╯
2600
2601   Custom Tables
2602 ╭────────┬─────╮
2603 │        │ Mean│
2604 ├────────┼─────┤
2605 │y x 1.00│15.00│
2606 ├────────┼─────┤
2607 │z x 1.00│55.00│
2608 ╰────────┴─────╯
2609
2610   Custom Tables
2611 ╭────────┬─────╮
2612 │        │ Mean│
2613 ├────────┼─────┤
2614 │y x 1.00│20.00│
2615 ├────────┼─────┤
2616 │z x 1.00│50.00│
2617 ╰────────┴─────╯
2618 ])
2619 AT_CLEANUP
2620
2621 AT_SETUP([CTABLES VLABELS - variables on different axes])
2622 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2623 AT_DATA([ctables.sps],
2624 [[GET 'nhtsa.sav'.
2625 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2626 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2627 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2628 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2629 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2630 ]])
2631 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2632                                  Custom Tables
2633 ╭────────────────────────────────────────────────────────────────┬────────────╮
2634 │                                                                │S3a. GENDER:│
2635 │                                                                ├─────┬──────┤
2636 │                                                                │ Male│Female│
2637 │                                                                ├─────┼──────┤
2638 │                                                                │Count│ Count│
2639 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2640 │D5a. What would you say is your primary    Cuban                │   13│     7│
2641 │ethnic background?                         Mexican              │  175│   136│
2642 │                                           Spanish              │   20│    28│
2643 │                                           South American       │   21│    13│
2644 │                                           Central American     │   27│    25│
2645 │                                           Puerto Rican, OR     │   37│    41│
2646 │                                           Something else       │   35│    33│
2647 │                                           Multiple - cannot    │    2│     5│
2648 │                                           choose one           │     │      │
2649 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2650
2651                   Custom Tables
2652 ╭──────────────────────────────────┬────────────╮
2653 │                                  │    QNS3A   │
2654 │                                  ├─────┬──────┤
2655 │                                  │ Male│Female│
2656 │                                  ├─────┼──────┤
2657 │                                  │Count│ Count│
2658 ├──────────────────────────────────┼─────┼──────┤
2659 │QND5A Cuban                       │   13│     7│
2660 │      Mexican                     │  175│   136│
2661 │      Spanish                     │   20│    28│
2662 │      South American              │   21│    13│
2663 │      Central American            │   27│    25│
2664 │      Puerto Rican, OR            │   37│    41│
2665 │      Something else              │   35│    33│
2666 │      Multiple - cannot choose one│    2│     5│
2667 ╰──────────────────────────────────┴─────┴──────╯
2668
2669                                  Custom Tables
2670 ╭────────────────────────────────────────────────────────────────┬────────────╮
2671 │                                                                │S3a. GENDER:│
2672 │                                                                ├─────┬──────┤
2673 │                                                                │ Male│Female│
2674 │                                                                ├─────┼──────┤
2675 │                                                                │Count│ Count│
2676 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2677 │D5a. What would you say is your primary    Cuban                │   13│     7│
2678 │ethnic background?                         Mexican              │  175│   136│
2679 │                                           Spanish              │   20│    28│
2680 │                                           South American       │   21│    13│
2681 │                                           Central American     │   27│    25│
2682 │                                           Puerto Rican, OR     │   37│    41│
2683 │                                           Something else       │   35│    33│
2684 │                                           Multiple - cannot    │    2│     5│
2685 │                                           choose one           │     │      │
2686 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2687
2688                                  Custom Tables
2689 ╭────────────────────────────────────────────────────────────┬────────────────╮
2690 │                                                            │   QNS3A S3a.   │
2691 │                                                            │     GENDER:    │
2692 │                                                            ├───────┬────────┤
2693 │                                                            │  Male │ Female │
2694 │                                                            ├───────┼────────┤
2695 │                                                            │ Count │  Count │
2696 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2697 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2698 │primary ethnic background?               Mexican            │    175│     136│
2699 │                                         Spanish            │     20│      28│
2700 │                                         South American     │     21│      13│
2701 │                                         Central American   │     27│      25│
2702 │                                         Puerto Rican, OR   │     37│      41│
2703 │                                         Something else     │     35│      33│
2704 │                                         Multiple - cannot  │      2│       5│
2705 │                                         choose one         │       │        │
2706 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2707
2708                Custom Tables
2709 ╭────────────────────────────┬─────┬──────╮
2710 │                            │ Male│Female│
2711 │                            ├─────┼──────┤
2712 │                            │Count│ Count│
2713 ├────────────────────────────┼─────┼──────┤
2714 │Cuban                       │   13│     7│
2715 │Mexican                     │  175│   136│
2716 │Spanish                     │   20│    28│
2717 │South American              │   21│    13│
2718 │Central American            │   27│    25│
2719 │Puerto Rican, OR            │   37│    41│
2720 │Something else              │   35│    33│
2721 │Multiple - cannot choose one│    2│     5│
2722 ╰────────────────────────────┴─────┴──────╯
2723 ])
2724 AT_CLEANUP
2725
2726 AT_SETUP([CTABLES VLABELS - stacked variables])
2727 AT_KEYWORDS([stack stacking])
2728 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2729 AT_DATA([ctables.sps],
2730 [[GET 'nhtsa.sav'.
2731 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2732 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2733 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2734 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2735 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2736 ]])
2737 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2738                                  Custom Tables
2739 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2740 │                                                                       │Count│
2741 ├───────────────────────────────────────────────────────────────────────┼─────┤
2742 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2743 │background?                                     Mexican                │  311│
2744 │                                                Spanish                │   48│
2745 │                                                South American         │   34│
2746 │                                                Central American       │   52│
2747 │                                                Puerto Rican, OR       │   78│
2748 │                                                Something else         │   68│
2749 │                                                Multiple - cannot      │    7│
2750 │                                                choose one             │     │
2751 ├───────────────────────────────────────────────────────────────────────┼─────┤
2752 │QNS3A                                           Male                   │ 3132│
2753 │                                                Female                 │ 3867│
2754 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2755
2756                   Custom Tables
2757 ╭─────────────────────────────────────────┬─────╮
2758 │                                         │Count│
2759 ├─────────────────────────────────────────┼─────┤
2760 │QND5A        Cuban                       │   20│
2761 │             Mexican                     │  311│
2762 │             Spanish                     │   48│
2763 │             South American              │   34│
2764 │             Central American            │   52│
2765 │             Puerto Rican, OR            │   78│
2766 │             Something else              │   68│
2767 │             Multiple - cannot choose one│    7│
2768 ├─────────────────────────────────────────┼─────┤
2769 │S3a. GENDER: Male                        │ 3132│
2770 │             Female                      │ 3867│
2771 ╰─────────────────────────────────────────┴─────╯
2772
2773                                  Custom Tables
2774 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2775 │                                                                       │Count│
2776 ├───────────────────────────────────────────────────────────────────────┼─────┤
2777 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2778 │background?                                     Mexican                │  311│
2779 │                                                Spanish                │   48│
2780 │                                                South American         │   34│
2781 │                                                Central American       │   52│
2782 │                                                Puerto Rican, OR       │   78│
2783 │                                                Something else         │   68│
2784 │                                                Multiple - cannot      │    7│
2785 │                                                choose one             │     │
2786 ├───────────────────────────────────────────────────────────────────────┼─────┤
2787 │Male                                                                   │ 3132│
2788 ├───────────────────────────────────────────────────────────────────────┼─────┤
2789 │Female                                                                 │ 3867│
2790 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2791
2792             Custom Tables
2793 ╭─────────────────────────────┬─────╮
2794 │                             │Count│
2795 ├─────────────────────────────┼─────┤
2796 │Cuban                        │   20│
2797 ├─────────────────────────────┼─────┤
2798 │Mexican                      │  311│
2799 ├─────────────────────────────┼─────┤
2800 │Spanish                      │   48│
2801 ├─────────────────────────────┼─────┤
2802 │South American               │   34│
2803 ├─────────────────────────────┼─────┤
2804 │Central American             │   52│
2805 ├─────────────────────────────┼─────┤
2806 │Puerto Rican, OR             │   78│
2807 ├─────────────────────────────┼─────┤
2808 │Something else               │   68│
2809 ├─────────────────────────────┼─────┤
2810 │Multiple - cannot choose one │    7│
2811 ├─────────────────────────────┼─────┤
2812 │S3a. GENDER:     Male        │ 3132│
2813 │                 Female      │ 3867│
2814 ╰─────────────────────────────┴─────╯
2815
2816             Custom Tables
2817 ╭────────────────────────────┬─────╮
2818 │                            │Count│
2819 ├────────────────────────────┼─────┤
2820 │Cuban                       │   20│
2821 │Mexican                     │  311│
2822 │Spanish                     │   48│
2823 │South American              │   34│
2824 │Central American            │   52│
2825 │Puerto Rican, OR            │   78│
2826 │Something else              │   68│
2827 │Multiple - cannot choose one│    7│
2828 │Male                        │ 3132│
2829 │Female                      │ 3867│
2830 ╰────────────────────────────┴─────╯
2831 ])
2832 AT_CLEANUP
2833
2834 AT_SETUP([CTABLES VLABELS - nested variables])
2835 AT_KEYWORDS([nest nesting])
2836 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2837 AT_DATA([ctables.sps],
2838 [[GET 'nhtsa.sav'.
2839 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2840 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2841 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2842 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2843 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2844 ]])
2845 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2846                                  Custom Tables
2847 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2848 │                                                                       │Count│
2849 ├───────────────────────────────────────────────────────────────────────┼─────┤
2850 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2851 │primary ethnic background?                                       Female│    7│
2852 │                                     ╶─────────────────────────────────┼─────┤
2853 │                                      Mexican              QNS3A Male  │  175│
2854 │                                                                 Female│  136│
2855 │                                     ╶─────────────────────────────────┼─────┤
2856 │                                      Spanish              QNS3A Male  │   20│
2857 │                                                                 Female│   28│
2858 │                                     ╶─────────────────────────────────┼─────┤
2859 │                                      South American       QNS3A Male  │   21│
2860 │                                                                 Female│   13│
2861 │                                     ╶─────────────────────────────────┼─────┤
2862 │                                      Central American     QNS3A Male  │   27│
2863 │                                                                 Female│   25│
2864 │                                     ╶─────────────────────────────────┼─────┤
2865 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2866 │                                                                 Female│   41│
2867 │                                     ╶─────────────────────────────────┼─────┤
2868 │                                      Something else       QNS3A Male  │   35│
2869 │                                                                 Female│   33│
2870 │                                     ╶─────────────────────────────────┼─────┤
2871 │                                      Multiple - cannot    QNS3A Male  │    2│
2872 │                                      choose one                 Female│    5│
2873 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2874
2875                          Custom Tables
2876 ╭──────────────────────────────────────────────────────┬─────╮
2877 │                                                      │Count│
2878 ├──────────────────────────────────────────────────────┼─────┤
2879 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2880 │                                                Female│    7│
2881 │     ╶────────────────────────────────────────────────┼─────┤
2882 │      Mexican                      S3a. GENDER: Male  │  175│
2883 │                                                Female│  136│
2884 │     ╶────────────────────────────────────────────────┼─────┤
2885 │      Spanish                      S3a. GENDER: Male  │   20│
2886 │                                                Female│   28│
2887 │     ╶────────────────────────────────────────────────┼─────┤
2888 │      South American               S3a. GENDER: Male  │   21│
2889 │                                                Female│   13│
2890 │     ╶────────────────────────────────────────────────┼─────┤
2891 │      Central American             S3a. GENDER: Male  │   27│
2892 │                                                Female│   25│
2893 │     ╶────────────────────────────────────────────────┼─────┤
2894 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2895 │                                                Female│   41│
2896 │     ╶────────────────────────────────────────────────┼─────┤
2897 │      Something else               S3a. GENDER: Male  │   35│
2898 │                                                Female│   33│
2899 │     ╶────────────────────────────────────────────────┼─────┤
2900 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2901 │                                                Female│    5│
2902 ╰──────────────────────────────────────────────────────┴─────╯
2903
2904                                  Custom Tables
2905 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2906 │                                                                       │Count│
2907 ├───────────────────────────────────────────────────────────────────────┼─────┤
2908 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2909 │ethnic background?                                               Female│    7│
2910 │                                          ╶────────────────────────────┼─────┤
2911 │                                           Mexican               Male  │  175│
2912 │                                                                 Female│  136│
2913 │                                          ╶────────────────────────────┼─────┤
2914 │                                           Spanish               Male  │   20│
2915 │                                                                 Female│   28│
2916 │                                          ╶────────────────────────────┼─────┤
2917 │                                           South American        Male  │   21│
2918 │                                                                 Female│   13│
2919 │                                          ╶────────────────────────────┼─────┤
2920 │                                           Central American      Male  │   27│
2921 │                                                                 Female│   25│
2922 │                                          ╶────────────────────────────┼─────┤
2923 │                                           Puerto Rican, OR      Male  │   37│
2924 │                                                                 Female│   41│
2925 │                                          ╶────────────────────────────┼─────┤
2926 │                                           Something else        Male  │   35│
2927 │                                                                 Female│   33│
2928 │                                          ╶────────────────────────────┼─────┤
2929 │                                           Multiple - cannot     Male  │    2│
2930 │                                           choose one            Female│    5│
2931 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2932
2933                       Custom Tables
2934 ╭────────────────────────────────────────────────┬─────╮
2935 │                                                │Count│
2936 ├────────────────────────────────────────────────┼─────┤
2937 │Cuban                        S3a. GENDER: Male  │   13│
2938 │                                          Female│    7│
2939 ├────────────────────────────────────────────────┼─────┤
2940 │Mexican                      S3a. GENDER: Male  │  175│
2941 │                                          Female│  136│
2942 ├────────────────────────────────────────────────┼─────┤
2943 │Spanish                      S3a. GENDER: Male  │   20│
2944 │                                          Female│   28│
2945 ├────────────────────────────────────────────────┼─────┤
2946 │South American               S3a. GENDER: Male  │   21│
2947 │                                          Female│   13│
2948 ├────────────────────────────────────────────────┼─────┤
2949 │Central American             S3a. GENDER: Male  │   27│
2950 │                                          Female│   25│
2951 ├────────────────────────────────────────────────┼─────┤
2952 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2953 │                                          Female│   41│
2954 ├────────────────────────────────────────────────┼─────┤
2955 │Something else               S3a. GENDER: Male  │   35│
2956 │                                          Female│   33│
2957 ├────────────────────────────────────────────────┼─────┤
2958 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2959 │                                          Female│    5│
2960 ╰────────────────────────────────────────────────┴─────╯
2961
2962                Custom Tables
2963 ╭───────────────────────────────────┬─────╮
2964 │                                   │Count│
2965 ├───────────────────────────────────┼─────┤
2966 │Cuban                        Male  │   13│
2967 │                             Female│    7│
2968 ├───────────────────────────────────┼─────┤
2969 │Mexican                      Male  │  175│
2970 │                             Female│  136│
2971 ├───────────────────────────────────┼─────┤
2972 │Spanish                      Male  │   20│
2973 │                             Female│   28│
2974 ├───────────────────────────────────┼─────┤
2975 │South American               Male  │   21│
2976 │                             Female│   13│
2977 ├───────────────────────────────────┼─────┤
2978 │Central American             Male  │   27│
2979 │                             Female│   25│
2980 ├───────────────────────────────────┼─────┤
2981 │Puerto Rican, OR             Male  │   37│
2982 │                             Female│   41│
2983 ├───────────────────────────────────┼─────┤
2984 │Something else               Male  │   35│
2985 │                             Female│   33│
2986 ├───────────────────────────────────┼─────┤
2987 │Multiple - cannot choose one Male  │    2│
2988 │                             Female│    5│
2989 ╰───────────────────────────────────┴─────╯
2990 ])
2991 AT_CLEANUP
2992
2993 AT_SETUP([CTABLES FORMAT EMPTY])
2994 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2995 AT_DATA([ctables.sps],
2996 [[GET 'nhtsa.sav'.
2997 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2998 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2999 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
3000 ]])
3001 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3002                                  Custom Tables
3003 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3004 │                                             │   D5. ETHNICITY: Are you of   │
3005 │                                             │  Hispanic or Latino origin or │
3006 │                                             │            descent?           │
3007 │                                             ├───────────────┬───────────────┤
3008 │                                             │      Yes      │       No      │
3009 │                                             ├───────────────┼───────────────┤
3010 │                                             │     Count     │     Count     │
3011 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3012 │D5a. What would you say is   Cuban           │             20│              0│
3013 │your primary ethnic          Mexican         │            311│              0│
3014 │background?                  Spanish         │             48│              0│
3015 │                             South American  │             34│              0│
3016 │                             Central American│             52│              0│
3017 │                             Puerto Rican, OR│             78│              0│
3018 │                             Something else  │             68│              0│
3019 │                             Multiple -      │              7│              0│
3020 │                             cannot choose   │               │               │
3021 │                             one             │               │               │
3022 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3023
3024                                  Custom Tables
3025 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3026 │                                             │   D5. ETHNICITY: Are you of   │
3027 │                                             │  Hispanic or Latino origin or │
3028 │                                             │            descent?           │
3029 │                                             ├───────────────┬───────────────┤
3030 │                                             │      Yes      │       No      │
3031 │                                             ├───────────────┼───────────────┤
3032 │                                             │     Count     │     Count     │
3033 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3034 │D5a. What would you say is   Cuban           │             20│               │
3035 │your primary ethnic          Mexican         │            311│               │
3036 │background?                  Spanish         │             48│               │
3037 │                             South American  │             34│               │
3038 │                             Central American│             52│               │
3039 │                             Puerto Rican, OR│             78│               │
3040 │                             Something else  │             68│               │
3041 │                             Multiple -      │              7│               │
3042 │                             cannot choose   │               │               │
3043 │                             one             │               │               │
3044 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3045
3046                                  Custom Tables
3047 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3048 │                                             │   D5. ETHNICITY: Are you of   │
3049 │                                             │  Hispanic or Latino origin or │
3050 │                                             │            descent?           │
3051 │                                             ├───────────────┬───────────────┤
3052 │                                             │      Yes      │       No      │
3053 │                                             ├───────────────┼───────────────┤
3054 │                                             │     Count     │     Count     │
3055 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3056 │D5a. What would you say is   Cuban           │             20│n/a            │
3057 │your primary ethnic          Mexican         │            311│n/a            │
3058 │background?                  Spanish         │             48│n/a            │
3059 │                             South American  │             34│n/a            │
3060 │                             Central American│             52│n/a            │
3061 │                             Puerto Rican, OR│             78│n/a            │
3062 │                             Something else  │             68│n/a            │
3063 │                             Multiple -      │              7│n/a            │
3064 │                             cannot choose   │               │               │
3065 │                             one             │               │               │
3066 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3067 ])
3068 AT_CLEANUP
3069
3070 AT_SETUP([CTABLES FORMAT MISSING])
3071 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3072 AT_DATA([ctables.sps],
3073 [[GET 'nhtsa.sav'.
3074 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
3075 ]])
3076 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3077                                  Custom Tables
3078 ╭─────────────────────────────────────────────┬───────────────────────────────╮
3079 │                                             │   D5. ETHNICITY: Are you of   │
3080 │                                             │  Hispanic or Latino origin or │
3081 │                                             │            descent?           │
3082 │                                             ├───────────────┬───────────────┤
3083 │                                             │      Yes      │       No      │
3084 │                                             ├───────────────┼───────────────┤
3085 │                                             │    Column %   │    Column %   │
3086 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
3087 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
3088 │your primary ethnic          Mexican         │          50.3%│(no data)      │
3089 │background?                  Spanish         │           7.8%│(no data)      │
3090 │                             South American  │           5.5%│(no data)      │
3091 │                             Central American│           8.4%│(no data)      │
3092 │                             Puerto Rican, OR│          12.6%│(no data)      │
3093 │                             Something else  │          11.0%│(no data)      │
3094 │                             Multiple -      │           1.1%│(no data)      │
3095 │                             cannot choose   │               │               │
3096 │                             one             │               │               │
3097 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
3098 ])
3099 AT_CLEANUP
3100
3101 AT_SETUP([CTABLES HIDESMALLCOUNTS])
3102 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3103 AT_DATA([ctables.sps],
3104 [[GET 'nhtsa.sav'.
3105 CTABLES /TABLE qn38[c][COUNT, COLPCT].
3106 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
3107 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
3108 ]])
3109 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3110                                  Custom Tables
3111 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3112 │                                                              │Count│Column %│
3113 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3114 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3115 │occasion?                                        1            │  491│   34.9%│
3116 │                                                 2            │  462│   32.9%│
3117 │                                                 3            │  229│   16.3%│
3118 │                                                 4            │   82│    5.8%│
3119 │                                                 5            │   56│    4.0%│
3120 │                                                 6            │   32│    2.3%│
3121 │                                                 7            │    9│     .6%│
3122 │                                                 8            │    8│     .6%│
3123 │                                                 9            │    4│     .3%│
3124 │                                                 10           │    6│     .4%│
3125 │                                                 11           │    2│     .1%│
3126 │                                                 12           │    5│     .4%│
3127 │                                                 14           │    1│     .1%│
3128 │                                                 15           │    1│     .1%│
3129 │                                                 18           │    1│     .1%│
3130 │                                                 20           │    4│     .3%│
3131 │                                                 25           │    1│     .1%│
3132 │                                                 30           │    3│     .2%│
3133 │                                                 60           │    1│     .1%│
3134 │                                                 99+          │    0│     .0%│
3135 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3136
3137                                  Custom Tables
3138 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3139 │                                                              │Count│Column %│
3140 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3141 │38. How many drinks did you have on that         Less than one│    7│     .5%│
3142 │occasion?                                        1            │  491│   34.9%│
3143 │                                                 2            │  462│   32.9%│
3144 │                                                 3            │  229│   16.3%│
3145 │                                                 4            │   82│    5.8%│
3146 │                                                 5            │   56│    4.0%│
3147 │                                                 6            │   32│    2.3%│
3148 │                                                 7            │    9│     .6%│
3149 │                                                 8            │    8│     .6%│
3150 │                                                 9            │<5   │     .3%│
3151 │                                                 10           │    6│     .4%│
3152 │                                                 11           │<5   │     .1%│
3153 │                                                 12           │    5│     .4%│
3154 │                                                 14           │<5   │     .1%│
3155 │                                                 15           │<5   │     .1%│
3156 │                                                 18           │<5   │     .1%│
3157 │                                                 20           │<5   │     .3%│
3158 │                                                 25           │<5   │     .1%│
3159 │                                                 30           │<5   │     .2%│
3160 │                                                 60           │<5   │     .1%│
3161 │                                                 99+          │<5   │     .0%│
3162 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3163
3164                                  Custom Tables
3165 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
3166 │                                                              │Count│Column %│
3167 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
3168 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
3169 │occasion?                                        1            │  491│   34.9%│
3170 │                                                 2            │  462│   32.9%│
3171 │                                                 3            │  229│   16.3%│
3172 │                                                 4            │   82│    5.8%│
3173 │                                                 5            │   56│    4.0%│
3174 │                                                 6            │   32│    2.3%│
3175 │                                                 7            │<10  │     .6%│
3176 │                                                 8            │<10  │     .6%│
3177 │                                                 9            │<10  │     .3%│
3178 │                                                 10           │<10  │     .4%│
3179 │                                                 11           │<10  │     .1%│
3180 │                                                 12           │<10  │     .4%│
3181 │                                                 14           │<10  │     .1%│
3182 │                                                 15           │<10  │     .1%│
3183 │                                                 18           │<10  │     .1%│
3184 │                                                 20           │<10  │     .3%│
3185 │                                                 25           │<10  │     .1%│
3186 │                                                 30           │<10  │     .2%│
3187 │                                                 60           │<10  │     .1%│
3188 │                                                 99+          │<10  │     .0%│
3189 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
3190 ])
3191 AT_CLEANUP
3192
3193 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
3194 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3195 AT_DATA([ctables.sps],
3196 [[GET 'nhtsa.sav'.
3197 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
3198 ]])
3199 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
3200  Custom Tables
3201 ╭────────────╮
3202 │S3a. GENDER:│
3203 ├─────┬──────┤
3204 │ Male│Female│
3205 ├─────┼──────┤
3206 │Count│ Count│
3207 ├─────┼──────┤
3208 │ 3132│  3867│
3209 ╰─────┴──────╯
3210 ])
3211 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
3212 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
3213 maximumColumnWidth="192"
3214 minimumColumnWidth="96"
3215 ])
3216 AT_CLEANUP
3217
3218 AT_SETUP([CTABLES special formats])
3219 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
3220 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3221 AT_DATA([ctables.sps],
3222 [[GET 'nhtsa.sav'.
3223 COMPUTE x = qnd3 - 4.
3224 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].
3225 ]])
3226 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3227                            Custom Tables
3228 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
3229 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
3230 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
3231 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
3232 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
3233 ])
3234 AT_CLEANUP
3235
3236 AT_SETUP([CTABLES TITLES])
3237 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3238 AT_DATA([ctables.sps],
3239 [[GET 'nhtsa.sav'.
3240 CTABLES
3241     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3242     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3243     /TITLES TITLE='How often do you drive?'
3244             CAPTION='Generated )TIME on )DATE'
3245             CORNER=')TABLE'.
3246 ]])
3247 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3248 s&../../..&MM/DD/YY&'], [0], [dnl
3249                             How often do you drive?
3250 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3251 │                                   │               S3a. GENDER:              │
3252 │                                   ├────────────────────┬────────────────────┤
3253 │                                   │        Male        │       Female       │
3254 │                                   ├────────────────────┼────────────────────┤
3255 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3256 │                                   │ you of Hispanic or │ you of Hispanic or │
3257 │                                   │  Latino origin or  │  Latino origin or  │
3258 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3259 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3260 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3261 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3262 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3263 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3264 │Every day                          │      218│      2066│      166│      2175│
3265 │Several days a week                │       44│       391│       45│       782│
3266 │Once a week or less                │       16│       109│       12│       223│
3267 │Only certain times a year          │       15│        41│       11│        61│
3268 │Never                              │       39│       150│       56│       278│
3269 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3270 Generated HH:MM:SS on MM/DD/YY
3271 ])
3272 AT_CLEANUP
3273
3274 AT_SETUP([CTABLES area definitions])
3275 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3276 AT_DATA([ctables.sps],
3277 [[GET 'nhtsa.sav'.
3278 CTABLES
3279     /VLABELS VARIABLES=ALL DISPLAY=NAME
3280     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3281     /SLABELS POSITION=ROW
3282     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3283     /SLABELS POSITION=ROW
3284     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3285     /SLABELS POSITION=ROW.
3286 ]])
3287 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3288                     Custom Tables
3289 Male
3290 ╭─────────────────────────────┬─────────────┬──────╮
3291 │                             │    QND7A    │ QN64B│
3292 │                             ├──────┬──────┼───┬──┤
3293 │                             │  Yes │  No  │   │  │
3294 │                             ├──────┼──────┤   │  │
3295 │                             │ QN86 │ QN86 │   │  │
3296 │                             ├───┬──┼───┬──┤   │  │
3297 │                             │Yes│No│Yes│No│Yes│No│
3298 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3299 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3300 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3301 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3302 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3303 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3304 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3305 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3306 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3307 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3308 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3309 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3310 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3311 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3312 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3313 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3314 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3315
3316                     Custom Tables
3317 Female
3318 ╭─────────────────────────────┬─────────────┬──────╮
3319 │                             │    QND7A    │ QN64B│
3320 │                             ├──────┬──────┼───┬──┤
3321 │                             │  Yes │  No  │   │  │
3322 │                             ├──────┼──────┤   │  │
3323 │                             │ QN86 │ QN86 │   │  │
3324 │                             ├───┬──┼───┬──┤   │  │
3325 │                             │Yes│No│Yes│No│Yes│No│
3326 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3327 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3328 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3329 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3330 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3331 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3332 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3333 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3334 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3335 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3336 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3337 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3338 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3339 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3340 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3341 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3342 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3343
3344                     Custom Tables
3345 Male
3346 ╭──────────────────────────────┬─────────────┬──────╮
3347 │                              │    QND7A    │ QN64B│
3348 │                              ├──────┬──────┼───┬──┤
3349 │                              │  Yes │  No  │   │  │
3350 │                              ├──────┼──────┤   │  │
3351 │                              │ QN86 │ QN86 │   │  │
3352 │                              ├───┬──┼───┬──┤   │  │
3353 │                              │Yes│No│Yes│No│Yes│No│
3354 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3355 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3356 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3357 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3358 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3359 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3360 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3361 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3362 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3363 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3364 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3365 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3366 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3367
3368                     Custom Tables
3369 Female
3370 ╭──────────────────────────────┬─────────────┬──────╮
3371 │                              │    QND7A    │ QN64B│
3372 │                              ├──────┬──────┼───┬──┤
3373 │                              │  Yes │  No  │   │  │
3374 │                              ├──────┼──────┤   │  │
3375 │                              │ QN86 │ QN86 │   │  │
3376 │                              ├───┬──┼───┬──┤   │  │
3377 │                              │Yes│No│Yes│No│Yes│No│
3378 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3379 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3380 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3381 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3382 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3383 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3384 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3385 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3386 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3387 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3388 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3389 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3390 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3391
3392                       Custom Tables
3393 Male
3394 ╭─────────────────────────────────┬─────────────┬──────╮
3395 │                                 │    QND7A    │ QN64B│
3396 │                                 ├──────┬──────┼───┬──┤
3397 │                                 │  Yes │  No  │   │  │
3398 │                                 ├──────┼──────┤   │  │
3399 │                                 │ QN86 │ QN86 │   │  │
3400 │                                 ├───┬──┼───┬──┤   │  │
3401 │                                 │Yes│No│Yes│No│Yes│No│
3402 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3403 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3404 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3405 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3406 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3407 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3408 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3409 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3410 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3411 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3412 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3413 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3414 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3415
3416                       Custom Tables
3417 Female
3418 ╭─────────────────────────────────┬─────────────┬──────╮
3419 │                                 │    QND7A    │ QN64B│
3420 │                                 ├──────┬──────┼───┬──┤
3421 │                                 │  Yes │  No  │   │  │
3422 │                                 ├──────┼──────┤   │  │
3423 │                                 │ QN86 │ QN86 │   │  │
3424 │                                 ├───┬──┼───┬──┤   │  │
3425 │                                 │Yes│No│Yes│No│Yes│No│
3426 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3427 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3428 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3429 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3430 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3431 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3432 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3433 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3434 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3435 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3436 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3437 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3438 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3439 ])
3440 AT_CLEANUP
3441
3442 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=OPPOSITE])
3443 AT_KEYWORDS([ROWLABELS OPPOSITE])
3444 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3445 AT_DATA([ctables.sps],
3446 [[GET 'nhtsa.sav'.
3447 CTABLES
3448     /VLABELS VARIABLES=ALL DISPLAY=NAME
3449     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3450     /SLABELS POSITION=ROW
3451     /CLABELS ROWLABELS=OPPOSITE
3452     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3453     /SLABELS POSITION=ROW
3454     /CLABELS ROWLABELS=OPPOSITE
3455     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3456     /SLABELS POSITION=ROW
3457     /CLABELS ROWLABELS=OPPOSITE.
3458 ]])
3459 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3460                                         Custom Tables
3461 Male
3462 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3463 │                                  │                          QN27                         │
3464 │                                  ├───────────────────────────┬───────────────────────────┤
3465 │                                  │            Yes            │             No            │
3466 │                                  ├───────────────────────────┼───────────────────────────┤
3467 │                                  │           QND7A           │           QND7A           │
3468 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3469 │                                  │     Yes     │      No     │     Yes     │      No     │
3470 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3471 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3472 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3473 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3474 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3475 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3476 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3477 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3478 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3479 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3480 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3481 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3482 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3483 │                       Subtable ID│  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3484 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3485 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3486 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3487 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3488 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3489 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3490 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3491 │                       Subtable ID│  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3492 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3493
3494                                         Custom Tables
3495 Female
3496 ╭──────────────────────────────────┬───────────────────────────────────────────────────────╮
3497 │                                  │                          QN27                         │
3498 │                                  ├───────────────────────────┬───────────────────────────┤
3499 │                                  │            Yes            │             No            │
3500 │                                  ├───────────────────────────┼───────────────────────────┤
3501 │                                  │           QND7A           │           QND7A           │
3502 │                                  ├─────────────┬─────────────┼─────────────┬─────────────┤
3503 │                                  │     Yes     │      No     │     Yes     │      No     │
3504 │                                  ├─────────────┼─────────────┼─────────────┼─────────────┤
3505 │                                  │     QN86    │     QN86    │     QN86    │     QN86    │
3506 │                                  ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3507 │                                  │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3508 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3509 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3510 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3511 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3512 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3513 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3514 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3515 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3516 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3517 │                       Subtable ID│ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3518 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3519 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3520 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3521 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3522 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3523 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3524 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3525 │                       Subtable ID│ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3526 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3527
3528                                         Custom Tables
3529 Male
3530 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3531 │                                   │                          QN27                         │
3532 │                                   ├───────────────────────────┬───────────────────────────┤
3533 │                                   │            Yes            │             No            │
3534 │                                   ├───────────────────────────┼───────────────────────────┤
3535 │                                   │           QND7A           │           QND7A           │
3536 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3537 │                                   │     Yes     │      No     │     Yes     │      No     │
3538 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3539 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3540 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3541 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3542 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3543 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3544 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3545 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  2│ 2│  3│ 3│  4│ 4│  5│ 5│  6│ 6│  7│ 7│  8│ 8│
3546 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
3547 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3548 │              No  QN57 Row ID      │  9│ 9│ 10│10│ 11│11│ 12│12│ 13│13│ 14│14│ 15│15│ 16│16│
3549 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
3550 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3551 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 18│18│ 19│19│ 20│20│ 21│21│ 22│22│ 23│23│ 24│24│
3552 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
3553 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3554 │              No  QN57 Row ID      │ 25│25│ 26│26│ 27│27│ 28│28│ 29│29│ 30│30│ 31│31│ 32│32│
3555 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
3556 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3557
3558                                         Custom Tables
3559 Female
3560 ╭───────────────────────────────────┬───────────────────────────────────────────────────────╮
3561 │                                   │                          QN27                         │
3562 │                                   ├───────────────────────────┬───────────────────────────┤
3563 │                                   │            Yes            │             No            │
3564 │                                   ├───────────────────────────┼───────────────────────────┤
3565 │                                   │           QND7A           │           QND7A           │
3566 │                                   ├─────────────┬─────────────┼─────────────┬─────────────┤
3567 │                                   │     Yes     │      No     │     Yes     │      No     │
3568 │                                   ├─────────────┼─────────────┼─────────────┼─────────────┤
3569 │                                   │     QN86    │     QN86    │     QN86    │     QN86    │
3570 │                                   ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3571 │                                   │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3572 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3573 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3574 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3575 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 34│34│ 35│35│ 36│36│ 37│37│ 38│38│ 39│39│ 40│40│
3576 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
3577 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3578 │              No  QN57 Row ID      │ 41│41│ 42│42│ 43│43│ 44│44│ 45│45│ 46│46│ 47│47│ 48│48│
3579 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
3580 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3581 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 50│50│ 51│51│ 52│52│ 53│53│ 54│54│ 55│55│ 56│56│
3582 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
3583 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3584 │              No  QN57 Row ID      │ 57│57│ 58│58│ 59│59│ 60│60│ 61│61│ 62│62│ 63│63│ 64│64│
3585 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
3586 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3587
3588                                           Custom Tables
3589 Male
3590 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3591 │                                      │                          QN27                         │
3592 │                                      ├───────────────────────────┬───────────────────────────┤
3593 │                                      │            Yes            │             No            │
3594 │                                      ├───────────────────────────┼───────────────────────────┤
3595 │                                      │           QND7A           │           QND7A           │
3596 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3597 │                                      │     Yes     │      No     │     Yes     │      No     │
3598 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3599 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3600 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3601 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3602 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3603 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3604 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3605 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3606 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3607 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3608 │              No  QN57 Column ID      │  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3609 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3610 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3611 │     No  QN61 Yes QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3612 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3613 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3614 │              No  QN57 Column ID      │ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3615 │                       Layer Column ID│  1│ 2│  3│ 4│  5│ 6│  7│ 8│  9│10│ 11│12│ 13│14│ 15│16│
3616 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3617
3618                                           Custom Tables
3619 Female
3620 ╭──────────────────────────────────────┬───────────────────────────────────────────────────────╮
3621 │                                      │                          QN27                         │
3622 │                                      ├───────────────────────────┬───────────────────────────┤
3623 │                                      │            Yes            │             No            │
3624 │                                      ├───────────────────────────┼───────────────────────────┤
3625 │                                      │           QND7A           │           QND7A           │
3626 │                                      ├─────────────┬─────────────┼─────────────┬─────────────┤
3627 │                                      │     Yes     │      No     │     Yes     │      No     │
3628 │                                      ├─────────────┼─────────────┼─────────────┼─────────────┤
3629 │                                      │     QN86    │     QN86    │     QN86    │     QN86    │
3630 │                                      ├──────┬──────┼──────┬──────┼──────┬──────┼──────┬──────┤
3631 │                                      │  Yes │  No  │  Yes │  No  │  Yes │  No  │  Yes │  No  │
3632 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┼───┬──┤
3633 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│Yes│No│
3634 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3635 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3636 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3637 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3638 │              No  QN57 Column ID      │ 33│34│ 35│36│ 37│38│ 39│40│ 41│42│ 43│44│ 45│46│ 47│48│
3639 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3640 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3641 │     No  QN61 Yes QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3642 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3643 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┼───┼──┤
3644 │              No  QN57 Column ID      │ 49│50│ 51│52│ 53│54│ 55│56│ 57│58│ 59│60│ 61│62│ 63│64│
3645 │                       Layer Column ID│ 17│18│ 19│20│ 21│22│ 23│24│ 25│26│ 27│28│ 29│30│ 31│32│
3646 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──┴───┴──╯
3647 ])
3648 AT_CLEANUP
3649
3650 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=OPPOSITE])
3651 AT_KEYWORDS([COLLABELS OPPOSITE])
3652 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3653 AT_DATA([ctables.sps],
3654 [[GET 'nhtsa.sav'.
3655 CTABLES
3656     /VLABELS VARIABLES=ALL DISPLAY=NAME
3657     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3658     /SLABELS POSITION=ROW
3659     /CLABELS COLLABELS=OPPOSITE
3660     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
3661     /SLABELS POSITION=ROW
3662     /CLABELS COLLABELS=OPPOSITE
3663     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
3664     /SLABELS POSITION=ROW
3665     /CLABELS COLLABELS=OPPOSITE.
3666 ]])
3667 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3668                           Custom Tables
3669 Male
3670 ╭──────────────────────────────────────────┬───────────────────╮
3671 │                                          │        QN27       │
3672 │                                          ├─────────┬─────────┤
3673 │                                          │   Yes   │    No   │
3674 │                                          ├─────────┼─────────┤
3675 │                                          │  QND7A  │  QND7A  │
3676 │                                          ├────┬────┼────┬────┤
3677 │                                          │ Yes│ No │ Yes│ No │
3678 │                                          ├────┼────┼────┼────┤
3679 │                                          │QN86│QN86│QN86│QN86│
3680 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3681 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3682 │                               Layer ID   │   1│   1│   1│   1│
3683 │                               Subtable ID│   1│   1│   2│   2│
3684 │                          ╶───────────────┼────┼────┼────┼────┤
3685 │                           No  Table ID   │   1│   1│   1│   1│
3686 │                               Layer ID   │   1│   1│   1│   1│
3687 │                               Subtable ID│   1│   1│   2│   2│
3688 │                      ╶───────────────────┼────┼────┼────┼────┤
3689 │                       No  Yes Table ID   │   1│   1│   1│   1│
3690 │                               Layer ID   │   1│   1│   1│   1│
3691 │                               Subtable ID│   3│   3│   4│   4│
3692 │                          ╶───────────────┼────┼────┼────┼────┤
3693 │                           No  Table ID   │   1│   1│   1│   1│
3694 │                               Layer ID   │   1│   1│   1│   1│
3695 │                               Subtable ID│   3│   3│   4│   4│
3696 │             ╶────────────────────────────┼────┼────┼────┼────┤
3697 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3698 │                               Layer ID   │   1│   1│   1│   1│
3699 │                               Subtable ID│   5│   5│   6│   6│
3700 │                          ╶───────────────┼────┼────┼────┼────┤
3701 │                           No  Table ID   │   1│   1│   1│   1│
3702 │                               Layer ID   │   1│   1│   1│   1│
3703 │                               Subtable ID│   5│   5│   6│   6│
3704 │                      ╶───────────────────┼────┼────┼────┼────┤
3705 │                       No  Yes Table ID   │   1│   1│   1│   1│
3706 │                               Layer ID   │   1│   1│   1│   1│
3707 │                               Subtable ID│   7│   7│   8│   8│
3708 │                          ╶───────────────┼────┼────┼────┼────┤
3709 │                           No  Table ID   │   1│   1│   1│   1│
3710 │                               Layer ID   │   1│   1│   1│   1│
3711 │                               Subtable ID│   7│   7│   8│   8│
3712 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3713 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3714 │                               Layer ID   │   1│   1│   1│   1│
3715 │                               Subtable ID│   9│   9│  10│  10│
3716 │                          ╶───────────────┼────┼────┼────┼────┤
3717 │                           No  Table ID   │   1│   1│   1│   1│
3718 │                               Layer ID   │   1│   1│   1│   1│
3719 │                               Subtable ID│   9│   9│  10│  10│
3720 │                      ╶───────────────────┼────┼────┼────┼────┤
3721 │                       No  Yes Table ID   │   1│   1│   1│   1│
3722 │                               Layer ID   │   1│   1│   1│   1│
3723 │                               Subtable ID│  11│  11│  12│  12│
3724 │                          ╶───────────────┼────┼────┼────┼────┤
3725 │                           No  Table ID   │   1│   1│   1│   1│
3726 │                               Layer ID   │   1│   1│   1│   1│
3727 │                               Subtable ID│  11│  11│  12│  12│
3728 │             ╶────────────────────────────┼────┼────┼────┼────┤
3729 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3730 │                               Layer ID   │   1│   1│   1│   1│
3731 │                               Subtable ID│  13│  13│  14│  14│
3732 │                          ╶───────────────┼────┼────┼────┼────┤
3733 │                           No  Table ID   │   1│   1│   1│   1│
3734 │                               Layer ID   │   1│   1│   1│   1│
3735 │                               Subtable ID│  13│  13│  14│  14│
3736 │                      ╶───────────────────┼────┼────┼────┼────┤
3737 │                       No  Yes Table ID   │   1│   1│   1│   1│
3738 │                               Layer ID   │   1│   1│   1│   1│
3739 │                               Subtable ID│  15│  15│  16│  16│
3740 │                          ╶───────────────┼────┼────┼────┼────┤
3741 │                           No  Table ID   │   1│   1│   1│   1│
3742 │                               Layer ID   │   1│   1│   1│   1│
3743 │                               Subtable ID│  15│  15│  16│  16│
3744 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3745
3746                           Custom Tables
3747 Female
3748 ╭──────────────────────────────────────────┬───────────────────╮
3749 │                                          │        QN27       │
3750 │                                          ├─────────┬─────────┤
3751 │                                          │   Yes   │    No   │
3752 │                                          ├─────────┼─────────┤
3753 │                                          │  QND7A  │  QND7A  │
3754 │                                          ├────┬────┼────┬────┤
3755 │                                          │ Yes│ No │ Yes│ No │
3756 │                                          ├────┼────┼────┼────┤
3757 │                                          │QN86│QN86│QN86│QN86│
3758 ├──────────────────────────────────────────┼────┼────┼────┼────┤
3759 │QN26 Yes QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3760 │                               Layer ID   │   2│   2│   2│   2│
3761 │                               Subtable ID│  17│  17│  18│  18│
3762 │                          ╶───────────────┼────┼────┼────┼────┤
3763 │                           No  Table ID   │   1│   1│   1│   1│
3764 │                               Layer ID   │   2│   2│   2│   2│
3765 │                               Subtable ID│  17│  17│  18│  18│
3766 │                      ╶───────────────────┼────┼────┼────┼────┤
3767 │                       No  Yes Table ID   │   1│   1│   1│   1│
3768 │                               Layer ID   │   2│   2│   2│   2│
3769 │                               Subtable ID│  19│  19│  20│  20│
3770 │                          ╶───────────────┼────┼────┼────┼────┤
3771 │                           No  Table ID   │   1│   1│   1│   1│
3772 │                               Layer ID   │   2│   2│   2│   2│
3773 │                               Subtable ID│  19│  19│  20│  20│
3774 │             ╶────────────────────────────┼────┼────┼────┼────┤
3775 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3776 │                               Layer ID   │   2│   2│   2│   2│
3777 │                               Subtable ID│  21│  21│  22│  22│
3778 │                          ╶───────────────┼────┼────┼────┼────┤
3779 │                           No  Table ID   │   1│   1│   1│   1│
3780 │                               Layer ID   │   2│   2│   2│   2│
3781 │                               Subtable ID│  21│  21│  22│  22│
3782 │                      ╶───────────────────┼────┼────┼────┼────┤
3783 │                       No  Yes Table ID   │   1│   1│   1│   1│
3784 │                               Layer ID   │   2│   2│   2│   2│
3785 │                               Subtable ID│  23│  23│  24│  24│
3786 │                          ╶───────────────┼────┼────┼────┼────┤
3787 │                           No  Table ID   │   1│   1│   1│   1│
3788 │                               Layer ID   │   2│   2│   2│   2│
3789 │                               Subtable ID│  23│  23│  24│  24│
3790 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
3791 │     No  QN61 Yes QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3792 │                               Layer ID   │   2│   2│   2│   2│
3793 │                               Subtable ID│  25│  25│  26│  26│
3794 │                          ╶───────────────┼────┼────┼────┼────┤
3795 │                           No  Table ID   │   1│   1│   1│   1│
3796 │                               Layer ID   │   2│   2│   2│   2│
3797 │                               Subtable ID│  25│  25│  26│  26│
3798 │                      ╶───────────────────┼────┼────┼────┼────┤
3799 │                       No  Yes Table ID   │   1│   1│   1│   1│
3800 │                               Layer ID   │   2│   2│   2│   2│
3801 │                               Subtable ID│  27│  27│  28│  28│
3802 │                          ╶───────────────┼────┼────┼────┼────┤
3803 │                           No  Table ID   │   1│   1│   1│   1│
3804 │                               Layer ID   │   2│   2│   2│   2│
3805 │                               Subtable ID│  27│  27│  28│  28│
3806 │             ╶────────────────────────────┼────┼────┼────┼────┤
3807 │              No  QN57 Yes Yes Table ID   │   1│   1│   1│   1│
3808 │                               Layer ID   │   2│   2│   2│   2│
3809 │                               Subtable ID│  29│  29│  30│  30│
3810 │                          ╶───────────────┼────┼────┼────┼────┤
3811 │                           No  Table ID   │   1│   1│   1│   1│
3812 │                               Layer ID   │   2│   2│   2│   2│
3813 │                               Subtable ID│  29│  29│  30│  30│
3814 │                      ╶───────────────────┼────┼────┼────┼────┤
3815 │                       No  Yes Table ID   │   1│   1│   1│   1│
3816 │                               Layer ID   │   2│   2│   2│   2│
3817 │                               Subtable ID│  31│  31│  32│  32│
3818 │                          ╶───────────────┼────┼────┼────┼────┤
3819 │                           No  Table ID   │   1│   1│   1│   1│
3820 │                               Layer ID   │   2│   2│   2│   2│
3821 │                               Subtable ID│  31│  31│  32│  32│
3822 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
3823
3824                           Custom Tables
3825 Male
3826 ╭───────────────────────────────────────────┬───────────────────╮
3827 │                                           │        QN27       │
3828 │                                           ├─────────┬─────────┤
3829 │                                           │   Yes   │    No   │
3830 │                                           ├─────────┼─────────┤
3831 │                                           │  QND7A  │  QND7A  │
3832 │                                           ├────┬────┼────┬────┤
3833 │                                           │ Yes│ No │ Yes│ No │
3834 │                                           ├────┼────┼────┼────┤
3835 │                                           │QN86│QN86│QN86│QN86│
3836 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3837 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │   1│   1│   3│   3│
3838 │                               Layer Row ID│   1│   1│   1│   1│
3839 │                          ╶────────────────┼────┼────┼────┼────┤
3840 │                           No  Row ID      │   2│   2│   4│   4│
3841 │                               Layer Row ID│   2│   2│   2│   2│
3842 │                      ╶────────────────────┼────┼────┼────┼────┤
3843 │                       No  Yes Row ID      │   5│   5│   7│   7│
3844 │                               Layer Row ID│   3│   3│   3│   3│
3845 │                          ╶────────────────┼────┼────┼────┼────┤
3846 │                           No  Row ID      │   6│   6│   8│   8│
3847 │                               Layer Row ID│   4│   4│   4│   4│
3848 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3849 │              No  QN57 Yes Yes Row ID      │   9│   9│  11│  11│
3850 │                               Layer Row ID│   5│   5│   5│   5│
3851 │                          ╶────────────────┼────┼────┼────┼────┤
3852 │                           No  Row ID      │  10│  10│  12│  12│
3853 │                               Layer Row ID│   6│   6│   6│   6│
3854 │                      ╶────────────────────┼────┼────┼────┼────┤
3855 │                       No  Yes Row ID      │  13│  13│  15│  15│
3856 │                               Layer Row ID│   7│   7│   7│   7│
3857 │                          ╶────────────────┼────┼────┼────┼────┤
3858 │                           No  Row ID      │  14│  14│  16│  16│
3859 │                               Layer Row ID│   8│   8│   8│   8│
3860 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3861 │     No  QN61 Yes QN57 Yes Yes Row ID      │  17│  17│  19│  19│
3862 │                               Layer Row ID│   9│   9│   9│   9│
3863 │                          ╶────────────────┼────┼────┼────┼────┤
3864 │                           No  Row ID      │  18│  18│  20│  20│
3865 │                               Layer Row ID│  10│  10│  10│  10│
3866 │                      ╶────────────────────┼────┼────┼────┼────┤
3867 │                       No  Yes Row ID      │  21│  21│  23│  23│
3868 │                               Layer Row ID│  11│  11│  11│  11│
3869 │                          ╶────────────────┼────┼────┼────┼────┤
3870 │                           No  Row ID      │  22│  22│  24│  24│
3871 │                               Layer Row ID│  12│  12│  12│  12│
3872 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3873 │              No  QN57 Yes Yes Row ID      │  25│  25│  27│  27│
3874 │                               Layer Row ID│  13│  13│  13│  13│
3875 │                          ╶────────────────┼────┼────┼────┼────┤
3876 │                           No  Row ID      │  26│  26│  28│  28│
3877 │                               Layer Row ID│  14│  14│  14│  14│
3878 │                      ╶────────────────────┼────┼────┼────┼────┤
3879 │                       No  Yes Row ID      │  29│  29│  31│  31│
3880 │                               Layer Row ID│  15│  15│  15│  15│
3881 │                          ╶────────────────┼────┼────┼────┼────┤
3882 │                           No  Row ID      │  30│  30│  32│  32│
3883 │                               Layer Row ID│  16│  16│  16│  16│
3884 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3885
3886                           Custom Tables
3887 Female
3888 ╭───────────────────────────────────────────┬───────────────────╮
3889 │                                           │        QN27       │
3890 │                                           ├─────────┬─────────┤
3891 │                                           │   Yes   │    No   │
3892 │                                           ├─────────┼─────────┤
3893 │                                           │  QND7A  │  QND7A  │
3894 │                                           ├────┬────┼────┬────┤
3895 │                                           │ Yes│ No │ Yes│ No │
3896 │                                           ├────┼────┼────┼────┤
3897 │                                           │QN86│QN86│QN86│QN86│
3898 ├───────────────────────────────────────────┼────┼────┼────┼────┤
3899 │QN26 Yes QN61 Yes QN57 Yes Yes Row ID      │  33│  33│  35│  35│
3900 │                               Layer Row ID│  17│  17│  17│  17│
3901 │                          ╶────────────────┼────┼────┼────┼────┤
3902 │                           No  Row ID      │  34│  34│  36│  36│
3903 │                               Layer Row ID│  18│  18│  18│  18│
3904 │                      ╶────────────────────┼────┼────┼────┼────┤
3905 │                       No  Yes Row ID      │  37│  37│  39│  39│
3906 │                               Layer Row ID│  19│  19│  19│  19│
3907 │                          ╶────────────────┼────┼────┼────┼────┤
3908 │                           No  Row ID      │  38│  38│  40│  40│
3909 │                               Layer Row ID│  20│  20│  20│  20│
3910 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3911 │              No  QN57 Yes Yes Row ID      │  41│  41│  43│  43│
3912 │                               Layer Row ID│  21│  21│  21│  21│
3913 │                          ╶────────────────┼────┼────┼────┼────┤
3914 │                           No  Row ID      │  42│  42│  44│  44│
3915 │                               Layer Row ID│  22│  22│  22│  22│
3916 │                      ╶────────────────────┼────┼────┼────┼────┤
3917 │                       No  Yes Row ID      │  45│  45│  47│  47│
3918 │                               Layer Row ID│  23│  23│  23│  23│
3919 │                          ╶────────────────┼────┼────┼────┼────┤
3920 │                           No  Row ID      │  46│  46│  48│  48│
3921 │                               Layer Row ID│  24│  24│  24│  24│
3922 │    ╶──────────────────────────────────────┼────┼────┼────┼────┤
3923 │     No  QN61 Yes QN57 Yes Yes Row ID      │  49│  49│  51│  51│
3924 │                               Layer Row ID│  25│  25│  25│  25│
3925 │                          ╶────────────────┼────┼────┼────┼────┤
3926 │                           No  Row ID      │  50│  50│  52│  52│
3927 │                               Layer Row ID│  26│  26│  26│  26│
3928 │                      ╶────────────────────┼────┼────┼────┼────┤
3929 │                       No  Yes Row ID      │  53│  53│  55│  55│
3930 │                               Layer Row ID│  27│  27│  27│  27│
3931 │                          ╶────────────────┼────┼────┼────┼────┤
3932 │                           No  Row ID      │  54│  54│  56│  56│
3933 │                               Layer Row ID│  28│  28│  28│  28│
3934 │             ╶─────────────────────────────┼────┼────┼────┼────┤
3935 │              No  QN57 Yes Yes Row ID      │  57│  57│  59│  59│
3936 │                               Layer Row ID│  29│  29│  29│  29│
3937 │                          ╶────────────────┼────┼────┼────┼────┤
3938 │                           No  Row ID      │  58│  58│  60│  60│
3939 │                               Layer Row ID│  30│  30│  30│  30│
3940 │                      ╶────────────────────┼────┼────┼────┼────┤
3941 │                       No  Yes Row ID      │  61│  61│  63│  63│
3942 │                               Layer Row ID│  31│  31│  31│  31│
3943 │                          ╶────────────────┼────┼────┼────┼────┤
3944 │                           No  Row ID      │  62│  62│  64│  64│
3945 │                               Layer Row ID│  32│  32│  32│  32│
3946 ╰───────────────────────────────────────────┴────┴────┴────┴────╯
3947
3948                             Custom Tables
3949 Male
3950 ╭──────────────────────────────────────────────┬───────────────────╮
3951 │                                              │        QN27       │
3952 │                                              ├─────────┬─────────┤
3953 │                                              │   Yes   │    No   │
3954 │                                              ├─────────┼─────────┤
3955 │                                              │  QND7A  │  QND7A  │
3956 │                                              ├────┬────┼────┬────┤
3957 │                                              │ Yes│ No │ Yes│ No │
3958 │                                              ├────┼────┼────┼────┤
3959 │                                              │QN86│QN86│QN86│QN86│
3960 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
3961 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │   1│   2│   3│   4│
3962 │                               Layer Column ID│   1│   2│   3│   4│
3963 │                          ╶───────────────────┼────┼────┼────┼────┤
3964 │                           No  Column ID      │   1│   2│   3│   4│
3965 │                               Layer Column ID│   1│   2│   3│   4│
3966 │                      ╶───────────────────────┼────┼────┼────┼────┤
3967 │                       No  Yes Column ID      │   5│   6│   7│   8│
3968 │                               Layer Column ID│   1│   2│   3│   4│
3969 │                          ╶───────────────────┼────┼────┼────┼────┤
3970 │                           No  Column ID      │   5│   6│   7│   8│
3971 │                               Layer Column ID│   1│   2│   3│   4│
3972 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3973 │              No  QN57 Yes Yes Column ID      │   9│  10│  11│  12│
3974 │                               Layer Column ID│   1│   2│   3│   4│
3975 │                          ╶───────────────────┼────┼────┼────┼────┤
3976 │                           No  Column ID      │   9│  10│  11│  12│
3977 │                               Layer Column ID│   1│   2│   3│   4│
3978 │                      ╶───────────────────────┼────┼────┼────┼────┤
3979 │                       No  Yes Column ID      │  13│  14│  15│  16│
3980 │                               Layer Column ID│   1│   2│   3│   4│
3981 │                          ╶───────────────────┼────┼────┼────┼────┤
3982 │                           No  Column ID      │  13│  14│  15│  16│
3983 │                               Layer Column ID│   1│   2│   3│   4│
3984 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
3985 │     No  QN61 Yes QN57 Yes Yes Column ID      │  17│  18│  19│  20│
3986 │                               Layer Column ID│   1│   2│   3│   4│
3987 │                          ╶───────────────────┼────┼────┼────┼────┤
3988 │                           No  Column ID      │  17│  18│  19│  20│
3989 │                               Layer Column ID│   1│   2│   3│   4│
3990 │                      ╶───────────────────────┼────┼────┼────┼────┤
3991 │                       No  Yes Column ID      │  21│  22│  23│  24│
3992 │                               Layer Column ID│   1│   2│   3│   4│
3993 │                          ╶───────────────────┼────┼────┼────┼────┤
3994 │                           No  Column ID      │  21│  22│  23│  24│
3995 │                               Layer Column ID│   1│   2│   3│   4│
3996 │             ╶────────────────────────────────┼────┼────┼────┼────┤
3997 │              No  QN57 Yes Yes Column ID      │  25│  26│  27│  28│
3998 │                               Layer Column ID│   1│   2│   3│   4│
3999 │                          ╶───────────────────┼────┼────┼────┼────┤
4000 │                           No  Column ID      │  25│  26│  27│  28│
4001 │                               Layer Column ID│   1│   2│   3│   4│
4002 │                      ╶───────────────────────┼────┼────┼────┼────┤
4003 │                       No  Yes Column ID      │  29│  30│  31│  32│
4004 │                               Layer Column ID│   1│   2│   3│   4│
4005 │                          ╶───────────────────┼────┼────┼────┼────┤
4006 │                           No  Column ID      │  29│  30│  31│  32│
4007 │                               Layer Column ID│   1│   2│   3│   4│
4008 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4009
4010                             Custom Tables
4011 Female
4012 ╭──────────────────────────────────────────────┬───────────────────╮
4013 │                                              │        QN27       │
4014 │                                              ├─────────┬─────────┤
4015 │                                              │   Yes   │    No   │
4016 │                                              ├─────────┼─────────┤
4017 │                                              │  QND7A  │  QND7A  │
4018 │                                              ├────┬────┼────┬────┤
4019 │                                              │ Yes│ No │ Yes│ No │
4020 │                                              ├────┼────┼────┼────┤
4021 │                                              │QN86│QN86│QN86│QN86│
4022 ├──────────────────────────────────────────────┼────┼────┼────┼────┤
4023 │QN26 Yes QN61 Yes QN57 Yes Yes Column ID      │  33│  34│  35│  36│
4024 │                               Layer Column ID│   5│   6│   7│   8│
4025 │                          ╶───────────────────┼────┼────┼────┼────┤
4026 │                           No  Column ID      │  33│  34│  35│  36│
4027 │                               Layer Column ID│   5│   6│   7│   8│
4028 │                      ╶───────────────────────┼────┼────┼────┼────┤
4029 │                       No  Yes Column ID      │  37│  38│  39│  40│
4030 │                               Layer Column ID│   5│   6│   7│   8│
4031 │                          ╶───────────────────┼────┼────┼────┼────┤
4032 │                           No  Column ID      │  37│  38│  39│  40│
4033 │                               Layer Column ID│   5│   6│   7│   8│
4034 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4035 │              No  QN57 Yes Yes Column ID      │  41│  42│  43│  44│
4036 │                               Layer Column ID│   5│   6│   7│   8│
4037 │                          ╶───────────────────┼────┼────┼────┼────┤
4038 │                           No  Column ID      │  41│  42│  43│  44│
4039 │                               Layer Column ID│   5│   6│   7│   8│
4040 │                      ╶───────────────────────┼────┼────┼────┼────┤
4041 │                       No  Yes Column ID      │  45│  46│  47│  48│
4042 │                               Layer Column ID│   5│   6│   7│   8│
4043 │                          ╶───────────────────┼────┼────┼────┼────┤
4044 │                           No  Column ID      │  45│  46│  47│  48│
4045 │                               Layer Column ID│   5│   6│   7│   8│
4046 │    ╶─────────────────────────────────────────┼────┼────┼────┼────┤
4047 │     No  QN61 Yes QN57 Yes Yes Column ID      │  49│  50│  51│  52│
4048 │                               Layer Column ID│   5│   6│   7│   8│
4049 │                          ╶───────────────────┼────┼────┼────┼────┤
4050 │                           No  Column ID      │  49│  50│  51│  52│
4051 │                               Layer Column ID│   5│   6│   7│   8│
4052 │                      ╶───────────────────────┼────┼────┼────┼────┤
4053 │                       No  Yes Column ID      │  53│  54│  55│  56│
4054 │                               Layer Column ID│   5│   6│   7│   8│
4055 │                          ╶───────────────────┼────┼────┼────┼────┤
4056 │                           No  Column ID      │  53│  54│  55│  56│
4057 │                               Layer Column ID│   5│   6│   7│   8│
4058 │             ╶────────────────────────────────┼────┼────┼────┼────┤
4059 │              No  QN57 Yes Yes Column ID      │  57│  58│  59│  60│
4060 │                               Layer Column ID│   5│   6│   7│   8│
4061 │                          ╶───────────────────┼────┼────┼────┼────┤
4062 │                           No  Column ID      │  57│  58│  59│  60│
4063 │                               Layer Column ID│   5│   6│   7│   8│
4064 │                      ╶───────────────────────┼────┼────┼────┼────┤
4065 │                       No  Yes Column ID      │  61│  62│  63│  64│
4066 │                               Layer Column ID│   5│   6│   7│   8│
4067 │                          ╶───────────────────┼────┼────┼────┼────┤
4068 │                           No  Column ID      │  61│  62│  63│  64│
4069 │                               Layer Column ID│   5│   6│   7│   8│
4070 ╰──────────────────────────────────────────────┴────┴────┴────┴────╯
4071 ])
4072 AT_CLEANUP
4073
4074 AT_SETUP([CTABLES area definitions with CLABELS ROWLABELS=LAYER])
4075 AT_KEYWORDS([ROWLABELS LAYER])
4076 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4077 AT_DATA([ctables.sps],
4078 [[GET 'nhtsa.sav'.
4079 CTABLES
4080     /VLABELS VARIABLES=ALL DISPLAY=NAME
4081     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4082     /SLABELS POSITION=ROW
4083     /CLABELS ROWLABELS=LAYER
4084     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4085     /SLABELS POSITION=ROW
4086     /CLABELS ROWLABELS=LAYER
4087     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4088     /SLABELS POSITION=ROW
4089     /CLABELS ROWLABELS=LAYER.
4090 ]])
4091 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4092                           Custom Tables
4093 Male
4094 Yes
4095 ╭──────────────────────────────────┬───────────────────────────╮
4096 │                                  │            QN27           │
4097 │                                  ├─────────────┬─────────────┤
4098 │                                  │     Yes     │      No     │
4099 │                                  ├─────────────┼─────────────┤
4100 │                                  │    QND7A    │    QND7A    │
4101 │                                  ├──────┬──────┼──────┬──────┤
4102 │                                  │  Yes │  No  │  Yes │  No  │
4103 │                                  ├──────┼──────┼──────┼──────┤
4104 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4105 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4106 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4107 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4108 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4109 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4110 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4111 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4112 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4113 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4114 │                       Subtable ID│  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4115 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4116 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4117 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4118 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4119 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4120 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4121 │                       Layer ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4122 │                       Subtable ID│  9│ 9│ 11│11│ 13│13│ 15│15│
4123 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4124
4125                           Custom Tables
4126 Male
4127 No
4128 ╭──────────────────────────────────┬───────────────────────────╮
4129 │                                  │            QN27           │
4130 │                                  ├─────────────┬─────────────┤
4131 │                                  │     Yes     │      No     │
4132 │                                  ├─────────────┼─────────────┤
4133 │                                  │    QND7A    │    QND7A    │
4134 │                                  ├──────┬──────┼──────┬──────┤
4135 │                                  │  Yes │  No  │  Yes │  No  │
4136 │                                  ├──────┼──────┼──────┼──────┤
4137 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4138 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4139 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4140 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4141 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4142 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4143 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4144 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4145 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4146 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4147 │                       Subtable ID│  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4148 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4149 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4150 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4151 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4152 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4153 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4154 │                       Layer ID   │  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4155 │                       Subtable ID│ 10│10│ 12│12│ 14│14│ 16│16│
4156 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4157
4158                           Custom Tables
4159 Female
4160 Yes
4161 ╭──────────────────────────────────┬───────────────────────────╮
4162 │                                  │            QN27           │
4163 │                                  ├─────────────┬─────────────┤
4164 │                                  │     Yes     │      No     │
4165 │                                  ├─────────────┼─────────────┤
4166 │                                  │    QND7A    │    QND7A    │
4167 │                                  ├──────┬──────┼──────┬──────┤
4168 │                                  │  Yes │  No  │  Yes │  No  │
4169 │                                  ├──────┼──────┼──────┼──────┤
4170 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4171 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4172 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4173 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4174 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4175 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4176 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4177 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4178 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4179 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4180 │                       Subtable ID│ 17│17│ 19│19│ 21│21│ 23│23│
4181 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4182 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4183 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4184 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4185 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4186 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4187 │                       Layer ID   │  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4188 │                       Subtable ID│ 25│25│ 27│27│ 29│29│ 31│31│
4189 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4190
4191                           Custom Tables
4192 Female
4193 No
4194 ╭──────────────────────────────────┬───────────────────────────╮
4195 │                                  │            QN27           │
4196 │                                  ├─────────────┬─────────────┤
4197 │                                  │     Yes     │      No     │
4198 │                                  ├─────────────┼─────────────┤
4199 │                                  │    QND7A    │    QND7A    │
4200 │                                  ├──────┬──────┼──────┬──────┤
4201 │                                  │  Yes │  No  │  Yes │  No  │
4202 │                                  ├──────┼──────┼──────┼──────┤
4203 │                                  │ QN86 │ QN86 │ QN86 │ QN86 │
4204 │                                  ├───┬──┼───┬──┼───┬──┼───┬──┤
4205 │                                  │Yes│No│Yes│No│Yes│No│Yes│No│
4206 ├──────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4207 │QN26 Yes QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4208 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4209 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4210 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4211 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4212 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4213 │                       Subtable ID│ 18│18│ 20│20│ 22│22│ 24│24│
4214 │    ╶─────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4215 │     No  QN61 Yes QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4216 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4217 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4218 │             ╶────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4219 │              No  QN57 Table ID   │  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4220 │                       Layer ID   │  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4221 │                       Subtable ID│ 26│26│ 28│28│ 30│30│ 32│32│
4222 ╰──────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4223
4224                           Custom Tables
4225 Male
4226 Yes
4227 ╭───────────────────────────────────┬───────────────────────────╮
4228 │                                   │            QN27           │
4229 │                                   ├─────────────┬─────────────┤
4230 │                                   │     Yes     │      No     │
4231 │                                   ├─────────────┼─────────────┤
4232 │                                   │    QND7A    │    QND7A    │
4233 │                                   ├──────┬──────┼──────┬──────┤
4234 │                                   │  Yes │  No  │  Yes │  No  │
4235 │                                   ├──────┼──────┼──────┼──────┤
4236 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4237 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4238 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4239 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4240 │QN26 Yes QN61 Yes QN57 Row ID      │  1│ 1│  3│ 3│  5│ 5│  7│ 7│
4241 │                       Layer Row ID│  1│ 1│  1│ 1│  1│ 1│  1│ 1│
4242 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4243 │              No  QN57 Row ID      │  9│ 9│ 11│11│ 13│13│ 15│15│
4244 │                       Layer Row ID│  3│ 3│  3│ 3│  3│ 3│  3│ 3│
4245 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4246 │     No  QN61 Yes QN57 Row ID      │ 17│17│ 19│19│ 21│21│ 23│23│
4247 │                       Layer Row ID│  5│ 5│  5│ 5│  5│ 5│  5│ 5│
4248 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4249 │              No  QN57 Row ID      │ 25│25│ 27│27│ 29│29│ 31│31│
4250 │                       Layer Row ID│  7│ 7│  7│ 7│  7│ 7│  7│ 7│
4251 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4252
4253                           Custom Tables
4254 Male
4255 No
4256 ╭───────────────────────────────────┬───────────────────────────╮
4257 │                                   │            QN27           │
4258 │                                   ├─────────────┬─────────────┤
4259 │                                   │     Yes     │      No     │
4260 │                                   ├─────────────┼─────────────┤
4261 │                                   │    QND7A    │    QND7A    │
4262 │                                   ├──────┬──────┼──────┬──────┤
4263 │                                   │  Yes │  No  │  Yes │  No  │
4264 │                                   ├──────┼──────┼──────┼──────┤
4265 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4266 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4267 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4268 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4269 │QN26 Yes QN61 Yes QN57 Row ID      │  2│ 2│  4│ 4│  6│ 6│  8│ 8│
4270 │                       Layer Row ID│  2│ 2│  2│ 2│  2│ 2│  2│ 2│
4271 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4272 │              No  QN57 Row ID      │ 10│10│ 12│12│ 14│14│ 16│16│
4273 │                       Layer Row ID│  4│ 4│  4│ 4│  4│ 4│  4│ 4│
4274 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4275 │     No  QN61 Yes QN57 Row ID      │ 18│18│ 20│20│ 22│22│ 24│24│
4276 │                       Layer Row ID│  6│ 6│  6│ 6│  6│ 6│  6│ 6│
4277 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4278 │              No  QN57 Row ID      │ 26│26│ 28│28│ 30│30│ 32│32│
4279 │                       Layer Row ID│  8│ 8│  8│ 8│  8│ 8│  8│ 8│
4280 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4281
4282                           Custom Tables
4283 Female
4284 Yes
4285 ╭───────────────────────────────────┬───────────────────────────╮
4286 │                                   │            QN27           │
4287 │                                   ├─────────────┬─────────────┤
4288 │                                   │     Yes     │      No     │
4289 │                                   ├─────────────┼─────────────┤
4290 │                                   │    QND7A    │    QND7A    │
4291 │                                   ├──────┬──────┼──────┬──────┤
4292 │                                   │  Yes │  No  │  Yes │  No  │
4293 │                                   ├──────┼──────┼──────┼──────┤
4294 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4295 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4296 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4297 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4298 │QN26 Yes QN61 Yes QN57 Row ID      │ 33│33│ 35│35│ 37│37│ 39│39│
4299 │                       Layer Row ID│  9│ 9│  9│ 9│  9│ 9│  9│ 9│
4300 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4301 │              No  QN57 Row ID      │ 41│41│ 43│43│ 45│45│ 47│47│
4302 │                       Layer Row ID│ 11│11│ 11│11│ 11│11│ 11│11│
4303 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4304 │     No  QN61 Yes QN57 Row ID      │ 49│49│ 51│51│ 53│53│ 55│55│
4305 │                       Layer Row ID│ 13│13│ 13│13│ 13│13│ 13│13│
4306 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4307 │              No  QN57 Row ID      │ 57│57│ 59│59│ 61│61│ 63│63│
4308 │                       Layer Row ID│ 15│15│ 15│15│ 15│15│ 15│15│
4309 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4310
4311                           Custom Tables
4312 Female
4313 No
4314 ╭───────────────────────────────────┬───────────────────────────╮
4315 │                                   │            QN27           │
4316 │                                   ├─────────────┬─────────────┤
4317 │                                   │     Yes     │      No     │
4318 │                                   ├─────────────┼─────────────┤
4319 │                                   │    QND7A    │    QND7A    │
4320 │                                   ├──────┬──────┼──────┬──────┤
4321 │                                   │  Yes │  No  │  Yes │  No  │
4322 │                                   ├──────┼──────┼──────┼──────┤
4323 │                                   │ QN86 │ QN86 │ QN86 │ QN86 │
4324 │                                   ├───┬──┼───┬──┼───┬──┼───┬──┤
4325 │                                   │Yes│No│Yes│No│Yes│No│Yes│No│
4326 ├───────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4327 │QN26 Yes QN61 Yes QN57 Row ID      │ 34│34│ 36│36│ 38│38│ 40│40│
4328 │                       Layer Row ID│ 10│10│ 10│10│ 10│10│ 10│10│
4329 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4330 │              No  QN57 Row ID      │ 42│42│ 44│44│ 46│46│ 48│48│
4331 │                       Layer Row ID│ 12│12│ 12│12│ 12│12│ 12│12│
4332 │    ╶──────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4333 │     No  QN61 Yes QN57 Row ID      │ 50│50│ 52│52│ 54│54│ 56│56│
4334 │                       Layer Row ID│ 14│14│ 14│14│ 14│14│ 14│14│
4335 │             ╶─────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4336 │              No  QN57 Row ID      │ 58│58│ 60│60│ 62│62│ 64│64│
4337 │                       Layer Row ID│ 16│16│ 16│16│ 16│16│ 16│16│
4338 ╰───────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4339
4340                             Custom Tables
4341 Male
4342 Yes
4343 ╭──────────────────────────────────────┬───────────────────────────╮
4344 │                                      │            QN27           │
4345 │                                      ├─────────────┬─────────────┤
4346 │                                      │     Yes     │      No     │
4347 │                                      ├─────────────┼─────────────┤
4348 │                                      │    QND7A    │    QND7A    │
4349 │                                      ├──────┬──────┼──────┬──────┤
4350 │                                      │  Yes │  No  │  Yes │  No  │
4351 │                                      ├──────┼──────┼──────┼──────┤
4352 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4353 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4354 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4355 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4356 │QN26 Yes QN61 Yes QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4357 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4358 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4359 │              No  QN57 Column ID      │  1│ 3│  5│ 7│  9│11│ 13│15│
4360 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4361 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4362 │     No  QN61 Yes QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4363 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4364 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4365 │              No  QN57 Column ID      │ 17│19│ 21│23│ 25│27│ 29│31│
4366 │                       Layer Column ID│  1│ 3│  5│ 7│  9│11│ 13│15│
4367 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4368
4369                             Custom Tables
4370 Male
4371 No
4372 ╭──────────────────────────────────────┬───────────────────────────╮
4373 │                                      │            QN27           │
4374 │                                      ├─────────────┬─────────────┤
4375 │                                      │     Yes     │      No     │
4376 │                                      ├─────────────┼─────────────┤
4377 │                                      │    QND7A    │    QND7A    │
4378 │                                      ├──────┬──────┼──────┬──────┤
4379 │                                      │  Yes │  No  │  Yes │  No  │
4380 │                                      ├──────┼──────┼──────┼──────┤
4381 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4382 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4383 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4384 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4385 │QN26 Yes QN61 Yes QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4386 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4387 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4388 │              No  QN57 Column ID      │  2│ 4│  6│ 8│ 10│12│ 14│16│
4389 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4390 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4391 │     No  QN61 Yes QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4392 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4393 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4394 │              No  QN57 Column ID      │ 18│20│ 22│24│ 26│28│ 30│32│
4395 │                       Layer Column ID│  2│ 4│  6│ 8│ 10│12│ 14│16│
4396 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4397
4398                             Custom Tables
4399 Female
4400 Yes
4401 ╭──────────────────────────────────────┬───────────────────────────╮
4402 │                                      │            QN27           │
4403 │                                      ├─────────────┬─────────────┤
4404 │                                      │     Yes     │      No     │
4405 │                                      ├─────────────┼─────────────┤
4406 │                                      │    QND7A    │    QND7A    │
4407 │                                      ├──────┬──────┼──────┬──────┤
4408 │                                      │  Yes │  No  │  Yes │  No  │
4409 │                                      ├──────┼──────┼──────┼──────┤
4410 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4411 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4412 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4413 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4414 │QN26 Yes QN61 Yes QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4415 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4416 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4417 │              No  QN57 Column ID      │ 33│35│ 37│39│ 41│43│ 45│47│
4418 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4419 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4420 │     No  QN61 Yes QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4421 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4422 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4423 │              No  QN57 Column ID      │ 49│51│ 53│55│ 57│59│ 61│63│
4424 │                       Layer Column ID│ 17│19│ 21│23│ 25│27│ 29│31│
4425 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4426
4427                             Custom Tables
4428 Female
4429 No
4430 ╭──────────────────────────────────────┬───────────────────────────╮
4431 │                                      │            QN27           │
4432 │                                      ├─────────────┬─────────────┤
4433 │                                      │     Yes     │      No     │
4434 │                                      ├─────────────┼─────────────┤
4435 │                                      │    QND7A    │    QND7A    │
4436 │                                      ├──────┬──────┼──────┬──────┤
4437 │                                      │  Yes │  No  │  Yes │  No  │
4438 │                                      ├──────┼──────┼──────┼──────┤
4439 │                                      │ QN86 │ QN86 │ QN86 │ QN86 │
4440 │                                      ├───┬──┼───┬──┼───┬──┼───┬──┤
4441 │                                      │Yes│No│Yes│No│Yes│No│Yes│No│
4442 ├──────────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4443 │QN26 Yes QN61 Yes QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4444 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4445 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4446 │              No  QN57 Column ID      │ 34│36│ 38│40│ 42│44│ 46│48│
4447 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4448 │    ╶─────────────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4449 │     No  QN61 Yes QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4450 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4451 │             ╶────────────────────────┼───┼──┼───┼──┼───┼──┼───┼──┤
4452 │              No  QN57 Column ID      │ 50│52│ 54│56│ 58│60│ 62│64│
4453 │                       Layer Column ID│ 18│20│ 22│24│ 26│28│ 30│32│
4454 ╰──────────────────────────────────────┴───┴──┴───┴──┴───┴──┴───┴──╯
4455 ])
4456 AT_CLEANUP
4457
4458 AT_SETUP([CTABLES area definitions with CLABELS COLLABELS=LAYER])
4459 AT_KEYWORDS([COLLABELS LAYER])
4460 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4461 AT_DATA([ctables.sps],
4462 [[GET 'nhtsa.sav'.
4463 CTABLES
4464     /VLABELS VARIABLES=ALL DISPLAY=NAME
4465     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID, LAYERID, SUBTABLEID]
4466     /SLABELS POSITION=ROW
4467     /CLABELS COLLABELS=LAYER
4468     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID, LAYERROWID]
4469     /SLABELS POSITION=ROW
4470     /CLABELS COLLABELS=LAYER
4471     /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID, LAYERCOLID]
4472     /SLABELS POSITION=ROW
4473     /CLABELS COLLABELS=LAYER.
4474 ]])
4475 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
4476                         Custom Tables
4477 Male
4478 Yes
4479 ╭──────────────────────────────────────┬───────────────────╮
4480 │                                      │        QN27       │
4481 │                                      ├─────────┬─────────┤
4482 │                                      │   Yes   │    No   │
4483 │                                      ├─────────┼─────────┤
4484 │                                      │  QND7A  │  QND7A  │
4485 │                                      ├────┬────┼────┬────┤
4486 │                                      │ Yes│ No │ Yes│ No │
4487 │                                      ├────┼────┼────┼────┤
4488 │                                      │QN86│QN86│QN86│QN86│
4489 ├──────────────────────────────────────┼────┼────┼────┼────┤
4490 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4491 │                           Layer ID   │   1│   1│   1│   1│
4492 │                           Subtable ID│   1│   1│   3│   3│
4493 │                      ╶───────────────┼────┼────┼────┼────┤
4494 │                       No  Table ID   │   1│   1│   1│   1│
4495 │                           Layer ID   │   1│   1│   1│   1│
4496 │                           Subtable ID│   1│   1│   3│   3│
4497 │             ╶────────────────────────┼────┼────┼────┼────┤
4498 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4499 │                           Layer ID   │   1│   1│   1│   1│
4500 │                           Subtable ID│   5│   5│   7│   7│
4501 │                      ╶───────────────┼────┼────┼────┼────┤
4502 │                       No  Table ID   │   1│   1│   1│   1│
4503 │                           Layer ID   │   1│   1│   1│   1│
4504 │                           Subtable ID│   5│   5│   7│   7│
4505 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4506 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4507 │                           Layer ID   │   1│   1│   1│   1│
4508 │                           Subtable ID│   9│   9│  11│  11│
4509 │                      ╶───────────────┼────┼────┼────┼────┤
4510 │                       No  Table ID   │   1│   1│   1│   1│
4511 │                           Layer ID   │   1│   1│   1│   1│
4512 │                           Subtable ID│   9│   9│  11│  11│
4513 │             ╶────────────────────────┼────┼────┼────┼────┤
4514 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4515 │                           Layer ID   │   1│   1│   1│   1│
4516 │                           Subtable ID│  13│  13│  15│  15│
4517 │                      ╶───────────────┼────┼────┼────┼────┤
4518 │                       No  Table ID   │   1│   1│   1│   1│
4519 │                           Layer ID   │   1│   1│   1│   1│
4520 │                           Subtable ID│  13│  13│  15│  15│
4521 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4522
4523                         Custom Tables
4524 Male
4525 No
4526 ╭──────────────────────────────────────┬───────────────────╮
4527 │                                      │        QN27       │
4528 │                                      ├─────────┬─────────┤
4529 │                                      │   Yes   │    No   │
4530 │                                      ├─────────┼─────────┤
4531 │                                      │  QND7A  │  QND7A  │
4532 │                                      ├────┬────┼────┬────┤
4533 │                                      │ Yes│ No │ Yes│ No │
4534 │                                      ├────┼────┼────┼────┤
4535 │                                      │QN86│QN86│QN86│QN86│
4536 ├──────────────────────────────────────┼────┼────┼────┼────┤
4537 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4538 │                           Layer ID   │   2│   2│   2│   2│
4539 │                           Subtable ID│   2│   2│   4│   4│
4540 │                      ╶───────────────┼────┼────┼────┼────┤
4541 │                       No  Table ID   │   1│   1│   1│   1│
4542 │                           Layer ID   │   2│   2│   2│   2│
4543 │                           Subtable ID│   2│   2│   4│   4│
4544 │             ╶────────────────────────┼────┼────┼────┼────┤
4545 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4546 │                           Layer ID   │   2│   2│   2│   2│
4547 │                           Subtable ID│   6│   6│   8│   8│
4548 │                      ╶───────────────┼────┼────┼────┼────┤
4549 │                       No  Table ID   │   1│   1│   1│   1│
4550 │                           Layer ID   │   2│   2│   2│   2│
4551 │                           Subtable ID│   6│   6│   8│   8│
4552 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4553 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4554 │                           Layer ID   │   2│   2│   2│   2│
4555 │                           Subtable ID│  10│  10│  12│  12│
4556 │                      ╶───────────────┼────┼────┼────┼────┤
4557 │                       No  Table ID   │   1│   1│   1│   1│
4558 │                           Layer ID   │   2│   2│   2│   2│
4559 │                           Subtable ID│  10│  10│  12│  12│
4560 │             ╶────────────────────────┼────┼────┼────┼────┤
4561 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4562 │                           Layer ID   │   2│   2│   2│   2│
4563 │                           Subtable ID│  14│  14│  16│  16│
4564 │                      ╶───────────────┼────┼────┼────┼────┤
4565 │                       No  Table ID   │   1│   1│   1│   1│
4566 │                           Layer ID   │   2│   2│   2│   2│
4567 │                           Subtable ID│  14│  14│  16│  16│
4568 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4569
4570                         Custom Tables
4571 Female
4572 Yes
4573 ╭──────────────────────────────────────┬───────────────────╮
4574 │                                      │        QN27       │
4575 │                                      ├─────────┬─────────┤
4576 │                                      │   Yes   │    No   │
4577 │                                      ├─────────┼─────────┤
4578 │                                      │  QND7A  │  QND7A  │
4579 │                                      ├────┬────┼────┬────┤
4580 │                                      │ Yes│ No │ Yes│ No │
4581 │                                      ├────┼────┼────┼────┤
4582 │                                      │QN86│QN86│QN86│QN86│
4583 ├──────────────────────────────────────┼────┼────┼────┼────┤
4584 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4585 │                           Layer ID   │   3│   3│   3│   3│
4586 │                           Subtable ID│  17│  17│  19│  19│
4587 │                      ╶───────────────┼────┼────┼────┼────┤
4588 │                       No  Table ID   │   1│   1│   1│   1│
4589 │                           Layer ID   │   3│   3│   3│   3│
4590 │                           Subtable ID│  17│  17│  19│  19│
4591 │             ╶────────────────────────┼────┼────┼────┼────┤
4592 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4593 │                           Layer ID   │   3│   3│   3│   3│
4594 │                           Subtable ID│  21│  21│  23│  23│
4595 │                      ╶───────────────┼────┼────┼────┼────┤
4596 │                       No  Table ID   │   1│   1│   1│   1│
4597 │                           Layer ID   │   3│   3│   3│   3│
4598 │                           Subtable ID│  21│  21│  23│  23│
4599 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4600 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4601 │                           Layer ID   │   3│   3│   3│   3│
4602 │                           Subtable ID│  25│  25│  27│  27│
4603 │                      ╶───────────────┼────┼────┼────┼────┤
4604 │                       No  Table ID   │   1│   1│   1│   1│
4605 │                           Layer ID   │   3│   3│   3│   3│
4606 │                           Subtable ID│  25│  25│  27│  27│
4607 │             ╶────────────────────────┼────┼────┼────┼────┤
4608 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4609 │                           Layer ID   │   3│   3│   3│   3│
4610 │                           Subtable ID│  29│  29│  31│  31│
4611 │                      ╶───────────────┼────┼────┼────┼────┤
4612 │                       No  Table ID   │   1│   1│   1│   1│
4613 │                           Layer ID   │   3│   3│   3│   3│
4614 │                           Subtable ID│  29│  29│  31│  31│
4615 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4616
4617                         Custom Tables
4618 Female
4619 No
4620 ╭──────────────────────────────────────┬───────────────────╮
4621 │                                      │        QN27       │
4622 │                                      ├─────────┬─────────┤
4623 │                                      │   Yes   │    No   │
4624 │                                      ├─────────┼─────────┤
4625 │                                      │  QND7A  │  QND7A  │
4626 │                                      ├────┬────┼────┬────┤
4627 │                                      │ Yes│ No │ Yes│ No │
4628 │                                      ├────┼────┼────┼────┤
4629 │                                      │QN86│QN86│QN86│QN86│
4630 ├──────────────────────────────────────┼────┼────┼────┼────┤
4631 │QN26 Yes QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4632 │                           Layer ID   │   4│   4│   4│   4│
4633 │                           Subtable ID│  18│  18│  20│  20│
4634 │                      ╶───────────────┼────┼────┼────┼────┤
4635 │                       No  Table ID   │   1│   1│   1│   1│
4636 │                           Layer ID   │   4│   4│   4│   4│
4637 │                           Subtable ID│  18│  18│  20│  20│
4638 │             ╶────────────────────────┼────┼────┼────┼────┤
4639 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4640 │                           Layer ID   │   4│   4│   4│   4│
4641 │                           Subtable ID│  22│  22│  24│  24│
4642 │                      ╶───────────────┼────┼────┼────┼────┤
4643 │                       No  Table ID   │   1│   1│   1│   1│
4644 │                           Layer ID   │   4│   4│   4│   4│
4645 │                           Subtable ID│  22│  22│  24│  24│
4646 │    ╶─────────────────────────────────┼────┼────┼────┼────┤
4647 │     No  QN61 Yes QN57 Yes Table ID   │   1│   1│   1│   1│
4648 │                           Layer ID   │   4│   4│   4│   4│
4649 │                           Subtable ID│  26│  26│  28│  28│
4650 │                      ╶───────────────┼────┼────┼────┼────┤
4651 │                       No  Table ID   │   1│   1│   1│   1│
4652 │                           Layer ID   │   4│   4│   4│   4│
4653 │                           Subtable ID│  26│  26│  28│  28│
4654 │             ╶────────────────────────┼────┼────┼────┼────┤
4655 │              No  QN57 Yes Table ID   │   1│   1│   1│   1│
4656 │                           Layer ID   │   4│   4│   4│   4│
4657 │                           Subtable ID│  30│  30│  32│  32│
4658 │                      ╶───────────────┼────┼────┼────┼────┤
4659 │                       No  Table ID   │   1│   1│   1│   1│
4660 │                           Layer ID   │   4│   4│   4│   4│
4661 │                           Subtable ID│  30│  30│  32│  32│
4662 ╰──────────────────────────────────────┴────┴────┴────┴────╯
4663
4664                         Custom Tables
4665 Male
4666 Yes
4667 ╭───────────────────────────────────────┬───────────────────╮
4668 │                                       │        QN27       │
4669 │                                       ├─────────┬─────────┤
4670 │                                       │   Yes   │    No   │
4671 │                                       ├─────────┼─────────┤
4672 │                                       │  QND7A  │  QND7A  │
4673 │                                       ├────┬────┼────┬────┤
4674 │                                       │ Yes│ No │ Yes│ No │
4675 │                                       ├────┼────┼────┼────┤
4676 │                                       │QN86│QN86│QN86│QN86│
4677 ├───────────────────────────────────────┼────┼────┼────┼────┤
4678 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   1│   1│   3│   3│
4679 │                           Layer Row ID│   1│   1│   1│   1│
4680 │                      ╶────────────────┼────┼────┼────┼────┤
4681 │                       No  Row ID      │   5│   5│   7│   7│
4682 │                           Layer Row ID│   3│   3│   3│   3│
4683 │             ╶─────────────────────────┼────┼────┼────┼────┤
4684 │              No  QN57 Yes Row ID      │   9│   9│  11│  11│
4685 │                           Layer Row ID│   5│   5│   5│   5│
4686 │                      ╶────────────────┼────┼────┼────┼────┤
4687 │                       No  Row ID      │  13│  13│  15│  15│
4688 │                           Layer Row ID│   7│   7│   7│   7│
4689 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4690 │     No  QN61 Yes QN57 Yes Row ID      │  17│  17│  19│  19│
4691 │                           Layer Row ID│   9│   9│   9│   9│
4692 │                      ╶────────────────┼────┼────┼────┼────┤
4693 │                       No  Row ID      │  21│  21│  23│  23│
4694 │                           Layer Row ID│  11│  11│  11│  11│
4695 │             ╶─────────────────────────┼────┼────┼────┼────┤
4696 │              No  QN57 Yes Row ID      │  25│  25│  27│  27│
4697 │                           Layer Row ID│  13│  13│  13│  13│
4698 │                      ╶────────────────┼────┼────┼────┼────┤
4699 │                       No  Row ID      │  29│  29│  31│  31│
4700 │                           Layer Row ID│  15│  15│  15│  15│
4701 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4702
4703                         Custom Tables
4704 Male
4705 No
4706 ╭───────────────────────────────────────┬───────────────────╮
4707 │                                       │        QN27       │
4708 │                                       ├─────────┬─────────┤
4709 │                                       │   Yes   │    No   │
4710 │                                       ├─────────┼─────────┤
4711 │                                       │  QND7A  │  QND7A  │
4712 │                                       ├────┬────┼────┬────┤
4713 │                                       │ Yes│ No │ Yes│ No │
4714 │                                       ├────┼────┼────┼────┤
4715 │                                       │QN86│QN86│QN86│QN86│
4716 ├───────────────────────────────────────┼────┼────┼────┼────┤
4717 │QN26 Yes QN61 Yes QN57 Yes Row ID      │   2│   2│   4│   4│
4718 │                           Layer Row ID│   2│   2│   2│   2│
4719 │                      ╶────────────────┼────┼────┼────┼────┤
4720 │                       No  Row ID      │   6│   6│   8│   8│
4721 │                           Layer Row ID│   4│   4│   4│   4│
4722 │             ╶─────────────────────────┼────┼────┼────┼────┤
4723 │              No  QN57 Yes Row ID      │  10│  10│  12│  12│
4724 │                           Layer Row ID│   6│   6│   6│   6│
4725 │                      ╶────────────────┼────┼────┼────┼────┤
4726 │                       No  Row ID      │  14│  14│  16│  16│
4727 │                           Layer Row ID│   8│   8│   8│   8│
4728 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4729 │     No  QN61 Yes QN57 Yes Row ID      │  18│  18│  20│  20│
4730 │                           Layer Row ID│  10│  10│  10│  10│
4731 │                      ╶────────────────┼────┼────┼────┼────┤
4732 │                       No  Row ID      │  22│  22│  24│  24│
4733 │                           Layer Row ID│  12│  12│  12│  12│
4734 │             ╶─────────────────────────┼────┼────┼────┼────┤
4735 │              No  QN57 Yes Row ID      │  26│  26│  28│  28│
4736 │                           Layer Row ID│  14│  14│  14│  14│
4737 │                      ╶────────────────┼────┼────┼────┼────┤
4738 │                       No  Row ID      │  30│  30│  32│  32│
4739 │                           Layer Row ID│  16│  16│  16│  16│
4740 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4741
4742                         Custom Tables
4743 Female
4744 Yes
4745 ╭───────────────────────────────────────┬───────────────────╮
4746 │                                       │        QN27       │
4747 │                                       ├─────────┬─────────┤
4748 │                                       │   Yes   │    No   │
4749 │                                       ├─────────┼─────────┤
4750 │                                       │  QND7A  │  QND7A  │
4751 │                                       ├────┬────┼────┬────┤
4752 │                                       │ Yes│ No │ Yes│ No │
4753 │                                       ├────┼────┼────┼────┤
4754 │                                       │QN86│QN86│QN86│QN86│
4755 ├───────────────────────────────────────┼────┼────┼────┼────┤
4756 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  33│  33│  35│  35│
4757 │                           Layer Row ID│  17│  17│  17│  17│
4758 │                      ╶────────────────┼────┼────┼────┼────┤
4759 │                       No  Row ID      │  37│  37│  39│  39│
4760 │                           Layer Row ID│  19│  19│  19│  19│
4761 │             ╶─────────────────────────┼────┼────┼────┼────┤
4762 │              No  QN57 Yes Row ID      │  41│  41│  43│  43│
4763 │                           Layer Row ID│  21│  21│  21│  21│
4764 │                      ╶────────────────┼────┼────┼────┼────┤
4765 │                       No  Row ID      │  45│  45│  47│  47│
4766 │                           Layer Row ID│  23│  23│  23│  23│
4767 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4768 │     No  QN61 Yes QN57 Yes Row ID      │  49│  49│  51│  51│
4769 │                           Layer Row ID│  25│  25│  25│  25│
4770 │                      ╶────────────────┼────┼────┼────┼────┤
4771 │                       No  Row ID      │  53│  53│  55│  55│
4772 │                           Layer Row ID│  27│  27│  27│  27│
4773 │             ╶─────────────────────────┼────┼────┼────┼────┤
4774 │              No  QN57 Yes Row ID      │  57│  57│  59│  59│
4775 │                           Layer Row ID│  29│  29│  29│  29│
4776 │                      ╶────────────────┼────┼────┼────┼────┤
4777 │                       No  Row ID      │  61│  61│  63│  63│
4778 │                           Layer Row ID│  31│  31│  31│  31│
4779 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4780
4781                         Custom Tables
4782 Female
4783 No
4784 ╭───────────────────────────────────────┬───────────────────╮
4785 │                                       │        QN27       │
4786 │                                       ├─────────┬─────────┤
4787 │                                       │   Yes   │    No   │
4788 │                                       ├─────────┼─────────┤
4789 │                                       │  QND7A  │  QND7A  │
4790 │                                       ├────┬────┼────┬────┤
4791 │                                       │ Yes│ No │ Yes│ No │
4792 │                                       ├────┼────┼────┼────┤
4793 │                                       │QN86│QN86│QN86│QN86│
4794 ├───────────────────────────────────────┼────┼────┼────┼────┤
4795 │QN26 Yes QN61 Yes QN57 Yes Row ID      │  34│  34│  36│  36│
4796 │                           Layer Row ID│  18│  18│  18│  18│
4797 │                      ╶────────────────┼────┼────┼────┼────┤
4798 │                       No  Row ID      │  38│  38│  40│  40│
4799 │                           Layer Row ID│  20│  20│  20│  20│
4800 │             ╶─────────────────────────┼────┼────┼────┼────┤
4801 │              No  QN57 Yes Row ID      │  42│  42│  44│  44│
4802 │                           Layer Row ID│  22│  22│  22│  22│
4803 │                      ╶────────────────┼────┼────┼────┼────┤
4804 │                       No  Row ID      │  46│  46│  48│  48│
4805 │                           Layer Row ID│  24│  24│  24│  24│
4806 │    ╶──────────────────────────────────┼────┼────┼────┼────┤
4807 │     No  QN61 Yes QN57 Yes Row ID      │  50│  50│  52│  52│
4808 │                           Layer Row ID│  26│  26│  26│  26│
4809 │                      ╶────────────────┼────┼────┼────┼────┤
4810 │                       No  Row ID      │  54│  54│  56│  56│
4811 │                           Layer Row ID│  28│  28│  28│  28│
4812 │             ╶─────────────────────────┼────┼────┼────┼────┤
4813 │              No  QN57 Yes Row ID      │  58│  58│  60│  60│
4814 │                           Layer Row ID│  30│  30│  30│  30│
4815 │                      ╶────────────────┼────┼────┼────┼────┤
4816 │                       No  Row ID      │  62│  62│  64│  64│
4817 │                           Layer Row ID│  32│  32│  32│  32│
4818 ╰───────────────────────────────────────┴────┴────┴────┴────╯
4819
4820                           Custom Tables
4821 Male
4822 Yes
4823 ╭──────────────────────────────────────────┬───────────────────╮
4824 │                                          │        QN27       │
4825 │                                          ├─────────┬─────────┤
4826 │                                          │   Yes   │    No   │
4827 │                                          ├─────────┼─────────┤
4828 │                                          │  QND7A  │  QND7A  │
4829 │                                          ├────┬────┼────┬────┤
4830 │                                          │ Yes│ No │ Yes│ No │
4831 │                                          ├────┼────┼────┼────┤
4832 │                                          │QN86│QN86│QN86│QN86│
4833 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4834 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   1│   3│   5│   7│
4835 │                           Layer Column ID│   1│   3│   5│   7│
4836 │                      ╶───────────────────┼────┼────┼────┼────┤
4837 │                       No  Column ID      │   1│   3│   5│   7│
4838 │                           Layer Column ID│   1│   3│   5│   7│
4839 │             ╶────────────────────────────┼────┼────┼────┼────┤
4840 │              No  QN57 Yes Column ID      │   9│  11│  13│  15│
4841 │                           Layer Column ID│   1│   3│   5│   7│
4842 │                      ╶───────────────────┼────┼────┼────┼────┤
4843 │                       No  Column ID      │   9│  11│  13│  15│
4844 │                           Layer Column ID│   1│   3│   5│   7│
4845 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4846 │     No  QN61 Yes QN57 Yes Column ID      │  17│  19│  21│  23│
4847 │                           Layer Column ID│   1│   3│   5│   7│
4848 │                      ╶───────────────────┼────┼────┼────┼────┤
4849 │                       No  Column ID      │  17│  19│  21│  23│
4850 │                           Layer Column ID│   1│   3│   5│   7│
4851 │             ╶────────────────────────────┼────┼────┼────┼────┤
4852 │              No  QN57 Yes Column ID      │  25│  27│  29│  31│
4853 │                           Layer Column ID│   1│   3│   5│   7│
4854 │                      ╶───────────────────┼────┼────┼────┼────┤
4855 │                       No  Column ID      │  25│  27│  29│  31│
4856 │                           Layer Column ID│   1│   3│   5│   7│
4857 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4858
4859                           Custom Tables
4860 Male
4861 No
4862 ╭──────────────────────────────────────────┬───────────────────╮
4863 │                                          │        QN27       │
4864 │                                          ├─────────┬─────────┤
4865 │                                          │   Yes   │    No   │
4866 │                                          ├─────────┼─────────┤
4867 │                                          │  QND7A  │  QND7A  │
4868 │                                          ├────┬────┼────┬────┤
4869 │                                          │ Yes│ No │ Yes│ No │
4870 │                                          ├────┼────┼────┼────┤
4871 │                                          │QN86│QN86│QN86│QN86│
4872 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4873 │QN26 Yes QN61 Yes QN57 Yes Column ID      │   2│   4│   6│   8│
4874 │                           Layer Column ID│   2│   4│   6│   8│
4875 │                      ╶───────────────────┼────┼────┼────┼────┤
4876 │                       No  Column ID      │   2│   4│   6│   8│
4877 │                           Layer Column ID│   2│   4│   6│   8│
4878 │             ╶────────────────────────────┼────┼────┼────┼────┤
4879 │              No  QN57 Yes Column ID      │  10│  12│  14│  16│
4880 │                           Layer Column ID│   2│   4│   6│   8│
4881 │                      ╶───────────────────┼────┼────┼────┼────┤
4882 │                       No  Column ID      │  10│  12│  14│  16│
4883 │                           Layer Column ID│   2│   4│   6│   8│
4884 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4885 │     No  QN61 Yes QN57 Yes Column ID      │  18│  20│  22│  24│
4886 │                           Layer Column ID│   2│   4│   6│   8│
4887 │                      ╶───────────────────┼────┼────┼────┼────┤
4888 │                       No  Column ID      │  18│  20│  22│  24│
4889 │                           Layer Column ID│   2│   4│   6│   8│
4890 │             ╶────────────────────────────┼────┼────┼────┼────┤
4891 │              No  QN57 Yes Column ID      │  26│  28│  30│  32│
4892 │                           Layer Column ID│   2│   4│   6│   8│
4893 │                      ╶───────────────────┼────┼────┼────┼────┤
4894 │                       No  Column ID      │  26│  28│  30│  32│
4895 │                           Layer Column ID│   2│   4│   6│   8│
4896 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4897
4898                           Custom Tables
4899 Female
4900 Yes
4901 ╭──────────────────────────────────────────┬───────────────────╮
4902 │                                          │        QN27       │
4903 │                                          ├─────────┬─────────┤
4904 │                                          │   Yes   │    No   │
4905 │                                          ├─────────┼─────────┤
4906 │                                          │  QND7A  │  QND7A  │
4907 │                                          ├────┬────┼────┬────┤
4908 │                                          │ Yes│ No │ Yes│ No │
4909 │                                          ├────┼────┼────┼────┤
4910 │                                          │QN86│QN86│QN86│QN86│
4911 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4912 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  33│  35│  37│  39│
4913 │                           Layer Column ID│   9│  11│  13│  15│
4914 │                      ╶───────────────────┼────┼────┼────┼────┤
4915 │                       No  Column ID      │  33│  35│  37│  39│
4916 │                           Layer Column ID│   9│  11│  13│  15│
4917 │             ╶────────────────────────────┼────┼────┼────┼────┤
4918 │              No  QN57 Yes Column ID      │  41│  43│  45│  47│
4919 │                           Layer Column ID│   9│  11│  13│  15│
4920 │                      ╶───────────────────┼────┼────┼────┼────┤
4921 │                       No  Column ID      │  41│  43│  45│  47│
4922 │                           Layer Column ID│   9│  11│  13│  15│
4923 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4924 │     No  QN61 Yes QN57 Yes Column ID      │  49│  51│  53│  55│
4925 │                           Layer Column ID│   9│  11│  13│  15│
4926 │                      ╶───────────────────┼────┼────┼────┼────┤
4927 │                       No  Column ID      │  49│  51│  53│  55│
4928 │                           Layer Column ID│   9│  11│  13│  15│
4929 │             ╶────────────────────────────┼────┼────┼────┼────┤
4930 │              No  QN57 Yes Column ID      │  57│  59│  61│  63│
4931 │                           Layer Column ID│   9│  11│  13│  15│
4932 │                      ╶───────────────────┼────┼────┼────┼────┤
4933 │                       No  Column ID      │  57│  59│  61│  63│
4934 │                           Layer Column ID│   9│  11│  13│  15│
4935 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4936
4937                           Custom Tables
4938 Female
4939 No
4940 ╭──────────────────────────────────────────┬───────────────────╮
4941 │                                          │        QN27       │
4942 │                                          ├─────────┬─────────┤
4943 │                                          │   Yes   │    No   │
4944 │                                          ├─────────┼─────────┤
4945 │                                          │  QND7A  │  QND7A  │
4946 │                                          ├────┬────┼────┬────┤
4947 │                                          │ Yes│ No │ Yes│ No │
4948 │                                          ├────┼────┼────┼────┤
4949 │                                          │QN86│QN86│QN86│QN86│
4950 ├──────────────────────────────────────────┼────┼────┼────┼────┤
4951 │QN26 Yes QN61 Yes QN57 Yes Column ID      │  34│  36│  38│  40│
4952 │                           Layer Column ID│  10│  12│  14│  16│
4953 │                      ╶───────────────────┼────┼────┼────┼────┤
4954 │                       No  Column ID      │  34│  36│  38│  40│
4955 │                           Layer Column ID│  10│  12│  14│  16│
4956 │             ╶────────────────────────────┼────┼────┼────┼────┤
4957 │              No  QN57 Yes Column ID      │  42│  44│  46│  48│
4958 │                           Layer Column ID│  10│  12│  14│  16│
4959 │                      ╶───────────────────┼────┼────┼────┼────┤
4960 │                       No  Column ID      │  42│  44│  46│  48│
4961 │                           Layer Column ID│  10│  12│  14│  16│
4962 │    ╶─────────────────────────────────────┼────┼────┼────┼────┤
4963 │     No  QN61 Yes QN57 Yes Column ID      │  50│  52│  54│  56│
4964 │                           Layer Column ID│  10│  12│  14│  16│
4965 │                      ╶───────────────────┼────┼────┼────┼────┤
4966 │                       No  Column ID      │  50│  52│  54│  56│
4967 │                           Layer Column ID│  10│  12│  14│  16│
4968 │             ╶────────────────────────────┼────┼────┼────┼────┤
4969 │              No  QN57 Yes Column ID      │  58│  60│  62│  64│
4970 │                           Layer Column ID│  10│  12│  14│  16│
4971 │                      ╶───────────────────┼────┼────┼────┼────┤
4972 │                       No  Column ID      │  58│  60│  62│  64│
4973 │                           Layer Column ID│  10│  12│  14│  16│
4974 ╰──────────────────────────────────────────┴────┴────┴────┴────╯
4975 ])
4976 AT_CLEANUP
4977
4978 AT_SETUP([CTABLES categorical summary functions])
4979 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
4980 AT_DATA([ctables.sps],
4981 [[GET 'nhtsa.sav'.
4982 CTABLES
4983     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
4984     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
4985     /SLABELS POSITION=ROW.
4986 ]])
4987 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
4988                                                       Custom Tables
4989 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
4990 │                 │                     D5a. What would you say is your primary ethnic background?                     │
4991 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
4992 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
4993 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
4994 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
4995 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
4996 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
4997 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
4998 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
4999 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5000 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5001 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
5002 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5003 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5004 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
5005 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
5006 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5007 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
5008 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
5009 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
5010 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5011 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5012 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
5013 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5014 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5015 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
5016 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
5017 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5018 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
5019 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
5020 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
5021 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5022 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5023 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
5024 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5025 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5026 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
5027 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
5028 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
5029 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
5030 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
5031 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
5032 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
5033 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5034 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
5035 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
5036 │          %      │     │       │       │          │          │         │          │              │      │       │     │
5037 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
5038 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
5039 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
5040 ])
5041 AT_CLEANUP
5042
5043 AT_SETUP([CTABLES scale summary functions])
5044 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5045 AT_DATA([ctables.sps],
5046 [[GET 'nhtsa.sav'.
5047 SET TVAR=NAME.
5048
5049 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5050   CTABLES later, to make the results easier to verify.
5051 SPLIT FILE BY REGION.
5052 FREQUENCIES
5053     qn19a
5054     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5055     /FORMAT NOTABLE /MISSING=INCLUDE.
5056 SPLIT FILE OFF.
5057
5058 CTABLES
5059     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5060     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, ROWPCT.SUM]
5061     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
5062     /SLABELS POSITION=ROW
5063     /CLABELS ROWLABELS=OPPOSITE.
5064 ]])
5065 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5066                    Statistics
5067 ╭─────────┬───────────────────────────────────╮
5068 │         │               REGION              │
5069 │         ├────────┬────────┬────────┬────────┤
5070 │         │   NE   │   MW   │    S   │    W   │
5071 │         ├────────┼────────┼────────┼────────┤
5072 │         │  QN19A │  QN19A │  QN19A │  QN19A │
5073 ├─────────┼────────┼────────┼────────┼────────┤
5074 │N Valid  │     936│    1019│    1276│     950│
5075 │  Missing│     473│     635│    1114│     596│
5076 ├─────────┼────────┼────────┼────────┼────────┤
5077 │Mean     │   19.33│   19.83│   20.29│   19.87│
5078 ├─────────┼────────┼────────┼────────┼────────┤
5079 │S.E. Mean│     .14│     .16│     .18│     .17│
5080 ├─────────┼────────┼────────┼────────┼────────┤
5081 │Median   │   18.00│   19.00│   19.00│   19.00│
5082 ├─────────┼────────┼────────┼────────┼────────┤
5083 │Mode     │   18.00│   18.00│   18.00│   18.00│
5084 ├─────────┼────────┼────────┼────────┼────────┤
5085 │Std Dev  │    4.41│    5.15│    6.44│    5.25│
5086 ├─────────┼────────┼────────┼────────┼────────┤
5087 │Variance │   19.41│   26.47│   41.43│   27.59│
5088 ├─────────┼────────┼────────┼────────┼────────┤
5089 │Range    │   59.00│   71.00│   75.00│   61.00│
5090 ├─────────┼────────┼────────┼────────┼────────┤
5091 │Minimum  │     .00│    4.00│    4.00│    4.00│
5092 ├─────────┼────────┼────────┼────────┼────────┤
5093 │Maximum  │   59.00│   75.00│   79.00│   65.00│
5094 ├─────────┼────────┼────────┼────────┼────────┤
5095 │Sum      │18092.00│20206.00│25886.00│18877.00│
5096 ╰─────────┴────────┴────────┴────────┴────────╯
5097
5098                          Custom Tables
5099 ╭────────────────────────┬────────┬────────┬────────┬────────╮
5100 │                        │   NE   │   MW   │    S   │    W   │
5101 ├────────────────────────┼────────┼────────┼────────┼────────┤
5102 │REGION Valid N          │     936│    1019│    1276│     950│
5103 │       Missing          │  473.00│  635.00│ 1114.00│  596.00│
5104 │       Mean             │   19.33│   19.83│   20.29│   19.87│
5105 │       Std Error of Mean│     .14│     .16│     .18│     .17│
5106 │       Median           │   18.00│   19.00│   19.00│   19.00│
5107 │       Mode             │   18.00│   18.00│   18.00│   18.00│
5108 │       Std Deviation    │    4.41│    5.15│    6.44│    5.25│
5109 │       Variance         │   19.41│   26.47│   41.43│   27.59│
5110 │       Range            │   59.00│   71.00│   75.00│   61.00│
5111 │       Minimum          │     .00│    4.00│    4.00│    4.00│
5112 │       Maximum          │   59.00│   75.00│   79.00│   65.00│
5113 │       Sum              │18092.00│20206.00│25886.00│18877.00│
5114 │       Count            │    1409│    1654│    2390│    1546│
5115 │       Total N          │    1409│    1654│    2390│    1546│
5116 │       Row Sum %        │   21.8%│   24.3%│   31.2%│   22.7%│
5117 ╰────────────────────────┴────────┴────────┴────────┴────────╯
5118 ])
5119 AT_CLEANUP
5120
5121 AT_SETUP([CTABLES scale summary functions - weighting])
5122 weight=1
5123 c=10
5124 for a in 1 2 9; do
5125     for b in 3 4 9; do
5126         for n in 1 2 3 4 5 6 7 8 9 10; do
5127             if test $c -lt 15; then
5128                 cval=.
5129             else
5130                 cval=$c
5131             fi
5132             printf "$weight $a $b $cval\n"
5133             weight=$(expr \( $weight + 3 \) % 7 + 2)
5134             c=$(expr \( $c + 13 \) % 29 + 7)
5135         done
5136     done
5137 done > ctables.txt
5138
5139 AT_DATA([analysis.sps],
5140 [[* Use SPLIT FILE with FREQUENCIES to generate output equivalent to
5141   CTABLES later, to make the results easier to verify.
5142 SPLIT FILE BY a b.
5143 FREQUENCIES
5144     c
5145     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
5146     /FORMAT NOTABLE /MISSING=INCLUDE.
5147 SPLIT FILE OFF.
5148
5149 CTABLES
5150     /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
5151     /SLABELS POSITION=ROW
5152     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5153 ]])
5154
5155 AT_DATA([ctables.sps],
5156 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
5157     /w (F5.0) a b c (f2.0).
5158 VAR LEVEL w c (SCALE) a b (NOMINAL).
5159 MISSING VALUES a b (9).
5160
5161 INCLUDE 'analysis.sps'.
5162
5163 WEIGHT BY w.
5164 INCLUDE 'analysis.sps'.
5165
5166 * Same as original analysis using unweighted versions of summaries.
5167 CTABLES
5168     /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
5169     /SLABELS POSITION=ROW
5170     /CATEGORIES VARIABLES=a b MISSING=INCLUDE.
5171 ]])
5172 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
5173                                 Statistics
5174 ╭─────────┬──────────────────────────────────────────────────────────────╮
5175 │         │                               a                              │
5176 │         ├────────────────────┬────────────────────┬────────────────────┤
5177 │         │          1         │          2         │          9         │
5178 │         ├────────────────────┼────────────────────┼────────────────────┤
5179 │         │          b         │          b         │          b         │
5180 │         ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5181 │         │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5182 │         ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5183 │         │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │   c  │
5184 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5185 │N Valid  │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5186 │  Missing│     3│     4│     2│     3│     3│     2│     3│     3│     2│
5187 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5188 │Mean     │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5189 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5190 │S.E. Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5191 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5192 │Median   │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5193 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5194 │Mode     │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5195 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5196 │Std Dev  │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5197 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5198 │Variance │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5199 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5200 │Range    │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5201 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5202 │Minimum  │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5203 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5204 │Maximum  │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5205 ├─────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5206 │Sum      │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5207 ╰─────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5208
5209                                     Custom Tables
5210 ╭───────────────────┬──────────────────────────────────────────────────────────────╮
5211 │                   │                               a                              │
5212 │                   ├────────────────────┬────────────────────┬────────────────────┤
5213 │                   │          1         │          2         │          9         │
5214 │                   ├────────────────────┼────────────────────┼────────────────────┤
5215 │                   │          b         │          b         │          b         │
5216 │                   ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5217 │                   │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5218 ├───────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5219 │c Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5220 │  Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5221 │  Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5222 │  Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5223 │  Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5224 │  Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5225 │  Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5226 │  Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5227 │  Range            │ 18.00│ 13.00│ 20.00│ 18.00│ 15.00│ 20.00│ 18.00│ 15.00│ 20.00│
5228 │  Minimum          │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5229 │  Maximum          │    34│    31│    35│    34│    33│    35│    34│    33│    35│
5230 │  Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5231 │  Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5232 │  Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5233 │  Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5234 ╰───────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5235
5236                                   Statistics
5237 ╭─────────┬─────────────────────────────────────────────────────────────────╮
5238 │         │                                a                                │
5239 │         ├─────────────────────┬─────────────────────┬─────────────────────┤
5240 │         │          1          │          2          │          9          │
5241 │         ├─────────────────────┼─────────────────────┼─────────────────────┤
5242 │         │          b          │          b          │          b          │
5243 │         ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5244 │         │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5245 │         ├───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5246 │         │   c   │   c  │   c  │   c  │   c   │   c  │   c  │   c  │   c   │
5247 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5248 │N Valid  │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5249 │  Missing│      6│    14│    11│    22│     13│     7│    16│    21│     10│
5250 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5251 │Mean     │  27.23│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5252 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5253 │S.E. Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5254 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5255 │Median   │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5256 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5257 │Mode     │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5258 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5259 │Std Dev  │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5260 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5261 │Variance │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5262 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5263 │Range    │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5264 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5265 │Minimum  │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5266 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5267 │Maximum  │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5268 ├─────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5269 │Sum      │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5270 ╰─────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5271
5272                                      Custom Tables
5273 ╭───────────────────┬─────────────────────────────────────────────────────────────────╮
5274 │                   │                                a                                │
5275 │                   ├─────────────────────┬─────────────────────┬─────────────────────┤
5276 │                   │          1          │          2          │          9          │
5277 │                   ├─────────────────────┼─────────────────────┼─────────────────────┤
5278 │                   │          b          │          b          │          b          │
5279 │                   ├───────┬──────┬──────┼──────┬───────┬──────┼──────┬──────┬───────┤
5280 │                   │   3   │   4  │   9  │   3  │   4   │   9  │   3  │   4  │   9   │
5281 ├───────────────────┼───────┼──────┼──────┼──────┼───────┼──────┼──────┼──────┼───────┤
5282 │c Valid N          │     40│    35│    41│    26│     38│    40│    34│    32│     39│
5283 │  Missing          │      6│    14│    11│    22│     13│     7│    16│    21│     10│
5284 │  Mean             │  27.22│ 24.20│ 22.63│ 27.96│  27.21│ 23.48│ 23.71│ 25.47│  26.03│
5285 │  Std Error of Mean│    .93│   .75│  1.03│  1.12│    .84│   .87│  1.01│  1.05│   1.01│
5286 │  Median           │  30.00│ 22.00│ 19.00│ 30.00│  29.00│ 24.00│ 23.00│ 24.00│  28.00│
5287 │  Mode             │     34│    29│    19│    34│     33│    28│    23│    18│     30│
5288 │  Std Deviation    │   5.89│  4.42│  6.59│  5.69│   5.16│  5.50│  5.87│  5.94│   6.30│
5289 │  Variance         │  34.64│ 19.52│ 43.39│ 32.36│  26.66│ 30.20│ 34.46│ 35.29│  39.71│
5290 │  Range            │  18.00│ 13.00│ 20.00│ 18.00│  15.00│ 20.00│ 18.00│ 15.00│  20.00│
5291 │  Minimum          │     16│    18│    15│    16│     18│    15│    16│    18│     15│
5292 │  Maximum          │     34│    31│    35│    34│     33│    35│    34│    33│     35│
5293 │  Sum              │1089.00│847.00│928.00│727.00│1034.00│939.00│806.00│815.00│1015.00│
5294 │  Count            │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5295 │  Total N          │     46│    49│    52│    48│     51│    47│    50│    53│     49│
5296 │  Layer Row Sum %  │  13.3%│ 10.3%│ 11.3%│  8.9%│  12.6%│ 11.5%│  9.8%│  9.9%│  12.4%│
5297 ╰───────────────────┴───────┴──────┴──────┴──────┴───────┴──────┴──────┴──────┴───────╯
5298
5299                                          Custom Tables
5300 ╭──────────────────────────────┬──────────────────────────────────────────────────────────────╮
5301 │                              │                               a                              │
5302 │                              ├────────────────────┬────────────────────┬────────────────────┤
5303 │                              │          1         │          2         │          9         │
5304 │                              ├────────────────────┼────────────────────┼────────────────────┤
5305 │                              │          b         │          b         │          b         │
5306 │                              ├──────┬──────┬──────┼──────┬──────┬──────┼──────┬──────┬──────┤
5307 │                              │   3  │   4  │   9  │   3  │   4  │   9  │   3  │   4  │   9  │
5308 ├──────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
5309 │c Unweighted Valid N          │     7│     6│     8│     7│     7│     8│     7│     7│     8│
5310 │  Unweighted Missing          │     3│     4│     2│     3│     3│     2│     3│     3│     2│
5311 │  Unweighted Mean             │ 25.86│ 24.50│ 24.63│ 25.86│ 25.71│ 24.25│ 25.43│ 25.29│ 23.88│
5312 │  Unweighted Std Error of Mean│  2.44│  2.14│  2.58│  2.44│  2.18│  2.43│  2.36│  2.18│  2.47│
5313 │  Unweighted Median           │ 25.00│ 24.50│ 25.00│ 25.00│ 27.00│ 25.00│ 25.00│ 24.00│ 23.50│
5314 │  Unweighted Mode             │    16│    18│    15│    16│    18│    15│    16│    18│    15│
5315 │  Unweighted Std Deviation    │  6.47│  5.24│  7.31│  6.47│  5.77│  6.88│  6.24│  5.77│  6.98│
5316 │  Unweighted Variance         │ 41.81│ 27.50│ 53.41│ 41.81│ 33.24│ 47.36│ 38.95│ 33.24│ 48.70│
5317 │  Unweighted Sum              │181.00│147.00│197.00│181.00│180.00│194.00│178.00│177.00│191.00│
5318 │  Unweighted Count            │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5319 │  Unweighted Total N          │    10│    10│    10│    10│    10│    10│    10│    10│    10│
5320 │  Unweighted Layer Row Sum %  │ 11.1%│  9.0%│ 12.1%│ 11.1%│ 11.1%│ 11.9%│ 10.9%│ 10.9%│ 11.7%│
5321 ╰──────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
5322 ])
5323 AT_CLEANUP
5324
5325 AT_SETUP([CTABLES hidden scale VLABELS])
5326 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5327 AT_DATA([ctables.sps],
5328 [[GET 'nhtsa.sav'.
5329 CTABLES
5330     /TABLE region BY qn19a + qn35
5331     /SLABELS POSITION=ROW.
5332 CTABLES
5333     /VLABELS VARIABLE=qn19a DISPLAY=NONE
5334     /TABLE region BY qn19a + qn35
5335     /SLABELS POSITION=ROW.
5336 CTABLES
5337     /VLABELS VARIABLE=qn35 DISPLAY=NONE
5338     /TABLE region BY qn19a + qn35
5339     /SLABELS POSITION=ROW.
5340
5341 * This one in particular caused a crash because no categories were
5342   created on the column axis, so passing in 0 for the index was still
5343   too big for that number of categories.  It was fixed by creating a
5344   name-only category for each variable despite the "NONE" request,
5345   then hiding the entire dimension's labels if all its labels were
5346   set to "NONE".
5347 CTABLES
5348     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
5349     /TABLE region BY qn19a + qn35
5350     /SLABELS POSITION=ROW.
5351 ]])
5352 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
5353                                  Custom Tables
5354 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
5355 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
5356 │              │   when you first starting  │   many times have you driven a  │
5357 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
5358 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
5359 │              │      sips of alcohol.      │            beverages?           │
5360 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
5361 │Region NE Mean│                       19.33│                                2│
5362 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5363 │       MW Mean│                       19.83│                                2│
5364 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5365 │       S  Mean│                       20.29│                                2│
5366 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
5367 │       W  Mean│                       19.87│                                2│
5368 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
5369
5370                                  Custom Tables
5371 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
5372 │              │     │  35. In the past thirty days, how many times have you  │
5373 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
5374 │              │QN19A│                  alcoholic beverages?                  │
5375 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
5376 │Region NE Mean│19.33│                                                       2│
5377 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5378 │       MW Mean│19.83│                                                       2│
5379 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5380 │       S  Mean│20.29│                                                       2│
5381 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
5382 │       W  Mean│19.87│                                                       2│
5383 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
5384
5385                                  Custom Tables
5386 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
5387 │              │   19a. About how old were you when you first starting   │    │
5388 │              │  drinking alcohol, not counting small tastes or sips of │    │
5389 │              │                         alcohol.                        │qn35│
5390 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
5391 │Region NE Mean│                                                    19.33│   2│
5392 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5393 │       MW Mean│                                                    19.83│   2│
5394 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5395 │       S  Mean│                                                    20.29│   2│
5396 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
5397 │       W  Mean│                                                    19.87│   2│
5398 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
5399
5400       Custom Tables
5401 ╭──────────────┬───────╮
5402 │Region NE Mean│19.33 2│
5403 │      ╶───────┼───────┤
5404 │       MW Mean│19.83 2│
5405 │      ╶───────┼───────┤
5406 │       S  Mean│20.29 2│
5407 │      ╶───────┼───────┤
5408 │       W  Mean│19.87 2│
5409 ╰──────────────┴───────╯
5410 ])
5411 AT_CLEANUP
5412
5413 AT_SETUP([CTABLES with SPLIT FILE])
5414 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
5415 AT_DATA([ctables.sps],
5416 [[GET 'nhtsa.sav'.
5417
5418 SORT CASES BY qns3a.
5419
5420 CTABLES /TABLE qn105ba.
5421
5422 * Layered split has no effect on output.
5423 SPLIT FILE BY qns3a.
5424 CTABLES /TABLE qn105ba.
5425
5426 * Add column variable qns3a to compare against separate splits.
5427 CTABLES /TABLE qn105ba BY qns3a.
5428
5429 * Separate splits are truly output separately.
5430 SPLIT FILE SEPARATE BY qns3a.
5431 CTABLES /TABLE qn105ba.
5432 ]])
5433 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5434                                   Custom Tables
5435 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5436 │                                                                        │Count│
5437 ├────────────────────────────────────────────────────────────────────────┼─────┤
5438 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5439 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5440 │                                                            Very likely │ 1502│
5441 │                                                            Somewhat    │ 2763│
5442 │                                                            likely      │     │
5443 │                                                            Somewhat    │ 1307│
5444 │                                                            unlikely    │     │
5445 │                                                            Very        │  609│
5446 │                                                            unlikely    │     │
5447 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5448
5449                                   Custom Tables
5450 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5451 │                                                                        │Count│
5452 ├────────────────────────────────────────────────────────────────────────┼─────┤
5453 │105b. How likely is it that drivers who have had too much   Almost      │  700│
5454 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5455 │                                                            Very likely │ 1502│
5456 │                                                            Somewhat    │ 2763│
5457 │                                                            likely      │     │
5458 │                                                            Somewhat    │ 1307│
5459 │                                                            unlikely    │     │
5460 │                                                            Very        │  609│
5461 │                                                            unlikely    │     │
5462 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5463
5464                                   Custom Tables
5465 ╭─────────────────────────────────────────────────────────────────┬────────────╮
5466 │                                                                 │S3a. GENDER:│
5467 │                                                                 ├─────┬──────┤
5468 │                                                                 │ Male│Female│
5469 │                                                                 ├─────┼──────┤
5470 │                                                                 │Count│ Count│
5471 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
5472 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
5473 │much to drink to drive safely will A. Get stopped by certain     │     │      │
5474 │the police?                                          Very likely │  660│   842│
5475 │                                                     Somewhat    │ 1174│  1589│
5476 │                                                     likely      │     │      │
5477 │                                                     Somewhat    │  640│   667│
5478 │                                                     unlikely    │     │      │
5479 │                                                     Very        │  311│   298│
5480 │                                                     unlikely    │     │      │
5481 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
5482
5483     Split Values
5484 ╭────────────┬─────╮
5485 │Variable    │Value│
5486 ├────────────┼─────┤
5487 │S3a. GENDER:│Male │
5488 ╰────────────┴─────╯
5489
5490                                   Custom Tables
5491 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5492 │                                                                        │Count│
5493 ├────────────────────────────────────────────────────────────────────────┼─────┤
5494 │105b. How likely is it that drivers who have had too much   Almost      │  297│
5495 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5496 │                                                            Very likely │  660│
5497 │                                                            Somewhat    │ 1174│
5498 │                                                            likely      │     │
5499 │                                                            Somewhat    │  640│
5500 │                                                            unlikely    │     │
5501 │                                                            Very        │  311│
5502 │                                                            unlikely    │     │
5503 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5504
5505      Split Values
5506 ╭────────────┬──────╮
5507 │Variable    │ Value│
5508 ├────────────┼──────┤
5509 │S3a. GENDER:│Female│
5510 ╰────────────┴──────╯
5511
5512                                   Custom Tables
5513 ╭────────────────────────────────────────────────────────────────────────┬─────╮
5514 │                                                                        │Count│
5515 ├────────────────────────────────────────────────────────────────────────┼─────┤
5516 │105b. How likely is it that drivers who have had too much   Almost      │  403│
5517 │to drink to drive safely will A. Get stopped by the police? certain     │     │
5518 │                                                            Very likely │  842│
5519 │                                                            Somewhat    │ 1589│
5520 │                                                            likely      │     │
5521 │                                                            Somewhat    │  667│
5522 │                                                            unlikely    │     │
5523 │                                                            Very        │  298│
5524 │                                                            unlikely    │     │
5525 ╰────────────────────────────────────────────────────────────────────────┴─────╯
5526 ])
5527 AT_CLEANUP
5528
5529 AT_SETUP([CTABLES variable level inference])
5530 AT_DATA([data.txt], [dnl
5531 dnl n1 has 10 unique small values -> nominal.
5532 dnl n2 has 23 unique small values -> nominal.
5533 dnl n3 is all missing -> nominal.
5534 dnl s1 has 24 unique small values -> scale.
5535 dnl s2 has one negative value -> scale.
5536 dnl s3 has one non-integer value -> scale.
5537 dnl s4 has no valid values less than 10 -> scale.
5538 dnl s5 has no valid values less than 10,000 -> scale.
5539 1  1  . 1  1  1    10 10001
5540 2  2  . 2  2  2    11 10002
5541 3  3  . 3  3  3    12 10003
5542 4  4  . 4  4  4    13 10004
5543 5  5  . 5  5  5    14 10005
5544 6  6  . 6  6  6    15 10006
5545 7  7  . 7  7  7    16 10007
5546 8  8  . 8  8  8    17 10008
5547 9  9  . 9  9  9    18 10009
5548 10 10 . 10 10 10.5 19 110000
5549 1  11 . 11 -1 1    11 10001
5550 2  12 . 12 2  2    12 10002
5551 3  13 . 13 3  3    13 10003
5552 4  14 . 14 4  4    14 10004
5553 5  15 . 15 5  5    15 10005
5554 6  16 . 16 6  6    16 10006
5555 7  17 . 17 7  7    17 10007
5556 8  18 . 18 8  8    18 10008
5557 9  19 . 19 9  9    19 10009
5558 1  20 . 20 1  1    20 10001
5559 2  21 . 21 2  2    21 10002
5560 3  22 . 22 3  3    22 10003
5561 4  23 . 23 4  4    23 10004
5562 5  23 . 24 5  5    24 10005
5563 6  23 . 24 6  6    25 10006
5564 ])
5565
5566 AT_DATA([ctables.sps], [dnl
5567 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
5568
5569 * Nominal formats (copied from data that will default to scale).
5570 COMPUTE n4=s1.
5571 COMPUTE n5=s1.
5572 FORMATS n4(WKDAY5) n5(MONTH5).
5573
5574 * Scale formats (copied from data that will default to nominal).
5575 COMPUTE s6=n1.
5576 COMPUTE s7=n1.
5577 COMPUTE s8=n1.
5578 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
5579
5580 STRING string(A8).
5581
5582 DISPLAY DICTIONARY.
5583 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
5584 DISPLAY DICTIONARY.
5585 ])
5586
5587 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
5588                                     Variables
5589 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5590 │      │        │  Measurement │     │     │         │            │            │
5591 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5592 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5593 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5594 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5595 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5596 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5597 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5598 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5599 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5600 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
5601 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5602 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
5603 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5604 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
5605 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5606 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5607 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5608
5609         Custom Tables
5610 ╭────────────┬─────┬────────╮
5611 │            │Count│  Mean  │
5612 ├────────────┼─────┼────────┤
5613 │n1     1.00 │    3│        │
5614 │       2.00 │    3│        │
5615 │       3.00 │    3│        │
5616 │       4.00 │    3│        │
5617 │       5.00 │    3│        │
5618 │       6.00 │    3│        │
5619 │       7.00 │    2│        │
5620 │       8.00 │    2│        │
5621 │       9.00 │    2│        │
5622 │       10.00│    1│        │
5623 ├────────────┼─────┼────────┤
5624 │n2     1.00 │    1│        │
5625 │       2.00 │    1│        │
5626 │       3.00 │    1│        │
5627 │       4.00 │    1│        │
5628 │       5.00 │    1│        │
5629 │       6.00 │    1│        │
5630 │       7.00 │    1│        │
5631 │       8.00 │    1│        │
5632 │       9.00 │    1│        │
5633 │       10.00│    1│        │
5634 │       11.00│    1│        │
5635 │       12.00│    1│        │
5636 │       13.00│    1│        │
5637 │       14.00│    1│        │
5638 │       15.00│    1│        │
5639 │       16.00│    1│        │
5640 │       17.00│    1│        │
5641 │       18.00│    1│        │
5642 │       19.00│    1│        │
5643 │       20.00│    1│        │
5644 │       21.00│    1│        │
5645 │       22.00│    1│        │
5646 │       23.00│    3│        │
5647 ├────────────┼─────┼────────┤
5648 │string      │   25│        │
5649 ├────────────┼─────┼────────┤
5650 │s1          │     │   12.96│
5651 ├────────────┼─────┼────────┤
5652 │s2          │     │    4.76│
5653 ├────────────┼─────┼────────┤
5654 │s3          │     │    4.86│
5655 ├────────────┼─────┼────────┤
5656 │s4          │     │   16.60│
5657 ├────────────┼─────┼────────┤
5658 │s5          │     │14004.44│
5659 ╰────────────┴─────┴────────╯
5660
5661                                     Variables
5662 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
5663 │      │        │  Measurement │     │     │         │            │            │
5664 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
5665 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
5666 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5667 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5668 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
5669 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5670 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5671 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5672 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5673 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
5674 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
5675 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
5676 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
5677 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
5678 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
5679 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
5680 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
5681 ])
5682 AT_CLEANUP