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