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