CTABLES infer variable level
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet tested:
4 dnl - Summary functions:
5 dnl   * Separate summary functions for totals and subtotals.
6 dnl   * U-prefix for unweighted summaries.
7 dnl   * areaPCT.SUM and UareaPCT.SUM functions.
8 dnl   * WEIGHT and adjustment weights.
9 dnl   * details of missing value handling in summaries.
10 dnl - Definition of columns/rows when labels are rotated from one axis to another.
11 dnl
12 dnl Not for v1:
13 dnl - Multiple response sets
14 dnl - MRSETS subcommand.
15 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
16 dnl - SIGTEST
17 dnl - COMPARETEST
18 dnl - Summary functions:
19 dnl   * .LCL and .UCL suffixes.
20 dnl   * .SE suffixes.
21 dnl - Summary functions:
22 dnl   * )CILEVEL in summary label specification
23 dnl - CATEGORIES:
24 dnl   * Data-dependent sorting.
25
26 AT_SETUP([CTABLES parsing])
27 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
28 AT_DATA([ctables.sps],
29 [[GET 'nhtsa.sav'.
30 CTABLES
31     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
32     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
33     /FORMAT UNITS=CM EMPTY="(-)"
34     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
35     /VLABELS VARIABLES=qn17 DISPLAY=NAME
36     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
37     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
38     /VLABELS VARIABLES=qn20 DISPLAY=NONE
39     /MRSETS COUNTDUPLICATES=NO
40     /MRSETS COUNTDUPLICATES=YES
41     /SMISSING VARIABLE
42     /SMISSING LISTWISE
43     /WEIGHT VARIABLE=qns3a
44     /HIDESMALLCOUNTS
45     /HIDESMALLCOUNTS COUNT=10
46     /TABLE qnsa1
47     /SLABELS POSITION=COLUMN VISIBLE=YES
48     /SLABELS VISIBLE=NO POSITION=ROW
49     /SLABELS POSITION=LAYER
50     /CLABELS AUTO
51     /CLABELS ROWLABELS=OPPOSITE
52     /CRITERIA CILEVEL=50
53     /CATEGORIES VARIABLES=qn1 qn17
54                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
55                 POSITION=BEFORE EMPTY=INCLUDE.
56 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
57 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
58 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
59 ]])
60 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
61          Custom Tables
62 Count
63 ╭───────────────────┬────┬────╮
64 │                   │ RDD│CELL│
65 ├───────────────────┼────┼────┤
66 │Sa1. SAMPLE SOURCE:│5392│1607│
67 ╰───────────────────┴────┴────╯
68
69        Custom Tables
70 RDD
71 ╭───────────────────┬─────╮
72 │                   │Count│
73 ├───────────────────┼─────┤
74 │Sa1. SAMPLE SOURCE:│ 5392│
75 ╰───────────────────┴─────╯
76
77           Custom Tables
78 ╭────────────────────────┬─────╮
79 │                        │Count│
80 ├────────────────────────┼─────┤
81 │Sa1. SAMPLE SOURCE: RDD │ 5392│
82 │                    CELL│ 1607│
83 ╰────────────────────────┴─────╯
84
85           Custom Tables
86 ╭────────────────────────┬─────╮
87 │                        │Count│
88 ├────────────────────────┼─────┤
89 │Sa1. SAMPLE SOURCE: RDD │ 5392│
90 │                    CELL│ 1607│
91 ╰────────────────────────┴─────╯
92 ])
93 AT_CLEANUP
94
95 AT_SETUP([CTABLES parsing - negative])
96 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
97 AT_DATA([ctables.sps],
98 [[GET 'nhtsa.sav'.
99 CTABLES.
100 CTABLES /FORMAT MINCOLWIDTH='foo'.
101 CTABLES /TABLE qn1 [**].
102 CTABLES /TABLE qn1 [NOTAFUNCTION].
103 CTABLES /TABLE (qn1.
104 CTABLES /TABLE **.
105 CTABLES /TABLE NOTAVAR.
106 STRING string(A8).
107 CTABLES /TABLE string[S].
108 CTABLES /TABLE qn1 [PTILE 101].
109 CTABLES /TABLE qn1 [MEAN F0.1].
110 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
111 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
112 CTABLES /TABLE qn1 [MEAN TOTALS].
113 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
114 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
115 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
116 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
117 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
118 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
119 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
120 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
121 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
122 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
123 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
124 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
127 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
128 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
129 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
130 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
131 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
132 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
133 CTABLES /PCOMPUTE &k=EXPR([LO **]).
134 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
135 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
136 CTABLES /PCOMPUTE &k=EXPR([1**]).
137 CTABLES /PCOMPUTE &k=EXPR((1x)).
138 CTABLES /PCOMPUTE **k.
139 CTABLES /PCOMPUTE &1.
140 CTABLES /PCOMPUTE &k**.
141 CTABLES /PCOMPUTE &k=**.
142 CTABLES /PCOMPUTE &k=EXPR**.
143 CTABLES /PCOMPUTE &k=EXPR(1x).
144 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
145 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
146 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
147 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
148 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
149 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
150 CTABLES /FORMAT EMPTY=**.
151 CTABLES /FORMAT MISSING=**.
152 CTABLES /FORMAT **.
153 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
154 CTABLES /VLABELS **.
155 CTABLES /VLABELS VARIABLES=NOTAVAR.
156 CTABLES /VLABELS VARIABLES=qn1 **.
157 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
158 CTABLES /MRSETS **.
159 CTABLES /MRSETS COUNTDUPLICATES=**.
160 CTABLES /SMISSING **.
161 CTABLES /WEIGHT **.
162 CTABLES /WEIGHT VARIABLE=NOTAVAR.
163 CTABLES /HIDESMALLCOUNTS COUNT=1.
164 CTABLES /QUUX.
165 CTABLES /HIDESMALLCOUNTS COUNT=2.
166 CTABLES /TABLE qn1**.
167 CTABLES /TABLE qn1 /SLABELS POSITION=**.
168 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
169 CTABLES /TABLE qn1 /SLABELS **.
170 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
171 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
172 CTABLES /TABLE qn1 /CLABELS **.
173 CTABLES /TABLE qn1 /CRITERIA **.
174 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
175 CTABLES /TABLE qn1 /TITLES **.
176 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
177 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
178 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
179 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
180 CTABLES /TABLE qn1 /SIGTEST **.
181 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
182 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
183 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
184 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
185 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
186 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
187 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
188 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
189 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
190 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
191 CTABLES /TABLE qn1 /COMPARETEST **.
192 CTABLES /TABLE qn1 / **.
193 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
194 CTABLES /TABLE qn20 > qnd1.
195 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
196 NUMERIC datetime (DATETIME17.0).
197 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
198 ]])
199 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
200 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
201
202 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
203 negative number for MINCOLWIDTH.
204
205 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
206 identifier.
207
208 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
209 summary function name.
210
211 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
212
213 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
214 identifier.
215
216 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
217
218 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
219 scale variable.
220    10 | CTABLES /TABLE string[S].
221       |                ^~~~~~~~~
222
223 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
224 between 0 and 100 for PTILE.
225
226 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
227 requires a width between 1 and 40.
228
229 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
230 format NEGPAREN requires width 2 or greater.
231
232 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
233 format NEGPAREN requires width greater than decimals.
234
235 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
236 scale variables.
237    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
238       |                     ^~~~
239
240 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
241    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
242       |                ^~~
243
244 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
245
246 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
247 scale variables.
248    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
249       |                     ^~~~
250
251 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
252    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
253       |                ^~~
254
255 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
256
257 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
258
259 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
260
261 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
262
263 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
264
265 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
266
267 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
268 identifier.
269
270 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
271    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
272       |                                               ^~
273
274 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
275 between 0 and 100 for PTILE.
276
277 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
278 `@:}@'.
279
280 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
281 `@{:@'.
282
283 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
284 or EXCLUDE.
285
286 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
287 NO.
288
289 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
290
291 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
292 or AFTER.
293
294 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
295 or EXCLUDE.
296
297 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
298 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
299
300 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
301 LABEL, POSITION, or EMPTY.
302
303 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
304 integer for SUBTOTAL.
305
306 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
307
308 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
309
310 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
311
312 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
313
314 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
315
316 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
317
318 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
319
320 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
321
322 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
323
324 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
325
326 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
327
328 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
329
330 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
331 the previous definition.
332    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
333       |                               ^~~~~~~~~~~~~~~~~~~
334
335 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
336    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
337       |          ^~~~~~~~~~~~~~~~~~~
338
339 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
340 `/'.
341
342 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
343 Expecting summary function name.
344
345 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
346 between 0 and 100 for PTILE.
347
348 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
349
350 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
351 NO.
352
353 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
354 FORMAT, or HIDESOURCECATS.
355
356 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
357
358 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
359
360 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
361 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
362
363 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
364 MAXCOLWIDTH.
365
366 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
367 VARIABLES.
368
369 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
370
371 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
372 DISPLAY.
373
374 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
375 DEFAULT, NAME, LABEL, BOTH, or NONE.
376
377 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
378 COUNTDUPLICATES.
379
380 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
381 NO.
382
383 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
384 VARIABLE or LISTWISE.
385
386 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
387 VARIABLE.
388
389 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
390
391 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
392 greater for HIDESMALLCOUNTS COUNT.
393
394 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
395 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
396 HIDESMALLCOUNTS, or TABLE.
397
398 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
399 `/'.
400
401 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
402
403 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
404 ROW, or LAYER.
405
406 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
407 NO.
408
409 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
410 POSITION or VISIBLE.
411
412 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
413 OPPOSITE or LAYER.
414
415 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
416 OPPOSITE or LAYER.
417
418 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
419 ROWLABELS, or COLLABELS.
420
421 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
422 CILEVEL.
423
424 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
425 in @<:@0,100@:}@ for CILEVEL.
426
427 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
428 CAPTION, CORNER, or TITLE.
429
430 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
431 CHISQUARE.
432
433 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
434 in @<:@0,1@:}@ for ALPHA.
435
436 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
437 NO.
438
439 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
440 ALLVISIBLE or SUBTOTALS.
441
442 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
443 ALPHA, INCLUDEMRSETS, or CATEGORIES.
444
445 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
446 MEAN.
447
448 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
449 in (0,1) for ALPHA.
450
451 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
452 for ALPHA.
453
454 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
455 BONFERRONI, BH, or NONE.
456
457 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
458 NO.
459
460 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
461 or TESTEDCATS.
462
463 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
464 ALLVISIBLE or SUBTOTALS.
465
466 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
467 NO.
468
469 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
470 SIMPLE.
471
472 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
473 NO.
474
475 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
476 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
477 SHOWSIG.
478
479 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
480 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
481
482 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
483 specified.
484
485 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
486    97 | CTABLES /TABLE qn20 > qnd1.
487       |                ^~~~~~~~~~~
488
489 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
490    97 | CTABLES /TABLE qn20 > qnd1.
491       |                ^~~~
492
493 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
494    97 | CTABLES /TABLE qn20 > qnd1.
495       |                       ^~~~
496
497 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
498 categorical variables at the innermost nesting level.
499    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
500       |                ^~~~~~~~~~~~~~~~~~~~
501
502 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
503 summary.
504    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
505       |                ^~~
506
507 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
508 specification as format DATETIME: Day (123) must be between 1 and 31..
509   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
510       |                                                    ^~~~~
511 ]])
512 AT_CLEANUP
513
514 AT_SETUP([CTABLES parsing - more negative])
515 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
516 AT_DATA([ctables.sps],
517 [[GET 'nhtsa.sav'.
518 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
519 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
520 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
521
522 STRING string(A8).
523 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
524 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
525
526 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
527
528 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
529 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
530 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
531 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
532
533 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
534 CTABLES /PCOMPUTE &x=EXPR([**]).
535 CTABLES /PCOMPUTE &x=EXPR(**).
536
537 CTABLES /TABLE.
538
539 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
540 ]])
541 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
542 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
543 category not included in the category list.
544     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
545 VARIABLES=qn1 [&pc].
546       |
547 ^~~
548
549 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
550     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
551 VARIABLES=qn1 [&pc].
552       |                            ^~~~~~~~
553
554 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
555 list of categories here.
556     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
557 VARIABLES=qn1 [&pc].
558       |
559 ^~~~
560
561 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
562 category not included in the category list.
563     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
564 [&pc].
565       |
566 ^~~
567
568 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
569     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
570 [&pc].
571       |                            ^~~~~
572
573 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
574 variable's CATEGORIES specification.
575
576 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
577 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
578 subtotals by position, e.g. SUBTOTAL[1].
579     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
580 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
581       |
582 ^~~~~~~~~~~~~~~~~~~~~~~~
583
584 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
585 position.
586     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
587 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
588       |                            ^~~~~~~~
589
590 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
591 applied only to string variables, but this subcommand tries to apply it to
592 numeric variable QN1.
593     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
594       |                                               ^~~~~~~~
595
596 ctables.sps:8.53: error: CTABLES: This category specification may be applied
597 only to numeric variables, but this subcommand tries to apply it to string
598 variable string.
599     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
600       |                                                     ^
601
602 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
603 based on a summary function.
604
605 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
606 moved to be categorical, but qnd1 is a scale variable.
607
608 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
609 moved to have the same width, but QN1 has width 0 and string has width 8.
610
611 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
612 moved to have the same value labels, but QN1 and QNSA1 have different value
613 labels.
614
615 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
616 moved to have the same category specifications, but QN105BA and QN105BB have
617 different category specifications.
618
619 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
620 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
621 this warning, insert parentheses.
622    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
623       |                           ^~~~~~~
624
625 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
626 `/'.
627
628 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
629
630 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
631
632 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
633 variable must be specified.
634
635 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
636
637 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
638 summary.
639    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
640       |                                                  ^~~~~
641
642 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
643 summary.
644    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
645       |                ^~~~~
646
647 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
648 summary.
649    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
650       |                                 ^~~~~
651
652 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
653 has a summary even if the syntax does not explicitly specify one.
654    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
655       |                                 ^~~~~
656 ]])
657 AT_CLEANUP
658
659 AT_SETUP([CTABLES one categorical variable])
660 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
661 AT_DATA([ctables.sps],
662 [[GET 'nhtsa.sav'.
663 CTABLES /TABLE qn1.
664 CTABLES /TABLE BY qn1.
665 CTABLES /TABLE BY BY qn1.
666 ]])
667 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
668                                   Custom Tables
669 ╭────────────────────────────────────────────────────────────────────────┬─────╮
670 │                                                                        │Count│
671 ├────────────────────────────────────────────────────────────────────────┼─────┤
672 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
673 │motor vehicle?                                     Several days a week  │ 1274│
674 │                                                   Once a week or less  │  361│
675 │                                                   Only certain times a │  130│
676 │                                                   year                 │     │
677 │                                                   Never                │  540│
678 ╰────────────────────────────────────────────────────────────────────────┴─────╯
679
680                                   Custom Tables
681 ╭──────────────────────────────────────────────────────────────────────────────╮
682 │        1. How often do you usually drive a car or other motor vehicle?       │
683 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
684 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
685 │Every day│       week       │       less       │          year          │Never│
686 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
687 │  Count  │       Count      │       Count      │          Count         │Count│
688 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
689 │     4667│              1274│               361│                     130│  540│
690 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
691
692 Custom Tables
693 Every day
694 ╭─────╮
695 │Count│
696 ├─────┤
697 │ 4667│
698 ╰─────╯
699 ])
700 AT_CLEANUP
701
702 AT_SETUP([CTABLES one string variable])
703 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
704 AT_DATA([ctables.sps],
705 [[GET 'nhtsa.sav'.
706 STRING licensed(A8).
707 MISSING VALUES licensed('DontKnow', 'Refused').
708 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
709 CTABLES /TABLE licensed.
710 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
711 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
712 * Notice that the string matching is case-sensitive.
713 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
714 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
715 CTABLES
716     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
717     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
718     /TABLE licensed
719     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
720 CTABLES
721     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
722     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
723     /TABLE licensed
724     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
725 ]])
726 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
727     Custom Tables
728 ╭────────────┬─────╮
729 │            │Count│
730 ├────────────┼─────┤
731 │licensed No │  572│
732 │         Yes│ 6379│
733 ╰────────────┴─────╯
734
735           Custom Tables
736 ╭─────────────────┬─────┬───────╮
737 │                 │Count│Valid N│
738 ├─────────────────┼─────┼───────┤
739 │licensed DontKnow│    4│       │
740 │         No      │  572│       │
741 │         Refused │   44│       │
742 │         Yes     │ 6379│       │
743 │         Total   │ 6999│   6951│
744 ╰─────────────────┴─────┴───────╯
745
746      Custom Tables
747 ╭──────────────┬─────╮
748 │              │Count│
749 ├──────────────┼─────┤
750 │licensed Yes  │ 6379│
751 │         No   │  572│
752 │         Total│ 6951│
753 ╰──────────────┴─────╯
754
755      Custom Tables
756 ╭──────────────┬─────╮
757 │              │Count│
758 ├──────────────┼─────┤
759 │licensed Yes  │ 6379│
760 │         no   │    0│
761 │         Total│ 6379│
762 ╰──────────────┴─────╯
763
764       Custom Tables
765 ╭────────────────┬─────╮
766 │                │Count│
767 ├────────────────┼─────┤
768 │licensed No     │  572│
769 │         Refused│   44│
770 │         Yes    │ 6379│
771 │         Total  │ 6995│
772 ╰────────────────┴─────╯
773
774       Custom Tables
775 ╭────────────────┬─────╮
776 │                │Count│
777 ├────────────────┼─────┤
778 │licensed Yes    │ 6379│
779 │         Not Yes│  620│
780 ╰────────────────┴─────╯
781
782       Custom Tables
783 ╭────────────────┬─────╮
784 │                │Count│
785 ├────────────────┼─────┤
786 │licensed Yes    │ 6379│
787 │         Not Yes│  620│
788 ╰────────────────┴─────╯
789 ])
790 AT_CLEANUP
791
792 AT_SETUP([CTABLES one scale variable])
793 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
794 AT_DATA([ctables.sps],
795 [[GET 'nhtsa.sav'.
796 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
797 CTABLES /TABLE BY qnd1.
798 CTABLES /TABLE BY BY qnd1.
799 ]])
800 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
801                                   Custom Tables
802 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
803 │                      │     │       │       │    │     Std    │       │       │
804 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
805 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
806 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
807 │age?                  │     │       │       │    │            │       │       │
808 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
809
810         Custom Tables
811 ╭──────────────────────────╮
812 │D1. AGE: What is your age?│
813 ├──────────────────────────┤
814 │           Mean           │
815 ├──────────────────────────┤
816 │                        48│
817 ╰──────────────────────────╯
818
819 Custom Tables
820 D1. AGE: What is your age?
821 ╭────╮
822 │Mean│
823 ├────┤
824 │  48│
825 ╰────╯
826 ])
827 AT_CLEANUP
828
829 AT_SETUP([CTABLES simple stacking])
830 AT_KEYWORDS([stack stacked])
831 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
832 AT_DATA([ctables.sps],
833 [[GET 'nhtsa.sav'.
834 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
835 ]])
836 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
837                                   Custom Tables
838 ╭───────────────────────────────────────────────────────────────┬──────────────╮
839 │                                                               │ S3a. GENDER: │
840 │                                                               ├──────┬───────┤
841 │                                                               │ Male │ Female│
842 │                                                               ├──────┼───────┤
843 │                                                               │Column│ Column│
844 │                                                               │   %  │   %   │
845 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
846 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
847 │too much to drink to drive safely will A. Get      certain     │      │       │
848 │stopped by the police?                             Very likely │   21%│    22%│
849 │                                                   Somewhat    │   38%│    42%│
850 │                                                   likely      │      │       │
851 │                                                   Somewhat    │   21%│    18%│
852 │                                                   unlikely    │      │       │
853 │                                                   Very        │   10%│     8%│
854 │                                                   unlikely    │      │       │
855 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
856 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
857 │too much to drink to drive safely will B. Have an  certain     │      │       │
858 │accident?                                          Very likely │   36%│    45%│
859 │                                                   Somewhat    │   39%│    32%│
860 │                                                   likely      │      │       │
861 │                                                   Somewhat    │    9%│     4%│
862 │                                                   unlikely    │      │       │
863 │                                                   Very        │    3%│     2%│
864 │                                                   unlikely    │      │       │
865 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
866 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
867 │too much to drink to drive safely will C. Be       certain     │      │       │
868 │convicted for drunk driving?                       Very likely │   32%│    28%│
869 │                                                   Somewhat    │   27%│    32%│
870 │                                                   likely      │      │       │
871 │                                                   Somewhat    │   15%│    15%│
872 │                                                   unlikely    │      │       │
873 │                                                   Very        │    9%│     9%│
874 │                                                   unlikely    │      │       │
875 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
876 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
877 │too much to drink to drive safely will D. Be       certain     │      │       │
878 │arrested for drunk driving?                        Very likely │   26%│    27%│
879 │                                                   Somewhat    │   32%│    35%│
880 │                                                   likely      │      │       │
881 │                                                   Somewhat    │   17%│    15%│
882 │                                                   unlikely    │      │       │
883 │                                                   Very        │    9%│     7%│
884 │                                                   unlikely    │      │       │
885 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
886 ])
887 AT_CLEANUP
888
889 AT_SETUP([CTABLES show or hide empty categories])
890 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
891 AT_DATA([ctables.sps],
892 [[GET 'nhtsa.sav'.
893 IF (qn105ba = 2) qn105ba = 1.
894 IF (qns3a = 1) qns3a = 2.
895 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
896 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
897     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
898 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
899     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
900 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
901     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
902 ]])
903 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
904                                   Custom Tables
905 ╭──────────────────────────────────────────────────────────────┬───────────────╮
906 │                                                              │  S3a. GENDER: │
907 │                                                              ├───────┬───────┤
908 │                                                              │  Male │ Female│
909 │                                                              ├───────┼───────┤
910 │                                                              │ Column│ Column│
911 │                                                              │   %   │   %   │
912 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
913 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
914 │too much to drink to drive safely will A. Get      certain    │       │       │
915 │stopped by the police?                             Very likely│      .│     0%│
916 │                                                   Somewhat   │      .│    40%│
917 │                                                   likely     │       │       │
918 │                                                   Somewhat   │      .│    19%│
919 │                                                   unlikely   │       │       │
920 │                                                   Very       │      .│     9%│
921 │                                                   unlikely   │       │       │
922 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
923
924                                   Custom Tables
925 ╭──────────────────────────────────────────────────────────────┬───────────────╮
926 │                                                              │  S3a. GENDER: │
927 │                                                              ├───────┬───────┤
928 │                                                              │  Male │ Female│
929 │                                                              ├───────┼───────┤
930 │                                                              │ Column│ Column│
931 │                                                              │   %   │   %   │
932 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
933 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
934 │too much to drink to drive safely will A. Get      certain    │       │       │
935 │stopped by the police?                             Somewhat   │      .│    40%│
936 │                                                   likely     │       │       │
937 │                                                   Somewhat   │      .│    19%│
938 │                                                   unlikely   │       │       │
939 │                                                   Very       │      .│     9%│
940 │                                                   unlikely   │       │       │
941 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
942
943                                   Custom Tables
944 ╭────────────────────────────────────────────────────────────────────┬─────────╮
945 │                                                                    │   S3a.  │
946 │                                                                    │ GENDER: │
947 │                                                                    ├─────────┤
948 │                                                                    │  Female │
949 │                                                                    ├─────────┤
950 │                                                                    │ Column %│
951 ├────────────────────────────────────────────────────────────────────┼─────────┤
952 │105b. How likely is it that drivers who have had too    Almost      │      32%│
953 │much to drink to drive safely will A. Get stopped by    certain     │         │
954 │the police?                                             Very likely │       0%│
955 │                                                        Somewhat    │      40%│
956 │                                                        likely      │         │
957 │                                                        Somewhat    │      19%│
958 │                                                        unlikely    │         │
959 │                                                        Very        │       9%│
960 │                                                        unlikely    │         │
961 ╰────────────────────────────────────────────────────────────────────┴─────────╯
962
963                                   Custom Tables
964 ╭────────────────────────────────────────────────────────────────────┬─────────╮
965 │                                                                    │   S3a.  │
966 │                                                                    │ GENDER: │
967 │                                                                    ├─────────┤
968 │                                                                    │  Female │
969 │                                                                    ├─────────┤
970 │                                                                    │ Column %│
971 ├────────────────────────────────────────────────────────────────────┼─────────┤
972 │105b. How likely is it that drivers who have had too    Almost      │      32%│
973 │much to drink to drive safely will A. Get stopped by    certain     │         │
974 │the police?                                             Somewhat    │      40%│
975 │                                                        likely      │         │
976 │                                                        Somewhat    │      19%│
977 │                                                        unlikely    │         │
978 │                                                        Very        │       9%│
979 │                                                        unlikely    │         │
980 ╰────────────────────────────────────────────────────────────────────┴─────────╯
981 ])
982 AT_CLEANUP
983
984 AT_SETUP([CTABLES sorting categories])
985 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
986 AT_DATA([ctables.sps],
987 [[GET 'nhtsa.sav'.
988 IF (QND5A=6) QND5A=-1.
989 IF (QND5A=5) QND5A=-2.
990 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
991         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
992         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
993         /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
994 ]])
995 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
996                                   Custom Tables
997 ╭────────────────────────────────────────────────────────────────────────┬─────╮
998 │                                                                        │Count│
999 ├────────────────────────────────────────────────────────────────────────┼─────┤
1000 │D5a. What would you say is your primary ethnic  -2.00                   │   52│
1001 │background?                                     -1.00                   │   78│
1002 │                                                Cuban                   │   20│
1003 │                                                Mexican                 │  311│
1004 │                                                Spanish                 │   48│
1005 │                                                South American          │   34│
1006 │                                                Central American        │    0│
1007 │                                                Puerto Rican, OR        │    0│
1008 │                                                Something else          │   68│
1009 │                                                Multiple - cannot choose│    7│
1010 │                                                one                     │     │
1011 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1012
1013                                   Custom Tables
1014 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1015 │                                                                        │Count│
1016 ├────────────────────────────────────────────────────────────────────────┼─────┤
1017 │D5a. What would you say is your primary ethnic  Multiple - cannot choose│    7│
1018 │background?                                     one                     │     │
1019 │                                                Something else          │   68│
1020 │                                                Puerto Rican, OR        │    0│
1021 │                                                Central American        │    0│
1022 │                                                South American          │   34│
1023 │                                                Spanish                 │   48│
1024 │                                                Mexican                 │  311│
1025 │                                                Cuban                   │   20│
1026 │                                                -1.00                   │   78│
1027 │                                                -2.00                   │   52│
1028 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1029
1030                                   Custom Tables
1031 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1032 │                                                                        │Count│
1033 ├────────────────────────────────────────────────────────────────────────┼─────┤
1034 │D5a. What would you say is your primary ethnic  Central American        │    0│
1035 │background?                                     Cuban                   │   20│
1036 │                                                Mexican                 │  311│
1037 │                                                Multiple - cannot choose│    7│
1038 │                                                one                     │     │
1039 │                                                Puerto Rican, OR        │    0│
1040 │                                                Something else          │   68│
1041 │                                                South American          │   34│
1042 │                                                Spanish                 │   48│
1043 │                                                -2.00                   │   52│
1044 │                                                -1.00                   │   78│
1045 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1046
1047                                   Custom Tables
1048 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1049 │                                                                        │Count│
1050 ├────────────────────────────────────────────────────────────────────────┼─────┤
1051 │D5a. What would you say is your primary ethnic  Spanish                 │   48│
1052 │background?                                     South American          │   34│
1053 │                                                Something else          │   68│
1054 │                                                Puerto Rican, OR        │    0│
1055 │                                                Multiple - cannot choose│    7│
1056 │                                                one                     │     │
1057 │                                                Mexican                 │  311│
1058 │                                                Cuban                   │   20│
1059 │                                                Central American        │    0│
1060 │                                                -1.00                   │   78│
1061 │                                                -2.00                   │   52│
1062 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1063 ])
1064 AT_CLEANUP
1065
1066 AT_SETUP([CTABLES simple nesting])
1067 AT_KEYWORDS([nest nested])
1068 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1069 AT_DATA([ctables.sps],
1070 [[GET 'nhtsa.sav'.
1071 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1072   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1073 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1074   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1075   /CLABELS ROW=OPPOSITE.
1076 ]])
1077 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1078                                   Custom Tables
1079 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1080 │                                                                 │     │ Table│
1081 │                                                                 │Count│   %  │
1082 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1083 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1084 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1085 │drive safely will A. Get stopped by                        Total │  700│   10%│
1086 │the police?                           ╶──────────────────────────┼─────┼──────┤
1087 │                                       Very       S3a.     Male  │  660│   10%│
1088 │                                       likely     GENDER:  Female│  842│   12%│
1089 │                                                           Total │ 1502│   22%│
1090 │                                      ╶──────────────────────────┼─────┼──────┤
1091 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1092 │                                       likely     GENDER:  Female│ 1589│   23%│
1093 │                                                           Total │ 2763│   40%│
1094 │                                      ╶──────────────────────────┼─────┼──────┤
1095 │                                       Somewhat   S3a.     Male  │  640│    9%│
1096 │                                       unlikely   GENDER:  Female│  667│   10%│
1097 │                                                           Total │ 1307│   19%│
1098 │                                      ╶──────────────────────────┼─────┼──────┤
1099 │                                       Very       S3a.     Male  │  311│    5%│
1100 │                                       unlikely   GENDER:  Female│  298│    4%│
1101 │                                                           Total │  609│    9%│
1102 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1103 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1104 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1105 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1106 │                                      ╶──────────────────────────┼─────┼──────┤
1107 │                                       Very       S3a.     Male  │ 1104│   16%│
1108 │                                       likely     GENDER:  Female│ 1715│   25%│
1109 │                                                           Total │ 2819│   41%│
1110 │                                      ╶──────────────────────────┼─────┼──────┤
1111 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1112 │                                       likely     GENDER:  Female│ 1214│   18%│
1113 │                                                           Total │ 2417│   35%│
1114 │                                      ╶──────────────────────────┼─────┼──────┤
1115 │                                       Somewhat   S3a.     Male  │  262│    4%│
1116 │                                       unlikely   GENDER:  Female│  168│    2%│
1117 │                                                           Total │  430│    6%│
1118 │                                      ╶──────────────────────────┼─────┼──────┤
1119 │                                       Very       S3a.     Male  │   81│    1%│
1120 │                                       unlikely   GENDER:  Female│   59│    1%│
1121 │                                                           Total │  140│    2%│
1122 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1123 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1124 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1125 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1126 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1127 │                                       Very       S3a.     Male  │  988│   14%│
1128 │                                       likely     GENDER:  Female│ 1049│   15%│
1129 │                                                           Total │ 2037│   30%│
1130 │                                      ╶──────────────────────────┼─────┼──────┤
1131 │                                       Somewhat   S3a.     Male  │  822│   12%│
1132 │                                       likely     GENDER:  Female│ 1210│   18%│
1133 │                                                           Total │ 2032│   30%│
1134 │                                      ╶──────────────────────────┼─────┼──────┤
1135 │                                       Somewhat   S3a.     Male  │  446│    7%│
1136 │                                       unlikely   GENDER:  Female│  548│    8%│
1137 │                                                           Total │  994│   15%│
1138 │                                      ╶──────────────────────────┼─────┼──────┤
1139 │                                       Very       S3a.     Male  │  268│    4%│
1140 │                                       unlikely   GENDER:  Female│  354│    5%│
1141 │                                                           Total │  622│    9%│
1142 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1143 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1144 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1145 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1146 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1147 │                                       Very       S3a.     Male  │  805│   12%│
1148 │                                       likely     GENDER:  Female│ 1029│   15%│
1149 │                                                           Total │ 1834│   27%│
1150 │                                      ╶──────────────────────────┼─────┼──────┤
1151 │                                       Somewhat   S3a.     Male  │  975│   14%│
1152 │                                       likely     GENDER:  Female│ 1332│   19%│
1153 │                                                           Total │ 2307│   34%│
1154 │                                      ╶──────────────────────────┼─────┼──────┤
1155 │                                       Somewhat   S3a.     Male  │  535│    8%│
1156 │                                       unlikely   GENDER:  Female│  560│    8%│
1157 │                                                           Total │ 1095│   16%│
1158 │                                      ╶──────────────────────────┼─────┼──────┤
1159 │                                       Very       S3a.     Male  │  270│    4%│
1160 │                                       unlikely   GENDER:  Female│  279│    4%│
1161 │                                                           Total │  549│    8%│
1162 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1163
1164                                   Custom Tables
1165 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1166 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1167 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1168 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1169 │                                 │        │ Table│         │         │        │
1170 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1171 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1172 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1173 │GENDER:        is it that drivers│        │      │         │         │        │
1174 │               who have had too  │        │      │         │         │        │
1175 │               much to drink to  │        │      │         │         │        │
1176 │               drive safely will │        │      │         │         │        │
1177 │               A. Get stopped by │        │      │         │         │        │
1178 │               the police?       │        │      │         │         │        │
1179 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1180 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1181 │               is it that drivers│        │      │         │         │        │
1182 │               who have had too  │        │      │         │         │        │
1183 │               much to drink to  │        │      │         │         │        │
1184 │               drive safely will │        │      │         │         │        │
1185 │               A. Get stopped by │        │      │         │         │        │
1186 │               the police?       │        │      │         │         │        │
1187 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1188 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1189 │               is it that drivers│        │      │         │         │        │
1190 │               who have had too  │        │      │         │         │        │
1191 │               much to drink to  │        │      │         │         │        │
1192 │               drive safely will │        │      │         │         │        │
1193 │               A. Get stopped by │        │      │         │         │        │
1194 │               the police?       │        │      │         │         │        │
1195 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1196 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1197 │GENDER:        is it that drivers│        │      │         │         │        │
1198 │               who have had too  │        │      │         │         │        │
1199 │               much to drink to  │        │      │         │         │        │
1200 │               drive safely will │        │      │         │         │        │
1201 │               B. Have an        │        │      │         │         │        │
1202 │               accident?         │        │      │         │         │        │
1203 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1204 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1205 │               is it that drivers│        │      │         │         │        │
1206 │               who have had too  │        │      │         │         │        │
1207 │               much to drink to  │        │      │         │         │        │
1208 │               drive safely will │        │      │         │         │        │
1209 │               B. Have an        │        │      │         │         │        │
1210 │               accident?         │        │      │         │         │        │
1211 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1212 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1213 │               is it that drivers│        │      │         │         │        │
1214 │               who have had too  │        │      │         │         │        │
1215 │               much to drink to  │        │      │         │         │        │
1216 │               drive safely will │        │      │         │         │        │
1217 │               B. Have an        │        │      │         │         │        │
1218 │               accident?         │        │      │         │         │        │
1219 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1220 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1221 │GENDER:        is it that drivers│        │      │         │         │        │
1222 │               who have had too  │        │      │         │         │        │
1223 │               much to drink to  │        │      │         │         │        │
1224 │               drive safely will │        │      │         │         │        │
1225 │               C. Be convicted   │        │      │         │         │        │
1226 │               for drunk driving?│        │      │         │         │        │
1227 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1228 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1229 │               is it that drivers│        │      │         │         │        │
1230 │               who have had too  │        │      │         │         │        │
1231 │               much to drink to  │        │      │         │         │        │
1232 │               drive safely will │        │      │         │         │        │
1233 │               C. Be convicted   │        │      │         │         │        │
1234 │               for drunk driving?│        │      │         │         │        │
1235 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1236 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1237 │               is it that drivers│        │      │         │         │        │
1238 │               who have had too  │        │      │         │         │        │
1239 │               much to drink to  │        │      │         │         │        │
1240 │               drive safely will │        │      │         │         │        │
1241 │               C. Be convicted   │        │      │         │         │        │
1242 │               for drunk driving?│        │      │         │         │        │
1243 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1244 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1245 │GENDER:        is it that drivers│        │      │         │         │        │
1246 │               who have had too  │        │      │         │         │        │
1247 │               much to drink to  │        │      │         │         │        │
1248 │               drive safely will │        │      │         │         │        │
1249 │               D. Be arrested for│        │      │         │         │        │
1250 │               drunk driving?    │        │      │         │         │        │
1251 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1252 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1253 │               is it that drivers│        │      │         │         │        │
1254 │               who have had too  │        │      │         │         │        │
1255 │               much to drink to  │        │      │         │         │        │
1256 │               drive safely will │        │      │         │         │        │
1257 │               D. Be arrested for│        │      │         │         │        │
1258 │               drunk driving?    │        │      │         │         │        │
1259 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1260 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1261 │               is it that drivers│        │      │         │         │        │
1262 │               who have had too  │        │      │         │         │        │
1263 │               much to drink to  │        │      │         │         │        │
1264 │               drive safely will │        │      │         │         │        │
1265 │               D. Be arrested for│        │      │         │         │        │
1266 │               drunk driving?    │        │      │         │         │        │
1267 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1268 ])
1269 AT_CLEANUP
1270
1271 AT_SETUP([CTABLES nesting and scale variables])
1272 AT_KEYWORDS([nest nested])
1273 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1274 AT_DATA([ctables.sps],
1275 [[GET 'nhtsa.sav'.
1276 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1277 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1278 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1279   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1280 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1281 ]])
1282 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1283                                   Custom Tables
1284 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1285 │                                                                 │S3a. GENDER:│
1286 │                                                                 ├─────┬──────┤
1287 │                                                                 │ Male│Female│
1288 │                                                                 ├─────┼──────┤
1289 │                                                                 │ Mean│ Mean │
1290 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1291 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1292 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1293 │                                                  week           │     │      │
1294 │                                                  Once a week or │   44│    54│
1295 │                                                  less           │     │      │
1296 │                                                  Only certain   │   34│    41│
1297 │                                                  times a year   │     │      │
1298 │                                                  Never          │   39│    55│
1299 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1300
1301                                   Custom Tables
1302 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1303 │                                                         │Minimum│Maximum│Mean│
1304 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1305 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1306 │What is  GENDER:         months, has there been a        │       │       │    │
1307 │your                     time when you felt you          │       │       │    │
1308 │age?                     should cut down on your      No │     16│     86│  46│
1309 │                         drinking?                       │       │       │    │
1310 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1311 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1312 │                         months, has there been a        │       │       │    │
1313 │                         time when you felt you          │       │       │    │
1314 │                         should cut down on your      No │     16│     86│  48│
1315 │                         drinking?                       │       │       │    │
1316 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1317 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1318 │What is  GENDER:         months, has there been a        │       │       │    │
1319 │your                     time when people criticized  No │     16│     86│  46│
1320 │age?                     your drinking?                  │       │       │    │
1321 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1322 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1323 │                         months, has there been a        │       │       │    │
1324 │                         time when people criticized  No │     16│     86│  48│
1325 │                         your drinking?                  │       │       │    │
1326 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1327
1328                                   Custom Tables
1329 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1330 │                             │S1. Including yourself, how many members of this│
1331 │                             │         household are age 16 or older?         │
1332 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1333 │                             │      │      │      │      │      │      │ 6 or │
1334 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1335 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1336 │                             │Column│Column│Column│Column│Column│Column│Column│
1337 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1338 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1339 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1340 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1341 │SOURCE:     likely           │      │      │      │      │      │      │      │
1342 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1343 │            that     likely  │      │      │      │      │      │      │      │
1344 │            drivers          │      │      │      │      │      │      │      │
1345 │            who have         │      │      │      │      │      │      │      │
1346 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1347 │            much to  likely  │      │      │      │      │      │      │      │
1348 │            drink to         │      │      │      │      │      │      │      │
1349 │            drive            │      │      │      │      │      │      │      │
1350 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1351 │            will A.  unlikely│      │      │      │      │      │      │      │
1352 │            Get              │      │      │      │      │      │      │      │
1353 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1354 │            by the   unlikely│      │      │      │      │      │      │      │
1355 │            police?          │      │      │      │      │      │      │      │
1356 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1357
1358                                   Custom Tables
1359 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1360 │                                                              │    │    Std   │
1361 │                                                              │Mean│ Deviation│
1362 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1363 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1364 │group           typical month did you have one or more        │    │          │
1365 │                alcoholic beverages to drink?                 │    │          │
1366 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1367 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1368 │                typical month did you have one or more        │    │          │
1369 │                alcoholic beverages to drink?                 │    │          │
1370 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1371 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1372 │                typical month did you have one or more        │    │          │
1373 │                alcoholic beverages to drink?                 │    │          │
1374 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1375 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1376 │                typical month did you have one or more        │    │          │
1377 │                alcoholic beverages to drink?                 │    │          │
1378 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1379 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1380 │                typical month did you have one or more        │    │          │
1381 │                alcoholic beverages to drink?                 │    │          │
1382 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1383 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1384 │       older    typical month did you have one or more        │    │          │
1385 │                alcoholic beverages to drink?                 │    │          │
1386 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1387 ])
1388 AT_CLEANUP
1389
1390
1391 AT_SETUP([CTABLES SLABELS])
1392 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1393 AT_DATA([ctables.sps],
1394 [[GET 'nhtsa.sav'.
1395 CTABLES /TABLE qn1 [COUNT COLPCT].
1396 CTABLES /TABLE qn1 [COUNT COLPCT]
1397     /SLABELS POSITION=ROW.
1398 CTABLES /TABLE qn1 [COUNT COLPCT]
1399     /SLABELS POSITION=ROW VISIBLE=NO.
1400 ]])
1401 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1402                                   Custom Tables
1403 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1404 │                                                                │     │ Column│
1405 │                                                                │Count│   %   │
1406 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1407 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1408 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1409 │                                             Once a week or less│  361│   5.2%│
1410 │                                             Only certain times │  130│   1.9%│
1411 │                                             a year             │     │       │
1412 │                                             Never              │  540│   7.7%│
1413 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1414
1415                                   Custom Tables
1416 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1417 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1418 │other motor vehicle?                                             Column │66.9%│
1419 │                                                                 %      │     │
1420 │                                            ╶───────────────────────────┼─────┤
1421 │                                             Several days a week Count  │ 1274│
1422 │                                                                 Column │18.3%│
1423 │                                                                 %      │     │
1424 │                                            ╶───────────────────────────┼─────┤
1425 │                                             Once a week or less Count  │  361│
1426 │                                                                 Column │ 5.2%│
1427 │                                                                 %      │     │
1428 │                                            ╶───────────────────────────┼─────┤
1429 │                                             Only certain times  Count  │  130│
1430 │                                             a year              Column │ 1.9%│
1431 │                                                                 %      │     │
1432 │                                            ╶───────────────────────────┼─────┤
1433 │                                             Never               Count  │  540│
1434 │                                                                 Column │ 7.7%│
1435 │                                                                 %      │     │
1436 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1437
1438                                   Custom Tables
1439 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1440 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1441 │motor vehicle?                                                          │66.9%│
1442 │                                                   Several days a week  │ 1274│
1443 │                                                                        │18.3%│
1444 │                                                   Once a week or less  │  361│
1445 │                                                                        │ 5.2%│
1446 │                                                   Only certain times a │  130│
1447 │                                                   year                 │ 1.9%│
1448 │                                                   Never                │  540│
1449 │                                                                        │ 7.7%│
1450 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1451 ])
1452 AT_CLEANUP
1453
1454 AT_SETUP([CTABLES simple totals])
1455 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1456 AT_DATA([ctables.sps],
1457 [[GET 'nhtsa.sav'.
1458 CTABLES /TABLE=qn17
1459     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1460 DESCRIPTIVES qn18/STATISTICS=MEAN.
1461 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1462     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1463 ]])
1464 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1465                                   Custom Tables
1466 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1467 │                                                                        │Count│
1468 ├────────────────────────────────────────────────────────────────────────┼─────┤
1469 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1470 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1471 │                                                      Light beer        │  620│
1472 │                                                      Wine              │ 1418│
1473 │                                                      Wine coolers      │  137│
1474 │                                                      Hard liquor or    │  888│
1475 │                                                      mixed drinks      │     │
1476 │                                                      Flavored malt     │   83│
1477 │                                                      drinks            │     │
1478 │                                                      Number responding │ 4221│
1479 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1480
1481                              Descriptive Statistics
1482 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1483 │                                                                    │  N │Mean│
1484 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1485 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1486 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1487 │Valid N (listwise)                                                  │6999│    │
1488 │Missing N (listwise)                                                │2781│    │
1489 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1490
1491                                   Custom Tables
1492 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1493 │                                                      │    │     │ Valid│Total│
1494 │                                                      │Mean│Count│   N  │  N  │
1495 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1496 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1497 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1498 │                you usually drink per sitting?        │    │     │      │     │
1499 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1500 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1501 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1502 │                you usually drink per sitting?        │    │     │      │     │
1503 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1504 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1505 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1506 │                you usually drink per sitting?        │    │     │      │     │
1507 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1508 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1509 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1510 │                you usually drink per sitting?        │    │     │      │     │
1511 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1512 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1513 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1514 │                you usually drink per sitting?        │    │     │      │     │
1515 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1516 ])
1517 AT_CLEANUP
1518
1519 AT_SETUP([CTABLES subtotals])
1520 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1521 AT_DATA([ctables.sps],
1522 [[GET 'nhtsa.sav'.
1523 CTABLES /TABLE=qn105ba BY qns1
1524     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1525 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1526     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1527 CTABLES /TABLE=qn105ba BY qns1
1528     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1529     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1530 ]])
1531 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1532                                                       Custom Tables
1533 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1534 │                                                         │ S1. Including yourself, how many members of this household │
1535 │                                                         │                    are age 16 or older?                    │
1536 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1537 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1538 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1539 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1540 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1541 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1542 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1543 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1544 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1545 │                                              likely     │       │       │         │       │        │      │          │
1546 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1547 │                                              unlikely   │       │       │         │       │        │      │          │
1548 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1549 │                                              unlikely   │       │       │         │       │        │      │          │
1550 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1551
1552                                                       Custom Tables
1553 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1554 │                                                        │  S1. Including yourself, how many members of this household │
1555 │                                                        │                     are age 16 or older?                    │
1556 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1557 │                                                        │        │        │        │        │       │        │  6 or  │
1558 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1559 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1560 │                                                        │        │        │        │        │ Column│        │        │
1561 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1562 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1563 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1564 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1565 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1566 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1567 │                                             likely     │        │        │        │        │       │        │        │
1568 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1569 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1570 │                                             unlikely   │        │        │        │        │       │        │        │
1571 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1572 │                                             unlikely   │        │        │        │        │       │        │        │
1573 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1574 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1575
1576                                                       Custom Tables
1577 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1578 │                                                         │ S1. Including yourself, how many members of this household │
1579 │                                                         │                    are age 16 or older?                    │
1580 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1581 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1582 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1583 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1584 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1585 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1586 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1587 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1588 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1589 │                                              likely     │       │       │         │       │        │      │          │
1590 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1591 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1592 │                                              unlikely   │       │       │         │       │        │      │          │
1593 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1594 │                                              unlikely   │       │       │         │       │        │      │          │
1595 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1596 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1597 ])
1598 AT_CLEANUP
1599
1600 AT_SETUP([CTABLES PCOMPUTE])
1601 AT_KEYWORDS([postcompute])
1602 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1603 AT_DATA([ctables.sps],
1604 [[GET 'nhtsa.sav'.
1605 CTABLES
1606     /PCOMPUTE &x=EXPR([3] + [4])
1607     /PCOMPUTE &y=EXPR([4] + [5])
1608     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1609     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1610     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1611     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1612
1613 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1614 CTABLES
1615     /PCOMPUTE &x=EXPR([3] + [4])
1616     /PCOMPUTE &y=EXPR([4] + [5])
1617     /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1618     /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1619     /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1620     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1621 ]])
1622 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1623                                                                 Custom Tables
1624 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1625 │                   │                    S1. Including yourself, how many members of this household are age 16 or older?                   │
1626 │                   ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1627 │                   │     1     │     2     │  Subtotal │     3     │     4    │     5    │     3+4    │    4+5   │  Subtotal │    Total   │
1628 │                   ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1629 │                   │     │     │     │     │     │     │     │     │     │ Row│     │ Row│      │     │     │ Row│     │     │     │      │
1630 │                   │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│  % │Count│  % │ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1631 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1632 │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%│
1633 │likely is  certain │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1634 │it that            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1635 │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%│
1636 │who have   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1637 │had too            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1638 │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%│
1639 │drink to   likely  │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1640 │drive              │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1641 │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%│
1642 │will A.    unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1643 │Get                │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1644 │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%│
1645 │the        unlikely│     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1646 │police?            │     │     │     │     │     │     │     │     │     │    │     │    │      │     │     │    │     │     │     │      │
1647 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1648
1649                                                                 Custom Tables
1650 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1651 │                                         │         S1. Including yourself, how many members of this household are age 16 or older?        │
1652 │                                         ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1653 │                                         │     1     │     2     │  Subtotal │     3     │     3+4    │    4+5   │  Subtotal │    Total   │
1654 │                                         ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1655 │                                         │     │     │     │     │     │     │     │     │      │     │     │ Row│     │     │     │      │
1656 │                                         │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│  % │Count│Row %│Count│ Row %│
1657 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1658 │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%│
1659 │drivers who have had too much  certain   │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1660 │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%│
1661 │A. Get stopped by the police?  likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1662 │                               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%│
1663 │                               likely    │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1664 │                               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%│
1665 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1666 │                               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%│
1667 │                               unlikely  │     │     │     │     │     │     │     │     │      │     │     │    │     │     │     │      │
1668 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1669 ])
1670 AT_CLEANUP
1671
1672 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1673 AT_KEYWORDS([postcompute])
1674 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1675 AT_DATA([ctables.sps],
1676 [[GET 'nhtsa.sav'.
1677 CTABLES
1678     /PCOMPUTE &x=EXPR(OTHERNM)
1679     /PCOMPUTE &y=EXPR(MISSING)
1680     /PPROPERTIES &x LABEL='Drivers'
1681     /PPROPERTIES &y LABEL='Missing Values 2'
1682     /TABLE=qn1 BY qns3a
1683     /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1684 ]])
1685 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1686                                               Custom Tables
1687 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1688 │                                                                                          │S3a. GENDER:│
1689 │                                                                                          ├─────┬──────┤
1690 │                                                                                          │ Male│Female│
1691 │                                                                                          ├─────┼──────┤
1692 │                                                                                          │Count│ Count│
1693 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1694 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1695 │                                                                 Several days a week      │  440│   834│
1696 │                                                                 Once a week or less      │  125│   236│
1697 │                                                                 Only certain times a year│   58│    72│
1698 │                                                                 Never                    │  192│   348│
1699 │                                                                 Drivers                  │ 2928│  3504│
1700 │                                                                 Valid Values             │ 3120│  3852│
1701 │                                                                 Don't know               │    3│     5│
1702 │                                                                 Refused                  │    9│    10│
1703 │                                                                 Missing Values           │   12│    15│
1704 │                                                                 Missing Values 2         │   12│    15│
1705 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1706 ])
1707 AT_CLEANUP
1708
1709 AT_SETUP([CTABLES PCOMPUTE - THRU])
1710 AT_KEYWORDS([postcompute])
1711 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1712 AT_DATA([ctables.sps],
1713 [[GET 'nhtsa.sav'.
1714 CTABLES
1715     /PCOMPUTE &x=EXPR([1 THRU 2])
1716     /PCOMPUTE &y=EXPR([3 THRU 4])
1717     /PCOMPUTE &z=EXPR([5] + MISSING)
1718     /PPROPERTIES &x LABEL='Frequent Drivers'
1719     /PPROPERTIES &y LABEL='Infrequent Drivers'
1720     /PPROPERTIES &z LABEL='Not Drivers or Missing'
1721     /TABLE=qn1 BY qns3a
1722     /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1723 ]])
1724 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1725                                               Custom Tables
1726 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1727 │                                                                                          │S3a. GENDER:│
1728 │                                                                                          ├─────┬──────┤
1729 │                                                                                          │ Male│Female│
1730 │                                                                                          ├─────┼──────┤
1731 │                                                                                          │Count│ Count│
1732 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1733 │ 1. How often do you usually drive a car or other motor vehicle? Every day                │ 2305│  2362│
1734 │                                                                 Several days a week      │  440│   834│
1735 │                                                                 Frequent Drivers         │ 2745│  3196│
1736 │                                                                 Once a week or less      │  125│   236│
1737 │                                                                 Only certain times a year│   58│    72│
1738 │                                                                 Infrequent Drivers       │  183│   308│
1739 │                                                                 Drivers                  │ 2928│  3504│
1740 │                                                                 Never                    │  192│   348│
1741 │                                                                 Don't know               │    3│     5│
1742 │                                                                 Refused                  │    9│    10│
1743 │                                                                 Not Drivers or Missing   │  204│   363│
1744 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1745 ])
1746 AT_CLEANUP
1747
1748 dnl I'm not sure that this is the correct behavior (see
1749 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1750 dnl but at least this test will notify us if the behavior changes.
1751 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1752 AT_KEYWORDS([PCOMPUTE postcompute])
1753 AT_DATA([ctables.sps],
1754 [[DATA LIST LIST NOTABLE/x y z.
1755 WEIGHT by z.
1756 FORMATS ALL (F1.0).
1757 VARIABLE LEVEL x y (NOMINAL).
1758 BEGIN DATA.
1759 1 4 5
1760 1 5 2
1761 1 6 9
1762 2 4 2
1763 2 5 3
1764 2 6 4
1765 3 4 1
1766 3 5 6
1767 3 6 1
1768 END DATA.
1769
1770 CTABLES
1771     /PCOMPUTE &a = EXPR([1] + [2])
1772     /PCOMPUTE &b = EXPR([2] + [3])
1773     /PCOMPUTE &c = EXPR([4] * [5])
1774     /PCOMPUTE &d = EXPR([5] * [6])
1775     /TABLE x BY y
1776     /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1777     /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1778 ]])
1779 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1780 [[                   Custom Tables
1781 ╭───────────┬─────────────────────────────────────╮
1782 │           │                  y                  │
1783 │           ├─────┬─────────┬─────┬─────────┬─────┤
1784 │           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
1785 │           ├─────┼─────────┼─────┼─────────┼─────┤
1786 │           │Count│  Count  │Count│  Count  │Count│
1787 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1788 │x 1        │    5│       10│    2│       18│    9│
1789 │  [1] + [2]│    7│        .│    5│        .│   13│
1790 │  2        │    2│        6│    3│       12│    4│
1791 │  [2] + [3]│    3│        .│    9│        .│    5│
1792 │  3        │    1│        6│    6│        6│    1│
1793 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1794 ]])
1795 AT_CLEANUP
1796
1797 AT_SETUP([CTABLES string and date and time])
1798
1799 weight=1
1800 for gender in F M; do
1801     for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1802         for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1803             printf "$weight $gender $month $wkday\n"
1804             weight=$(expr \( $weight + 3 \) % 7 + 2)
1805         done
1806     done
1807 done > ctables.txt
1808
1809 AT_DATA([ctables.sps],
1810 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1811     /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1812 WEIGHT by w.
1813 VARIABLE LEVEL w (SCALE).
1814 VARIABLE LEVEL gender fmon fday (NOMINAL).
1815 VARIABLE LABEL
1816   gender 'Gender'
1817   fmon 'Favorite month'
1818   fday 'Favorite day of the week'.
1819 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1820 CTABLES
1821     /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1822     /PPROPERTIES &q2 LABEL='Q2'
1823     /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1824     /PPROPERTIES &weekend LABEL='Weekend'
1825     /TABLE fmon BY gender > fday
1826     /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1827                                 4 THRU 6, &q2,
1828                                 'JUL' THRU 'sep', SUBTOTAL="Q3",
1829                                 OTHERNM, SUBTOTAL='Q4']
1830     /CATEGORIES VARIABLES=gender ['M', 'F']
1831     /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1832     /SLABELS VISIBLE=NO.
1833 ]])
1834 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1835                                               Custom Tables
1836 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1837 │                  │                                       Gender                                      │
1838 │                  ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1839 │                  │                   Male                  │                  Female                 │
1840 │                  ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1841 │                  │         Favorite day of the week        │         Favorite day of the week        │
1842 │                  ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1843 │                  │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1844 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1845 │Favorite month JAN│ 10│  3│  8│  6│  4│  2│  7│     17│   40│  9│  6│  4│  2│  7│  5│  3│     12│   36│
1846 │               FEB│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1847 │               MAR│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1848 │               Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│       │     │ 29│ 12│ 13│ 14│ 15│ 16│ 17│       │     │
1849 │               APR│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1850 │               MAY│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1851 │               JUN│  4│  7│  5│  3│  8│  6│  4│      8│   37│ 10│  3│  8│  6│  4│  2│  7│     17│   40│
1852 │               Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│      .│     │ 28│ 15│ 16│ 17│ 18│ 12│ 13│      .│     │
1853 │               JUL│ 14│  5│  3│  8│  6│  4│  2│     16│   42│  6│  8│  6│  4│  2│  7│  5│     11│   38│
1854 │               AUG│ 10│  3│  8│  6│  4│  2│  7│     17│   40│ 16│  6│  4│  2│  7│  5│  3│     19│   43│
1855 │               SEP│  6│  8│  6│  4│  2│  7│  5│     11│   38│ 12│  4│  2│  7│  5│  3│  8│     20│   41│
1856 │               Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│       │     │ 62│ 33│ 28│ 30│ 32│ 27│ 29│       │     │
1857 │               OCT│ 16│  6│  4│  2│  7│  5│  3│     19│   43│  8│  2│  7│  5│  3│  8│  6│     14│   39│
1858 │               NOV│ 12│  4│  2│  7│  5│  3│  8│     20│   41│  4│  7│  5│  3│  8│  6│  4│      8│   37│
1859 │               DEC│  8│  2│  7│  5│  3│  8│  6│     14│   39│ 14│  5│  3│  8│  6│  4│  2│     16│   42│
1860 │               Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│       │     │ 26│ 14│ 15│ 16│ 17│ 18│ 12│       │     │
1861 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1862 ])
1863 AT_CLEANUP
1864
1865 AT_SETUP([CTABLES CLABELS])
1866 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1867 AT_DATA([ctables.sps],
1868 [[GET 'nhtsa.sav'.
1869 CTABLES /TABLE AgeGroup BY qns3a.
1870 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1871 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1872 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1873 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1874 ]])
1875 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1876              Custom Tables
1877 ╭───────────────────────┬────────────╮
1878 │                       │S3a. GENDER:│
1879 │                       ├─────┬──────┤
1880 │                       │ Male│Female│
1881 │                       ├─────┼──────┤
1882 │                       │Count│ Count│
1883 ├───────────────────────┼─────┼──────┤
1884 │Age group 15 or younger│    0│     0│
1885 │          16 to 25     │  594│   505│
1886 │          26 to 35     │  476│   491│
1887 │          36 to 45     │  489│   548│
1888 │          46 to 55     │  526│   649│
1889 │          56 to 65     │  516│   731│
1890 │          66 or older  │  531│   943│
1891 ╰───────────────────────┴─────┴──────╯
1892
1893                                                       Custom Tables
1894 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1895 │       │                                                 S3a. GENDER:                                                 │
1896 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1897 │       │                         Male                         │                         Female                        │
1898 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1899 │       │  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 │
1900 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1901 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1902 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1903 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1904 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1905 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1906 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1907
1908                 Custom Tables
1909 ╭──────────────────────────────┬────────────╮
1910 │                              │S3a. GENDER:│
1911 │                              ├────────────┤
1912 │                              │    Count   │
1913 ├──────────────────────────────┼────────────┤
1914 │Age group 15 or younger Male  │           0│
1915 │                        Female│           0│
1916 │         ╶────────────────────┼────────────┤
1917 │          16 to 25      Male  │         594│
1918 │                        Female│         505│
1919 │         ╶────────────────────┼────────────┤
1920 │          26 to 35      Male  │         476│
1921 │                        Female│         491│
1922 │         ╶────────────────────┼────────────┤
1923 │          36 to 45      Male  │         489│
1924 │                        Female│         548│
1925 │         ╶────────────────────┼────────────┤
1926 │          46 to 55      Male  │         526│
1927 │                        Female│         649│
1928 │         ╶────────────────────┼────────────┤
1929 │          56 to 65      Male  │         516│
1930 │                        Female│         731│
1931 │         ╶────────────────────┼────────────┤
1932 │          66 or older   Male  │         531│
1933 │                        Female│         943│
1934 ╰──────────────────────────────┴────────────╯
1935
1936       Custom Tables
1937 15 or younger
1938 ╭─────────┬────────────╮
1939 │         │S3a. GENDER:│
1940 │         ├─────┬──────┤
1941 │         │ Male│Female│
1942 │         ├─────┼──────┤
1943 │         │Count│ Count│
1944 ├─────────┼─────┼──────┤
1945 │Age group│    0│     0│
1946 ╰─────────┴─────┴──────╯
1947
1948       Custom Tables
1949 16 to 25
1950 ╭─────────┬────────────╮
1951 │         │S3a. GENDER:│
1952 │         ├─────┬──────┤
1953 │         │ Male│Female│
1954 │         ├─────┼──────┤
1955 │         │Count│ Count│
1956 ├─────────┼─────┼──────┤
1957 │Age group│  594│   505│
1958 ╰─────────┴─────┴──────╯
1959
1960       Custom Tables
1961 26 to 35
1962 ╭─────────┬────────────╮
1963 │         │S3a. GENDER:│
1964 │         ├─────┬──────┤
1965 │         │ Male│Female│
1966 │         ├─────┼──────┤
1967 │         │Count│ Count│
1968 ├─────────┼─────┼──────┤
1969 │Age group│  476│   491│
1970 ╰─────────┴─────┴──────╯
1971
1972       Custom Tables
1973 36 to 45
1974 ╭─────────┬────────────╮
1975 │         │S3a. GENDER:│
1976 │         ├─────┬──────┤
1977 │         │ Male│Female│
1978 │         ├─────┼──────┤
1979 │         │Count│ Count│
1980 ├─────────┼─────┼──────┤
1981 │Age group│  489│   548│
1982 ╰─────────┴─────┴──────╯
1983
1984       Custom Tables
1985 46 to 55
1986 ╭─────────┬────────────╮
1987 │         │S3a. GENDER:│
1988 │         ├─────┬──────┤
1989 │         │ Male│Female│
1990 │         ├─────┼──────┤
1991 │         │Count│ Count│
1992 ├─────────┼─────┼──────┤
1993 │Age group│  526│   649│
1994 ╰─────────┴─────┴──────╯
1995
1996       Custom Tables
1997 56 to 65
1998 ╭─────────┬────────────╮
1999 │         │S3a. GENDER:│
2000 │         ├─────┬──────┤
2001 │         │ Male│Female│
2002 │         ├─────┼──────┤
2003 │         │Count│ Count│
2004 ├─────────┼─────┼──────┤
2005 │Age group│  516│   731│
2006 ╰─────────┴─────┴──────╯
2007
2008       Custom Tables
2009 66 or older
2010 ╭─────────┬────────────╮
2011 │         │S3a. GENDER:│
2012 │         ├─────┬──────┤
2013 │         │ Male│Female│
2014 │         ├─────┼──────┤
2015 │         │Count│ Count│
2016 ├─────────┼─────┼──────┤
2017 │Age group│  531│   943│
2018 ╰─────────┴─────┴──────╯
2019
2020              Custom Tables
2021 Male
2022 ╭───────────────────────┬────────────╮
2023 │                       │S3a. GENDER:│
2024 │                       ├────────────┤
2025 │                       │    Count   │
2026 ├───────────────────────┼────────────┤
2027 │Age group 15 or younger│           0│
2028 │          16 to 25     │         594│
2029 │          26 to 35     │         476│
2030 │          36 to 45     │         489│
2031 │          46 to 55     │         526│
2032 │          56 to 65     │         516│
2033 │          66 or older  │         531│
2034 ╰───────────────────────┴────────────╯
2035
2036              Custom Tables
2037 Female
2038 ╭───────────────────────┬────────────╮
2039 │                       │S3a. GENDER:│
2040 │                       ├────────────┤
2041 │                       │    Count   │
2042 ├───────────────────────┼────────────┤
2043 │Age group 15 or younger│           0│
2044 │          16 to 25     │         505│
2045 │          26 to 35     │         491│
2046 │          36 to 45     │         548│
2047 │          46 to 55     │         649│
2048 │          56 to 65     │         731│
2049 │          66 or older  │         943│
2050 ╰───────────────────────┴────────────╯
2051 ])
2052 AT_CLEANUP
2053
2054 AT_SETUP([CTABLES missing values])
2055 AT_DATA([ctables.sps],
2056 [[DATA LIST LIST NOTABLE/x y.
2057 BEGIN DATA.
2058 1 1
2059 1 2
2060 1 3
2061 1 4
2062 1 5
2063 1 .
2064 2 1
2065 2 2
2066 2 3
2067 2 4
2068 2 5
2069 2 .
2070 3 1
2071 3 2
2072 3 3
2073 3 4
2074 3 5
2075 3 .
2076 4 1
2077 4 2
2078 4 3
2079 4 4
2080 4 5
2081 4 .
2082 5 1
2083 5 2
2084 5 3
2085 5 4
2086 5 5
2087 5 .
2088 . 1
2089 . 2
2090 . 3
2091 . 4
2092 . 5
2093 . .
2094 END DATA.
2095 MISSING VALUES x (1, 2) y (2, 3).
2096 VARIABLE LEVEL ALL (NOMINAL).
2097
2098 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2099                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2100     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2101 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2102                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2103     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2104 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2105                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2106     /CATEGORIES VARIABLES=ALL TOTAL=YES
2107     /SLABELS POSITION=ROW.
2108 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2109                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2110     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2111     /SLABELS POSITION=ROW.
2112 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2113                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2114     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2115     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2116     /SLABELS POSITION=ROW.
2117 ]])
2118 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2119                                Custom Tables
2120 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2121 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2122 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2123 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2124 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2125 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2126 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2127 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2128 dnl Note that Column Total N % doesn't add up to 100 because missing
2129 dnl values are included in the total but not shown as a category and this
2130 dnl is expected behavior.
2131
2132                                Custom Tables
2133 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2134 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2135 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2136 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2137 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2138 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2139 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2140 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2141 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2142 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2143 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2144 dnl values are included in the total but not shown as a category and this
2145 dnl is expected behavior.
2146
2147                      Custom Tables
2148 ╭────────────────────────┬───────────────────────────╮
2149 │                        │             y             │
2150 │                        ├──────┬──────┬──────┬──────┤
2151 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2152 ├────────────────────────┼──────┼──────┼──────┼──────┤
2153 │x 3.00  Count           │     1│     1│     1│     3│
2154 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2155 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2156 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2157 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2158 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2159 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2160 │        Valid N         │      │      │      │     3│
2161 │        Total N         │      │      │      │     6│
2162 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2163 │  4.00  Count           │     1│     1│     1│     3│
2164 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2165 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2166 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2167 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2168 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2169 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2170 │        Valid N         │      │      │      │     3│
2171 │        Total N         │      │      │      │     6│
2172 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2173 │  5.00  Count           │     1│     1│     1│     3│
2174 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2175 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2176 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2177 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2178 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2179 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2180 │        Valid N         │      │      │      │     3│
2181 │        Total N         │      │      │      │     6│
2182 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2183 │  Total Count           │     3│     3│     3│     9│
2184 │        Column %        │100.0%│100.0%│100.0%│     .│
2185 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2186 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2187 │        Row %           │     .│     .│     .│     .│
2188 │        Row Valid N %   │     .│     .│     .│     .│
2189 │        Row Total N %   │     .│     .│     .│     .│
2190 │        Valid N         │     3│     3│     3│     9│
2191 │        Total N         │     6│     6│     6│    36│
2192 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2193
2194                             Custom Tables
2195 ╭────────────────────────┬─────────────────────────────────────────╮
2196 │                        │                    y                    │
2197 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2198 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2199 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2200 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2201 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2202 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2203 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2204 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2205 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2206 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2207 │        Valid N         │      │      │      │      │      │     0│
2208 │        Total N         │      │      │      │      │      │     6│
2209 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2210 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2211 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2212 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2213 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2214 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2215 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2216 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2217 │        Valid N         │      │      │      │      │      │     0│
2218 │        Total N         │      │      │      │      │      │     6│
2219 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2220 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2221 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2222 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2223 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2224 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2225 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2226 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2227 │        Valid N         │      │      │      │      │      │     3│
2228 │        Total N         │      │      │      │      │      │     6│
2229 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2230 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2231 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2232 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2233 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2234 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2235 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2236 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2237 │        Valid N         │      │      │      │      │      │     3│
2238 │        Total N         │      │      │      │      │      │     6│
2239 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2240 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2241 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2242 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2243 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2244 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2245 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2246 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2247 │        Valid N         │      │      │      │      │      │     3│
2248 │        Total N         │      │      │      │      │      │     6│
2249 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2250 │  Total Count           │     5│     5│     5│     5│     5│    25│
2251 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2252 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2253 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2254 │        Row %           │     .│     .│     .│     .│     .│     .│
2255 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2256 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2257 │        Valid N         │     3│     0│     0│     3│     3│     9│
2258 │        Total N         │     6│     6│     6│     6│     6│    36│
2259 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2260
2261                         Custom Tables
2262 ╭────────────────────────┬──────────────────────────────────╮
2263 │                        │                 y                │
2264 │                        ├──────┬──────┬──────┬──────┬──────┤
2265 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2266 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2267 │x 1.00  Count           │     1│     1│     1│     1│     4│
2268 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2269 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2270 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2271 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2272 │        Row Valid N %   │     .│     .│     .│     .│     .│
2273 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2274 │        Valid N         │      │      │      │      │     0│
2275 │        Total N         │      │      │      │      │     6│
2276 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2277 │  2.00  Count           │     1│     1│     1│     1│     4│
2278 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2279 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2280 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2281 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2282 │        Row Valid N %   │     .│     .│     .│     .│     .│
2283 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2284 │        Valid N         │      │      │      │      │     0│
2285 │        Total N         │      │      │      │      │     6│
2286 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2287 │  3.00  Count           │     1│     1│     1│     1│     4│
2288 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2289 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2290 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2291 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2292 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2293 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2294 │        Valid N         │      │      │      │      │     3│
2295 │        Total N         │      │      │      │      │     6│
2296 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2297 │  4.00  Count           │     1│     1│     1│     1│     4│
2298 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2299 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2300 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2301 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2302 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2303 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2304 │        Valid N         │      │      │      │      │     3│
2305 │        Total N         │      │      │      │      │     6│
2306 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2307 │  Total Count           │     4│     4│     4│     4│    16│
2308 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2309 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2310 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2311 │        Row %           │     .│     .│     .│     .│     .│
2312 │        Row Valid N %   │     .│     .│     .│     .│     .│
2313 │        Row Total N %   │     .│     .│     .│     .│     .│
2314 │        Valid N         │     2│     0│     2│     2│     6│
2315 │        Total N         │     5│     5│     5│     5│    30│
2316 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2317 ])
2318 AT_CLEANUP
2319
2320 AT_SETUP([CTABLES SMISSING=LISTWISE])
2321 AT_KEYWORDS([SMISSING LISTWISE])
2322 AT_DATA([ctables.sps],
2323 [[DATA LIST LIST NOTABLE/x y z.
2324 BEGIN DATA.
2325 1  . 40
2326 1 10 50
2327 1 20 60
2328 1  .  .
2329 1 30  .
2330 END DATA.
2331 VARIABLE LEVEL x (NOMINAL).
2332
2333 CTABLES /TABLE (y + z) > x.
2334 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2335
2336 * The following doesn't come out as listwise because the tables are
2337 separate, not linked by an > operator.
2338 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2339 ]])
2340 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2341   Custom Tables
2342 ╭────────┬─────╮
2343 │        │ Mean│
2344 ├────────┼─────┤
2345 │y x 1.00│20.00│
2346 ├────────┼─────┤
2347 │z x 1.00│50.00│
2348 ╰────────┴─────╯
2349
2350   Custom Tables
2351 ╭────────┬─────╮
2352 │        │ Mean│
2353 ├────────┼─────┤
2354 │y x 1.00│15.00│
2355 ├────────┼─────┤
2356 │z x 1.00│55.00│
2357 ╰────────┴─────╯
2358
2359   Custom Tables
2360 ╭────────┬─────╮
2361 │        │ Mean│
2362 ├────────┼─────┤
2363 │y x 1.00│20.00│
2364 ├────────┼─────┤
2365 │z x 1.00│50.00│
2366 ╰────────┴─────╯
2367 ])
2368 AT_CLEANUP
2369
2370 AT_SETUP([CTABLES VLABELS - variables on different axes])
2371 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2372 AT_DATA([ctables.sps],
2373 [[GET 'nhtsa.sav'.
2374 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2375 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2376 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2377 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2378 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2379 ]])
2380 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2381                                  Custom Tables
2382 ╭────────────────────────────────────────────────────────────────┬────────────╮
2383 │                                                                │S3a. GENDER:│
2384 │                                                                ├─────┬──────┤
2385 │                                                                │ Male│Female│
2386 │                                                                ├─────┼──────┤
2387 │                                                                │Count│ Count│
2388 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2389 │D5a. What would you say is your primary    Cuban                │   13│     7│
2390 │ethnic background?                         Mexican              │  175│   136│
2391 │                                           Spanish              │   20│    28│
2392 │                                           South American       │   21│    13│
2393 │                                           Central American     │   27│    25│
2394 │                                           Puerto Rican, OR     │   37│    41│
2395 │                                           Something else       │   35│    33│
2396 │                                           Multiple - cannot    │    2│     5│
2397 │                                           choose one           │     │      │
2398 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2399
2400                   Custom Tables
2401 ╭──────────────────────────────────┬────────────╮
2402 │                                  │    QNS3A   │
2403 │                                  ├─────┬──────┤
2404 │                                  │ Male│Female│
2405 │                                  ├─────┼──────┤
2406 │                                  │Count│ Count│
2407 ├──────────────────────────────────┼─────┼──────┤
2408 │QND5A Cuban                       │   13│     7│
2409 │      Mexican                     │  175│   136│
2410 │      Spanish                     │   20│    28│
2411 │      South American              │   21│    13│
2412 │      Central American            │   27│    25│
2413 │      Puerto Rican, OR            │   37│    41│
2414 │      Something else              │   35│    33│
2415 │      Multiple - cannot choose one│    2│     5│
2416 ╰──────────────────────────────────┴─────┴──────╯
2417
2418                                  Custom Tables
2419 ╭────────────────────────────────────────────────────────────────┬────────────╮
2420 │                                                                │S3a. GENDER:│
2421 │                                                                ├─────┬──────┤
2422 │                                                                │ Male│Female│
2423 │                                                                ├─────┼──────┤
2424 │                                                                │Count│ Count│
2425 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2426 │D5a. What would you say is your primary    Cuban                │   13│     7│
2427 │ethnic background?                         Mexican              │  175│   136│
2428 │                                           Spanish              │   20│    28│
2429 │                                           South American       │   21│    13│
2430 │                                           Central American     │   27│    25│
2431 │                                           Puerto Rican, OR     │   37│    41│
2432 │                                           Something else       │   35│    33│
2433 │                                           Multiple - cannot    │    2│     5│
2434 │                                           choose one           │     │      │
2435 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2436
2437                                  Custom Tables
2438 ╭────────────────────────────────────────────────────────────┬────────────────╮
2439 │                                                            │   QNS3A S3a.   │
2440 │                                                            │     GENDER:    │
2441 │                                                            ├───────┬────────┤
2442 │                                                            │  Male │ Female │
2443 │                                                            ├───────┼────────┤
2444 │                                                            │ Count │  Count │
2445 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2446 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2447 │primary ethnic background?               Mexican            │    175│     136│
2448 │                                         Spanish            │     20│      28│
2449 │                                         South American     │     21│      13│
2450 │                                         Central American   │     27│      25│
2451 │                                         Puerto Rican, OR   │     37│      41│
2452 │                                         Something else     │     35│      33│
2453 │                                         Multiple - cannot  │      2│       5│
2454 │                                         choose one         │       │        │
2455 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2456
2457                Custom Tables
2458 ╭────────────────────────────┬─────┬──────╮
2459 │                            │ Male│Female│
2460 │                            ├─────┼──────┤
2461 │                            │Count│ Count│
2462 ├────────────────────────────┼─────┼──────┤
2463 │Cuban                       │   13│     7│
2464 │Mexican                     │  175│   136│
2465 │Spanish                     │   20│    28│
2466 │South American              │   21│    13│
2467 │Central American            │   27│    25│
2468 │Puerto Rican, OR            │   37│    41│
2469 │Something else              │   35│    33│
2470 │Multiple - cannot choose one│    2│     5│
2471 ╰────────────────────────────┴─────┴──────╯
2472 ])
2473 AT_CLEANUP
2474
2475 AT_SETUP([CTABLES VLABELS - stacked variables])
2476 AT_KEYWORDS([stack stacking])
2477 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2478 AT_DATA([ctables.sps],
2479 [[GET 'nhtsa.sav'.
2480 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2481 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2482 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2483 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2484 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2485 ]])
2486 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2487                                  Custom Tables
2488 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2489 │                                                                       │Count│
2490 ├───────────────────────────────────────────────────────────────────────┼─────┤
2491 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2492 │background?                                     Mexican                │  311│
2493 │                                                Spanish                │   48│
2494 │                                                South American         │   34│
2495 │                                                Central American       │   52│
2496 │                                                Puerto Rican, OR       │   78│
2497 │                                                Something else         │   68│
2498 │                                                Multiple - cannot      │    7│
2499 │                                                choose one             │     │
2500 ├───────────────────────────────────────────────────────────────────────┼─────┤
2501 │QNS3A                                           Male                   │ 3132│
2502 │                                                Female                 │ 3867│
2503 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2504
2505                   Custom Tables
2506 ╭─────────────────────────────────────────┬─────╮
2507 │                                         │Count│
2508 ├─────────────────────────────────────────┼─────┤
2509 │QND5A        Cuban                       │   20│
2510 │             Mexican                     │  311│
2511 │             Spanish                     │   48│
2512 │             South American              │   34│
2513 │             Central American            │   52│
2514 │             Puerto Rican, OR            │   78│
2515 │             Something else              │   68│
2516 │             Multiple - cannot choose one│    7│
2517 ├─────────────────────────────────────────┼─────┤
2518 │S3a. GENDER: Male                        │ 3132│
2519 │             Female                      │ 3867│
2520 ╰─────────────────────────────────────────┴─────╯
2521
2522                                  Custom Tables
2523 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2524 │                                                                       │Count│
2525 ├───────────────────────────────────────────────────────────────────────┼─────┤
2526 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2527 │background?                                     Mexican                │  311│
2528 │                                                Spanish                │   48│
2529 │                                                South American         │   34│
2530 │                                                Central American       │   52│
2531 │                                                Puerto Rican, OR       │   78│
2532 │                                                Something else         │   68│
2533 │                                                Multiple - cannot      │    7│
2534 │                                                choose one             │     │
2535 ├───────────────────────────────────────────────────────────────────────┼─────┤
2536 │Male                                                                   │ 3132│
2537 ├───────────────────────────────────────────────────────────────────────┼─────┤
2538 │Female                                                                 │ 3867│
2539 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2540
2541             Custom Tables
2542 ╭─────────────────────────────┬─────╮
2543 │                             │Count│
2544 ├─────────────────────────────┼─────┤
2545 │Cuban                        │   20│
2546 ├─────────────────────────────┼─────┤
2547 │Mexican                      │  311│
2548 ├─────────────────────────────┼─────┤
2549 │Spanish                      │   48│
2550 ├─────────────────────────────┼─────┤
2551 │South American               │   34│
2552 ├─────────────────────────────┼─────┤
2553 │Central American             │   52│
2554 ├─────────────────────────────┼─────┤
2555 │Puerto Rican, OR             │   78│
2556 ├─────────────────────────────┼─────┤
2557 │Something else               │   68│
2558 ├─────────────────────────────┼─────┤
2559 │Multiple - cannot choose one │    7│
2560 ├─────────────────────────────┼─────┤
2561 │S3a. GENDER:     Male        │ 3132│
2562 │                 Female      │ 3867│
2563 ╰─────────────────────────────┴─────╯
2564
2565             Custom Tables
2566 ╭────────────────────────────┬─────╮
2567 │                            │Count│
2568 ├────────────────────────────┼─────┤
2569 │Cuban                       │   20│
2570 │Mexican                     │  311│
2571 │Spanish                     │   48│
2572 │South American              │   34│
2573 │Central American            │   52│
2574 │Puerto Rican, OR            │   78│
2575 │Something else              │   68│
2576 │Multiple - cannot choose one│    7│
2577 │Male                        │ 3132│
2578 │Female                      │ 3867│
2579 ╰────────────────────────────┴─────╯
2580 ])
2581 AT_CLEANUP
2582
2583 AT_SETUP([CTABLES VLABELS - nested variables])
2584 AT_KEYWORDS([nest nesting])
2585 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2586 AT_DATA([ctables.sps],
2587 [[GET 'nhtsa.sav'.
2588 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2589 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2590 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2591 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2592 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2593 ]])
2594 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2595                                  Custom Tables
2596 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2597 │                                                                       │Count│
2598 ├───────────────────────────────────────────────────────────────────────┼─────┤
2599 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2600 │primary ethnic background?                                       Female│    7│
2601 │                                     ╶─────────────────────────────────┼─────┤
2602 │                                      Mexican              QNS3A Male  │  175│
2603 │                                                                 Female│  136│
2604 │                                     ╶─────────────────────────────────┼─────┤
2605 │                                      Spanish              QNS3A Male  │   20│
2606 │                                                                 Female│   28│
2607 │                                     ╶─────────────────────────────────┼─────┤
2608 │                                      South American       QNS3A Male  │   21│
2609 │                                                                 Female│   13│
2610 │                                     ╶─────────────────────────────────┼─────┤
2611 │                                      Central American     QNS3A Male  │   27│
2612 │                                                                 Female│   25│
2613 │                                     ╶─────────────────────────────────┼─────┤
2614 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2615 │                                                                 Female│   41│
2616 │                                     ╶─────────────────────────────────┼─────┤
2617 │                                      Something else       QNS3A Male  │   35│
2618 │                                                                 Female│   33│
2619 │                                     ╶─────────────────────────────────┼─────┤
2620 │                                      Multiple - cannot    QNS3A Male  │    2│
2621 │                                      choose one                 Female│    5│
2622 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2623
2624                          Custom Tables
2625 ╭──────────────────────────────────────────────────────┬─────╮
2626 │                                                      │Count│
2627 ├──────────────────────────────────────────────────────┼─────┤
2628 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2629 │                                                Female│    7│
2630 │     ╶────────────────────────────────────────────────┼─────┤
2631 │      Mexican                      S3a. GENDER: Male  │  175│
2632 │                                                Female│  136│
2633 │     ╶────────────────────────────────────────────────┼─────┤
2634 │      Spanish                      S3a. GENDER: Male  │   20│
2635 │                                                Female│   28│
2636 │     ╶────────────────────────────────────────────────┼─────┤
2637 │      South American               S3a. GENDER: Male  │   21│
2638 │                                                Female│   13│
2639 │     ╶────────────────────────────────────────────────┼─────┤
2640 │      Central American             S3a. GENDER: Male  │   27│
2641 │                                                Female│   25│
2642 │     ╶────────────────────────────────────────────────┼─────┤
2643 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2644 │                                                Female│   41│
2645 │     ╶────────────────────────────────────────────────┼─────┤
2646 │      Something else               S3a. GENDER: Male  │   35│
2647 │                                                Female│   33│
2648 │     ╶────────────────────────────────────────────────┼─────┤
2649 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2650 │                                                Female│    5│
2651 ╰──────────────────────────────────────────────────────┴─────╯
2652
2653                                  Custom Tables
2654 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2655 │                                                                       │Count│
2656 ├───────────────────────────────────────────────────────────────────────┼─────┤
2657 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2658 │ethnic background?                                               Female│    7│
2659 │                                          ╶────────────────────────────┼─────┤
2660 │                                           Mexican               Male  │  175│
2661 │                                                                 Female│  136│
2662 │                                          ╶────────────────────────────┼─────┤
2663 │                                           Spanish               Male  │   20│
2664 │                                                                 Female│   28│
2665 │                                          ╶────────────────────────────┼─────┤
2666 │                                           South American        Male  │   21│
2667 │                                                                 Female│   13│
2668 │                                          ╶────────────────────────────┼─────┤
2669 │                                           Central American      Male  │   27│
2670 │                                                                 Female│   25│
2671 │                                          ╶────────────────────────────┼─────┤
2672 │                                           Puerto Rican, OR      Male  │   37│
2673 │                                                                 Female│   41│
2674 │                                          ╶────────────────────────────┼─────┤
2675 │                                           Something else        Male  │   35│
2676 │                                                                 Female│   33│
2677 │                                          ╶────────────────────────────┼─────┤
2678 │                                           Multiple - cannot     Male  │    2│
2679 │                                           choose one            Female│    5│
2680 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2681
2682                       Custom Tables
2683 ╭────────────────────────────────────────────────┬─────╮
2684 │                                                │Count│
2685 ├────────────────────────────────────────────────┼─────┤
2686 │Cuban                        S3a. GENDER: Male  │   13│
2687 │                                          Female│    7│
2688 ├────────────────────────────────────────────────┼─────┤
2689 │Mexican                      S3a. GENDER: Male  │  175│
2690 │                                          Female│  136│
2691 ├────────────────────────────────────────────────┼─────┤
2692 │Spanish                      S3a. GENDER: Male  │   20│
2693 │                                          Female│   28│
2694 ├────────────────────────────────────────────────┼─────┤
2695 │South American               S3a. GENDER: Male  │   21│
2696 │                                          Female│   13│
2697 ├────────────────────────────────────────────────┼─────┤
2698 │Central American             S3a. GENDER: Male  │   27│
2699 │                                          Female│   25│
2700 ├────────────────────────────────────────────────┼─────┤
2701 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2702 │                                          Female│   41│
2703 ├────────────────────────────────────────────────┼─────┤
2704 │Something else               S3a. GENDER: Male  │   35│
2705 │                                          Female│   33│
2706 ├────────────────────────────────────────────────┼─────┤
2707 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2708 │                                          Female│    5│
2709 ╰────────────────────────────────────────────────┴─────╯
2710
2711                Custom Tables
2712 ╭───────────────────────────────────┬─────╮
2713 │                                   │Count│
2714 ├───────────────────────────────────┼─────┤
2715 │Cuban                        Male  │   13│
2716 │                             Female│    7│
2717 ├───────────────────────────────────┼─────┤
2718 │Mexican                      Male  │  175│
2719 │                             Female│  136│
2720 ├───────────────────────────────────┼─────┤
2721 │Spanish                      Male  │   20│
2722 │                             Female│   28│
2723 ├───────────────────────────────────┼─────┤
2724 │South American               Male  │   21│
2725 │                             Female│   13│
2726 ├───────────────────────────────────┼─────┤
2727 │Central American             Male  │   27│
2728 │                             Female│   25│
2729 ├───────────────────────────────────┼─────┤
2730 │Puerto Rican, OR             Male  │   37│
2731 │                             Female│   41│
2732 ├───────────────────────────────────┼─────┤
2733 │Something else               Male  │   35│
2734 │                             Female│   33│
2735 ├───────────────────────────────────┼─────┤
2736 │Multiple - cannot choose one Male  │    2│
2737 │                             Female│    5│
2738 ╰───────────────────────────────────┴─────╯
2739 ])
2740 AT_CLEANUP
2741
2742 AT_SETUP([CTABLES FORMAT EMPTY])
2743 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2744 AT_DATA([ctables.sps],
2745 [[GET 'nhtsa.sav'.
2746 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2747 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2748 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2749 ]])
2750 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2751                                  Custom Tables
2752 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2753 │                                             │   D5. ETHNICITY: Are you of   │
2754 │                                             │  Hispanic or Latino origin or │
2755 │                                             │            descent?           │
2756 │                                             ├───────────────┬───────────────┤
2757 │                                             │      Yes      │       No      │
2758 │                                             ├───────────────┼───────────────┤
2759 │                                             │     Count     │     Count     │
2760 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2761 │D5a. What would you say is   Cuban           │             20│              0│
2762 │your primary ethnic          Mexican         │            311│              0│
2763 │background?                  Spanish         │             48│              0│
2764 │                             South American  │             34│              0│
2765 │                             Central American│             52│              0│
2766 │                             Puerto Rican, OR│             78│              0│
2767 │                             Something else  │             68│              0│
2768 │                             Multiple -      │              7│              0│
2769 │                             cannot choose   │               │               │
2770 │                             one             │               │               │
2771 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2772
2773                                  Custom Tables
2774 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2775 │                                             │   D5. ETHNICITY: Are you of   │
2776 │                                             │  Hispanic or Latino origin or │
2777 │                                             │            descent?           │
2778 │                                             ├───────────────┬───────────────┤
2779 │                                             │      Yes      │       No      │
2780 │                                             ├───────────────┼───────────────┤
2781 │                                             │     Count     │     Count     │
2782 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2783 │D5a. What would you say is   Cuban           │             20│               │
2784 │your primary ethnic          Mexican         │            311│               │
2785 │background?                  Spanish         │             48│               │
2786 │                             South American  │             34│               │
2787 │                             Central American│             52│               │
2788 │                             Puerto Rican, OR│             78│               │
2789 │                             Something else  │             68│               │
2790 │                             Multiple -      │              7│               │
2791 │                             cannot choose   │               │               │
2792 │                             one             │               │               │
2793 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2794
2795                                  Custom Tables
2796 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2797 │                                             │   D5. ETHNICITY: Are you of   │
2798 │                                             │  Hispanic or Latino origin or │
2799 │                                             │            descent?           │
2800 │                                             ├───────────────┬───────────────┤
2801 │                                             │      Yes      │       No      │
2802 │                                             ├───────────────┼───────────────┤
2803 │                                             │     Count     │     Count     │
2804 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2805 │D5a. What would you say is   Cuban           │             20│n/a            │
2806 │your primary ethnic          Mexican         │            311│n/a            │
2807 │background?                  Spanish         │             48│n/a            │
2808 │                             South American  │             34│n/a            │
2809 │                             Central American│             52│n/a            │
2810 │                             Puerto Rican, OR│             78│n/a            │
2811 │                             Something else  │             68│n/a            │
2812 │                             Multiple -      │              7│n/a            │
2813 │                             cannot choose   │               │               │
2814 │                             one             │               │               │
2815 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2816 ])
2817 AT_CLEANUP
2818
2819 AT_SETUP([CTABLES FORMAT MISSING])
2820 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2821 AT_DATA([ctables.sps],
2822 [[GET 'nhtsa.sav'.
2823 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2824 ]])
2825 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2826                                  Custom Tables
2827 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2828 │                                             │   D5. ETHNICITY: Are you of   │
2829 │                                             │  Hispanic or Latino origin or │
2830 │                                             │            descent?           │
2831 │                                             ├───────────────┬───────────────┤
2832 │                                             │      Yes      │       No      │
2833 │                                             ├───────────────┼───────────────┤
2834 │                                             │    Column %   │    Column %   │
2835 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2836 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2837 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2838 │background?                  Spanish         │           7.8%│(no data)      │
2839 │                             South American  │           5.5%│(no data)      │
2840 │                             Central American│           8.4%│(no data)      │
2841 │                             Puerto Rican, OR│          12.6%│(no data)      │
2842 │                             Something else  │          11.0%│(no data)      │
2843 │                             Multiple -      │           1.1%│(no data)      │
2844 │                             cannot choose   │               │               │
2845 │                             one             │               │               │
2846 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2847 ])
2848 AT_CLEANUP
2849
2850 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2851 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2852 AT_DATA([ctables.sps],
2853 [[GET 'nhtsa.sav'.
2854 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2855 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2856 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2857 ]])
2858 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2859                                  Custom Tables
2860 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2861 │                                                              │Count│Column %│
2862 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2863 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2864 │occasion?                                        1            │  491│   34.9%│
2865 │                                                 2            │  462│   32.9%│
2866 │                                                 3            │  229│   16.3%│
2867 │                                                 4            │   82│    5.8%│
2868 │                                                 5            │   56│    4.0%│
2869 │                                                 6            │   32│    2.3%│
2870 │                                                 7            │    9│     .6%│
2871 │                                                 8            │    8│     .6%│
2872 │                                                 9            │    4│     .3%│
2873 │                                                 10           │    6│     .4%│
2874 │                                                 11           │    2│     .1%│
2875 │                                                 12           │    5│     .4%│
2876 │                                                 14           │    1│     .1%│
2877 │                                                 15           │    1│     .1%│
2878 │                                                 18           │    1│     .1%│
2879 │                                                 20           │    4│     .3%│
2880 │                                                 25           │    1│     .1%│
2881 │                                                 30           │    3│     .2%│
2882 │                                                 60           │    1│     .1%│
2883 │                                                 99+          │    0│     .0%│
2884 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2885
2886                                  Custom Tables
2887 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2888 │                                                              │Count│Column %│
2889 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2890 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2891 │occasion?                                        1            │  491│   34.9%│
2892 │                                                 2            │  462│   32.9%│
2893 │                                                 3            │  229│   16.3%│
2894 │                                                 4            │   82│    5.8%│
2895 │                                                 5            │   56│    4.0%│
2896 │                                                 6            │   32│    2.3%│
2897 │                                                 7            │    9│     .6%│
2898 │                                                 8            │    8│     .6%│
2899 │                                                 9            │<5   │     .3%│
2900 │                                                 10           │    6│     .4%│
2901 │                                                 11           │<5   │     .1%│
2902 │                                                 12           │    5│     .4%│
2903 │                                                 14           │<5   │     .1%│
2904 │                                                 15           │<5   │     .1%│
2905 │                                                 18           │<5   │     .1%│
2906 │                                                 20           │<5   │     .3%│
2907 │                                                 25           │<5   │     .1%│
2908 │                                                 30           │<5   │     .2%│
2909 │                                                 60           │<5   │     .1%│
2910 │                                                 99+          │<5   │     .0%│
2911 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2912
2913                                  Custom Tables
2914 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2915 │                                                              │Count│Column %│
2916 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2917 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2918 │occasion?                                        1            │  491│   34.9%│
2919 │                                                 2            │  462│   32.9%│
2920 │                                                 3            │  229│   16.3%│
2921 │                                                 4            │   82│    5.8%│
2922 │                                                 5            │   56│    4.0%│
2923 │                                                 6            │   32│    2.3%│
2924 │                                                 7            │<10  │     .6%│
2925 │                                                 8            │<10  │     .6%│
2926 │                                                 9            │<10  │     .3%│
2927 │                                                 10           │<10  │     .4%│
2928 │                                                 11           │<10  │     .1%│
2929 │                                                 12           │<10  │     .4%│
2930 │                                                 14           │<10  │     .1%│
2931 │                                                 15           │<10  │     .1%│
2932 │                                                 18           │<10  │     .1%│
2933 │                                                 20           │<10  │     .3%│
2934 │                                                 25           │<10  │     .1%│
2935 │                                                 30           │<10  │     .2%│
2936 │                                                 60           │<10  │     .1%│
2937 │                                                 99+          │<10  │     .0%│
2938 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2939 ])
2940 AT_CLEANUP
2941
2942 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2943 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2944 AT_DATA([ctables.sps],
2945 [[GET 'nhtsa.sav'.
2946 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2947 ]])
2948 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2949  Custom Tables
2950 ╭────────────╮
2951 │S3a. GENDER:│
2952 ├─────┬──────┤
2953 │ Male│Female│
2954 ├─────┼──────┤
2955 │Count│ Count│
2956 ├─────┼──────┤
2957 │ 3132│  3867│
2958 ╰─────┴──────╯
2959 ])
2960 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2961 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2962 maximumColumnWidth="192"
2963 minimumColumnWidth="96"
2964 ])
2965 AT_CLEANUP
2966
2967 AT_SETUP([CTABLES special formats])
2968 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2969 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2970 AT_DATA([ctables.sps],
2971 [[GET 'nhtsa.sav'.
2972 COMPUTE x = qnd3 - 4.
2973 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].
2974 ]])
2975 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2976                            Custom Tables
2977 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2978 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2979 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2980 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
2981 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2982 ])
2983 AT_CLEANUP
2984
2985 AT_SETUP([CTABLES TITLES])
2986 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2987 AT_DATA([ctables.sps],
2988 [[GET 'nhtsa.sav'.
2989 CTABLES
2990     /VLABELS VARIABLES=qn1 DISPLAY=NONE
2991     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
2992     /TITLES TITLE='How often do you drive?'
2993             CAPTION='Generated )TIME on )DATE'
2994             CORNER=')TABLE'.
2995 ]])
2996 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
2997 s&../../..&MM/DD/YY&'], [0], [dnl
2998                             How often do you drive?
2999 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3000 │                                   │               S3a. GENDER:              │
3001 │                                   ├────────────────────┬────────────────────┤
3002 │                                   │        Male        │       Female       │
3003 │                                   ├────────────────────┼────────────────────┤
3004 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3005 │                                   │ you of Hispanic or │ you of Hispanic or │
3006 │                                   │  Latino origin or  │  Latino origin or  │
3007 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3008 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3009 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3010 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3011 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3012 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3013 │Every day                          │      218│      2066│      166│      2175│
3014 │Several days a week                │       44│       391│       45│       782│
3015 │Once a week or less                │       16│       109│       12│       223│
3016 │Only certain times a year          │       15│        41│       11│        61│
3017 │Never                              │       39│       150│       56│       278│
3018 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3019 Generated HH:MM:SS on MM/DD/YY
3020 ])
3021 AT_CLEANUP
3022
3023 AT_SETUP([CTABLES area definitions])
3024 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3025 AT_DATA([ctables.sps],
3026 [[GET 'nhtsa.sav'.
3027 CTABLES
3028     /VLABELS VARIABLES=ALL DISPLAY=NAME
3029     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLE.ID, LAYER.ID, SUBTABLE.ID]
3030     /SLABELS POSITION=ROW
3031     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROW.ID, LAYERROW.ID]
3032     /SLABELS POSITION=ROW
3033     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COL.ID, LAYERCOL.ID]
3034     /SLABELS POSITION=ROW.
3035 ]])
3036 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3037                     Custom Tables
3038 Male
3039 ╭─────────────────────────────┬─────────────┬──────╮
3040 │                             │    QND7A    │ QN64B│
3041 │                             ├──────┬──────┼───┬──┤
3042 │                             │  Yes │  No  │   │  │
3043 │                             ├──────┼──────┤   │  │
3044 │                             │ QN86 │ QN86 │   │  │
3045 │                             ├───┬──┼───┬──┤   │  │
3046 │                             │Yes│No│Yes│No│Yes│No│
3047 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3048 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3049 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3050 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3051 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3052 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3053 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3054 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3055 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3056 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3057 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3058 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3059 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3060 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3061 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3062 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3063 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3064
3065                     Custom Tables
3066 Female
3067 ╭─────────────────────────────┬─────────────┬──────╮
3068 │                             │    QND7A    │ QN64B│
3069 │                             ├──────┬──────┼───┬──┤
3070 │                             │  Yes │  No  │   │  │
3071 │                             ├──────┼──────┤   │  │
3072 │                             │ QN86 │ QN86 │   │  │
3073 │                             ├───┬──┼───┬──┤   │  │
3074 │                             │Yes│No│Yes│No│Yes│No│
3075 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3076 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3077 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3078 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3079 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3080 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3081 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3082 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3083 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3084 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3085 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3086 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3087 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3088 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3089 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3090 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3091 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3092
3093                     Custom Tables
3094 Male
3095 ╭──────────────────────────────┬─────────────┬──────╮
3096 │                              │    QND7A    │ QN64B│
3097 │                              ├──────┬──────┼───┬──┤
3098 │                              │  Yes │  No  │   │  │
3099 │                              ├──────┼──────┤   │  │
3100 │                              │ QN86 │ QN86 │   │  │
3101 │                              ├───┬──┼───┬──┤   │  │
3102 │                              │Yes│No│Yes│No│Yes│No│
3103 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3104 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3105 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3106 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3107 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3108 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3109 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3110 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3111 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3112 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3113 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3114 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3115 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3116
3117                     Custom Tables
3118 Female
3119 ╭──────────────────────────────┬─────────────┬──────╮
3120 │                              │    QND7A    │ QN64B│
3121 │                              ├──────┬──────┼───┬──┤
3122 │                              │  Yes │  No  │   │  │
3123 │                              ├──────┼──────┤   │  │
3124 │                              │ QN86 │ QN86 │   │  │
3125 │                              ├───┬──┼───┬──┤   │  │
3126 │                              │Yes│No│Yes│No│Yes│No│
3127 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3128 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3129 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3130 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3131 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3132 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3133 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3134 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3135 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3136 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3137 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3138 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3139 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3140
3141                       Custom Tables
3142 Male
3143 ╭─────────────────────────────────┬─────────────┬──────╮
3144 │                                 │    QND7A    │ QN64B│
3145 │                                 ├──────┬──────┼───┬──┤
3146 │                                 │  Yes │  No  │   │  │
3147 │                                 ├──────┼──────┤   │  │
3148 │                                 │ QN86 │ QN86 │   │  │
3149 │                                 ├───┬──┼───┬──┤   │  │
3150 │                                 │Yes│No│Yes│No│Yes│No│
3151 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3152 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3153 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3154 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3155 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3156 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3157 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3158 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3159 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3160 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3161 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3162 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3163 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3164
3165                       Custom Tables
3166 Female
3167 ╭─────────────────────────────────┬─────────────┬──────╮
3168 │                                 │    QND7A    │ QN64B│
3169 │                                 ├──────┬──────┼───┬──┤
3170 │                                 │  Yes │  No  │   │  │
3171 │                                 ├──────┼──────┤   │  │
3172 │                                 │ QN86 │ QN86 │   │  │
3173 │                                 ├───┬──┼───┬──┤   │  │
3174 │                                 │Yes│No│Yes│No│Yes│No│
3175 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3176 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3177 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3178 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3179 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3180 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3181 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3182 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3183 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3184 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3185 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3186 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3187 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3188 ])
3189 AT_CLEANUP
3190
3191 AT_SETUP([CTABLES categorical summary functions])
3192 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3193 AT_DATA([ctables.sps],
3194 [[GET 'nhtsa.sav'.
3195 CTABLES
3196     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
3197     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
3198     /SLABELS POSITION=ROW.
3199 ]])
3200 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3201                                                       Custom Tables
3202 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
3203 │                 │                     D5a. What would you say is your primary ethnic background?                     │
3204 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
3205 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
3206 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
3207 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
3208 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3209 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
3210 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
3211 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
3212 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3213 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3214 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
3215 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3216 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3217 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
3218 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
3219 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3220 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
3221 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
3222 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
3223 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3224 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3225 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
3226 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3227 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3228 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
3229 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
3230 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3231 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
3232 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
3233 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
3234 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3235 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3236 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
3237 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3238 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3239 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
3240 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
3241 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3242 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
3243 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
3244 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
3245 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3246 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3247 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
3248 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3249 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3250 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
3251 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
3252 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
3253 ])
3254 AT_CLEANUP
3255
3256 AT_SETUP([CTABLES scale summary functions])
3257 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3258 AT_DATA([ctables.sps],
3259 [[GET 'nhtsa.sav'.
3260 SET TVAR=NAME.
3261
3262 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
3263   CTABLES later, to make the results easier to verify.
3264 SPLIT FILE BY REGION.
3265 FREQUENCIES
3266     qn19a
3267     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
3268     /FORMAT NOTABLE /MISSING=INCLUDE.
3269 SPLIT FILE OFF.
3270
3271 CTABLES
3272     /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
3273     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, COLPCT.SUM]
3274     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
3275     /SLABELS POSITION=ROW.
3276 ]])
3277 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3278          Statistics
3279 ╭────────────────┬────────╮
3280 │REGION          │  QN19A │
3281 ├────────────────┼────────┤
3282 │NE     N Valid  │     936│
3283 │         Missing│     473│
3284 │      ╶─────────┼────────┤
3285 │       Mean     │   19.33│
3286 │      ╶─────────┼────────┤
3287 │       S.E. Mean│     .14│
3288 │      ╶─────────┼────────┤
3289 │       Median   │   18.00│
3290 │      ╶─────────┼────────┤
3291 │       Mode     │   18.00│
3292 │      ╶─────────┼────────┤
3293 │       Std Dev  │    4.41│
3294 │      ╶─────────┼────────┤
3295 │       Variance │   19.41│
3296 │      ╶─────────┼────────┤
3297 │       Range    │   59.00│
3298 │      ╶─────────┼────────┤
3299 │       Minimum  │     .00│
3300 │      ╶─────────┼────────┤
3301 │       Maximum  │   59.00│
3302 │      ╶─────────┼────────┤
3303 │       Sum      │18092.00│
3304 ├────────────────┼────────┤
3305 │MW     N Valid  │    1019│
3306 │         Missing│     635│
3307 │      ╶─────────┼────────┤
3308 │       Mean     │   19.83│
3309 │      ╶─────────┼────────┤
3310 │       S.E. Mean│     .16│
3311 │      ╶─────────┼────────┤
3312 │       Median   │   19.00│
3313 │      ╶─────────┼────────┤
3314 │       Mode     │   18.00│
3315 │      ╶─────────┼────────┤
3316 │       Std Dev  │    5.15│
3317 │      ╶─────────┼────────┤
3318 │       Variance │   26.47│
3319 │      ╶─────────┼────────┤
3320 │       Range    │   71.00│
3321 │      ╶─────────┼────────┤
3322 │       Minimum  │    4.00│
3323 │      ╶─────────┼────────┤
3324 │       Maximum  │   75.00│
3325 │      ╶─────────┼────────┤
3326 │       Sum      │20206.00│
3327 ├────────────────┼────────┤
3328 │S      N Valid  │    1276│
3329 │         Missing│    1114│
3330 │      ╶─────────┼────────┤
3331 │       Mean     │   20.29│
3332 │      ╶─────────┼────────┤
3333 │       S.E. Mean│     .18│
3334 │      ╶─────────┼────────┤
3335 │       Median   │   19.00│
3336 │      ╶─────────┼────────┤
3337 │       Mode     │   18.00│
3338 │      ╶─────────┼────────┤
3339 │       Std Dev  │    6.44│
3340 │      ╶─────────┼────────┤
3341 │       Variance │   41.43│
3342 │      ╶─────────┼────────┤
3343 │       Range    │   75.00│
3344 │      ╶─────────┼────────┤
3345 │       Minimum  │    4.00│
3346 │      ╶─────────┼────────┤
3347 │       Maximum  │   79.00│
3348 │      ╶─────────┼────────┤
3349 │       Sum      │25886.00│
3350 ├────────────────┼────────┤
3351 │W      N Valid  │     950│
3352 │         Missing│     596│
3353 │      ╶─────────┼────────┤
3354 │       Mean     │   19.87│
3355 │      ╶─────────┼────────┤
3356 │       S.E. Mean│     .17│
3357 │      ╶─────────┼────────┤
3358 │       Median   │   19.00│
3359 │      ╶─────────┼────────┤
3360 │       Mode     │   18.00│
3361 │      ╶─────────┼────────┤
3362 │       Std Dev  │    5.25│
3363 │      ╶─────────┼────────┤
3364 │       Variance │   27.59│
3365 │      ╶─────────┼────────┤
3366 │       Range    │   61.00│
3367 │      ╶─────────┼────────┤
3368 │       Minimum  │    4.00│
3369 │      ╶─────────┼────────┤
3370 │       Maximum  │   65.00│
3371 │      ╶─────────┼────────┤
3372 │       Sum      │18877.00│
3373 ╰────────────────┴────────╯
3374
3375              Custom Tables
3376 ╭───────────────────────────┬────────╮
3377 │                           │  QN19A │
3378 ├───────────────────────────┼────────┤
3379 │REGION NE Valid N          │     936│
3380 │          Missing          │  473.00│
3381 │          Mean             │   19.33│
3382 │          Std Error of Mean│     .14│
3383 │          Median           │   18.00│
3384 │          Mode             │   18.00│
3385 │          Std Deviation    │    4.41│
3386 │          Variance         │   19.41│
3387 │          Range            │   59.00│
3388 │          Minimum          │     .00│
3389 │          Maximum          │   59.00│
3390 │          Sum              │18092.00│
3391 │          Count            │    1409│
3392 │          Total N          │    1409│
3393 │          Column Sum %     │   21.8%│
3394 │      ╶────────────────────┼────────┤
3395 │       MW Valid N          │    1019│
3396 │          Missing          │  635.00│
3397 │          Mean             │   19.83│
3398 │          Std Error of Mean│     .16│
3399 │          Median           │   19.00│
3400 │          Mode             │   18.00│
3401 │          Std Deviation    │    5.15│
3402 │          Variance         │   26.47│
3403 │          Range            │   71.00│
3404 │          Minimum          │    4.00│
3405 │          Maximum          │   75.00│
3406 │          Sum              │20206.00│
3407 │          Count            │    1654│
3408 │          Total N          │    1654│
3409 │          Column Sum %     │   24.3%│
3410 │      ╶────────────────────┼────────┤
3411 │       S  Valid N          │    1276│
3412 │          Missing          │ 1114.00│
3413 │          Mean             │   20.29│
3414 │          Std Error of Mean│     .18│
3415 │          Median           │   19.00│
3416 │          Mode             │   18.00│
3417 │          Std Deviation    │    6.44│
3418 │          Variance         │   41.43│
3419 │          Range            │   75.00│
3420 │          Minimum          │    4.00│
3421 │          Maximum          │   79.00│
3422 │          Sum              │25886.00│
3423 │          Count            │    2390│
3424 │          Total N          │    2390│
3425 │          Column Sum %     │   31.2%│
3426 │      ╶────────────────────┼────────┤
3427 │       W  Valid N          │     950│
3428 │          Missing          │  596.00│
3429 │          Mean             │   19.87│
3430 │          Std Error of Mean│     .17│
3431 │          Median           │   19.00│
3432 │          Mode             │   18.00│
3433 │          Std Deviation    │    5.25│
3434 │          Variance         │   27.59│
3435 │          Range            │   61.00│
3436 │          Minimum          │    4.00│
3437 │          Maximum          │   65.00│
3438 │          Sum              │18877.00│
3439 │          Count            │    1546│
3440 │          Total N          │    1546│
3441 │          Column Sum %     │   22.7%│
3442 ╰───────────────────────────┴────────╯
3443 ])
3444 AT_CLEANUP
3445
3446
3447 AT_SETUP([CTABLES hidden scale VLABELS])
3448 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3449 AT_DATA([ctables.sps],
3450 [[GET 'nhtsa.sav'.
3451 CTABLES
3452     /TABLE region BY qn19a + qn35
3453     /SLABELS POSITION=ROW.
3454 CTABLES
3455     /VLABELS VARIABLE=qn19a DISPLAY=NONE
3456     /TABLE region BY qn19a + qn35
3457     /SLABELS POSITION=ROW.
3458 CTABLES
3459     /VLABELS VARIABLE=qn35 DISPLAY=NONE
3460     /TABLE region BY qn19a + qn35
3461     /SLABELS POSITION=ROW.
3462
3463 * This one in particular caused a crash because no categories were
3464   created on the column axis, so passing in 0 for the index was still
3465   too big for that number of categories.  It was fixed by creating a
3466   name-only category for each variable despite the "NONE" request,
3467   then hiding the entire dimension's labels if all its labels were
3468   set to "NONE".
3469 CTABLES
3470     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
3471     /TABLE region BY qn19a + qn35
3472     /SLABELS POSITION=ROW.
3473 ]])
3474 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3475                                  Custom Tables
3476 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
3477 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
3478 │              │   when you first starting  │   many times have you driven a  │
3479 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
3480 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
3481 │              │      sips of alcohol.      │            beverages?           │
3482 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
3483 │Region NE Mean│                       19.33│                                2│
3484 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3485 │       MW Mean│                       19.83│                                2│
3486 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3487 │       S  Mean│                       20.29│                                2│
3488 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3489 │       W  Mean│                       19.87│                                2│
3490 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
3491
3492                                  Custom Tables
3493 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
3494 │              │     │  35. In the past thirty days, how many times have you  │
3495 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
3496 │              │QN19A│                  alcoholic beverages?                  │
3497 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
3498 │Region NE Mean│19.33│                                                       2│
3499 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3500 │       MW Mean│19.83│                                                       2│
3501 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3502 │       S  Mean│20.29│                                                       2│
3503 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3504 │       W  Mean│19.87│                                                       2│
3505 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
3506
3507                                  Custom Tables
3508 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
3509 │              │   19a. About how old were you when you first starting   │    │
3510 │              │  drinking alcohol, not counting small tastes or sips of │    │
3511 │              │                         alcohol.                        │qn35│
3512 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
3513 │Region NE Mean│                                                    19.33│   2│
3514 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3515 │       MW Mean│                                                    19.83│   2│
3516 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3517 │       S  Mean│                                                    20.29│   2│
3518 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3519 │       W  Mean│                                                    19.87│   2│
3520 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
3521
3522       Custom Tables
3523 ╭──────────────┬───────╮
3524 │Region NE Mean│19.33 2│
3525 │      ╶───────┼───────┤
3526 │       MW Mean│19.83 2│
3527 │      ╶───────┼───────┤
3528 │       S  Mean│20.29 2│
3529 │      ╶───────┼───────┤
3530 │       W  Mean│19.87 2│
3531 ╰──────────────┴───────╯
3532 ])
3533 AT_CLEANUP
3534
3535 AT_SETUP([CTABLES with SPLIT FILE])
3536 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3537 AT_DATA([ctables.sps],
3538 [[GET 'nhtsa.sav'.
3539
3540 SORT CASES BY qns3a.
3541
3542 CTABLES /TABLE qn105ba.
3543
3544 * Layered split has no effect on output.
3545 SPLIT FILE BY qns3a.
3546 CTABLES /TABLE qn105ba.
3547
3548 * Add column variable qns3a to compare against separate splits.
3549 CTABLES /TABLE qn105ba BY qns3a.
3550
3551 * Separate splits are truly output separately.
3552 SPLIT FILE SEPARATE BY qns3a.
3553 CTABLES /TABLE qn105ba.
3554 ]])
3555 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
3556                                   Custom Tables
3557 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3558 │                                                                        │Count│
3559 ├────────────────────────────────────────────────────────────────────────┼─────┤
3560 │105b. How likely is it that drivers who have had too much   Almost      │  700│
3561 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3562 │                                                            Very likely │ 1502│
3563 │                                                            Somewhat    │ 2763│
3564 │                                                            likely      │     │
3565 │                                                            Somewhat    │ 1307│
3566 │                                                            unlikely    │     │
3567 │                                                            Very        │  609│
3568 │                                                            unlikely    │     │
3569 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3570
3571                                   Custom Tables
3572 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3573 │                                                                        │Count│
3574 ├────────────────────────────────────────────────────────────────────────┼─────┤
3575 │105b. How likely is it that drivers who have had too much   Almost      │  700│
3576 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3577 │                                                            Very likely │ 1502│
3578 │                                                            Somewhat    │ 2763│
3579 │                                                            likely      │     │
3580 │                                                            Somewhat    │ 1307│
3581 │                                                            unlikely    │     │
3582 │                                                            Very        │  609│
3583 │                                                            unlikely    │     │
3584 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3585
3586                                   Custom Tables
3587 ╭─────────────────────────────────────────────────────────────────┬────────────╮
3588 │                                                                 │S3a. GENDER:│
3589 │                                                                 ├─────┬──────┤
3590 │                                                                 │ Male│Female│
3591 │                                                                 ├─────┼──────┤
3592 │                                                                 │Count│ Count│
3593 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
3594 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
3595 │much to drink to drive safely will A. Get stopped by certain     │     │      │
3596 │the police?                                          Very likely │  660│   842│
3597 │                                                     Somewhat    │ 1174│  1589│
3598 │                                                     likely      │     │      │
3599 │                                                     Somewhat    │  640│   667│
3600 │                                                     unlikely    │     │      │
3601 │                                                     Very        │  311│   298│
3602 │                                                     unlikely    │     │      │
3603 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
3604
3605     Split Values
3606 ╭────────────┬─────╮
3607 │Variable    │Value│
3608 ├────────────┼─────┤
3609 │S3a. GENDER:│Male │
3610 ╰────────────┴─────╯
3611
3612                                   Custom Tables
3613 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3614 │                                                                        │Count│
3615 ├────────────────────────────────────────────────────────────────────────┼─────┤
3616 │105b. How likely is it that drivers who have had too much   Almost      │  297│
3617 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3618 │                                                            Very likely │  660│
3619 │                                                            Somewhat    │ 1174│
3620 │                                                            likely      │     │
3621 │                                                            Somewhat    │  640│
3622 │                                                            unlikely    │     │
3623 │                                                            Very        │  311│
3624 │                                                            unlikely    │     │
3625 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3626
3627      Split Values
3628 ╭────────────┬──────╮
3629 │Variable    │ Value│
3630 ├────────────┼──────┤
3631 │S3a. GENDER:│Female│
3632 ╰────────────┴──────╯
3633
3634                                   Custom Tables
3635 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3636 │                                                                        │Count│
3637 ├────────────────────────────────────────────────────────────────────────┼─────┤
3638 │105b. How likely is it that drivers who have had too much   Almost      │  403│
3639 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3640 │                                                            Very likely │  842│
3641 │                                                            Somewhat    │ 1589│
3642 │                                                            likely      │     │
3643 │                                                            Somewhat    │  667│
3644 │                                                            unlikely    │     │
3645 │                                                            Very        │  298│
3646 │                                                            unlikely    │     │
3647 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3648 ])
3649 AT_CLEANUP
3650
3651 AT_SETUP([CTABLES variable level inference])
3652 AT_DATA([data.txt], [dnl
3653 dnl n1 has 10 unique small values -> nominal.
3654 dnl n2 has 23 unique small values -> nominal.
3655 dnl n3 is all missing -> nominal.
3656 dnl s1 has 24 unique small values -> scale.
3657 dnl s2 has one negative value -> scale.
3658 dnl s3 has one non-integer value -> scale.
3659 dnl s4 has no valid values less than 10 -> scale.
3660 dnl s5 has no valid values less than 10,000 -> scale.
3661 1  1  . 1  1  1    10 10001
3662 2  2  . 2  2  2    11 10002
3663 3  3  . 3  3  3    12 10003
3664 4  4  . 4  4  4    13 10004
3665 5  5  . 5  5  5    14 10005
3666 6  6  . 6  6  6    15 10006
3667 7  7  . 7  7  7    16 10007
3668 8  8  . 8  8  8    17 10008
3669 9  9  . 9  9  9    18 10009
3670 10 10 . 10 10 10.5 19 110000
3671 1  11 . 11 -1 1    11 10001
3672 2  12 . 12 2  2    12 10002
3673 3  13 . 13 3  3    13 10003
3674 4  14 . 14 4  4    14 10004
3675 5  15 . 15 5  5    15 10005
3676 6  16 . 16 6  6    16 10006
3677 7  17 . 17 7  7    17 10007
3678 8  18 . 18 8  8    18 10008
3679 9  19 . 19 9  9    19 10009
3680 1  20 . 20 1  1    20 10001
3681 2  21 . 21 2  2    21 10002
3682 3  22 . 22 3  3    22 10003
3683 4  23 . 23 4  4    23 10004
3684 5  23 . 24 5  5    24 10005
3685 6  23 . 24 6  6    25 10006
3686 ])
3687
3688 AT_DATA([ctables.sps], [dnl
3689 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
3690
3691 * Nominal formats (copied from data that will default to scale).
3692 COMPUTE n4=s1.
3693 COMPUTE n5=s1.
3694 FORMATS n4(WKDAY5) n5(MONTH5).
3695
3696 * Scale formats (copied from data that will default to nominal).
3697 COMPUTE s6=n1.
3698 COMPUTE s7=n1.
3699 COMPUTE s8=n1.
3700 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
3701
3702 STRING string(A8).
3703
3704 DISPLAY DICTIONARY.
3705 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
3706 DISPLAY DICTIONARY.
3707 ])
3708
3709 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
3710                                     Variables
3711 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
3712 │      │        │  Measurement │     │     │         │            │            │
3713 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
3714 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
3715 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3716 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3717 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3718 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3719 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3720 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3721 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3722 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3723 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
3724 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
3725 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
3726 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
3727 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
3728 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
3729 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
3730
3731         Custom Tables
3732 ╭────────────┬─────┬────────╮
3733 │            │Count│  Mean  │
3734 ├────────────┼─────┼────────┤
3735 │n1     1.00 │    3│        │
3736 │       2.00 │    3│        │
3737 │       3.00 │    3│        │
3738 │       4.00 │    3│        │
3739 │       5.00 │    3│        │
3740 │       6.00 │    3│        │
3741 │       7.00 │    2│        │
3742 │       8.00 │    2│        │
3743 │       9.00 │    2│        │
3744 │       10.00│    1│        │
3745 ├────────────┼─────┼────────┤
3746 │n2     1.00 │    1│        │
3747 │       2.00 │    1│        │
3748 │       3.00 │    1│        │
3749 │       4.00 │    1│        │
3750 │       5.00 │    1│        │
3751 │       6.00 │    1│        │
3752 │       7.00 │    1│        │
3753 │       8.00 │    1│        │
3754 │       9.00 │    1│        │
3755 │       10.00│    1│        │
3756 │       11.00│    1│        │
3757 │       12.00│    1│        │
3758 │       13.00│    1│        │
3759 │       14.00│    1│        │
3760 │       15.00│    1│        │
3761 │       16.00│    1│        │
3762 │       17.00│    1│        │
3763 │       18.00│    1│        │
3764 │       19.00│    1│        │
3765 │       20.00│    1│        │
3766 │       21.00│    1│        │
3767 │       22.00│    1│        │
3768 │       23.00│    3│        │
3769 ├────────────┼─────┼────────┤
3770 │string      │   25│        │
3771 ├────────────┼─────┼────────┤
3772 │s1          │     │   12.96│
3773 ├────────────┼─────┼────────┤
3774 │s2          │     │    4.76│
3775 ├────────────┼─────┼────────┤
3776 │s3          │     │    4.86│
3777 ├────────────┼─────┼────────┤
3778 │s4          │     │   16.60│
3779 ├────────────┼─────┼────────┤
3780 │s5          │     │14004.44│
3781 ╰────────────┴─────┴────────╯
3782
3783                                     Variables
3784 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
3785 │      │        │  Measurement │     │     │         │            │            │
3786 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
3787 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
3788 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
3789 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
3790 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
3791 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3792 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3793 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3794 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3795 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3796 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
3797 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
3798 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
3799 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
3800 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
3801 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
3802 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
3803 ])
3804 AT_CLEANUP