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