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