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