fd1000b853734325834f237971e4f03b38502543
[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 CLABELS])
2055 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2056 AT_DATA([ctables.sps],
2057 [[GET 'nhtsa.sav'.
2058 CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [COLPCT].
2059 CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [COLPCT] /CLABELS ROWLABELS=OPPOSITE.
2060 CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [COLPCT] /CLABELS ROWLABELS=LAYER.
2061 ]])
2062 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode], [0], [dnl
2063 ])
2064 AT_CLEANUP
2065
2066 AT_SETUP([CTABLES missing values])
2067 AT_DATA([ctables.sps],
2068 [[DATA LIST LIST NOTABLE/x y.
2069 BEGIN DATA.
2070 1 1
2071 1 2
2072 1 3
2073 1 4
2074 1 5
2075 1 .
2076 2 1
2077 2 2
2078 2 3
2079 2 4
2080 2 5
2081 2 .
2082 3 1
2083 3 2
2084 3 3
2085 3 4
2086 3 5
2087 3 .
2088 4 1
2089 4 2
2090 4 3
2091 4 4
2092 4 5
2093 4 .
2094 5 1
2095 5 2
2096 5 3
2097 5 4
2098 5 5
2099 5 .
2100 . 1
2101 . 2
2102 . 3
2103 . 4
2104 . 5
2105 . .
2106 END DATA.
2107 MISSING VALUES x (1, 2) y (2, 3).
2108 VARIABLE LEVEL ALL (NOMINAL).
2109
2110 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2111                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2112     /CATEGORIES VARIABLES=ALL TOTAL=YES.
2113 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2114                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2115     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2116 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2117                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2118     /CATEGORIES VARIABLES=ALL TOTAL=YES
2119     /SLABELS POSITION=ROW.
2120 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2121                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2122     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2123     /SLABELS POSITION=ROW.
2124 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2125                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2126     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
2127     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
2128     /SLABELS POSITION=ROW.
2129 ]])
2130 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2131                                Custom Tables
2132 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2133 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2134 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2135 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2136 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2137 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
2138 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
2139 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2140 dnl Note that Column Total N % doesn't add up to 100 because missing
2141 dnl values are included in the total but not shown as a category and this
2142 dnl is expected behavior.
2143
2144                                Custom Tables
2145 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2146 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2147 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2148 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2149 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
2150 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2151 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2152 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
2153 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
2154 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2155 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2156 dnl values are included in the total but not shown as a category and this
2157 dnl is expected behavior.
2158
2159                      Custom Tables
2160 ╭────────────────────────┬───────────────────────────╮
2161 │                        │             y             │
2162 │                        ├──────┬──────┬──────┬──────┤
2163 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
2164 ├────────────────────────┼──────┼──────┼──────┼──────┤
2165 │x 3.00  Count           │     1│     1│     1│     3│
2166 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2167 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2168 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2169 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2170 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2171 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2172 │        Valid N         │      │      │      │     3│
2173 │        Total N         │      │      │      │     6│
2174 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2175 │  4.00  Count           │     1│     1│     1│     3│
2176 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2177 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2178 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2179 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2180 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2181 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2182 │        Valid N         │      │      │      │     3│
2183 │        Total N         │      │      │      │     6│
2184 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2185 │  5.00  Count           │     1│     1│     1│     3│
2186 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
2187 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
2188 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
2189 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
2190 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
2191 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
2192 │        Valid N         │      │      │      │     3│
2193 │        Total N         │      │      │      │     6│
2194 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2195 │  Total Count           │     3│     3│     3│     9│
2196 │        Column %        │100.0%│100.0%│100.0%│     .│
2197 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
2198 │        Column Total N %│100.0%│100.0%│100.0%│     .│
2199 │        Row %           │     .│     .│     .│     .│
2200 │        Row Valid N %   │     .│     .│     .│     .│
2201 │        Row Total N %   │     .│     .│     .│     .│
2202 │        Valid N         │     3│     3│     3│     9│
2203 │        Total N         │     6│     6│     6│    36│
2204 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2205
2206                             Custom Tables
2207 ╭────────────────────────┬─────────────────────────────────────────╮
2208 │                        │                    y                    │
2209 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
2210 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2211 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2212 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
2213 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2214 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2215 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2216 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2217 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2218 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2219 │        Valid N         │      │      │      │      │      │     0│
2220 │        Total N         │      │      │      │      │      │     6│
2221 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2222 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
2223 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2224 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
2225 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2226 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2227 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2228 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2229 │        Valid N         │      │      │      │      │      │     0│
2230 │        Total N         │      │      │      │      │      │     6│
2231 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2232 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
2233 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2234 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2235 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2236 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2237 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2238 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2239 │        Valid N         │      │      │      │      │      │     3│
2240 │        Total N         │      │      │      │      │      │     6│
2241 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2242 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
2243 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2244 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2245 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2246 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2247 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2248 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2249 │        Valid N         │      │      │      │      │      │     3│
2250 │        Total N         │      │      │      │      │      │     6│
2251 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2252 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
2253 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2254 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
2255 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
2256 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2257 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
2258 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2259 │        Valid N         │      │      │      │      │      │     3│
2260 │        Total N         │      │      │      │      │      │     6│
2261 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2262 │  Total Count           │     5│     5│     5│     5│     5│    25│
2263 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2264 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
2265 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
2266 │        Row %           │     .│     .│     .│     .│     .│     .│
2267 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
2268 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
2269 │        Valid N         │     3│     0│     0│     3│     3│     9│
2270 │        Total N         │     6│     6│     6│     6│     6│    36│
2271 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2272
2273                         Custom Tables
2274 ╭────────────────────────┬──────────────────────────────────╮
2275 │                        │                 y                │
2276 │                        ├──────┬──────┬──────┬──────┬──────┤
2277 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2278 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2279 │x 1.00  Count           │     1│     1│     1│     1│     4│
2280 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2281 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2282 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2283 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2284 │        Row Valid N %   │     .│     .│     .│     .│     .│
2285 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2286 │        Valid N         │      │      │      │      │     0│
2287 │        Total N         │      │      │      │      │     6│
2288 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2289 │  2.00  Count           │     1│     1│     1│     1│     4│
2290 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2291 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
2292 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2293 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2294 │        Row Valid N %   │     .│     .│     .│     .│     .│
2295 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2296 │        Valid N         │      │      │      │      │     0│
2297 │        Total N         │      │      │      │      │     6│
2298 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2299 │  3.00  Count           │     1│     1│     1│     1│     4│
2300 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2301 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2302 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2303 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2304 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2305 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2306 │        Valid N         │      │      │      │      │     3│
2307 │        Total N         │      │      │      │      │     6│
2308 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2309 │  4.00  Count           │     1│     1│     1│     1│     4│
2310 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2311 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2312 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2313 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2314 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2315 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2316 │        Valid N         │      │      │      │      │     3│
2317 │        Total N         │      │      │      │      │     6│
2318 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2319 │  Total Count           │     4│     4│     4│     4│    16│
2320 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2321 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2322 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2323 │        Row %           │     .│     .│     .│     .│     .│
2324 │        Row Valid N %   │     .│     .│     .│     .│     .│
2325 │        Row Total N %   │     .│     .│     .│     .│     .│
2326 │        Valid N         │     2│     0│     2│     2│     6│
2327 │        Total N         │     5│     5│     5│     5│    30│
2328 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2329 ])
2330 AT_CLEANUP
2331
2332 AT_SETUP([CTABLES SMISSING=LISTWISE])
2333 AT_KEYWORDS([SMISSING LISTWISE])
2334 AT_DATA([ctables.sps],
2335 [[DATA LIST LIST NOTABLE/x y z.
2336 BEGIN DATA.
2337 1  . 40
2338 1 10 50
2339 1 20 60
2340 1  .  .
2341 1 30  .
2342 END DATA.
2343 VARIABLE LEVEL x (NOMINAL).
2344
2345 CTABLES /TABLE (y + z) > x.
2346 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2347
2348 * The following doesn't come out as listwise because the tables are
2349 separate, not linked by an > operator.
2350 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2351 ]])
2352 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2353   Custom Tables
2354 ╭────────┬─────╮
2355 │        │ Mean│
2356 ├────────┼─────┤
2357 │y x 1.00│20.00│
2358 ├────────┼─────┤
2359 │z x 1.00│50.00│
2360 ╰────────┴─────╯
2361
2362   Custom Tables
2363 ╭────────┬─────╮
2364 │        │ Mean│
2365 ├────────┼─────┤
2366 │y x 1.00│15.00│
2367 ├────────┼─────┤
2368 │z x 1.00│55.00│
2369 ╰────────┴─────╯
2370
2371   Custom Tables
2372 ╭────────┬─────╮
2373 │        │ Mean│
2374 ├────────┼─────┤
2375 │y x 1.00│20.00│
2376 ├────────┼─────┤
2377 │z x 1.00│50.00│
2378 ╰────────┴─────╯
2379 ])
2380 AT_CLEANUP
2381
2382 AT_SETUP([CTABLES VLABELS - variables on different axes])
2383 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2384 AT_DATA([ctables.sps],
2385 [[GET 'nhtsa.sav'.
2386 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2387 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2388 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2389 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2390 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2391 ]])
2392 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2393                                  Custom Tables
2394 ╭────────────────────────────────────────────────────────────────┬────────────╮
2395 │                                                                │S3a. GENDER:│
2396 │                                                                ├─────┬──────┤
2397 │                                                                │ Male│Female│
2398 │                                                                ├─────┼──────┤
2399 │                                                                │Count│ Count│
2400 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2401 │D5a. What would you say is your primary    Cuban                │   13│     7│
2402 │ethnic background?                         Mexican              │  175│   136│
2403 │                                           Spanish              │   20│    28│
2404 │                                           South American       │   21│    13│
2405 │                                           Central American     │   27│    25│
2406 │                                           Puerto Rican, OR     │   37│    41│
2407 │                                           Something else       │   35│    33│
2408 │                                           Multiple - cannot    │    2│     5│
2409 │                                           choose one           │     │      │
2410 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2411
2412                   Custom Tables
2413 ╭──────────────────────────────────┬────────────╮
2414 │                                  │    QNS3A   │
2415 │                                  ├─────┬──────┤
2416 │                                  │ Male│Female│
2417 │                                  ├─────┼──────┤
2418 │                                  │Count│ Count│
2419 ├──────────────────────────────────┼─────┼──────┤
2420 │QND5A Cuban                       │   13│     7│
2421 │      Mexican                     │  175│   136│
2422 │      Spanish                     │   20│    28│
2423 │      South American              │   21│    13│
2424 │      Central American            │   27│    25│
2425 │      Puerto Rican, OR            │   37│    41│
2426 │      Something else              │   35│    33│
2427 │      Multiple - cannot choose one│    2│     5│
2428 ╰──────────────────────────────────┴─────┴──────╯
2429
2430                                  Custom Tables
2431 ╭────────────────────────────────────────────────────────────────┬────────────╮
2432 │                                                                │S3a. GENDER:│
2433 │                                                                ├─────┬──────┤
2434 │                                                                │ Male│Female│
2435 │                                                                ├─────┼──────┤
2436 │                                                                │Count│ Count│
2437 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2438 │D5a. What would you say is your primary    Cuban                │   13│     7│
2439 │ethnic background?                         Mexican              │  175│   136│
2440 │                                           Spanish              │   20│    28│
2441 │                                           South American       │   21│    13│
2442 │                                           Central American     │   27│    25│
2443 │                                           Puerto Rican, OR     │   37│    41│
2444 │                                           Something else       │   35│    33│
2445 │                                           Multiple - cannot    │    2│     5│
2446 │                                           choose one           │     │      │
2447 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2448
2449                                  Custom Tables
2450 ╭────────────────────────────────────────────────────────────┬────────────────╮
2451 │                                                            │   QNS3A S3a.   │
2452 │                                                            │     GENDER:    │
2453 │                                                            ├───────┬────────┤
2454 │                                                            │  Male │ Female │
2455 │                                                            ├───────┼────────┤
2456 │                                                            │ Count │  Count │
2457 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2458 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2459 │primary ethnic background?               Mexican            │    175│     136│
2460 │                                         Spanish            │     20│      28│
2461 │                                         South American     │     21│      13│
2462 │                                         Central American   │     27│      25│
2463 │                                         Puerto Rican, OR   │     37│      41│
2464 │                                         Something else     │     35│      33│
2465 │                                         Multiple - cannot  │      2│       5│
2466 │                                         choose one         │       │        │
2467 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2468
2469                Custom Tables
2470 ╭────────────────────────────┬─────┬──────╮
2471 │                            │ Male│Female│
2472 │                            ├─────┼──────┤
2473 │                            │Count│ Count│
2474 ├────────────────────────────┼─────┼──────┤
2475 │Cuban                       │   13│     7│
2476 │Mexican                     │  175│   136│
2477 │Spanish                     │   20│    28│
2478 │South American              │   21│    13│
2479 │Central American            │   27│    25│
2480 │Puerto Rican, OR            │   37│    41│
2481 │Something else              │   35│    33│
2482 │Multiple - cannot choose one│    2│     5│
2483 ╰────────────────────────────┴─────┴──────╯
2484 ])
2485 AT_CLEANUP
2486
2487 AT_SETUP([CTABLES VLABELS - stacked variables])
2488 AT_KEYWORDS([stack stacking])
2489 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2490 AT_DATA([ctables.sps],
2491 [[GET 'nhtsa.sav'.
2492 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2493 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2494 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2495 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2496 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2497 ]])
2498 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2499                                  Custom Tables
2500 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2501 │                                                                       │Count│
2502 ├───────────────────────────────────────────────────────────────────────┼─────┤
2503 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2504 │background?                                     Mexican                │  311│
2505 │                                                Spanish                │   48│
2506 │                                                South American         │   34│
2507 │                                                Central American       │   52│
2508 │                                                Puerto Rican, OR       │   78│
2509 │                                                Something else         │   68│
2510 │                                                Multiple - cannot      │    7│
2511 │                                                choose one             │     │
2512 ├───────────────────────────────────────────────────────────────────────┼─────┤
2513 │QNS3A                                           Male                   │ 3132│
2514 │                                                Female                 │ 3867│
2515 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2516
2517                   Custom Tables
2518 ╭─────────────────────────────────────────┬─────╮
2519 │                                         │Count│
2520 ├─────────────────────────────────────────┼─────┤
2521 │QND5A        Cuban                       │   20│
2522 │             Mexican                     │  311│
2523 │             Spanish                     │   48│
2524 │             South American              │   34│
2525 │             Central American            │   52│
2526 │             Puerto Rican, OR            │   78│
2527 │             Something else              │   68│
2528 │             Multiple - cannot choose one│    7│
2529 ├─────────────────────────────────────────┼─────┤
2530 │S3a. GENDER: Male                        │ 3132│
2531 │             Female                      │ 3867│
2532 ╰─────────────────────────────────────────┴─────╯
2533
2534                                  Custom Tables
2535 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2536 │                                                                       │Count│
2537 ├───────────────────────────────────────────────────────────────────────┼─────┤
2538 │D5a. What would you say is your primary ethnic  Cuban                  │   20│
2539 │background?                                     Mexican                │  311│
2540 │                                                Spanish                │   48│
2541 │                                                South American         │   34│
2542 │                                                Central American       │   52│
2543 │                                                Puerto Rican, OR       │   78│
2544 │                                                Something else         │   68│
2545 │                                                Multiple - cannot      │    7│
2546 │                                                choose one             │     │
2547 ├───────────────────────────────────────────────────────────────────────┼─────┤
2548 │Male                                                                   │ 3132│
2549 ├───────────────────────────────────────────────────────────────────────┼─────┤
2550 │Female                                                                 │ 3867│
2551 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2552
2553             Custom Tables
2554 ╭─────────────────────────────┬─────╮
2555 │                             │Count│
2556 ├─────────────────────────────┼─────┤
2557 │Cuban                        │   20│
2558 ├─────────────────────────────┼─────┤
2559 │Mexican                      │  311│
2560 ├─────────────────────────────┼─────┤
2561 │Spanish                      │   48│
2562 ├─────────────────────────────┼─────┤
2563 │South American               │   34│
2564 ├─────────────────────────────┼─────┤
2565 │Central American             │   52│
2566 ├─────────────────────────────┼─────┤
2567 │Puerto Rican, OR             │   78│
2568 ├─────────────────────────────┼─────┤
2569 │Something else               │   68│
2570 ├─────────────────────────────┼─────┤
2571 │Multiple - cannot choose one │    7│
2572 ├─────────────────────────────┼─────┤
2573 │S3a. GENDER:     Male        │ 3132│
2574 │                 Female      │ 3867│
2575 ╰─────────────────────────────┴─────╯
2576
2577             Custom Tables
2578 ╭────────────────────────────┬─────╮
2579 │                            │Count│
2580 ├────────────────────────────┼─────┤
2581 │Cuban                       │   20│
2582 │Mexican                     │  311│
2583 │Spanish                     │   48│
2584 │South American              │   34│
2585 │Central American            │   52│
2586 │Puerto Rican, OR            │   78│
2587 │Something else              │   68│
2588 │Multiple - cannot choose one│    7│
2589 │Male                        │ 3132│
2590 │Female                      │ 3867│
2591 ╰────────────────────────────┴─────╯
2592 ])
2593 AT_CLEANUP
2594
2595 AT_SETUP([CTABLES VLABELS - nested variables])
2596 AT_KEYWORDS([nest nesting])
2597 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2598 AT_DATA([ctables.sps],
2599 [[GET 'nhtsa.sav'.
2600 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2601 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2602 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2603 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2604 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2605 ]])
2606 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2607                                  Custom Tables
2608 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2609 │                                                                       │Count│
2610 ├───────────────────────────────────────────────────────────────────────┼─────┤
2611 │D5a. What would you say is your       Cuban                QNS3A Male  │   13│
2612 │primary ethnic background?                                       Female│    7│
2613 │                                     ╶─────────────────────────────────┼─────┤
2614 │                                      Mexican              QNS3A Male  │  175│
2615 │                                                                 Female│  136│
2616 │                                     ╶─────────────────────────────────┼─────┤
2617 │                                      Spanish              QNS3A Male  │   20│
2618 │                                                                 Female│   28│
2619 │                                     ╶─────────────────────────────────┼─────┤
2620 │                                      South American       QNS3A Male  │   21│
2621 │                                                                 Female│   13│
2622 │                                     ╶─────────────────────────────────┼─────┤
2623 │                                      Central American     QNS3A Male  │   27│
2624 │                                                                 Female│   25│
2625 │                                     ╶─────────────────────────────────┼─────┤
2626 │                                      Puerto Rican, OR     QNS3A Male  │   37│
2627 │                                                                 Female│   41│
2628 │                                     ╶─────────────────────────────────┼─────┤
2629 │                                      Something else       QNS3A Male  │   35│
2630 │                                                                 Female│   33│
2631 │                                     ╶─────────────────────────────────┼─────┤
2632 │                                      Multiple - cannot    QNS3A Male  │    2│
2633 │                                      choose one                 Female│    5│
2634 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2635
2636                          Custom Tables
2637 ╭──────────────────────────────────────────────────────┬─────╮
2638 │                                                      │Count│
2639 ├──────────────────────────────────────────────────────┼─────┤
2640 │QND5A Cuban                        S3a. GENDER: Male  │   13│
2641 │                                                Female│    7│
2642 │     ╶────────────────────────────────────────────────┼─────┤
2643 │      Mexican                      S3a. GENDER: Male  │  175│
2644 │                                                Female│  136│
2645 │     ╶────────────────────────────────────────────────┼─────┤
2646 │      Spanish                      S3a. GENDER: Male  │   20│
2647 │                                                Female│   28│
2648 │     ╶────────────────────────────────────────────────┼─────┤
2649 │      South American               S3a. GENDER: Male  │   21│
2650 │                                                Female│   13│
2651 │     ╶────────────────────────────────────────────────┼─────┤
2652 │      Central American             S3a. GENDER: Male  │   27│
2653 │                                                Female│   25│
2654 │     ╶────────────────────────────────────────────────┼─────┤
2655 │      Puerto Rican, OR             S3a. GENDER: Male  │   37│
2656 │                                                Female│   41│
2657 │     ╶────────────────────────────────────────────────┼─────┤
2658 │      Something else               S3a. GENDER: Male  │   35│
2659 │                                                Female│   33│
2660 │     ╶────────────────────────────────────────────────┼─────┤
2661 │      Multiple - cannot choose one S3a. GENDER: Male  │    2│
2662 │                                                Female│    5│
2663 ╰──────────────────────────────────────────────────────┴─────╯
2664
2665                                  Custom Tables
2666 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2667 │                                                                       │Count│
2668 ├───────────────────────────────────────────────────────────────────────┼─────┤
2669 │D5a. What would you say is your primary    Cuban                 Male  │   13│
2670 │ethnic background?                                               Female│    7│
2671 │                                          ╶────────────────────────────┼─────┤
2672 │                                           Mexican               Male  │  175│
2673 │                                                                 Female│  136│
2674 │                                          ╶────────────────────────────┼─────┤
2675 │                                           Spanish               Male  │   20│
2676 │                                                                 Female│   28│
2677 │                                          ╶────────────────────────────┼─────┤
2678 │                                           South American        Male  │   21│
2679 │                                                                 Female│   13│
2680 │                                          ╶────────────────────────────┼─────┤
2681 │                                           Central American      Male  │   27│
2682 │                                                                 Female│   25│
2683 │                                          ╶────────────────────────────┼─────┤
2684 │                                           Puerto Rican, OR      Male  │   37│
2685 │                                                                 Female│   41│
2686 │                                          ╶────────────────────────────┼─────┤
2687 │                                           Something else        Male  │   35│
2688 │                                                                 Female│   33│
2689 │                                          ╶────────────────────────────┼─────┤
2690 │                                           Multiple - cannot     Male  │    2│
2691 │                                           choose one            Female│    5│
2692 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2693
2694                       Custom Tables
2695 ╭────────────────────────────────────────────────┬─────╮
2696 │                                                │Count│
2697 ├────────────────────────────────────────────────┼─────┤
2698 │Cuban                        S3a. GENDER: Male  │   13│
2699 │                                          Female│    7│
2700 ├────────────────────────────────────────────────┼─────┤
2701 │Mexican                      S3a. GENDER: Male  │  175│
2702 │                                          Female│  136│
2703 ├────────────────────────────────────────────────┼─────┤
2704 │Spanish                      S3a. GENDER: Male  │   20│
2705 │                                          Female│   28│
2706 ├────────────────────────────────────────────────┼─────┤
2707 │South American               S3a. GENDER: Male  │   21│
2708 │                                          Female│   13│
2709 ├────────────────────────────────────────────────┼─────┤
2710 │Central American             S3a. GENDER: Male  │   27│
2711 │                                          Female│   25│
2712 ├────────────────────────────────────────────────┼─────┤
2713 │Puerto Rican, OR             S3a. GENDER: Male  │   37│
2714 │                                          Female│   41│
2715 ├────────────────────────────────────────────────┼─────┤
2716 │Something else               S3a. GENDER: Male  │   35│
2717 │                                          Female│   33│
2718 ├────────────────────────────────────────────────┼─────┤
2719 │Multiple - cannot choose one S3a. GENDER: Male  │    2│
2720 │                                          Female│    5│
2721 ╰────────────────────────────────────────────────┴─────╯
2722
2723                Custom Tables
2724 ╭───────────────────────────────────┬─────╮
2725 │                                   │Count│
2726 ├───────────────────────────────────┼─────┤
2727 │Cuban                        Male  │   13│
2728 │                             Female│    7│
2729 ├───────────────────────────────────┼─────┤
2730 │Mexican                      Male  │  175│
2731 │                             Female│  136│
2732 ├───────────────────────────────────┼─────┤
2733 │Spanish                      Male  │   20│
2734 │                             Female│   28│
2735 ├───────────────────────────────────┼─────┤
2736 │South American               Male  │   21│
2737 │                             Female│   13│
2738 ├───────────────────────────────────┼─────┤
2739 │Central American             Male  │   27│
2740 │                             Female│   25│
2741 ├───────────────────────────────────┼─────┤
2742 │Puerto Rican, OR             Male  │   37│
2743 │                             Female│   41│
2744 ├───────────────────────────────────┼─────┤
2745 │Something else               Male  │   35│
2746 │                             Female│   33│
2747 ├───────────────────────────────────┼─────┤
2748 │Multiple - cannot choose one Male  │    2│
2749 │                             Female│    5│
2750 ╰───────────────────────────────────┴─────╯
2751 ])
2752 AT_CLEANUP
2753
2754 AT_SETUP([CTABLES FORMAT EMPTY])
2755 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2756 AT_DATA([ctables.sps],
2757 [[GET 'nhtsa.sav'.
2758 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2759 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2760 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2761 ]])
2762 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2763                                  Custom Tables
2764 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2765 │                                             │   D5. ETHNICITY: Are you of   │
2766 │                                             │  Hispanic or Latino origin or │
2767 │                                             │            descent?           │
2768 │                                             ├───────────────┬───────────────┤
2769 │                                             │      Yes      │       No      │
2770 │                                             ├───────────────┼───────────────┤
2771 │                                             │     Count     │     Count     │
2772 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2773 │D5a. What would you say is   Cuban           │             20│              0│
2774 │your primary ethnic          Mexican         │            311│              0│
2775 │background?                  Spanish         │             48│              0│
2776 │                             South American  │             34│              0│
2777 │                             Central American│             52│              0│
2778 │                             Puerto Rican, OR│             78│              0│
2779 │                             Something else  │             68│              0│
2780 │                             Multiple -      │              7│              0│
2781 │                             cannot choose   │               │               │
2782 │                             one             │               │               │
2783 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2784
2785                                  Custom Tables
2786 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2787 │                                             │   D5. ETHNICITY: Are you of   │
2788 │                                             │  Hispanic or Latino origin or │
2789 │                                             │            descent?           │
2790 │                                             ├───────────────┬───────────────┤
2791 │                                             │      Yes      │       No      │
2792 │                                             ├───────────────┼───────────────┤
2793 │                                             │     Count     │     Count     │
2794 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2795 │D5a. What would you say is   Cuban           │             20│               │
2796 │your primary ethnic          Mexican         │            311│               │
2797 │background?                  Spanish         │             48│               │
2798 │                             South American  │             34│               │
2799 │                             Central American│             52│               │
2800 │                             Puerto Rican, OR│             78│               │
2801 │                             Something else  │             68│               │
2802 │                             Multiple -      │              7│               │
2803 │                             cannot choose   │               │               │
2804 │                             one             │               │               │
2805 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2806
2807                                  Custom Tables
2808 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2809 │                                             │   D5. ETHNICITY: Are you of   │
2810 │                                             │  Hispanic or Latino origin or │
2811 │                                             │            descent?           │
2812 │                                             ├───────────────┬───────────────┤
2813 │                                             │      Yes      │       No      │
2814 │                                             ├───────────────┼───────────────┤
2815 │                                             │     Count     │     Count     │
2816 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2817 │D5a. What would you say is   Cuban           │             20│n/a            │
2818 │your primary ethnic          Mexican         │            311│n/a            │
2819 │background?                  Spanish         │             48│n/a            │
2820 │                             South American  │             34│n/a            │
2821 │                             Central American│             52│n/a            │
2822 │                             Puerto Rican, OR│             78│n/a            │
2823 │                             Something else  │             68│n/a            │
2824 │                             Multiple -      │              7│n/a            │
2825 │                             cannot choose   │               │               │
2826 │                             one             │               │               │
2827 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2828 ])
2829 AT_CLEANUP
2830
2831 AT_SETUP([CTABLES FORMAT MISSING])
2832 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2833 AT_DATA([ctables.sps],
2834 [[GET 'nhtsa.sav'.
2835 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2836 ]])
2837 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2838                                  Custom Tables
2839 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2840 │                                             │   D5. ETHNICITY: Are you of   │
2841 │                                             │  Hispanic or Latino origin or │
2842 │                                             │            descent?           │
2843 │                                             ├───────────────┬───────────────┤
2844 │                                             │      Yes      │       No      │
2845 │                                             ├───────────────┼───────────────┤
2846 │                                             │    Column %   │    Column %   │
2847 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2848 │D5a. What would you say is   Cuban           │           3.2%│(no data)      │
2849 │your primary ethnic          Mexican         │          50.3%│(no data)      │
2850 │background?                  Spanish         │           7.8%│(no data)      │
2851 │                             South American  │           5.5%│(no data)      │
2852 │                             Central American│           8.4%│(no data)      │
2853 │                             Puerto Rican, OR│          12.6%│(no data)      │
2854 │                             Something else  │          11.0%│(no data)      │
2855 │                             Multiple -      │           1.1%│(no data)      │
2856 │                             cannot choose   │               │               │
2857 │                             one             │               │               │
2858 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2859 ])
2860 AT_CLEANUP
2861
2862 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2863 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2864 AT_DATA([ctables.sps],
2865 [[GET 'nhtsa.sav'.
2866 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2867 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2868 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2869 ]])
2870 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2871                                  Custom Tables
2872 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2873 │                                                              │Count│Column %│
2874 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2875 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2876 │occasion?                                        1            │  491│   34.9%│
2877 │                                                 2            │  462│   32.9%│
2878 │                                                 3            │  229│   16.3%│
2879 │                                                 4            │   82│    5.8%│
2880 │                                                 5            │   56│    4.0%│
2881 │                                                 6            │   32│    2.3%│
2882 │                                                 7            │    9│     .6%│
2883 │                                                 8            │    8│     .6%│
2884 │                                                 9            │    4│     .3%│
2885 │                                                 10           │    6│     .4%│
2886 │                                                 11           │    2│     .1%│
2887 │                                                 12           │    5│     .4%│
2888 │                                                 14           │    1│     .1%│
2889 │                                                 15           │    1│     .1%│
2890 │                                                 18           │    1│     .1%│
2891 │                                                 20           │    4│     .3%│
2892 │                                                 25           │    1│     .1%│
2893 │                                                 30           │    3│     .2%│
2894 │                                                 60           │    1│     .1%│
2895 │                                                 99+          │    0│     .0%│
2896 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2897
2898                                  Custom Tables
2899 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2900 │                                                              │Count│Column %│
2901 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2902 │38. How many drinks did you have on that         Less than one│    7│     .5%│
2903 │occasion?                                        1            │  491│   34.9%│
2904 │                                                 2            │  462│   32.9%│
2905 │                                                 3            │  229│   16.3%│
2906 │                                                 4            │   82│    5.8%│
2907 │                                                 5            │   56│    4.0%│
2908 │                                                 6            │   32│    2.3%│
2909 │                                                 7            │    9│     .6%│
2910 │                                                 8            │    8│     .6%│
2911 │                                                 9            │<5   │     .3%│
2912 │                                                 10           │    6│     .4%│
2913 │                                                 11           │<5   │     .1%│
2914 │                                                 12           │    5│     .4%│
2915 │                                                 14           │<5   │     .1%│
2916 │                                                 15           │<5   │     .1%│
2917 │                                                 18           │<5   │     .1%│
2918 │                                                 20           │<5   │     .3%│
2919 │                                                 25           │<5   │     .1%│
2920 │                                                 30           │<5   │     .2%│
2921 │                                                 60           │<5   │     .1%│
2922 │                                                 99+          │<5   │     .0%│
2923 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2924
2925                                  Custom Tables
2926 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2927 │                                                              │Count│Column %│
2928 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2929 │38. How many drinks did you have on that         Less than one│<10  │     .5%│
2930 │occasion?                                        1            │  491│   34.9%│
2931 │                                                 2            │  462│   32.9%│
2932 │                                                 3            │  229│   16.3%│
2933 │                                                 4            │   82│    5.8%│
2934 │                                                 5            │   56│    4.0%│
2935 │                                                 6            │   32│    2.3%│
2936 │                                                 7            │<10  │     .6%│
2937 │                                                 8            │<10  │     .6%│
2938 │                                                 9            │<10  │     .3%│
2939 │                                                 10           │<10  │     .4%│
2940 │                                                 11           │<10  │     .1%│
2941 │                                                 12           │<10  │     .4%│
2942 │                                                 14           │<10  │     .1%│
2943 │                                                 15           │<10  │     .1%│
2944 │                                                 18           │<10  │     .1%│
2945 │                                                 20           │<10  │     .3%│
2946 │                                                 25           │<10  │     .1%│
2947 │                                                 30           │<10  │     .2%│
2948 │                                                 60           │<10  │     .1%│
2949 │                                                 99+          │<10  │     .0%│
2950 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2951 ])
2952 AT_CLEANUP
2953
2954 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2955 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2956 AT_DATA([ctables.sps],
2957 [[GET 'nhtsa.sav'.
2958 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2959 ]])
2960 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2961  Custom Tables
2962 ╭────────────╮
2963 │S3a. GENDER:│
2964 ├─────┬──────┤
2965 │ Male│Female│
2966 ├─────┼──────┤
2967 │Count│ Count│
2968 ├─────┼──────┤
2969 │ 3132│  3867│
2970 ╰─────┴──────╯
2971 ])
2972 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2973 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2974 maximumColumnWidth="192"
2975 minimumColumnWidth="96"
2976 ])
2977 AT_CLEANUP
2978
2979 AT_SETUP([CTABLES special formats])
2980 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2981 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2982 AT_DATA([ctables.sps],
2983 [[GET 'nhtsa.sav'.
2984 COMPUTE x = qnd3 - 4.
2985 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].
2986 ]])
2987 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2988                            Custom Tables
2989 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2990 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2991 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2992 │x│(3.0)  │N=-3.0 │(-3.0) │(-3.0%)│8.0    │N=8.0  │(8.0)  │(8.0%) │
2993 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2994 ])
2995 AT_CLEANUP
2996
2997 AT_SETUP([CTABLES TITLES])
2998 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2999 AT_DATA([ctables.sps],
3000 [[GET 'nhtsa.sav'.
3001 CTABLES
3002     /VLABELS VARIABLES=qn1 DISPLAY=NONE
3003     /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3004     /TITLES TITLE='How often do you drive?'
3005             CAPTION='Generated )TIME on )DATE'
3006             CORNER=')TABLE'.
3007 ]])
3008 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3009 s&../../..&MM/DD/YY&'], [0], [dnl
3010                             How often do you drive?
3011 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3012 │                                   │               S3a. GENDER:              │
3013 │                                   ├────────────────────┬────────────────────┤
3014 │                                   │        Male        │       Female       │
3015 │                                   ├────────────────────┼────────────────────┤
3016 │                                   │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3017 │                                   │ you of Hispanic or │ you of Hispanic or │
3018 │                                   │  Latino origin or  │  Latino origin or  │
3019 │( ( 1. How often do you usually    │      descent?      │      descent?      │
3020 │drive a car or other motor         ├─────────┬──────────┼─────────┬──────────┤
3021 │vehicle?) ) BY S3a. GENDER: > D5.  │   Yes   │    No    │   Yes   │    No    │
3022 │ETHNICITY: Are you of Hispanic or  ├─────────┼──────────┼─────────┼──────────┤
3023 │Latino origin or descent?          │  Count  │   Count  │  Count  │   Count  │
3024 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3025 │Every day                          │      218│      2066│      166│      2175│
3026 │Several days a week                │       44│       391│       45│       782│
3027 │Once a week or less                │       16│       109│       12│       223│
3028 │Only certain times a year          │       15│        41│       11│        61│
3029 │Never                              │       39│       150│       56│       278│
3030 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3031 Generated HH:MM:SS on MM/DD/YY
3032 ])
3033 AT_CLEANUP
3034
3035 AT_SETUP([CTABLES area definitions])
3036 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3037 AT_DATA([ctables.sps],
3038 [[GET 'nhtsa.sav'.
3039 CTABLES
3040     /VLABELS VARIABLES=ALL DISPLAY=NAME
3041     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3042     /SLABELS POSITION=ROW
3043     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3044     /SLABELS POSITION=ROW
3045     /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3046     /SLABELS POSITION=ROW.
3047 ]])
3048 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3049                     Custom Tables
3050 Male
3051 ╭─────────────────────────────┬─────────────┬──────╮
3052 │                             │    QND7A    │ QN64B│
3053 │                             ├──────┬──────┼───┬──┤
3054 │                             │  Yes │  No  │   │  │
3055 │                             ├──────┼──────┤   │  │
3056 │                             │ QN86 │ QN86 │   │  │
3057 │                             ├───┬──┼───┬──┤   │  │
3058 │                             │Yes│No│Yes│No│Yes│No│
3059 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3060 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3061 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3062 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3063 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3064 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3065 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3066 │                  Subtable ID│  1│ 1│  2│ 2│  3│ 3│
3067 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3068 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3069 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3070 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3071 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3072 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3073 │                  Layer ID   │  1│ 1│  1│ 1│  2│ 2│
3074 │                  Subtable ID│  4│ 4│  5│ 5│  6│ 6│
3075 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3076
3077                     Custom Tables
3078 Female
3079 ╭─────────────────────────────┬─────────────┬──────╮
3080 │                             │    QND7A    │ QN64B│
3081 │                             ├──────┬──────┼───┬──┤
3082 │                             │  Yes │  No  │   │  │
3083 │                             ├──────┼──────┤   │  │
3084 │                             │ QN86 │ QN86 │   │  │
3085 │                             ├───┬──┼───┬──┤   │  │
3086 │                             │Yes│No│Yes│No│Yes│No│
3087 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3088 │QN61 Yes QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3089 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3090 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3091 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3092 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3093 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3094 │                  Subtable ID│  7│ 7│  8│ 8│  9│ 9│
3095 │    ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3096 │     No  QN57 Yes Table ID   │  1│ 1│  1│ 1│  2│ 2│
3097 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3098 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3099 │             ╶───────────────┼───┼──┼───┼──┼───┼──┤
3100 │              No  Table ID   │  1│ 1│  1│ 1│  2│ 2│
3101 │                  Layer ID   │  3│ 3│  3│ 3│  4│ 4│
3102 │                  Subtable ID│ 10│10│ 11│11│ 12│12│
3103 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3104
3105                     Custom Tables
3106 Male
3107 ╭──────────────────────────────┬─────────────┬──────╮
3108 │                              │    QND7A    │ QN64B│
3109 │                              ├──────┬──────┼───┬──┤
3110 │                              │  Yes │  No  │   │  │
3111 │                              ├──────┼──────┤   │  │
3112 │                              │ QN86 │ QN86 │   │  │
3113 │                              ├───┬──┼───┬──┤   │  │
3114 │                              │Yes│No│Yes│No│Yes│No│
3115 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3116 │QN61 Yes QN57 Yes Row ID      │  1│ 1│  2│ 2│  3│ 3│
3117 │                  Layer Row ID│  1│ 1│  1│ 1│  2│ 2│
3118 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3119 │              No  Row ID      │  4│ 4│  5│ 5│  6│ 6│
3120 │                  Layer Row ID│  3│ 3│  3│ 3│  4│ 4│
3121 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3122 │     No  QN57 Yes Row ID      │  7│ 7│  8│ 8│  9│ 9│
3123 │                  Layer Row ID│  5│ 5│  5│ 5│  6│ 6│
3124 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3125 │              No  Row ID      │ 10│10│ 11│11│ 12│12│
3126 │                  Layer Row ID│  7│ 7│  7│ 7│  8│ 8│
3127 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3128
3129                     Custom Tables
3130 Female
3131 ╭──────────────────────────────┬─────────────┬──────╮
3132 │                              │    QND7A    │ QN64B│
3133 │                              ├──────┬──────┼───┬──┤
3134 │                              │  Yes │  No  │   │  │
3135 │                              ├──────┼──────┤   │  │
3136 │                              │ QN86 │ QN86 │   │  │
3137 │                              ├───┬──┼───┬──┤   │  │
3138 │                              │Yes│No│Yes│No│Yes│No│
3139 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3140 │QN61 Yes QN57 Yes Row ID      │ 13│13│ 14│14│ 15│15│
3141 │                  Layer Row ID│  9│ 9│  9│ 9│ 10│10│
3142 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3143 │              No  Row ID      │ 16│16│ 17│17│ 18│18│
3144 │                  Layer Row ID│ 11│11│ 11│11│ 12│12│
3145 │    ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3146 │     No  QN57 Yes Row ID      │ 19│19│ 20│20│ 21│21│
3147 │                  Layer Row ID│ 13│13│ 13│13│ 14│14│
3148 │             ╶────────────────┼───┼──┼───┼──┼───┼──┤
3149 │              No  Row ID      │ 22│22│ 23│23│ 24│24│
3150 │                  Layer Row ID│ 15│15│ 15│15│ 16│16│
3151 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3152
3153                       Custom Tables
3154 Male
3155 ╭─────────────────────────────────┬─────────────┬──────╮
3156 │                                 │    QND7A    │ QN64B│
3157 │                                 ├──────┬──────┼───┬──┤
3158 │                                 │  Yes │  No  │   │  │
3159 │                                 ├──────┼──────┤   │  │
3160 │                                 │ QN86 │ QN86 │   │  │
3161 │                                 ├───┬──┼───┬──┤   │  │
3162 │                                 │Yes│No│Yes│No│Yes│No│
3163 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3164 │QN61 Yes QN57 Yes Column ID      │  1│ 2│  3│ 4│  5│ 6│
3165 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3166 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3167 │              No  Column ID      │  1│ 2│  3│ 4│  5│ 6│
3168 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3169 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3170 │     No  QN57 Yes Column ID      │  7│ 8│  9│10│ 11│12│
3171 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3172 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3173 │              No  Column ID      │  7│ 8│  9│10│ 11│12│
3174 │                  Layer Column ID│  1│ 2│  3│ 4│  5│ 6│
3175 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3176
3177                       Custom Tables
3178 Female
3179 ╭─────────────────────────────────┬─────────────┬──────╮
3180 │                                 │    QND7A    │ QN64B│
3181 │                                 ├──────┬──────┼───┬──┤
3182 │                                 │  Yes │  No  │   │  │
3183 │                                 ├──────┼──────┤   │  │
3184 │                                 │ QN86 │ QN86 │   │  │
3185 │                                 ├───┬──┼───┬──┤   │  │
3186 │                                 │Yes│No│Yes│No│Yes│No│
3187 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3188 │QN61 Yes QN57 Yes Column ID      │ 13│14│ 15│16│ 17│18│
3189 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3190 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3191 │              No  Column ID      │ 13│14│ 15│16│ 17│18│
3192 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3193 │    ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3194 │     No  QN57 Yes Column ID      │ 19│20│ 21│22│ 23│24│
3195 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3196 │             ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3197 │              No  Column ID      │ 19│20│ 21│22│ 23│24│
3198 │                  Layer Column ID│  7│ 8│  9│10│ 11│12│
3199 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3200 ])
3201 AT_CLEANUP
3202
3203 AT_SETUP([CTABLES categorical summary functions])
3204 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3205 AT_DATA([ctables.sps],
3206 [[GET 'nhtsa.sav'.
3207 CTABLES
3208     /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
3209     /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
3210     /SLABELS POSITION=ROW.
3211 ]])
3212 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3213                                                       Custom Tables
3214 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
3215 │                 │                     D5a. What would you say is your primary ethnic background?                     │
3216 │                 ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
3217 │                 │     │       │       │          │          │         │          │  Multiple -  │      │       │     │
3218 │                 │     │       │       │   South  │  Central │  Puerto │ Something│ cannot choose│ Don't│       │     │
3219 │                 │Cuban│Mexican│Spanish│ American │ American │Rican, OR│   else   │      one     │ know │Refused│Total│
3220 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3221 │Region NE Count  │    6│      8│      8│        11│         7│       39│        23│             2│     0│      1│  105│
3222 │          Row %  │ 5.7%│   7.6%│   7.6%│     10.5%│      6.7%│    37.1%│     21.9%│          1.9%│   .0%│   1.0%│     │
3223 │          Row    │ 5.8%│   7.7%│   7.7%│     10.6%│      6.7%│    37.5%│     22.1%│          1.9%│   .0%│    .0%│     │
3224 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3225 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3226 │          Row    │  .4%│    .6%│    .6%│       .8%│       .5%│     2.8%│      1.6%│           .1%│   .0%│    .1%│     │
3227 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3228 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3229 │          Valid N│     │       │       │          │          │         │          │              │      │       │  104│
3230 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1409│
3231 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3232 │       MW Count  │    3│     24│      1│         4│         5│        9│         6│             0│     0│      1│   53│
3233 │          Row %  │ 5.7%│  45.3%│   1.9%│      7.5%│      9.4%│    17.0%│     11.3%│           .0%│   .0%│   1.9%│     │
3234 │          Row    │ 5.8%│  46.2%│   1.9%│      7.7%│      9.6%│    17.3%│     11.5%│           .0%│   .0%│    .0%│     │
3235 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3236 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3237 │          Row    │  .2%│   1.5%│    .1%│       .2%│       .3%│      .5%│       .4%│           .0%│   .0%│    .1%│     │
3238 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3239 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3240 │          Valid N│     │       │       │          │          │         │          │              │      │       │   52│
3241 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1654│
3242 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3243 │       S  Count  │   10│    113│     11│        14│        25│       23│        20│             2│     3│      2│  223│
3244 │          Row %  │ 4.5%│  50.7%│   4.9%│      6.3%│     11.2%│    10.3%│      9.0%│           .9%│  1.3%│    .9%│     │
3245 │          Row    │ 4.6%│  51.8%│   5.0%│      6.4%│     11.5%│    10.6%│      9.2%│           .9%│   .0%│    .0%│     │
3246 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3247 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3248 │          Row    │  .4%│   4.7%│    .5%│       .6%│      1.0%│     1.0%│       .8%│           .1%│   .1%│    .1%│     │
3249 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3250 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3251 │          Valid N│     │       │       │          │          │         │          │              │      │       │  218│
3252 │          Total N│     │       │       │          │          │         │          │              │      │       │ 2390│
3253 │      ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3254 │       W  Count  │    1│    166│     28│         5│        15│        7│        19│             3│     0│      1│  245│
3255 │          Row %  │  .4%│  67.8%│  11.4%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .4%│     │
3256 │          Row    │  .4%│  68.0%│  11.5%│      2.0%│      6.1%│     2.9%│      7.8%│          1.2%│   .0%│    .0%│     │
3257 │          Valid N│     │       │       │          │          │         │          │              │      │       │     │
3258 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3259 │          Row    │  .1%│  10.7%│   1.8%│       .3%│      1.0%│      .5%│      1.2%│           .2%│   .0%│    .1%│     │
3260 │          Total N│     │       │       │          │          │         │          │              │      │       │     │
3261 │          %      │     │       │       │          │          │         │          │              │      │       │     │
3262 │          Valid N│     │       │       │          │          │         │          │              │      │       │  244│
3263 │          Total N│     │       │       │          │          │         │          │              │      │       │ 1546│
3264 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
3265 ])
3266 AT_CLEANUP
3267
3268 AT_SETUP([CTABLES scale summary functions])
3269 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3270 AT_DATA([ctables.sps],
3271 [[GET 'nhtsa.sav'.
3272 SET TVAR=NAME.
3273
3274 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
3275   CTABLES later, to make the results easier to verify.
3276 SPLIT FILE BY REGION.
3277 FREQUENCIES
3278     qn19a
3279     /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
3280     /FORMAT NOTABLE /MISSING=INCLUDE.
3281 SPLIT FILE OFF.
3282
3283 CTABLES
3284     /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
3285     /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, COLPCT.SUM]
3286     /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
3287     /SLABELS POSITION=ROW.
3288 ]])
3289 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3290          Statistics
3291 ╭────────────────┬────────╮
3292 │REGION          │  QN19A │
3293 ├────────────────┼────────┤
3294 │NE     N Valid  │     936│
3295 │         Missing│     473│
3296 │      ╶─────────┼────────┤
3297 │       Mean     │   19.33│
3298 │      ╶─────────┼────────┤
3299 │       S.E. Mean│     .14│
3300 │      ╶─────────┼────────┤
3301 │       Median   │   18.00│
3302 │      ╶─────────┼────────┤
3303 │       Mode     │   18.00│
3304 │      ╶─────────┼────────┤
3305 │       Std Dev  │    4.41│
3306 │      ╶─────────┼────────┤
3307 │       Variance │   19.41│
3308 │      ╶─────────┼────────┤
3309 │       Range    │   59.00│
3310 │      ╶─────────┼────────┤
3311 │       Minimum  │     .00│
3312 │      ╶─────────┼────────┤
3313 │       Maximum  │   59.00│
3314 │      ╶─────────┼────────┤
3315 │       Sum      │18092.00│
3316 ├────────────────┼────────┤
3317 │MW     N Valid  │    1019│
3318 │         Missing│     635│
3319 │      ╶─────────┼────────┤
3320 │       Mean     │   19.83│
3321 │      ╶─────────┼────────┤
3322 │       S.E. Mean│     .16│
3323 │      ╶─────────┼────────┤
3324 │       Median   │   19.00│
3325 │      ╶─────────┼────────┤
3326 │       Mode     │   18.00│
3327 │      ╶─────────┼────────┤
3328 │       Std Dev  │    5.15│
3329 │      ╶─────────┼────────┤
3330 │       Variance │   26.47│
3331 │      ╶─────────┼────────┤
3332 │       Range    │   71.00│
3333 │      ╶─────────┼────────┤
3334 │       Minimum  │    4.00│
3335 │      ╶─────────┼────────┤
3336 │       Maximum  │   75.00│
3337 │      ╶─────────┼────────┤
3338 │       Sum      │20206.00│
3339 ├────────────────┼────────┤
3340 │S      N Valid  │    1276│
3341 │         Missing│    1114│
3342 │      ╶─────────┼────────┤
3343 │       Mean     │   20.29│
3344 │      ╶─────────┼────────┤
3345 │       S.E. Mean│     .18│
3346 │      ╶─────────┼────────┤
3347 │       Median   │   19.00│
3348 │      ╶─────────┼────────┤
3349 │       Mode     │   18.00│
3350 │      ╶─────────┼────────┤
3351 │       Std Dev  │    6.44│
3352 │      ╶─────────┼────────┤
3353 │       Variance │   41.43│
3354 │      ╶─────────┼────────┤
3355 │       Range    │   75.00│
3356 │      ╶─────────┼────────┤
3357 │       Minimum  │    4.00│
3358 │      ╶─────────┼────────┤
3359 │       Maximum  │   79.00│
3360 │      ╶─────────┼────────┤
3361 │       Sum      │25886.00│
3362 ├────────────────┼────────┤
3363 │W      N Valid  │     950│
3364 │         Missing│     596│
3365 │      ╶─────────┼────────┤
3366 │       Mean     │   19.87│
3367 │      ╶─────────┼────────┤
3368 │       S.E. Mean│     .17│
3369 │      ╶─────────┼────────┤
3370 │       Median   │   19.00│
3371 │      ╶─────────┼────────┤
3372 │       Mode     │   18.00│
3373 │      ╶─────────┼────────┤
3374 │       Std Dev  │    5.25│
3375 │      ╶─────────┼────────┤
3376 │       Variance │   27.59│
3377 │      ╶─────────┼────────┤
3378 │       Range    │   61.00│
3379 │      ╶─────────┼────────┤
3380 │       Minimum  │    4.00│
3381 │      ╶─────────┼────────┤
3382 │       Maximum  │   65.00│
3383 │      ╶─────────┼────────┤
3384 │       Sum      │18877.00│
3385 ╰────────────────┴────────╯
3386
3387              Custom Tables
3388 ╭───────────────────────────┬────────╮
3389 │                           │  QN19A │
3390 ├───────────────────────────┼────────┤
3391 │REGION NE Valid N          │     936│
3392 │          Missing          │  473.00│
3393 │          Mean             │   19.33│
3394 │          Std Error of Mean│     .14│
3395 │          Median           │   18.00│
3396 │          Mode             │   18.00│
3397 │          Std Deviation    │    4.41│
3398 │          Variance         │   19.41│
3399 │          Range            │   59.00│
3400 │          Minimum          │     .00│
3401 │          Maximum          │   59.00│
3402 │          Sum              │18092.00│
3403 │          Count            │    1409│
3404 │          Total N          │    1409│
3405 │          Column Sum %     │   21.8%│
3406 │      ╶────────────────────┼────────┤
3407 │       MW Valid N          │    1019│
3408 │          Missing          │  635.00│
3409 │          Mean             │   19.83│
3410 │          Std Error of Mean│     .16│
3411 │          Median           │   19.00│
3412 │          Mode             │   18.00│
3413 │          Std Deviation    │    5.15│
3414 │          Variance         │   26.47│
3415 │          Range            │   71.00│
3416 │          Minimum          │    4.00│
3417 │          Maximum          │   75.00│
3418 │          Sum              │20206.00│
3419 │          Count            │    1654│
3420 │          Total N          │    1654│
3421 │          Column Sum %     │   24.3%│
3422 │      ╶────────────────────┼────────┤
3423 │       S  Valid N          │    1276│
3424 │          Missing          │ 1114.00│
3425 │          Mean             │   20.29│
3426 │          Std Error of Mean│     .18│
3427 │          Median           │   19.00│
3428 │          Mode             │   18.00│
3429 │          Std Deviation    │    6.44│
3430 │          Variance         │   41.43│
3431 │          Range            │   75.00│
3432 │          Minimum          │    4.00│
3433 │          Maximum          │   79.00│
3434 │          Sum              │25886.00│
3435 │          Count            │    2390│
3436 │          Total N          │    2390│
3437 │          Column Sum %     │   31.2%│
3438 │      ╶────────────────────┼────────┤
3439 │       W  Valid N          │     950│
3440 │          Missing          │  596.00│
3441 │          Mean             │   19.87│
3442 │          Std Error of Mean│     .17│
3443 │          Median           │   19.00│
3444 │          Mode             │   18.00│
3445 │          Std Deviation    │    5.25│
3446 │          Variance         │   27.59│
3447 │          Range            │   61.00│
3448 │          Minimum          │    4.00│
3449 │          Maximum          │   65.00│
3450 │          Sum              │18877.00│
3451 │          Count            │    1546│
3452 │          Total N          │    1546│
3453 │          Column Sum %     │   22.7%│
3454 ╰───────────────────────────┴────────╯
3455 ])
3456 AT_CLEANUP
3457
3458
3459 AT_SETUP([CTABLES hidden scale VLABELS])
3460 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3461 AT_DATA([ctables.sps],
3462 [[GET 'nhtsa.sav'.
3463 CTABLES
3464     /TABLE region BY qn19a + qn35
3465     /SLABELS POSITION=ROW.
3466 CTABLES
3467     /VLABELS VARIABLE=qn19a DISPLAY=NONE
3468     /TABLE region BY qn19a + qn35
3469     /SLABELS POSITION=ROW.
3470 CTABLES
3471     /VLABELS VARIABLE=qn35 DISPLAY=NONE
3472     /TABLE region BY qn19a + qn35
3473     /SLABELS POSITION=ROW.
3474
3475 * This one in particular caused a crash because no categories were
3476   created on the column axis, so passing in 0 for the index was still
3477   too big for that number of categories.  It was fixed by creating a
3478   name-only category for each variable despite the "NONE" request,
3479   then hiding the entire dimension's labels if all its labels were
3480   set to "NONE".
3481 CTABLES
3482     /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
3483     /TABLE region BY qn19a + qn35
3484     /SLABELS POSITION=ROW.
3485 ]])
3486 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3487                                  Custom Tables
3488 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
3489 │              │ 19a. About how old were you│ 35. In the past thirty days, how│
3490 │              │   when you first starting  │   many times have you driven a  │
3491 │              │    drinking alcohol, not   │  motor vehicle WITHIN TWO HOURS │
3492 │              │  counting small tastes or  │     AFTER drinking alcoholic    │
3493 │              │      sips of alcohol.      │            beverages?           │
3494 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
3495 │Region NE Mean│                       19.33│                                2│
3496 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3497 │       MW Mean│                       19.83│                                2│
3498 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3499 │       S  Mean│                       20.29│                                2│
3500 │      ╶───────┼────────────────────────────┼─────────────────────────────────┤
3501 │       W  Mean│                       19.87│                                2│
3502 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
3503
3504                                  Custom Tables
3505 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
3506 │              │     │  35. In the past thirty days, how many times have you  │
3507 │              │     │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
3508 │              │QN19A│                  alcoholic beverages?                  │
3509 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
3510 │Region NE Mean│19.33│                                                       2│
3511 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3512 │       MW Mean│19.83│                                                       2│
3513 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3514 │       S  Mean│20.29│                                                       2│
3515 │      ╶───────┼─────┼────────────────────────────────────────────────────────┤
3516 │       W  Mean│19.87│                                                       2│
3517 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
3518
3519                                  Custom Tables
3520 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
3521 │              │   19a. About how old were you when you first starting   │    │
3522 │              │  drinking alcohol, not counting small tastes or sips of │    │
3523 │              │                         alcohol.                        │qn35│
3524 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
3525 │Region NE Mean│                                                    19.33│   2│
3526 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3527 │       MW Mean│                                                    19.83│   2│
3528 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3529 │       S  Mean│                                                    20.29│   2│
3530 │      ╶───────┼─────────────────────────────────────────────────────────┼────┤
3531 │       W  Mean│                                                    19.87│   2│
3532 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
3533
3534       Custom Tables
3535 ╭──────────────┬───────╮
3536 │Region NE Mean│19.33 2│
3537 │      ╶───────┼───────┤
3538 │       MW Mean│19.83 2│
3539 │      ╶───────┼───────┤
3540 │       S  Mean│20.29 2│
3541 │      ╶───────┼───────┤
3542 │       W  Mean│19.87 2│
3543 ╰──────────────┴───────╯
3544 ])
3545 AT_CLEANUP
3546
3547 AT_SETUP([CTABLES with SPLIT FILE])
3548 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3549 AT_DATA([ctables.sps],
3550 [[GET 'nhtsa.sav'.
3551
3552 SORT CASES BY qns3a.
3553
3554 CTABLES /TABLE qn105ba.
3555
3556 * Layered split has no effect on output.
3557 SPLIT FILE BY qns3a.
3558 CTABLES /TABLE qn105ba.
3559
3560 * Add column variable qns3a to compare against separate splits.
3561 CTABLES /TABLE qn105ba BY qns3a.
3562
3563 * Separate splits are truly output separately.
3564 SPLIT FILE SEPARATE BY qns3a.
3565 CTABLES /TABLE qn105ba.
3566 ]])
3567 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
3568                                   Custom Tables
3569 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3570 │                                                                        │Count│
3571 ├────────────────────────────────────────────────────────────────────────┼─────┤
3572 │105b. How likely is it that drivers who have had too much   Almost      │  700│
3573 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3574 │                                                            Very likely │ 1502│
3575 │                                                            Somewhat    │ 2763│
3576 │                                                            likely      │     │
3577 │                                                            Somewhat    │ 1307│
3578 │                                                            unlikely    │     │
3579 │                                                            Very        │  609│
3580 │                                                            unlikely    │     │
3581 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3582
3583                                   Custom Tables
3584 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3585 │                                                                        │Count│
3586 ├────────────────────────────────────────────────────────────────────────┼─────┤
3587 │105b. How likely is it that drivers who have had too much   Almost      │  700│
3588 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3589 │                                                            Very likely │ 1502│
3590 │                                                            Somewhat    │ 2763│
3591 │                                                            likely      │     │
3592 │                                                            Somewhat    │ 1307│
3593 │                                                            unlikely    │     │
3594 │                                                            Very        │  609│
3595 │                                                            unlikely    │     │
3596 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3597
3598                                   Custom Tables
3599 ╭─────────────────────────────────────────────────────────────────┬────────────╮
3600 │                                                                 │S3a. GENDER:│
3601 │                                                                 ├─────┬──────┤
3602 │                                                                 │ Male│Female│
3603 │                                                                 ├─────┼──────┤
3604 │                                                                 │Count│ Count│
3605 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
3606 │105b. How likely is it that drivers who have had too Almost      │  297│   403│
3607 │much to drink to drive safely will A. Get stopped by certain     │     │      │
3608 │the police?                                          Very likely │  660│   842│
3609 │                                                     Somewhat    │ 1174│  1589│
3610 │                                                     likely      │     │      │
3611 │                                                     Somewhat    │  640│   667│
3612 │                                                     unlikely    │     │      │
3613 │                                                     Very        │  311│   298│
3614 │                                                     unlikely    │     │      │
3615 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
3616
3617     Split Values
3618 ╭────────────┬─────╮
3619 │Variable    │Value│
3620 ├────────────┼─────┤
3621 │S3a. GENDER:│Male │
3622 ╰────────────┴─────╯
3623
3624                                   Custom Tables
3625 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3626 │                                                                        │Count│
3627 ├────────────────────────────────────────────────────────────────────────┼─────┤
3628 │105b. How likely is it that drivers who have had too much   Almost      │  297│
3629 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3630 │                                                            Very likely │  660│
3631 │                                                            Somewhat    │ 1174│
3632 │                                                            likely      │     │
3633 │                                                            Somewhat    │  640│
3634 │                                                            unlikely    │     │
3635 │                                                            Very        │  311│
3636 │                                                            unlikely    │     │
3637 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3638
3639      Split Values
3640 ╭────────────┬──────╮
3641 │Variable    │ Value│
3642 ├────────────┼──────┤
3643 │S3a. GENDER:│Female│
3644 ╰────────────┴──────╯
3645
3646                                   Custom Tables
3647 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3648 │                                                                        │Count│
3649 ├────────────────────────────────────────────────────────────────────────┼─────┤
3650 │105b. How likely is it that drivers who have had too much   Almost      │  403│
3651 │to drink to drive safely will A. Get stopped by the police? certain     │     │
3652 │                                                            Very likely │  842│
3653 │                                                            Somewhat    │ 1589│
3654 │                                                            likely      │     │
3655 │                                                            Somewhat    │  667│
3656 │                                                            unlikely    │     │
3657 │                                                            Very        │  298│
3658 │                                                            unlikely    │     │
3659 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3660 ])
3661 AT_CLEANUP
3662
3663 AT_SETUP([CTABLES variable level inference])
3664 AT_DATA([data.txt], [dnl
3665 dnl n1 has 10 unique small values -> nominal.
3666 dnl n2 has 23 unique small values -> nominal.
3667 dnl n3 is all missing -> nominal.
3668 dnl s1 has 24 unique small values -> scale.
3669 dnl s2 has one negative value -> scale.
3670 dnl s3 has one non-integer value -> scale.
3671 dnl s4 has no valid values less than 10 -> scale.
3672 dnl s5 has no valid values less than 10,000 -> scale.
3673 1  1  . 1  1  1    10 10001
3674 2  2  . 2  2  2    11 10002
3675 3  3  . 3  3  3    12 10003
3676 4  4  . 4  4  4    13 10004
3677 5  5  . 5  5  5    14 10005
3678 6  6  . 6  6  6    15 10006
3679 7  7  . 7  7  7    16 10007
3680 8  8  . 8  8  8    17 10008
3681 9  9  . 9  9  9    18 10009
3682 10 10 . 10 10 10.5 19 110000
3683 1  11 . 11 -1 1    11 10001
3684 2  12 . 12 2  2    12 10002
3685 3  13 . 13 3  3    13 10003
3686 4  14 . 14 4  4    14 10004
3687 5  15 . 15 5  5    15 10005
3688 6  16 . 16 6  6    16 10006
3689 7  17 . 17 7  7    17 10007
3690 8  18 . 18 8  8    18 10008
3691 9  19 . 19 9  9    19 10009
3692 1  20 . 20 1  1    20 10001
3693 2  21 . 21 2  2    21 10002
3694 3  22 . 22 3  3    22 10003
3695 4  23 . 23 4  4    23 10004
3696 5  23 . 24 5  5    24 10005
3697 6  23 . 24 6  6    25 10006
3698 ])
3699
3700 AT_DATA([ctables.sps], [dnl
3701 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
3702
3703 * Nominal formats (copied from data that will default to scale).
3704 COMPUTE n4=s1.
3705 COMPUTE n5=s1.
3706 FORMATS n4(WKDAY5) n5(MONTH5).
3707
3708 * Scale formats (copied from data that will default to nominal).
3709 COMPUTE s6=n1.
3710 COMPUTE s7=n1.
3711 COMPUTE s8=n1.
3712 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
3713
3714 STRING string(A8).
3715
3716 DISPLAY DICTIONARY.
3717 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
3718 DISPLAY DICTIONARY.
3719 ])
3720
3721 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
3722                                     Variables
3723 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
3724 │      │        │  Measurement │     │     │         │            │            │
3725 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
3726 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
3727 │n1    │       1│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3728 │n2    │       2│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3729 │n3    │       3│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3730 │s1    │       4│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3731 │s2    │       5│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3732 │s3    │       6│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3733 │s4    │       7│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3734 │s5    │       8│Unknown       │Input│    8│Right    │F8.2        │F8.2        │
3735 │n4    │       9│Unknown       │Input│    8│Right    │WKDAY5      │WKDAY5      │
3736 │n5    │      10│Unknown       │Input│    8│Right    │MONTH5      │MONTH5      │
3737 │s6    │      11│Unknown       │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
3738 │s7    │      12│Unknown       │Input│    8│Right    │CCA8.2      │CCA8.2      │
3739 │s8    │      13│Unknown       │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
3740 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
3741 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
3742
3743         Custom Tables
3744 ╭────────────┬─────┬────────╮
3745 │            │Count│  Mean  │
3746 ├────────────┼─────┼────────┤
3747 │n1     1.00 │    3│        │
3748 │       2.00 │    3│        │
3749 │       3.00 │    3│        │
3750 │       4.00 │    3│        │
3751 │       5.00 │    3│        │
3752 │       6.00 │    3│        │
3753 │       7.00 │    2│        │
3754 │       8.00 │    2│        │
3755 │       9.00 │    2│        │
3756 │       10.00│    1│        │
3757 ├────────────┼─────┼────────┤
3758 │n2     1.00 │    1│        │
3759 │       2.00 │    1│        │
3760 │       3.00 │    1│        │
3761 │       4.00 │    1│        │
3762 │       5.00 │    1│        │
3763 │       6.00 │    1│        │
3764 │       7.00 │    1│        │
3765 │       8.00 │    1│        │
3766 │       9.00 │    1│        │
3767 │       10.00│    1│        │
3768 │       11.00│    1│        │
3769 │       12.00│    1│        │
3770 │       13.00│    1│        │
3771 │       14.00│    1│        │
3772 │       15.00│    1│        │
3773 │       16.00│    1│        │
3774 │       17.00│    1│        │
3775 │       18.00│    1│        │
3776 │       19.00│    1│        │
3777 │       20.00│    1│        │
3778 │       21.00│    1│        │
3779 │       22.00│    1│        │
3780 │       23.00│    3│        │
3781 ├────────────┼─────┼────────┤
3782 │string      │   25│        │
3783 ├────────────┼─────┼────────┤
3784 │s1          │     │   12.96│
3785 ├────────────┼─────┼────────┤
3786 │s2          │     │    4.76│
3787 ├────────────┼─────┼────────┤
3788 │s3          │     │    4.86│
3789 ├────────────┼─────┼────────┤
3790 │s4          │     │   16.60│
3791 ├────────────┼─────┼────────┤
3792 │s5          │     │14004.44│
3793 ╰────────────┴─────┴────────╯
3794
3795                                     Variables
3796 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
3797 │      │        │  Measurement │     │     │         │            │            │
3798 │Name  │Position│     Level    │ Role│Width│Alignment│Print Format│Write Format│
3799 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
3800 │n1    │       1│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
3801 │n2    │       2│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
3802 │n3    │       3│Nominal       │Input│    8│Right    │F8.2        │F8.2        │
3803 │s1    │       4│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3804 │s2    │       5│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3805 │s3    │       6│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3806 │s4    │       7│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3807 │s5    │       8│Scale         │Input│    8│Right    │F8.2        │F8.2        │
3808 │n4    │       9│Nominal       │Input│    8│Right    │WKDAY5      │WKDAY5      │
3809 │n5    │      10│Nominal       │Input│    8│Right    │MONTH5      │MONTH5      │
3810 │s6    │      11│Scale         │Input│    8│Right    │DOLLAR6.2   │DOLLAR6.2   │
3811 │s7    │      12│Scale         │Input│    8│Right    │CCA8.2      │CCA8.2      │
3812 │s8    │      13│Scale         │Input│    8│Right    │DATETIME17.0│DATETIME17.0│
3813 │string│      14│Nominal       │Input│    8│Left     │A8          │A8          │
3814 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
3815 ])
3816 AT_CLEANUP