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