cfa39ec3a3503af7888eb0db6cacfed9c047e6e3
[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 Category sorting:
11 dnl   * VALUE
12 dnl   * LABEL
13 dnl   * ascending/descending
14 dnl - CATEGORIES:
15 dnl   * Date values
16 dnl   * THRU (numeric ranges)
17 dnl   * OTHERNM
18 dnl - FORMAT:
19 dnl   * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
20 dnl   * MISSING.
21 dnl - HIDESMALLCOUNTS.
22 dnl - Date/time variables and values
23 dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
24 dnl - TITLES: )DATE, )TIME, )TABLE.
25 dnl - Test PCOMPUTE:
26 dnl   * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
27 dnl   * MISSING, OTHERNM
28 dnl   * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
29 dnl   * dates
30 dnl - PPROPERTIES:
31 dnl   * )LABEL[N].
32 dnl - Summary functions:
33 dnl   * U-prefix for unweighted summaries.
34 dnl   * areaPCT.SUM and UareaPCT.SUM functions.
35 dnl - SPLIT FILE with SEPARATE splits
36 dnl - Definition of columns/rows when labels are rotated from one axis to another.
37 dnl
38 dnl Not for v1:
39 dnl - Multiple response sets
40 dnl - MRSETS subcommand.
41 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
42 dnl - SIGTEST
43 dnl - COMPARETEST
44 dnl - Summary functions:
45 dnl   * .LCL and .UCL suffixes.
46 dnl   * .SE suffixes.
47 dnl - CATEGORIES:
48 dnl   * Data-dependent sorting.
49
50 AT_SETUP([CTABLES parsing])
51 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
52 AT_DATA([ctables.sps],
53 [[GET 'nhtsa.sav'.
54 CTABLES
55     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
56     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
57     /FORMAT UNITS=CM EMPTY="(-)"
58     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
59     /VLABELS VARIABLES=qn17 DISPLAY=NAME
60     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
61     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
62     /VLABELS VARIABLES=qn20 DISPLAY=NONE
63     /MRSETS COUNTDUPLICATES=NO
64     /MRSETS COUNTDUPLICATES=YES
65     /SMISSING VARIABLE
66     /SMISSING LISTWISE
67     /WEIGHT VARIABLE=qns3a
68     /HIDESMALLCOUNTS
69     /HIDESMALLCOUNTS COUNT=10
70     /TABLE qnsa1
71     /SLABELS POSITION=COLUMN VISIBLE=YES
72     /SLABELS VISIBLE=NO POSITION=ROW
73     /SLABELS POSITION=LAYER
74     /CLABELS AUTO
75     /CLABELS ROWLABELS=OPPOSITE
76     /CRITERIA CILEVEL=50
77     /CATEGORIES VARIABLES=qn1 qn17
78                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
79                 POSITION=BEFORE EMPTY=INCLUDE.
80 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
81 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
82 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
83 ]])
84 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
85          Custom Tables
86 Count
87 ╭───────────────────┬────┬────╮
88 │                   │ RDD│CELL│
89 ├───────────────────┼────┼────┤
90 │Sa1. SAMPLE SOURCE:│5392│1607│
91 ╰───────────────────┴────┴────╯
92
93        Custom Tables
94 RDD
95 ╭───────────────────┬─────╮
96 │                   │Count│
97 ├───────────────────┼─────┤
98 │Sa1. SAMPLE SOURCE:│ 5392│
99 ╰───────────────────┴─────╯
100
101           Custom Tables
102 ╭────────────────────────┬─────╮
103 │                        │Count│
104 ├────────────────────────┼─────┤
105 │Sa1. SAMPLE SOURCE: RDD │ 5392│
106 │                    CELL│ 1607│
107 ╰────────────────────────┴─────╯
108
109           Custom Tables
110 ╭────────────────────────┬─────╮
111 │                        │Count│
112 ├────────────────────────┼─────┤
113 │Sa1. SAMPLE SOURCE: RDD │ 5392│
114 │                    CELL│ 1607│
115 ╰────────────────────────┴─────╯
116 ])
117 AT_CLEANUP
118
119 AT_SETUP([CTABLES parsing - negative])
120 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
121 AT_DATA([ctables.sps],
122 [[GET 'nhtsa.sav'.
123 CTABLES.
124 CTABLES /FORMAT MINCOLWIDTH='foo'.
125 CTABLES /TABLE qn1 [**].
126 CTABLES /TABLE qn1 [NOTAFUNCTION].
127 CTABLES /TABLE (qn1.
128 CTABLES /TABLE **.
129 CTABLES /TABLE NOTAVAR.
130 STRING string(A8).
131 CTABLES /TABLE string[S].
132 CTABLES /TABLE qn1 [PTILE 101].
133 CTABLES /TABLE qn1 [MEAN F0.1].
134 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
135 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
136 CTABLES /TABLE qn1 [MEAN TOTALS].
137 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
138 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
142 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
143 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
144 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
145 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
146 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
147 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
148 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
149 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
150 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
151 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
152 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
153 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
154 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
155 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
156 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
157 CTABLES /PCOMPUTE &k=EXPR([LO **]).
158 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
159 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
160 CTABLES /PCOMPUTE &k=EXPR([1**]).
161 CTABLES /PCOMPUTE &k=EXPR((1x)).
162 CTABLES /PCOMPUTE **k.
163 CTABLES /PCOMPUTE &1.
164 CTABLES /PCOMPUTE &k**.
165 CTABLES /PCOMPUTE &k=**.
166 CTABLES /PCOMPUTE &k=EXPR**.
167 CTABLES /PCOMPUTE &k=EXPR(1x).
168 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
169 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
170 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
171 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
172 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
173 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
174 CTABLES /FORMAT EMPTY=**.
175 CTABLES /FORMAT MISSING=**.
176 CTABLES /FORMAT **.
177 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
178 CTABLES /VLABELS **.
179 CTABLES /VLABELS VARIABLES=NOTAVAR.
180 CTABLES /VLABELS VARIABLES=qn1 **.
181 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
182 CTABLES /MRSETS **.
183 CTABLES /MRSETS COUNTDUPLICATES=**.
184 CTABLES /SMISSING **.
185 CTABLES /WEIGHT **.
186 CTABLES /WEIGHT VARIABLE=NOTAVAR.
187 CTABLES /HIDESMALLCOUNTS COUNT=1.
188 CTABLES /QUUX.
189 CTABLES /HIDESMALLCOUNTS COUNT=2.
190 CTABLES /TABLE qn1**.
191 CTABLES /TABLE qn1 /SLABELS POSITION=**.
192 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
193 CTABLES /TABLE qn1 /SLABELS **.
194 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
195 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
196 CTABLES /TABLE qn1 /CLABELS **.
197 CTABLES /TABLE qn1 /CRITERIA **.
198 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
199 CTABLES /TABLE qn1 /TITLES **.
200 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
201 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
202 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
203 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
204 CTABLES /TABLE qn1 /SIGTEST **.
205 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
206 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
207 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
208 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
209 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
210 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
211 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
212 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
213 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
214 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
215 CTABLES /TABLE qn1 /COMPARETEST **.
216 CTABLES /TABLE qn1 / **.
217 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
218 CTABLES /TABLE qn20 > qnd1.
219 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
220 NUMERIC datetime (DATETIME17.0).
221 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
222 ]])
223 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
224 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
225
226 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
227 negative number for MINCOLWIDTH.
228
229 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
230 identifier.
231
232 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
233 summary function name.
234
235 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
236
237 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
238 identifier.
239
240 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
241
242 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
243 scale variable.
244    10 | CTABLES /TABLE string[S].
245       |                ^~~~~~~~~
246
247 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
248 between 0 and 100 for PTILE.
249
250 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
251 requires a width between 1 and 40.
252
253 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
254 format NEGPAREN requires width 2 or greater.
255
256 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
257 format NEGPAREN requires width greater than decimals.
258
259 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
260 scale variables.
261    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
262       |                     ^~~~
263
264 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
265    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
266       |                ^~~
267
268 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
269
270 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
271 scale variables.
272    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
273       |                     ^~~~
274
275 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
276    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
277       |                ^~~
278
279 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
280
281 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
282
283 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
284
285 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
286
287 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
288
289 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
290
291 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
292 identifier.
293
294 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
295    23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
296       |                                               ^~
297
298 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
299 between 0 and 100 for PTILE.
300
301 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
302 `@:}@'.
303
304 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
305 `@{:@'.
306
307 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
308 or EXCLUDE.
309
310 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
311 NO.
312
313 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
314
315 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
316 or AFTER.
317
318 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
319 or EXCLUDE.
320
321 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
322 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
323
324 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
325 LABEL, POSITION, or EMPTY.
326
327 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
328 integer for SUBTOTAL.
329
330 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
331
332 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
333
334 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
335
336 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
337
338 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
339
340 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
341
342 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
343
344 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
345
346 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
347
348 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
349
350 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
351
352 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
353
354 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
355 the previous definition.
356    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
357       |                               ^~~~~~~~~~~~~~~~~~~
358
359 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
360    47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
361       |          ^~~~~~~~~~~~~~~~~~~
362
363 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
364 `/'.
365
366 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
367 Expecting summary function name.
368
369 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
370 between 0 and 100 for PTILE.
371
372 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
373
374 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
375 NO.
376
377 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
378 FORMAT, or HIDESOURCECATS.
379
380 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
381
382 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
383
384 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
385 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
386
387 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
388 MAXCOLWIDTH.
389
390 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
391 VARIABLES.
392
393 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
394
395 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
396 DISPLAY.
397
398 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
399 DEFAULT, NAME, LABEL, BOTH, or NONE.
400
401 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
402 COUNTDUPLICATES.
403
404 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
405 NO.
406
407 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
408 VARIABLE or LISTWISE.
409
410 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
411 VARIABLE.
412
413 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
414
415 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
416 greater for HIDESMALLCOUNTS COUNT.
417
418 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
419 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
420 HIDESMALLCOUNTS, or TABLE.
421
422 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
423 `/'.
424
425 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
426
427 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
428 ROW, or LAYER.
429
430 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
431 NO.
432
433 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
434 POSITION or VISIBLE.
435
436 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
437 OPPOSITE or LAYER.
438
439 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
440 OPPOSITE or LAYER.
441
442 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
443 ROWLABELS, or COLLABELS.
444
445 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
446 CILEVEL.
447
448 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
449 in @<:@0,100@:}@ for CILEVEL.
450
451 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
452 CAPTION, CORNER, or TITLE.
453
454 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
455 CHISQUARE.
456
457 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
458 in @<:@0,1@:}@ for ALPHA.
459
460 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
461 NO.
462
463 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
464 ALLVISIBLE or SUBTOTALS.
465
466 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
467 ALPHA, INCLUDEMRSETS, or CATEGORIES.
468
469 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
470 MEAN.
471
472 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
473 in (0,1) for ALPHA.
474
475 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
476 for ALPHA.
477
478 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
479 BONFERRONI, BH, or NONE.
480
481 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
482 NO.
483
484 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
485 or TESTEDCATS.
486
487 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
488 ALLVISIBLE or SUBTOTALS.
489
490 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
491 NO.
492
493 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
494 SIMPLE.
495
496 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
497 NO.
498
499 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
500 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
501 SHOWSIG.
502
503 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
504 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
505
506 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
507 specified.
508
509 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
510    97 | CTABLES /TABLE qn20 > qnd1.
511       |                ^~~~~~~~~~~
512
513 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
514    97 | CTABLES /TABLE qn20 > qnd1.
515       |                ^~~~
516
517 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
518    97 | CTABLES /TABLE qn20 > qnd1.
519       |                       ^~~~
520
521 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
522 categorical variables at the innermost nesting level.
523    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
524       |                ^~~~~~~~~~~~~~~~~~~~
525
526 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
527 summary.
528    98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
529       |                ^~~
530
531 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
532 specification as format DATETIME: Day (123) must be between 1 and 31..
533   100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
534       |                                                    ^~~~~
535 ]])
536 AT_CLEANUP
537
538 AT_SETUP([CTABLES parsing - more negative])
539 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
540 AT_DATA([ctables.sps],
541 [[GET 'nhtsa.sav'.
542 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
543 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
544 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
545
546 STRING string(A8).
547 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
548 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
549
550 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
551
552 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
553 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
554 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
555 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
556
557 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
558 CTABLES /PCOMPUTE &x=EXPR([**]).
559 CTABLES /PCOMPUTE &x=EXPR(**).
560
561 CTABLES /TABLE.
562
563 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT]. 
564 ]])
565 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
566 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
567 category not included in the category list.
568     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
569 VARIABLES=qn1 [&pc].
570       |
571 ^~~
572
573 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
574     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
575 VARIABLES=qn1 [&pc].
576       |                            ^~~~~~~~
577
578 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
579 list of categories here.
580     2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
581 VARIABLES=qn1 [&pc].
582       |
583 ^~~~
584
585 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
586 category not included in the category list.
587     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
588 [&pc].
589       |
590 ^~~
591
592 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
593     3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
594 [&pc].
595       |                            ^~~~~
596
597 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
598 variable's CATEGORIES specification.
599
600 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
601 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
602 subtotals by position, e.g. SUBTOTAL[1].
603     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
604 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
605       |
606 ^~~~~~~~~~~~~~~~~~~~~~~~
607
608 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
609 position.
610     4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
611 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
612       |                            ^~~~~~~~
613
614 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
615 applied only to string variables, but this subcommand tries to apply it to
616 numeric variable QN1.
617     7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
618       |                                               ^~~~~~~~
619
620 ctables.sps:8.53: error: CTABLES: This category specification may be applied
621 only to numeric variables, but this subcommand tries to apply it to string
622 variable string.
623     8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
624       |                                                     ^
625
626 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
627 based on a summary function.
628
629 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
630 moved to be categorical, but qnd1 is a scale variable.
631
632 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
633 moved to have the same width, but QN1 has width 0 and string has width 8.
634
635 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
636 moved to have the same value labels, but QN1 and QNSA1 have different value
637 labels.
638
639 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
640 moved to have the same category specifications, but QN105BA and QN105BB have
641 different category specifications.
642
643 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
644 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'.  To disable
645 this warning, insert parentheses.
646    17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
647       |                           ^~~~~~~
648
649 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
650 `/'.
651
652 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
653
654 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
655
656 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
657 variable must be specified.
658
659 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
660
661 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows 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 variable on the columns axis has a
667 summary.
668    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
669       |                                 ^~~~~
670
671 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
672 summary.
673    23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
674       |                                                  ^~~~~
675 ]])
676 AT_CLEANUP
677
678 AT_SETUP([CTABLES one categorical variable])
679 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
680 AT_DATA([ctables.sps],
681 [[GET 'nhtsa.sav'.
682 CTABLES /TABLE qn1.
683 CTABLES /TABLE BY qn1.
684 CTABLES /TABLE BY BY qn1.
685 ]])
686 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
687                                   Custom Tables
688 ╭────────────────────────────────────────────────────────────────────────┬─────╮
689 │                                                                        │Count│
690 ├────────────────────────────────────────────────────────────────────────┼─────┤
691 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
692 │motor vehicle?                                     Several days a week  │ 1274│
693 │                                                   Once a week or less  │  361│
694 │                                                   Only certain times a │  130│
695 │                                                   year                 │     │
696 │                                                   Never                │  540│
697 ╰────────────────────────────────────────────────────────────────────────┴─────╯
698
699                                   Custom Tables
700 ╭──────────────────────────────────────────────────────────────────────────────╮
701 │        1. How often do you usually drive a car or other motor vehicle?       │
702 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
703 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
704 │Every day│       week       │       less       │          year          │Never│
705 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
706 │  Count  │       Count      │       Count      │          Count         │Count│
707 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
708 │     4667│              1274│               361│                     130│  540│
709 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
710
711 Custom Tables
712 Every day
713 ╭─────╮
714 │Count│
715 ├─────┤
716 │ 4667│
717 ╰─────╯
718 ])
719 AT_CLEANUP
720
721 AT_SETUP([CTABLES one string variable])
722 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
723 AT_DATA([ctables.sps],
724 [[GET 'nhtsa.sav'.
725 STRING licensed(A8).
726 MISSING VALUES licensed('DontKnow', 'Refused').
727 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
728 CTABLES /TABLE licensed.
729 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
730 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
731 * Notice that the string matching is case-sensitive.
732 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
733 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
734 CTABLES
735     /PCOMPUTE &notyes=EXPR(['No']+['DontKnow']+['Refused'])
736     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
737     /TABLE licensed
738     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'No', 'DontKnow', 'Refused'].
739 CTABLES
740     /PCOMPUTE &notyes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
741     /PPROPERTIES &notyes LABEL='Not Yes' HIDESOURCECATS=YES
742     /TABLE licensed
743     /CATEGORIES VARIABLES=licensed ['Yes', &notyes, 'DontKnow' THRU 'No', 'Refused'].
744 ]])
745 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
746     Custom Tables
747 ╭────────────┬─────╮
748 │            │Count│
749 ├────────────┼─────┤
750 │licensed No │  572│
751 │         Yes│ 6379│
752 ╰────────────┴─────╯
753
754           Custom Tables
755 ╭─────────────────┬─────┬───────╮
756 │                 │Count│Valid N│
757 ├─────────────────┼─────┼───────┤
758 │licensed DontKnow│    4│       │
759 │         No      │  572│       │
760 │         Refused │   44│       │
761 │         Yes     │ 6379│       │
762 │         Total   │ 6999│   6951│
763 ╰─────────────────┴─────┴───────╯
764
765      Custom Tables
766 ╭──────────────┬─────╮
767 │              │Count│
768 ├──────────────┼─────┤
769 │licensed Yes  │ 6379│
770 │         No   │  572│
771 │         Total│ 6951│
772 ╰──────────────┴─────╯
773
774      Custom Tables
775 ╭──────────────┬─────╮
776 │              │Count│
777 ├──────────────┼─────┤
778 │licensed Yes  │ 6379│
779 │         no   │    0│
780 │         Total│ 6379│
781 ╰──────────────┴─────╯
782
783       Custom Tables
784 ╭────────────────┬─────╮
785 │                │Count│
786 ├────────────────┼─────┤
787 │licensed No     │  572│
788 │         Refused│   44│
789 │         Yes    │ 6379│
790 │         Total  │ 6995│
791 ╰────────────────┴─────╯
792
793       Custom Tables
794 ╭────────────────┬─────╮
795 │                │Count│
796 ├────────────────┼─────┤
797 │licensed Yes    │ 6379│
798 │         Not Yes│  620│
799 ╰────────────────┴─────╯
800
801       Custom Tables
802 ╭────────────────┬─────╮
803 │                │Count│
804 ├────────────────┼─────┤
805 │licensed Yes    │ 6379│
806 │         Not Yes│  620│
807 ╰────────────────┴─────╯
808 ])
809 AT_CLEANUP
810
811 AT_SETUP([CTABLES one scale variable])
812 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
813 AT_DATA([ctables.sps],
814 [[GET 'nhtsa.sav'.
815 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
816 CTABLES /TABLE BY qnd1.
817 CTABLES /TABLE BY BY qnd1.
818 ]])
819 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
820                                   Custom Tables
821 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
822 │                      │     │       │       │    │     Std    │       │       │
823 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
824 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
825 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
826 │age?                  │     │       │       │    │            │       │       │
827 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
828
829         Custom Tables
830 ╭──────────────────────────╮
831 │D1. AGE: What is your age?│
832 ├──────────────────────────┤
833 │           Mean           │
834 ├──────────────────────────┤
835 │                        48│
836 ╰──────────────────────────╯
837
838 Custom Tables
839 D1. AGE: What is your age?
840 ╭────╮
841 │Mean│
842 ├────┤
843 │  48│
844 ╰────╯
845 ])
846 AT_CLEANUP
847
848 AT_SETUP([CTABLES simple stacking])
849 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
850 AT_DATA([ctables.sps],
851 [[GET 'nhtsa.sav'.
852 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
853 ]])
854 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
855                                   Custom Tables
856 ╭───────────────────────────────────────────────────────────────┬──────────────╮
857 │                                                               │ S3a. GENDER: │
858 │                                                               ├──────┬───────┤
859 │                                                               │ Male │ Female│
860 │                                                               ├──────┼───────┤
861 │                                                               │Column│ Column│
862 │                                                               │   %  │   %   │
863 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
864 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
865 │too much to drink to drive safely will A. Get      certain     │      │       │
866 │stopped by the police?                             Very likely │   21%│    22%│
867 │                                                   Somewhat    │   38%│    42%│
868 │                                                   likely      │      │       │
869 │                                                   Somewhat    │   21%│    18%│
870 │                                                   unlikely    │      │       │
871 │                                                   Very        │   10%│     8%│
872 │                                                   unlikely    │      │       │
873 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
874 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
875 │too much to drink to drive safely will B. Have an  certain     │      │       │
876 │accident?                                          Very likely │   36%│    45%│
877 │                                                   Somewhat    │   39%│    32%│
878 │                                                   likely      │      │       │
879 │                                                   Somewhat    │    9%│     4%│
880 │                                                   unlikely    │      │       │
881 │                                                   Very        │    3%│     2%│
882 │                                                   unlikely    │      │       │
883 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
884 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
885 │too much to drink to drive safely will C. Be       certain     │      │       │
886 │convicted for drunk driving?                       Very likely │   32%│    28%│
887 │                                                   Somewhat    │   27%│    32%│
888 │                                                   likely      │      │       │
889 │                                                   Somewhat    │   15%│    15%│
890 │                                                   unlikely    │      │       │
891 │                                                   Very        │    9%│     9%│
892 │                                                   unlikely    │      │       │
893 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
894 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
895 │too much to drink to drive safely will D. Be       certain     │      │       │
896 │arrested for drunk driving?                        Very likely │   26%│    27%│
897 │                                                   Somewhat    │   32%│    35%│
898 │                                                   likely      │      │       │
899 │                                                   Somewhat    │   17%│    15%│
900 │                                                   unlikely    │      │       │
901 │                                                   Very        │    9%│     7%│
902 │                                                   unlikely    │      │       │
903 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
904 ])
905 AT_CLEANUP
906
907 AT_SETUP([CTABLES show or hide empty categories])
908 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
909 AT_DATA([ctables.sps],
910 [[GET 'nhtsa.sav'.
911 IF (qn105ba = 2) qn105ba = 1.
912 IF (qns3a = 1) qns3a = 2.
913 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
914 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
915     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
916 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
917     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
918 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
919     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
920 ]])
921 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
922                                   Custom Tables
923 ╭──────────────────────────────────────────────────────────────┬───────────────╮
924 │                                                              │  S3a. GENDER: │
925 │                                                              ├───────┬───────┤
926 │                                                              │  Male │ Female│
927 │                                                              ├───────┼───────┤
928 │                                                              │ Column│ Column│
929 │                                                              │   %   │   %   │
930 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
931 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
932 │too much to drink to drive safely will A. Get      certain    │       │       │
933 │stopped by the police?                             Very likely│      .│     0%│
934 │                                                   Somewhat   │      .│    40%│
935 │                                                   likely     │       │       │
936 │                                                   Somewhat   │      .│    19%│
937 │                                                   unlikely   │       │       │
938 │                                                   Very       │      .│     9%│
939 │                                                   unlikely   │       │       │
940 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
941
942                                   Custom Tables
943 ╭──────────────────────────────────────────────────────────────┬───────────────╮
944 │                                                              │  S3a. GENDER: │
945 │                                                              ├───────┬───────┤
946 │                                                              │  Male │ Female│
947 │                                                              ├───────┼───────┤
948 │                                                              │ Column│ Column│
949 │                                                              │   %   │   %   │
950 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
951 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
952 │too much to drink to drive safely will A. Get      certain    │       │       │
953 │stopped by the police?                             Somewhat   │      .│    40%│
954 │                                                   likely     │       │       │
955 │                                                   Somewhat   │      .│    19%│
956 │                                                   unlikely   │       │       │
957 │                                                   Very       │      .│     9%│
958 │                                                   unlikely   │       │       │
959 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
960
961                                   Custom Tables
962 ╭────────────────────────────────────────────────────────────────────┬─────────╮
963 │                                                                    │   S3a.  │
964 │                                                                    │ GENDER: │
965 │                                                                    ├─────────┤
966 │                                                                    │  Female │
967 │                                                                    ├─────────┤
968 │                                                                    │ Column %│
969 ├────────────────────────────────────────────────────────────────────┼─────────┤
970 │105b. How likely is it that drivers who have had too    Almost      │      32%│
971 │much to drink to drive safely will A. Get stopped by    certain     │         │
972 │the police?                                             Very likely │       0%│
973 │                                                        Somewhat    │      40%│
974 │                                                        likely      │         │
975 │                                                        Somewhat    │      19%│
976 │                                                        unlikely    │         │
977 │                                                        Very        │       9%│
978 │                                                        unlikely    │         │
979 ╰────────────────────────────────────────────────────────────────────┴─────────╯
980
981                                   Custom Tables
982 ╭────────────────────────────────────────────────────────────────────┬─────────╮
983 │                                                                    │   S3a.  │
984 │                                                                    │ GENDER: │
985 │                                                                    ├─────────┤
986 │                                                                    │  Female │
987 │                                                                    ├─────────┤
988 │                                                                    │ Column %│
989 ├────────────────────────────────────────────────────────────────────┼─────────┤
990 │105b. How likely is it that drivers who have had too    Almost      │      32%│
991 │much to drink to drive safely will A. Get stopped by    certain     │         │
992 │the police?                                             Somewhat    │      40%│
993 │                                                        likely      │         │
994 │                                                        Somewhat    │      19%│
995 │                                                        unlikely    │         │
996 │                                                        Very        │       9%│
997 │                                                        unlikely    │         │
998 ╰────────────────────────────────────────────────────────────────────┴─────────╯
999 ])
1000 AT_CLEANUP
1001
1002 AT_SETUP([CTABLES simple nesting])
1003 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1004 AT_DATA([ctables.sps],
1005 [[GET 'nhtsa.sav'.
1006 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1007   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1008 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1009   /CATEGORIES VARIABLES=qns3a TOTAL=YES
1010   /CLABELS ROW=OPPOSITE.
1011 ]])
1012 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1013                                   Custom Tables
1014 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1015 │                                                                 │     │ Table│
1016 │                                                                 │Count│   %  │
1017 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1018 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
1019 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
1020 │drive safely will A. Get stopped by                        Total │  700│   10%│
1021 │the police?                           ╶──────────────────────────┼─────┼──────┤
1022 │                                       Very       S3a.     Male  │  660│   10%│
1023 │                                       likely     GENDER:  Female│  842│   12%│
1024 │                                                           Total │ 1502│   22%│
1025 │                                      ╶──────────────────────────┼─────┼──────┤
1026 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
1027 │                                       likely     GENDER:  Female│ 1589│   23%│
1028 │                                                           Total │ 2763│   40%│
1029 │                                      ╶──────────────────────────┼─────┼──────┤
1030 │                                       Somewhat   S3a.     Male  │  640│    9%│
1031 │                                       unlikely   GENDER:  Female│  667│   10%│
1032 │                                                           Total │ 1307│   19%│
1033 │                                      ╶──────────────────────────┼─────┼──────┤
1034 │                                       Very       S3a.     Male  │  311│    5%│
1035 │                                       unlikely   GENDER:  Female│  298│    4%│
1036 │                                                           Total │  609│    9%│
1037 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1038 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
1039 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
1040 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
1041 │                                      ╶──────────────────────────┼─────┼──────┤
1042 │                                       Very       S3a.     Male  │ 1104│   16%│
1043 │                                       likely     GENDER:  Female│ 1715│   25%│
1044 │                                                           Total │ 2819│   41%│
1045 │                                      ╶──────────────────────────┼─────┼──────┤
1046 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
1047 │                                       likely     GENDER:  Female│ 1214│   18%│
1048 │                                                           Total │ 2417│   35%│
1049 │                                      ╶──────────────────────────┼─────┼──────┤
1050 │                                       Somewhat   S3a.     Male  │  262│    4%│
1051 │                                       unlikely   GENDER:  Female│  168│    2%│
1052 │                                                           Total │  430│    6%│
1053 │                                      ╶──────────────────────────┼─────┼──────┤
1054 │                                       Very       S3a.     Male  │   81│    1%│
1055 │                                       unlikely   GENDER:  Female│   59│    1%│
1056 │                                                           Total │  140│    2%│
1057 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1058 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
1059 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
1060 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
1061 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1062 │                                       Very       S3a.     Male  │  988│   14%│
1063 │                                       likely     GENDER:  Female│ 1049│   15%│
1064 │                                                           Total │ 2037│   30%│
1065 │                                      ╶──────────────────────────┼─────┼──────┤
1066 │                                       Somewhat   S3a.     Male  │  822│   12%│
1067 │                                       likely     GENDER:  Female│ 1210│   18%│
1068 │                                                           Total │ 2032│   30%│
1069 │                                      ╶──────────────────────────┼─────┼──────┤
1070 │                                       Somewhat   S3a.     Male  │  446│    7%│
1071 │                                       unlikely   GENDER:  Female│  548│    8%│
1072 │                                                           Total │  994│   15%│
1073 │                                      ╶──────────────────────────┼─────┼──────┤
1074 │                                       Very       S3a.     Male  │  268│    4%│
1075 │                                       unlikely   GENDER:  Female│  354│    5%│
1076 │                                                           Total │  622│    9%│
1077 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1078 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
1079 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
1080 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
1081 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
1082 │                                       Very       S3a.     Male  │  805│   12%│
1083 │                                       likely     GENDER:  Female│ 1029│   15%│
1084 │                                                           Total │ 1834│   27%│
1085 │                                      ╶──────────────────────────┼─────┼──────┤
1086 │                                       Somewhat   S3a.     Male  │  975│   14%│
1087 │                                       likely     GENDER:  Female│ 1332│   19%│
1088 │                                                           Total │ 2307│   34%│
1089 │                                      ╶──────────────────────────┼─────┼──────┤
1090 │                                       Somewhat   S3a.     Male  │  535│    8%│
1091 │                                       unlikely   GENDER:  Female│  560│    8%│
1092 │                                                           Total │ 1095│   16%│
1093 │                                      ╶──────────────────────────┼─────┼──────┤
1094 │                                       Very       S3a.     Male  │  270│    4%│
1095 │                                       unlikely   GENDER:  Female│  279│    4%│
1096 │                                                           Total │  549│    8%│
1097 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1098
1099                                   Custom Tables
1100 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1101 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
1102 │                                 │ certain│likely│  likely │ unlikely│unlikely│
1103 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
1104 │                                 │        │ Table│         │         │        │
1105 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
1106 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1107 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
1108 │GENDER:        is it that drivers│        │      │         │         │        │
1109 │               who have had too  │        │      │         │         │        │
1110 │               much to drink to  │        │      │         │         │        │
1111 │               drive safely will │        │      │         │         │        │
1112 │               A. Get stopped by │        │      │         │         │        │
1113 │               the police?       │        │      │         │         │        │
1114 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1115 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
1116 │               is it that drivers│        │      │         │         │        │
1117 │               who have had too  │        │      │         │         │        │
1118 │               much to drink to  │        │      │         │         │        │
1119 │               drive safely will │        │      │         │         │        │
1120 │               A. Get stopped by │        │      │         │         │        │
1121 │               the police?       │        │      │         │         │        │
1122 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1123 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
1124 │               is it that drivers│        │      │         │         │        │
1125 │               who have had too  │        │      │         │         │        │
1126 │               much to drink to  │        │      │         │         │        │
1127 │               drive safely will │        │      │         │         │        │
1128 │               A. Get stopped by │        │      │         │         │        │
1129 │               the police?       │        │      │         │         │        │
1130 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1131 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
1132 │GENDER:        is it that drivers│        │      │         │         │        │
1133 │               who have had too  │        │      │         │         │        │
1134 │               much to drink to  │        │      │         │         │        │
1135 │               drive safely will │        │      │         │         │        │
1136 │               B. Have an        │        │      │         │         │        │
1137 │               accident?         │        │      │         │         │        │
1138 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1139 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
1140 │               is it that drivers│        │      │         │         │        │
1141 │               who have had too  │        │      │         │         │        │
1142 │               much to drink to  │        │      │         │         │        │
1143 │               drive safely will │        │      │         │         │        │
1144 │               B. Have an        │        │      │         │         │        │
1145 │               accident?         │        │      │         │         │        │
1146 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1147 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
1148 │               is it that drivers│        │      │         │         │        │
1149 │               who have had too  │        │      │         │         │        │
1150 │               much to drink to  │        │      │         │         │        │
1151 │               drive safely will │        │      │         │         │        │
1152 │               B. Have an        │        │      │         │         │        │
1153 │               accident?         │        │      │         │         │        │
1154 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1155 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
1156 │GENDER:        is it that drivers│        │      │         │         │        │
1157 │               who have had too  │        │      │         │         │        │
1158 │               much to drink to  │        │      │         │         │        │
1159 │               drive safely will │        │      │         │         │        │
1160 │               C. Be convicted   │        │      │         │         │        │
1161 │               for drunk driving?│        │      │         │         │        │
1162 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1163 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
1164 │               is it that drivers│        │      │         │         │        │
1165 │               who have had too  │        │      │         │         │        │
1166 │               much to drink to  │        │      │         │         │        │
1167 │               drive safely will │        │      │         │         │        │
1168 │               C. Be convicted   │        │      │         │         │        │
1169 │               for drunk driving?│        │      │         │         │        │
1170 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1171 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
1172 │               is it that drivers│        │      │         │         │        │
1173 │               who have had too  │        │      │         │         │        │
1174 │               much to drink to  │        │      │         │         │        │
1175 │               drive safely will │        │      │         │         │        │
1176 │               C. Be convicted   │        │      │         │         │        │
1177 │               for drunk driving?│        │      │         │         │        │
1178 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1179 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
1180 │GENDER:        is it that drivers│        │      │         │         │        │
1181 │               who have had too  │        │      │         │         │        │
1182 │               much to drink to  │        │      │         │         │        │
1183 │               drive safely will │        │      │         │         │        │
1184 │               D. Be arrested for│        │      │         │         │        │
1185 │               drunk driving?    │        │      │         │         │        │
1186 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1187 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
1188 │               is it that drivers│        │      │         │         │        │
1189 │               who have had too  │        │      │         │         │        │
1190 │               much to drink to  │        │      │         │         │        │
1191 │               drive safely will │        │      │         │         │        │
1192 │               D. Be arrested for│        │      │         │         │        │
1193 │               drunk driving?    │        │      │         │         │        │
1194 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1195 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
1196 │               is it that drivers│        │      │         │         │        │
1197 │               who have had too  │        │      │         │         │        │
1198 │               much to drink to  │        │      │         │         │        │
1199 │               drive safely will │        │      │         │         │        │
1200 │               D. Be arrested for│        │      │         │         │        │
1201 │               drunk driving?    │        │      │         │         │        │
1202 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1203 ])
1204 AT_CLEANUP
1205
1206 AT_SETUP([CTABLES nesting and scale variables])
1207 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1208 AT_DATA([ctables.sps],
1209 [[GET 'nhtsa.sav'.
1210 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1211 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1212 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1213   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1214 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1215 ]])
1216 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1217                                   Custom Tables
1218 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1219 │                                                                 │S3a. GENDER:│
1220 │                                                                 ├─────┬──────┤
1221 │                                                                 │ Male│Female│
1222 │                                                                 ├─────┼──────┤
1223 │                                                                 │ Mean│ Mean │
1224 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1225 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
1226 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
1227 │                                                  week           │     │      │
1228 │                                                  Once a week or │   44│    54│
1229 │                                                  less           │     │      │
1230 │                                                  Only certain   │   34│    41│
1231 │                                                  times a year   │     │      │
1232 │                                                  Never          │   39│    55│
1233 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1234
1235                                   Custom Tables
1236 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1237 │                                                         │Minimum│Maximum│Mean│
1238 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1239 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
1240 │What is  GENDER:         months, has there been a        │       │       │    │
1241 │your                     time when you felt you          │       │       │    │
1242 │age?                     should cut down on your      No │     16│     86│  46│
1243 │                         drinking?                       │       │       │    │
1244 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1245 │                  Female 26. During the last 12       Yes│     16│     86│  43│
1246 │                         months, has there been a        │       │       │    │
1247 │                         time when you felt you          │       │       │    │
1248 │                         should cut down on your      No │     16│     86│  48│
1249 │                         drinking?                       │       │       │    │
1250 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1251 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
1252 │What is  GENDER:         months, has there been a        │       │       │    │
1253 │your                     time when people criticized  No │     16│     86│  46│
1254 │age?                     your drinking?                  │       │       │    │
1255 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
1256 │                  Female 27. During the last 12       Yes│     17│     69│  37│
1257 │                         months, has there been a        │       │       │    │
1258 │                         time when people criticized  No │     16│     86│  48│
1259 │                         your drinking?                  │       │       │    │
1260 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1261
1262                                   Custom Tables
1263 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1264 │                             │S1. Including yourself, how many members of this│
1265 │                             │         household are age 16 or older?         │
1266 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1267 │                             │      │      │      │      │      │      │ 6 or │
1268 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
1269 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1270 │                             │Column│Column│Column│Column│Column│Column│Column│
1271 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
1272 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1273 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
1274 │SAMPLE      How      certain │      │      │      │      │      │      │      │
1275 │SOURCE:     likely           │      │      │      │      │      │      │      │
1276 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1277 │            that     likely  │      │      │      │      │      │      │      │
1278 │            drivers          │      │      │      │      │      │      │      │
1279 │            who have         │      │      │      │      │      │      │      │
1280 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1281 │            much to  likely  │      │      │      │      │      │      │      │
1282 │            drink to         │      │      │      │      │      │      │      │
1283 │            drive            │      │      │      │      │      │      │      │
1284 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
1285 │            will A.  unlikely│      │      │      │      │      │      │      │
1286 │            Get              │      │      │      │      │      │      │      │
1287 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
1288 │            by the   unlikely│      │      │      │      │      │      │      │
1289 │            police?          │      │      │      │      │      │      │      │
1290 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1291
1292                                   Custom Tables
1293 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1294 │                                                              │    │    Std   │
1295 │                                                              │Mean│ Deviation│
1296 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1297 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
1298 │group           typical month did you have one or more        │    │          │
1299 │                alcoholic beverages to drink?                 │    │          │
1300 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1301 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
1302 │                typical month did you have one or more        │    │          │
1303 │                alcoholic beverages to drink?                 │    │          │
1304 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1305 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
1306 │                typical month did you have one or more        │    │          │
1307 │                alcoholic beverages to drink?                 │    │          │
1308 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1309 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
1310 │                typical month did you have one or more        │    │          │
1311 │                alcoholic beverages to drink?                 │    │          │
1312 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1313 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
1314 │                typical month did you have one or more        │    │          │
1315 │                alcoholic beverages to drink?                 │    │          │
1316 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
1317 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
1318 │       older    typical month did you have one or more        │    │          │
1319 │                alcoholic beverages to drink?                 │    │          │
1320 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1321 ])
1322 AT_CLEANUP
1323
1324
1325 AT_SETUP([CTABLES SLABELS])
1326 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1327 AT_DATA([ctables.sps],
1328 [[GET 'nhtsa.sav'.
1329 CTABLES /TABLE qn1 [COUNT COLPCT].
1330 CTABLES /TABLE qn1 [COUNT COLPCT]
1331     /SLABELS POSITION=ROW.
1332 CTABLES /TABLE qn1 [COUNT COLPCT]
1333     /SLABELS POSITION=ROW VISIBLE=NO.
1334 ]])
1335 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1336                                   Custom Tables
1337 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1338 │                                                                │     │ Column│
1339 │                                                                │Count│   %   │
1340 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1341 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
1342 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
1343 │                                             Once a week or less│  361│   5.2%│
1344 │                                             Only certain times │  130│   1.9%│
1345 │                                             a year             │     │       │
1346 │                                             Never              │  540│   7.7%│
1347 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1348
1349                                   Custom Tables
1350 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1351 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
1352 │other motor vehicle?                                             Column │66.9%│
1353 │                                                                 %      │     │
1354 │                                            ╶───────────────────────────┼─────┤
1355 │                                             Several days a week Count  │ 1274│
1356 │                                                                 Column │18.3%│
1357 │                                                                 %      │     │
1358 │                                            ╶───────────────────────────┼─────┤
1359 │                                             Once a week or less Count  │  361│
1360 │                                                                 Column │ 5.2%│
1361 │                                                                 %      │     │
1362 │                                            ╶───────────────────────────┼─────┤
1363 │                                             Only certain times  Count  │  130│
1364 │                                             a year              Column │ 1.9%│
1365 │                                                                 %      │     │
1366 │                                            ╶───────────────────────────┼─────┤
1367 │                                             Never               Count  │  540│
1368 │                                                                 Column │ 7.7%│
1369 │                                                                 %      │     │
1370 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1371
1372                                   Custom Tables
1373 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1374 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
1375 │motor vehicle?                                                          │66.9%│
1376 │                                                   Several days a week  │ 1274│
1377 │                                                                        │18.3%│
1378 │                                                   Once a week or less  │  361│
1379 │                                                                        │ 5.2%│
1380 │                                                   Only certain times a │  130│
1381 │                                                   year                 │ 1.9%│
1382 │                                                   Never                │  540│
1383 │                                                                        │ 7.7%│
1384 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1385 ])
1386 AT_CLEANUP
1387
1388 AT_SETUP([CTABLES simple totals])
1389 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1390 AT_DATA([ctables.sps],
1391 [[GET 'nhtsa.sav'.
1392 CTABLES /TABLE=qn17
1393     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1394 DESCRIPTIVES qn18/STATISTICS=MEAN.
1395 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1396     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1397 ]])
1398 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1399                                   Custom Tables
1400 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1401 │                                                                        │Count│
1402 ├────────────────────────────────────────────────────────────────────────┼─────┤
1403 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
1404 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
1405 │                                                      Light beer        │  620│
1406 │                                                      Wine              │ 1418│
1407 │                                                      Wine coolers      │  137│
1408 │                                                      Hard liquor or    │  888│
1409 │                                                      mixed drinks      │     │
1410 │                                                      Flavored malt     │   83│
1411 │                                                      drinks            │     │
1412 │                                                      Number responding │ 4221│
1413 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1414
1415                              Descriptive Statistics
1416 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1417 │                                                                    │  N │Mean│
1418 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1419 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
1420 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
1421 │Valid N (listwise)                                                  │6999│    │
1422 │Missing N (listwise)                                                │2781│    │
1423 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1424
1425                                   Custom Tables
1426 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1427 │                                                      │    │     │ Valid│Total│
1428 │                                                      │Mean│Count│   N  │  N  │
1429 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1430 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
1431 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1432 │                you usually drink per sitting?        │    │     │      │     │
1433 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1434 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
1435 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1436 │                you usually drink per sitting?        │    │     │      │     │
1437 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1438 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
1439 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1440 │                you usually drink per sitting?        │    │     │      │     │
1441 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1442 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
1443 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1444 │                you usually drink per sitting?        │    │     │      │     │
1445 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1446 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
1447 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
1448 │                you usually drink per sitting?        │    │     │      │     │
1449 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1450 ])
1451 AT_CLEANUP
1452
1453 AT_SETUP([CTABLES subtotals])
1454 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1455 AT_DATA([ctables.sps],
1456 [[GET 'nhtsa.sav'.
1457 CTABLES /TABLE=qn105ba BY qns1
1458     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1459 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1460     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1461 CTABLES /TABLE=qn105ba BY qns1
1462     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1463     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1464 ]])
1465 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1466                                                       Custom Tables
1467 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1468 │                                                         │ S1. Including yourself, how many members of this household │
1469 │                                                         │                    are age 16 or older?                    │
1470 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1471 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1472 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1473 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1474 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1475 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1476 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1477 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1478 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1479 │                                              likely     │       │       │         │       │        │      │          │
1480 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1481 │                                              unlikely   │       │       │         │       │        │      │          │
1482 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1483 │                                              unlikely   │       │       │         │       │        │      │          │
1484 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1485
1486                                                       Custom Tables
1487 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1488 │                                                        │  S1. Including yourself, how many members of this household │
1489 │                                                        │                     are age 16 or older?                    │
1490 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1491 │                                                        │        │        │        │        │       │        │  6 or  │
1492 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
1493 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1494 │                                                        │        │        │        │        │ Column│        │        │
1495 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
1496 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1497 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
1498 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
1499 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
1500 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
1501 │                                             likely     │        │        │        │        │       │        │        │
1502 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
1503 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
1504 │                                             unlikely   │        │        │        │        │       │        │        │
1505 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
1506 │                                             unlikely   │        │        │        │        │       │        │        │
1507 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
1508 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1509
1510                                                       Custom Tables
1511 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1512 │                                                         │ S1. Including yourself, how many members of this household │
1513 │                                                         │                    are age 16 or older?                    │
1514 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1515 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
1516 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1517 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
1518 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1519 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
1520 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
1521 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
1522 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
1523 │                                              likely     │       │       │         │       │        │      │          │
1524 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
1525 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
1526 │                                              unlikely   │       │       │         │       │        │      │          │
1527 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
1528 │                                              unlikely   │       │       │         │       │        │      │          │
1529 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
1530 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1531 ])
1532 AT_CLEANUP
1533
1534 AT_SETUP([CTABLES PCOMPUTE])
1535 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1536 AT_DATA([ctables.sps],
1537 [[GET 'nhtsa.sav'.
1538 CTABLES
1539     /PCOMPUTE &x=EXPR([3] + [4])
1540     /PCOMPUTE &y=EXPR([4] + [5])
1541     /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
1542     /PPROPERTIES &y LABEL='4+5'
1543     /TABLE=qn105ba BY qns1
1544     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
1545 ]])
1546 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1547                                                       Custom Tables
1548 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1549 │                                                        │  S1. Including yourself, how many members of this household │
1550 │                                                        │                     are age 16 or older?                    │
1551 │                                                        ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
1552 │                                                        │   1   │   2   │ Subtotal │   5   │   3+4  │  4+5 │ Subtotal │
1553 │                                                        ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1554 │                                                        │ Count │ Count │   Count  │ Count │  Count │ Count│   Count  │
1555 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1556 │105b. How likely is it that drivers who have Almost     │    147│    246│       393│     11│   81.00│    30│        92│
1557 │had too much to drink to drive safely will   certain    │       │       │          │       │        │      │          │
1558 │A. Get stopped by the police?                Very likely│    384│    552│       936│     14│  171.00│    65│       185│
1559 │                                             Somewhat   │    590│   1249│      1839│     20│  265.00│    92│       285│
1560 │                                             likely     │       │       │          │       │        │      │          │
1561 │                                             Somewhat   │    278│    647│       925│      6│  116.00│    38│       122│
1562 │                                             unlikely   │       │       │          │       │        │      │          │
1563 │                                             Very       │    141│    290│       431│      4│   59.00│    22│        63│
1564 │                                             unlikely   │       │       │          │       │        │      │          │
1565 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
1566 ])
1567 AT_CLEANUP
1568
1569 AT_SETUP([CTABLES CLABELS])
1570 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1571 AT_DATA([ctables.sps],
1572 [[GET 'nhtsa.sav'.
1573 CTABLES /TABLE AgeGroup BY qns3a.
1574 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1575 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1576 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1577 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1578 ]])
1579 pwd
1580 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1581              Custom Tables
1582 ╭───────────────────────┬────────────╮
1583 │                       │S3a. GENDER:│
1584 │                       ├─────┬──────┤
1585 │                       │ Male│Female│
1586 │                       ├─────┼──────┤
1587 │                       │Count│ Count│
1588 ├───────────────────────┼─────┼──────┤
1589 │Age group 15 or younger│    0│     0│
1590 │          16 to 25     │  594│   505│
1591 │          26 to 35     │  476│   491│
1592 │          36 to 45     │  489│   548│
1593 │          46 to 55     │  526│   649│
1594 │          56 to 65     │  516│   731│
1595 │          66 or older  │  531│   943│
1596 ╰───────────────────────┴─────┴──────╯
1597
1598                                                       Custom Tables
1599 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1600 │       │                                                 S3a. GENDER:                                                 │
1601 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1602 │       │                         Male                         │                         Female                        │
1603 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1604 │       │  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 │
1605 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
1606 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1607 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
1608 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1609 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
1610 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
1611 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1612
1613                 Custom Tables
1614 ╭──────────────────────────────┬────────────╮
1615 │                              │S3a. GENDER:│
1616 │                              ├────────────┤
1617 │                              │    Count   │
1618 ├──────────────────────────────┼────────────┤
1619 │Age group 15 or younger Male  │           0│
1620 │                        Female│           0│
1621 │         ╶────────────────────┼────────────┤
1622 │          16 to 25      Male  │         594│
1623 │                        Female│         505│
1624 │         ╶────────────────────┼────────────┤
1625 │          26 to 35      Male  │         476│
1626 │                        Female│         491│
1627 │         ╶────────────────────┼────────────┤
1628 │          36 to 45      Male  │         489│
1629 │                        Female│         548│
1630 │         ╶────────────────────┼────────────┤
1631 │          46 to 55      Male  │         526│
1632 │                        Female│         649│
1633 │         ╶────────────────────┼────────────┤
1634 │          56 to 65      Male  │         516│
1635 │                        Female│         731│
1636 │         ╶────────────────────┼────────────┤
1637 │          66 or older   Male  │         531│
1638 │                        Female│         943│
1639 ╰──────────────────────────────┴────────────╯
1640
1641       Custom Tables
1642 15 or younger
1643 ╭─────────┬────────────╮
1644 │         │S3a. GENDER:│
1645 │         ├─────┬──────┤
1646 │         │ Male│Female│
1647 │         ├─────┼──────┤
1648 │         │Count│ Count│
1649 ├─────────┼─────┼──────┤
1650 │Age group│    0│     0│
1651 ╰─────────┴─────┴──────╯
1652
1653       Custom Tables
1654 16 to 25
1655 ╭─────────┬────────────╮
1656 │         │S3a. GENDER:│
1657 │         ├─────┬──────┤
1658 │         │ Male│Female│
1659 │         ├─────┼──────┤
1660 │         │Count│ Count│
1661 ├─────────┼─────┼──────┤
1662 │Age group│  594│   505│
1663 ╰─────────┴─────┴──────╯
1664
1665       Custom Tables
1666 26 to 35
1667 ╭─────────┬────────────╮
1668 │         │S3a. GENDER:│
1669 │         ├─────┬──────┤
1670 │         │ Male│Female│
1671 │         ├─────┼──────┤
1672 │         │Count│ Count│
1673 ├─────────┼─────┼──────┤
1674 │Age group│  476│   491│
1675 ╰─────────┴─────┴──────╯
1676
1677       Custom Tables
1678 36 to 45
1679 ╭─────────┬────────────╮
1680 │         │S3a. GENDER:│
1681 │         ├─────┬──────┤
1682 │         │ Male│Female│
1683 │         ├─────┼──────┤
1684 │         │Count│ Count│
1685 ├─────────┼─────┼──────┤
1686 │Age group│  489│   548│
1687 ╰─────────┴─────┴──────╯
1688
1689       Custom Tables
1690 46 to 55
1691 ╭─────────┬────────────╮
1692 │         │S3a. GENDER:│
1693 │         ├─────┬──────┤
1694 │         │ Male│Female│
1695 │         ├─────┼──────┤
1696 │         │Count│ Count│
1697 ├─────────┼─────┼──────┤
1698 │Age group│  526│   649│
1699 ╰─────────┴─────┴──────╯
1700
1701       Custom Tables
1702 56 to 65
1703 ╭─────────┬────────────╮
1704 │         │S3a. GENDER:│
1705 │         ├─────┬──────┤
1706 │         │ Male│Female│
1707 │         ├─────┼──────┤
1708 │         │Count│ Count│
1709 ├─────────┼─────┼──────┤
1710 │Age group│  516│   731│
1711 ╰─────────┴─────┴──────╯
1712
1713       Custom Tables
1714 66 or older
1715 ╭─────────┬────────────╮
1716 │         │S3a. GENDER:│
1717 │         ├─────┬──────┤
1718 │         │ Male│Female│
1719 │         ├─────┼──────┤
1720 │         │Count│ Count│
1721 ├─────────┼─────┼──────┤
1722 │Age group│  531│   943│
1723 ╰─────────┴─────┴──────╯
1724
1725              Custom Tables
1726 Male
1727 ╭───────────────────────┬────────────╮
1728 │                       │S3a. GENDER:│
1729 │                       ├────────────┤
1730 │                       │    Count   │
1731 ├───────────────────────┼────────────┤
1732 │Age group 15 or younger│           0│
1733 │          16 to 25     │         594│
1734 │          26 to 35     │         476│
1735 │          36 to 45     │         489│
1736 │          46 to 55     │         526│
1737 │          56 to 65     │         516│
1738 │          66 or older  │         531│
1739 ╰───────────────────────┴────────────╯
1740
1741              Custom Tables
1742 Female
1743 ╭───────────────────────┬────────────╮
1744 │                       │S3a. GENDER:│
1745 │                       ├────────────┤
1746 │                       │    Count   │
1747 ├───────────────────────┼────────────┤
1748 │Age group 15 or younger│           0│
1749 │          16 to 25     │         505│
1750 │          26 to 35     │         491│
1751 │          36 to 45     │         548│
1752 │          46 to 55     │         649│
1753 │          56 to 65     │         731│
1754 │          66 or older  │         943│
1755 ╰───────────────────────┴────────────╯
1756 ])
1757 AT_CLEANUP
1758
1759 AT_SETUP([CTABLES missing values])
1760 AT_DATA([ctables.sps],
1761 [[DATA LIST LIST NOTABLE/x y.
1762 BEGIN DATA.
1763 1 1
1764 1 2
1765 1 3
1766 1 4
1767 1 5
1768 1 .
1769 2 1
1770 2 2
1771 2 3
1772 2 4
1773 2 5
1774 2 .
1775 3 1
1776 3 2
1777 3 3
1778 3 4
1779 3 5
1780 3 .
1781 4 1
1782 4 2
1783 4 3
1784 4 4
1785 4 5
1786 4 .
1787 5 1
1788 5 2
1789 5 3
1790 5 4
1791 5 5
1792 5 .
1793 . 1
1794 . 2
1795 . 3
1796 . 4
1797 . 5
1798 . .
1799 END DATA.
1800 MISSING VALUES x (1, 2) y (2, 3).
1801 VARIABLE LEVEL ALL (NOMINAL).
1802
1803 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1804                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1805     /CATEGORIES VARIABLES=ALL TOTAL=YES.
1806 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1807                  TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1808     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1809 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1810                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1811     /CATEGORIES VARIABLES=ALL TOTAL=YES
1812     /SLABELS POSITION=ROW.
1813 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1814                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1815     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1816     /SLABELS POSITION=ROW.
1817 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1818                       TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1819     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
1820     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
1821     /SLABELS POSITION=ROW.
1822 ]])
1823 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1824                                Custom Tables
1825 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1826 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1827 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1828 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1829 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1830 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1831 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
1832 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1833 dnl Note that Column Total N % doesn't add up to 100 because missing
1834 dnl values are included in the total but not shown as a category and this
1835 dnl is expected behavior.
1836
1837                                Custom Tables
1838 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1839 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1840 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1841 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1842 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1843 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1844 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1845 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1846 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
1847 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1848 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1849 dnl values are included in the total but not shown as a category and this
1850 dnl is expected behavior.
1851
1852                      Custom Tables
1853 ╭────────────────────────┬───────────────────────────╮
1854 │                        │             y             │
1855 │                        ├──────┬──────┬──────┬──────┤
1856 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
1857 ├────────────────────────┼──────┼──────┼──────┼──────┤
1858 │x 3.00  Count           │     1│     1│     1│     3│
1859 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1860 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1861 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1862 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1863 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1864 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1865 │        Valid N         │      │      │      │     3│
1866 │        Total N         │      │      │      │     6│
1867 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1868 │  4.00  Count           │     1│     1│     1│     3│
1869 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1870 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1871 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1872 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1873 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1874 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1875 │        Valid N         │      │      │      │     3│
1876 │        Total N         │      │      │      │     6│
1877 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1878 │  5.00  Count           │     1│     1│     1│     3│
1879 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1880 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1881 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1882 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1883 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1884 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1885 │        Valid N         │      │      │      │     3│
1886 │        Total N         │      │      │      │     6│
1887 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1888 │  Total Count           │     3│     3│     3│     9│
1889 │        Column %        │100.0%│100.0%│100.0%│     .│
1890 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
1891 │        Column Total N %│100.0%│100.0%│100.0%│     .│
1892 │        Row %           │     .│     .│     .│     .│
1893 │        Row Valid N %   │     .│     .│     .│     .│
1894 │        Row Total N %   │     .│     .│     .│     .│
1895 │        Valid N         │     3│     3│     3│     9│
1896 │        Total N         │     6│     6│     6│    36│
1897 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1898
1899                             Custom Tables
1900 ╭────────────────────────┬─────────────────────────────────────────╮
1901 │                        │                    y                    │
1902 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
1903 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1904 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1905 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
1906 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1907 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
1908 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1909 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1910 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1911 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1912 │        Valid N         │      │      │      │      │      │     0│
1913 │        Total N         │      │      │      │      │      │     6│
1914 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1915 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
1916 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1917 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
1918 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1919 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1920 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1921 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1922 │        Valid N         │      │      │      │      │      │     0│
1923 │        Total N         │      │      │      │      │      │     6│
1924 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1925 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
1926 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1927 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1928 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1929 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1930 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1931 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1932 │        Valid N         │      │      │      │      │      │     3│
1933 │        Total N         │      │      │      │      │      │     6│
1934 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1935 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
1936 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1937 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1938 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1939 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1940 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1941 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1942 │        Valid N         │      │      │      │      │      │     3│
1943 │        Total N         │      │      │      │      │      │     6│
1944 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1945 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
1946 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1947 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1948 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1949 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1950 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1951 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1952 │        Valid N         │      │      │      │      │      │     3│
1953 │        Total N         │      │      │      │      │      │     6│
1954 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1955 │  Total Count           │     5│     5│     5│     5│     5│    25│
1956 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
1957 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
1958 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
1959 │        Row %           │     .│     .│     .│     .│     .│     .│
1960 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1961 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
1962 │        Valid N         │     3│     0│     0│     3│     3│     9│
1963 │        Total N         │     6│     6│     6│     6│     6│    36│
1964 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
1965
1966                         Custom Tables
1967 ╭────────────────────────┬──────────────────────────────────╮
1968 │                        │                 y                │
1969 │                        ├──────┬──────┬──────┬──────┬──────┤
1970 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1971 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
1972 │x 1.00  Count           │     1│     1│     1│     1│     4│
1973 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1974 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
1975 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1976 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1977 │        Row Valid N %   │     .│     .│     .│     .│     .│
1978 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1979 │        Valid N         │      │      │      │      │     0│
1980 │        Total N         │      │      │      │      │     6│
1981 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1982 │  2.00  Count           │     1│     1│     1│     1│     4│
1983 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1984 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
1985 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1986 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1987 │        Row Valid N %   │     .│     .│     .│     .│     .│
1988 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1989 │        Valid N         │      │      │      │      │     0│
1990 │        Total N         │      │      │      │      │     6│
1991 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1992 │  3.00  Count           │     1│     1│     1│     1│     4│
1993 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1994 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
1995 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1996 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1997 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
1998 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1999 │        Valid N         │      │      │      │      │     3│
2000 │        Total N         │      │      │      │      │     6│
2001 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2002 │  4.00  Count           │     1│     1│     1│     1│     4│
2003 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
2004 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
2005 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
2006 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2007 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
2008 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2009 │        Valid N         │      │      │      │      │     3│
2010 │        Total N         │      │      │      │      │     6│
2011 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2012 │  Total Count           │     4│     4│     4│     4│    16│
2013 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
2014 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
2015 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
2016 │        Row %           │     .│     .│     .│     .│     .│
2017 │        Row Valid N %   │     .│     .│     .│     .│     .│
2018 │        Row Total N %   │     .│     .│     .│     .│     .│
2019 │        Valid N         │     2│     0│     2│     2│     6│
2020 │        Total N         │     5│     5│     5│     5│    30│
2021 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2022 ])
2023 AT_CLEANUP
2024
2025 AT_SETUP([CTABLES SMISSING=LISTWISE])
2026 AT_KEYWORDS([SMISSING LISTWISE])
2027 AT_DATA([ctables.sps],
2028 [[DATA LIST LIST NOTABLE/x y z.
2029 BEGIN DATA.
2030 1  . 40
2031 1 10 50
2032 1 20 60
2033 1  .  .
2034 1 30  .
2035 END DATA.
2036 VARIABLE LEVEL x (NOMINAL).
2037
2038 CTABLES /TABLE (y + z) > x.
2039 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2040
2041 * The following doesn't come out as listwise because the tables are
2042 separate, not linked by an > operator.
2043 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2044 ]])
2045 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2046   Custom Tables
2047 ╭────────┬─────╮
2048 │        │ Mean│
2049 ├────────┼─────┤
2050 │y x 1.00│20.00│
2051 ├────────┼─────┤
2052 │z x 1.00│50.00│
2053 ╰────────┴─────╯
2054
2055   Custom Tables
2056 ╭────────┬─────╮
2057 │        │ Mean│
2058 ├────────┼─────┤
2059 │y x 1.00│15.00│
2060 ├────────┼─────┤
2061 │z x 1.00│55.00│
2062 ╰────────┴─────╯
2063
2064   Custom Tables
2065 ╭────────┬─────╮
2066 │        │ Mean│
2067 ├────────┼─────┤
2068 │y x 1.00│20.00│
2069 ├────────┼─────┤
2070 │z x 1.00│50.00│
2071 ╰────────┴─────╯
2072 ])
2073 AT_CLEANUP
2074
2075 AT_SETUP([CTABLES VLABELS])
2076 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2077 AT_DATA([ctables.sps],
2078 [[GET 'nhtsa.sav'.
2079 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2080 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME    /TABLE qnd5a BY qns3a.
2081 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL   /TABLE qnd5a BY qns3a.
2082 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH    /TABLE qnd5a BY qns3a.
2083 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE    /TABLE qnd5a BY qns3a.
2084 ]])
2085 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2086                                  Custom Tables
2087 ╭────────────────────────────────────────────────────────────────┬────────────╮
2088 │                                                                │S3a. GENDER:│
2089 │                                                                ├─────┬──────┤
2090 │                                                                │ Male│Female│
2091 │                                                                ├─────┼──────┤
2092 │                                                                │Count│ Count│
2093 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2094 │D5a. What would you say is your primary    Cuban                │   13│     7│
2095 │ethnic background?                         Mexican              │  175│   136│
2096 │                                           Spanish              │   20│    28│
2097 │                                           South American       │   21│    13│
2098 │                                           Central American     │   27│    25│
2099 │                                           Puerto Rican, OR     │   37│    41│
2100 │                                           Something else       │   35│    33│
2101 │                                           Multiple - cannot    │    2│     5│
2102 │                                           choose one           │     │      │
2103 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2104
2105                   Custom Tables
2106 ╭──────────────────────────────────┬────────────╮
2107 │                                  │    QNS3A   │
2108 │                                  ├─────┬──────┤
2109 │                                  │ Male│Female│
2110 │                                  ├─────┼──────┤
2111 │                                  │Count│ Count│
2112 ├──────────────────────────────────┼─────┼──────┤
2113 │QND5A Cuban                       │   13│     7│
2114 │      Mexican                     │  175│   136│
2115 │      Spanish                     │   20│    28│
2116 │      South American              │   21│    13│
2117 │      Central American            │   27│    25│
2118 │      Puerto Rican, OR            │   37│    41│
2119 │      Something else              │   35│    33│
2120 │      Multiple - cannot choose one│    2│     5│
2121 ╰──────────────────────────────────┴─────┴──────╯
2122
2123                                  Custom Tables
2124 ╭────────────────────────────────────────────────────────────────┬────────────╮
2125 │                                                                │S3a. GENDER:│
2126 │                                                                ├─────┬──────┤
2127 │                                                                │ Male│Female│
2128 │                                                                ├─────┼──────┤
2129 │                                                                │Count│ Count│
2130 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2131 │D5a. What would you say is your primary    Cuban                │   13│     7│
2132 │ethnic background?                         Mexican              │  175│   136│
2133 │                                           Spanish              │   20│    28│
2134 │                                           South American       │   21│    13│
2135 │                                           Central American     │   27│    25│
2136 │                                           Puerto Rican, OR     │   37│    41│
2137 │                                           Something else       │   35│    33│
2138 │                                           Multiple - cannot    │    2│     5│
2139 │                                           choose one           │     │      │
2140 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2141
2142                                  Custom Tables
2143 ╭────────────────────────────────────────────────────────────┬────────────────╮
2144 │                                                            │   QNS3A S3a.   │
2145 │                                                            │     GENDER:    │
2146 │                                                            ├───────┬────────┤
2147 │                                                            │  Male │ Female │
2148 │                                                            ├───────┼────────┤
2149 │                                                            │ Count │  Count │
2150 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2151 │QND5A D5a. What would you say is your    Cuban              │     13│       7│
2152 │primary ethnic background?               Mexican            │    175│     136│
2153 │                                         Spanish            │     20│      28│
2154 │                                         South American     │     21│      13│
2155 │                                         Central American   │     27│      25│
2156 │                                         Puerto Rican, OR   │     37│      41│
2157 │                                         Something else     │     35│      33│
2158 │                                         Multiple - cannot  │      2│       5│
2159 │                                         choose one         │       │        │
2160 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2161
2162                Custom Tables
2163 ╭────────────────────────────┬─────┬──────╮
2164 │                            │ Male│Female│
2165 │                            ├─────┼──────┤
2166 │                            │Count│ Count│
2167 ├────────────────────────────┼─────┼──────┤
2168 │Cuban                       │   13│     7│
2169 │Mexican                     │  175│   136│
2170 │Spanish                     │   20│    28│
2171 │South American              │   21│    13│
2172 │Central American            │   27│    25│
2173 │Puerto Rican, OR            │   37│    41│
2174 │Something else              │   35│    33│
2175 │Multiple - cannot choose one│    2│     5│
2176 ╰────────────────────────────┴─────┴──────╯
2177 ])
2178 AT_CLEANUP
2179
2180 AT_SETUP([CTABLES FORMAT=EMPTY])
2181 AT_KEYWORDS([FORMAT EMPTY])
2182 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2183 AT_DATA([ctables.sps],
2184 [[GET 'nhtsa.sav'.
2185 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2186 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2187 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2188 ]])
2189 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2190                                  Custom Tables
2191 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2192 │                                             │   D5. ETHNICITY: Are you of   │
2193 │                                             │  Hispanic or Latino origin or │
2194 │                                             │            descent?           │
2195 │                                             ├───────────────┬───────────────┤
2196 │                                             │      Yes      │       No      │
2197 │                                             ├───────────────┼───────────────┤
2198 │                                             │     Count     │     Count     │
2199 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2200 │D5a. What would you say is   Cuban           │             20│              0│
2201 │your primary ethnic          Mexican         │            311│              0│
2202 │background?                  Spanish         │             48│              0│
2203 │                             South American  │             34│              0│
2204 │                             Central American│             52│              0│
2205 │                             Puerto Rican, OR│             78│              0│
2206 │                             Something else  │             68│              0│
2207 │                             Multiple -      │              7│              0│
2208 │                             cannot choose   │               │               │
2209 │                             one             │               │               │
2210 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2211
2212                                  Custom Tables
2213 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2214 │                                             │   D5. ETHNICITY: Are you of   │
2215 │                                             │  Hispanic or Latino origin or │
2216 │                                             │            descent?           │
2217 │                                             ├───────────────┬───────────────┤
2218 │                                             │      Yes      │       No      │
2219 │                                             ├───────────────┼───────────────┤
2220 │                                             │     Count     │     Count     │
2221 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2222 │D5a. What would you say is   Cuban           │             20│               │
2223 │your primary ethnic          Mexican         │            311│               │
2224 │background?                  Spanish         │             48│               │
2225 │                             South American  │             34│               │
2226 │                             Central American│             52│               │
2227 │                             Puerto Rican, OR│             78│               │
2228 │                             Something else  │             68│               │
2229 │                             Multiple -      │              7│               │
2230 │                             cannot choose   │               │               │
2231 │                             one             │               │               │
2232 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2233
2234                                  Custom Tables
2235 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2236 │                                             │   D5. ETHNICITY: Are you of   │
2237 │                                             │  Hispanic or Latino origin or │
2238 │                                             │            descent?           │
2239 │                                             ├───────────────┬───────────────┤
2240 │                                             │      Yes      │       No      │
2241 │                                             ├───────────────┼───────────────┤
2242 │                                             │     Count     │     Count     │
2243 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2244 │D5a. What would you say is   Cuban           │             20│n/a            │
2245 │your primary ethnic          Mexican         │            311│n/a            │
2246 │background?                  Spanish         │             48│n/a            │
2247 │                             South American  │             34│n/a            │
2248 │                             Central American│             52│n/a            │
2249 │                             Puerto Rican, OR│             78│n/a            │
2250 │                             Something else  │             68│n/a            │
2251 │                             Multiple -      │              7│n/a            │
2252 │                             cannot choose   │               │               │
2253 │                             one             │               │               │
2254 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2255 ])
2256 AT_CLEANUP