3 dnl Features not yet tested:
4 dnl - Preprocessing to distinguish categorical from scale.
5 dnl - Parsing (positive and negative)
6 dnl - String variables and values
7 dnl - Testing details of missing value handling in summaries.
8 dnl - test CLABELS ROWLABELS=LAYER.
10 dnl - Test WEIGHT and adjustment weights.
11 dnl - EMPTY=INCLUDE For string ranges.
12 dnl - Summary functions:
13 dnl * Separate summary functions for totals and subtotals.
14 dnl * )CILEVEL in summary label specification
18 dnl * ascending/descending
22 dnl * THRU (numeric ranges)
23 dnl * THRU (string ranges)
26 dnl * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
29 dnl - HIDESMALLCOUNTS.
30 dnl - Date/time variables and values
31 dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
32 dnl - TITLES: )DATE, )TIME, )TABLE.
34 dnl * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
35 dnl * MISSING, OTHERNM
36 dnl * strings and string ranges
37 dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
41 dnl - Summary functions:
42 dnl * U-prefix for unweighted summaries.
43 dnl * areaPCT.SUM and UareaPCT.SUM functions.
44 dnl - SPLIT FILE with SEPARATE splits
45 dnl - Definition of columns/rows when labels are rotated from one axis to another.
48 dnl - Multiple response sets
49 dnl - MRSETS subcommand.
50 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
53 dnl - Summary functions:
54 dnl * .LCL and .UCL suffixes.
57 dnl * Data-dependent sorting.
61 dnl CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a.
62 dnl produces a bad median:
64 dnl +--------------------------+-----------------------+
65 dnl | | S3a. GENDER: |
66 dnl | +-----------+-----------+
67 dnl | | Male | Female |
68 dnl | +----+------+----+------+
69 dnl | |Mean|Median|Mean|Median|
70 dnl +--------------------------+----+------+----+------+
71 dnl |D1. AGE: What is your age?| 46| 999| 50| 999|
72 dnl +--------------------------+----+------+----+------+
76 AT_SETUP([CTABLES parsing])
77 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
78 AT_DATA([ctables.sps],
81 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
82 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
83 /FORMAT UNITS=CM EMPTY="(-)"
84 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
85 /VLABELS VARIABLES=qn17 DISPLAY=NAME
86 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
87 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
88 /VLABELS VARIABLES=qn20 DISPLAY=NONE
89 /MRSETS COUNTDUPLICATES=NO
90 /MRSETS COUNTDUPLICATES=YES
93 /WEIGHT VARIABLE=qns3a
95 /HIDESMALLCOUNTS COUNT=10
97 /SLABELS POSITION=COLUMN VISIBLE=YES
98 /SLABELS VISIBLE=NO POSITION=ROW
99 /SLABELS POSITION=LAYER
101 /CLABELS ROWLABELS=OPPOSITE
103 /CATEGORIES VARIABLES=qn1 qn17
104 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
105 POSITION=BEFORE EMPTY=INCLUDE.
106 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
107 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
108 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
110 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
113 ╭───────────────────┬────┬────╮
115 ├───────────────────┼────┼────┤
116 │Sa1. SAMPLE SOURCE:│5392│1607│
117 ╰───────────────────┴────┴────╯
121 ╭───────────────────┬─────╮
123 ├───────────────────┼─────┤
124 │Sa1. SAMPLE SOURCE:│ 5392│
125 ╰───────────────────┴─────╯
128 ╭────────────────────────┬─────╮
130 ├────────────────────────┼─────┤
131 │Sa1. SAMPLE SOURCE: RDD │ 5392│
133 ╰────────────────────────┴─────╯
136 ╭────────────────────────┬─────╮
138 ├────────────────────────┼─────┤
139 │Sa1. SAMPLE SOURCE: RDD │ 5392│
141 ╰────────────────────────┴─────╯
145 AT_SETUP([CTABLES parsing - negative])
146 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
147 AT_DATA([ctables.sps],
150 CTABLES /FORMAT MINCOLWIDTH='foo'.
151 CTABLES /TABLE qn1 [**].
152 CTABLES /TABLE qn1 [NOTAFUNCTION].
155 CTABLES /TABLE NOTAVAR.
157 CTABLES /TABLE string[S].
158 CTABLES /TABLE qn1 [PTILE 101].
159 CTABLES /TABLE qn1 [MEAN F0.1].
160 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
161 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
162 CTABLES /TABLE qn1 [MEAN TOTALS].
163 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
164 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
165 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
166 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
167 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
168 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
169 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
170 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
171 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
172 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
173 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
174 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
175 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
176 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
177 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
178 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
179 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
180 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
181 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
182 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
183 CTABLES /PCOMPUTE &k=EXPR([LO **]).
184 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
185 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
186 CTABLES /PCOMPUTE &k=EXPR([1**]).
187 CTABLES /PCOMPUTE &k=EXPR((1x)).
188 CTABLES /PCOMPUTE **k.
189 CTABLES /PCOMPUTE &1.
190 CTABLES /PCOMPUTE &k**.
191 CTABLES /PCOMPUTE &k=**.
192 CTABLES /PCOMPUTE &k=EXPR**.
193 CTABLES /PCOMPUTE &k=EXPR(1x).
194 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
195 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
196 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
197 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
198 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
199 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
200 CTABLES /FORMAT EMPTY=**.
201 CTABLES /FORMAT MISSING=**.
203 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
205 CTABLES /VLABELS VARIABLES=NOTAVAR.
206 CTABLES /VLABELS VARIABLES=qn1 **.
207 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
209 CTABLES /MRSETS COUNTDUPLICATES=**.
210 CTABLES /SMISSING **.
212 CTABLES /WEIGHT VARIABLE=NOTAVAR.
213 CTABLES /HIDESMALLCOUNTS COUNT=1.
215 CTABLES /HIDESMALLCOUNTS COUNT=2.
216 CTABLES /TABLE qn1**.
217 CTABLES /TABLE qn1 /SLABELS POSITION=**.
218 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
219 CTABLES /TABLE qn1 /SLABELS **.
220 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
221 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
222 CTABLES /TABLE qn1 /CLABELS **.
223 CTABLES /TABLE qn1 /CRITERIA **.
224 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
225 CTABLES /TABLE qn1 /TITLES **.
226 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
227 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
228 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
229 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
230 CTABLES /TABLE qn1 /SIGTEST **.
231 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
232 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
233 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
234 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
235 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
236 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
237 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
238 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
239 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
240 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
241 CTABLES /TABLE qn1 /COMPARETEST **.
242 CTABLES /TABLE qn1 / **.
243 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
244 CTABLES /TABLE qn20 > qnd1.
245 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
246 NUMERIC datetime (DATETIME17.0).
247 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
249 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
250 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
252 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
253 negative number for MINCOLWIDTH.
255 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
258 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
259 summary function name.
261 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
263 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
266 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
268 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
270 10 | CTABLES /TABLE string[S].
273 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
274 between 0 and 100 for PTILE.
276 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
277 requires a width between 1 and 40.
279 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
280 format NEGPAREN requires width 2 or greater.
282 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
283 format NEGPAREN requires width greater than decimals.
285 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
287 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
290 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
291 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
294 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
296 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
298 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
301 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
302 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
305 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
307 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
309 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
311 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
313 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
315 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
317 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
320 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
321 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
324 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
325 between 0 and 100 for PTILE.
327 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
330 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
333 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
336 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
339 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
341 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
344 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
347 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
348 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
350 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
351 LABEL, POSITION, or EMPTY.
353 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
354 integer for SUBTOTAL.
356 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
358 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
360 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
362 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
364 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
366 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
368 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
370 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
372 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
374 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
376 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
378 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
380 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
381 the previous definition.
382 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
383 | ^~~~~~~~~~~~~~~~~~~
385 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
386 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
387 | ^~~~~~~~~~~~~~~~~~~
389 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
392 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
393 Expecting summary function name.
395 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
396 between 0 and 100 for PTILE.
398 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
400 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
403 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
404 FORMAT, or HIDESOURCECATS.
406 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
408 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
410 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
411 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
413 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
416 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
419 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
421 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
424 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
425 DEFAULT, NAME, LABEL, BOTH, or NONE.
427 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
430 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
433 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
434 VARIABLE or LISTWISE.
436 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
439 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
441 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
442 greater for HIDESMALLCOUNTS COUNT.
444 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
445 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
446 HIDESMALLCOUNTS, or TABLE.
448 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
451 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
453 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
456 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
459 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
462 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
465 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
468 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
469 ROWLABELS, or COLLABELS.
471 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
474 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
475 in @<:@0,100@:}@ for CILEVEL.
477 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
478 CAPTION, CORNER, or TITLE.
480 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
483 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
484 in @<:@0,1@:}@ for ALPHA.
486 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
489 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
490 ALLVISIBLE or SUBTOTALS.
492 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
493 ALPHA, INCLUDEMRSETS, or CATEGORIES.
495 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
498 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
501 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
504 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
505 BONFERRONI, BH, or NONE.
507 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
510 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
513 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
514 ALLVISIBLE or SUBTOTALS.
516 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
519 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
522 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
525 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
526 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
529 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
530 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
532 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
535 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
536 97 | CTABLES /TABLE qn20 > qnd1.
539 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
540 97 | CTABLES /TABLE qn20 > qnd1.
543 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
544 97 | CTABLES /TABLE qn20 > qnd1.
547 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
548 categorical variables at the innermost nesting level.
549 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
550 | ^~~~~~~~~~~~~~~~~~~~
552 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
554 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
557 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
558 specification as format DATETIME: Day (123) must be between 1 and 31..
559 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
564 AT_SETUP([CTABLES parsing - more negative])
565 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
566 AT_DATA([ctables.sps],
568 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
569 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
570 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
573 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
574 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
576 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
578 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
579 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
580 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
581 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
583 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
584 CTABLES /PCOMPUTE &x=EXPR([**]).
585 CTABLES /PCOMPUTE &x=EXPR(**).
589 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
591 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
592 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
593 category not included in the category list.
594 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
599 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
600 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
604 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
605 list of categories here.
606 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
611 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
612 category not included in the category list.
613 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
618 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
619 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
623 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
624 variable's CATEGORIES specification.
626 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
627 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
628 subtotals by position, e.g. SUBTOTAL[1].
629 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
630 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
632 ^~~~~~~~~~~~~~~~~~~~~~~~
634 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
636 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
637 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
640 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
641 applied only to string variables, but this subcommand tries to apply it to
642 numeric variable QN1.
643 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
646 ctables.sps:8.53: error: CTABLES: This category specification may be applied
647 only to numeric variables, but this subcommand tries to apply it to string
649 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
652 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
653 based on a summary function.
655 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
656 moved to be categorical, but qnd1 is a scale variable.
658 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
659 moved to have the same width, but QN1 has width 0 and string has width 8.
661 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
662 moved to have the same value labels, but QN1 and QNSA1 have different value
665 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
666 moved to have the same category specifications, but QN105BA and QN105BB have
667 different category specifications.
669 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
670 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
671 this warning, insert parentheses.
672 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
675 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
678 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
680 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
682 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
683 variable must be specified.
685 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
687 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
689 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
692 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
694 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
697 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
699 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
704 AT_SETUP([CTABLES one categorical variable])
705 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
706 AT_DATA([ctables.sps],
709 CTABLES /TABLE BY qn1.
710 CTABLES /TABLE BY BY qn1.
712 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
714 ╭────────────────────────────────────────────────────────────────────────┬─────╮
716 ├────────────────────────────────────────────────────────────────────────┼─────┤
717 │ 1. How often do you usually drive a car or other Every day │ 4667│
718 │motor vehicle? Several days a week │ 1274│
719 │ Once a week or less │ 361│
720 │ Only certain times a │ 130│
723 ╰────────────────────────────────────────────────────────────────────────┴─────╯
726 ╭──────────────────────────────────────────────────────────────────────────────╮
727 │ 1. How often do you usually drive a car or other motor vehicle? │
728 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
729 │ │ Several days a │ Once a week or │ Only certain times a │ │
730 │Every day│ week │ less │ year │Never│
731 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
732 │ Count │ Count │ Count │ Count │Count│
733 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
734 │ 4667│ 1274│ 361│ 130│ 540│
735 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
747 AT_SETUP([CTABLES one scale variable])
748 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
749 AT_DATA([ctables.sps],
751 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
752 CTABLES /TABLE BY qnd1.
753 CTABLES /TABLE BY BY qnd1.
755 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
757 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
758 │ │ │ │ │ │ Std │ │ │
759 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
760 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
761 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
762 │age? │ │ │ │ │ │ │ │
763 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
766 ╭──────────────────────────╮
767 │D1. AGE: What is your age?│
768 ├──────────────────────────┤
770 ├──────────────────────────┤
772 ╰──────────────────────────╯
775 D1. AGE: What is your age?
784 AT_SETUP([CTABLES simple stacking])
785 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
786 AT_DATA([ctables.sps],
788 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
790 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
792 ╭───────────────────────────────────────────────────────────────┬──────────────╮
799 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
800 │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│
801 │too much to drink to drive safely will A. Get certain │ │ │
802 │stopped by the police? Very likely │ 21%│ 22%│
803 │ Somewhat │ 38%│ 42%│
805 │ Somewhat │ 21%│ 18%│
809 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
810 │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│
811 │too much to drink to drive safely will B. Have an certain │ │ │
812 │accident? Very likely │ 36%│ 45%│
813 │ Somewhat │ 39%│ 32%│
819 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
820 │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│
821 │too much to drink to drive safely will C. Be certain │ │ │
822 │convicted for drunk driving? Very likely │ 32%│ 28%│
823 │ Somewhat │ 27%│ 32%│
825 │ Somewhat │ 15%│ 15%│
829 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
830 │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│
831 │too much to drink to drive safely will D. Be certain │ │ │
832 │arrested for drunk driving? Very likely │ 26%│ 27%│
833 │ Somewhat │ 32%│ 35%│
835 │ Somewhat │ 17%│ 15%│
839 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
843 AT_SETUP([CTABLES show or hide empty categories])
844 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
845 AT_DATA([ctables.sps],
847 IF (qn105ba = 2) qn105ba = 1.
848 IF (qns3a = 1) qns3a = 2.
849 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
850 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
851 /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
852 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
853 /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
854 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
855 /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
857 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
859 ╭──────────────────────────────────────────────────────────────┬───────────────╮
866 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
867 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
868 │too much to drink to drive safely will A. Get certain │ │ │
869 │stopped by the police? Very likely│ .│ 0%│
876 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
879 ╭──────────────────────────────────────────────────────────────┬───────────────╮
886 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
887 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
888 │too much to drink to drive safely will A. Get certain │ │ │
889 │stopped by the police? Somewhat │ .│ 40%│
895 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
898 ╭────────────────────────────────────────────────────────────────────┬─────────╮
905 ├────────────────────────────────────────────────────────────────────┼─────────┤
906 │105b. How likely is it that drivers who have had too Almost │ 32%│
907 │much to drink to drive safely will A. Get stopped by certain │ │
908 │the police? Very likely │ 0%│
915 ╰────────────────────────────────────────────────────────────────────┴─────────╯
918 ╭────────────────────────────────────────────────────────────────────┬─────────╮
925 ├────────────────────────────────────────────────────────────────────┼─────────┤
926 │105b. How likely is it that drivers who have had too Almost │ 32%│
927 │much to drink to drive safely will A. Get stopped by certain │ │
928 │the police? Somewhat │ 40%│
934 ╰────────────────────────────────────────────────────────────────────┴─────────╯
938 AT_SETUP([CTABLES simple nesting])
939 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
940 AT_DATA([ctables.sps],
942 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
943 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
944 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
945 /CATEGORIES VARIABLES=qns3a TOTAL=YES
946 /CLABELS ROW=OPPOSITE.
948 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
950 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
953 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
954 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
955 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
956 │drive safely will A. Get stopped by Total │ 700│ 10%│
957 │the police? ╶──────────────────────────┼─────┼──────┤
958 │ Very S3a. Male │ 660│ 10%│
959 │ likely GENDER: Female│ 842│ 12%│
961 │ ╶──────────────────────────┼─────┼──────┤
962 │ Somewhat S3a. Male │ 1174│ 17%│
963 │ likely GENDER: Female│ 1589│ 23%│
965 │ ╶──────────────────────────┼─────┼──────┤
966 │ Somewhat S3a. Male │ 640│ 9%│
967 │ unlikely GENDER: Female│ 667│ 10%│
969 │ ╶──────────────────────────┼─────┼──────┤
970 │ Very S3a. Male │ 311│ 5%│
971 │ unlikely GENDER: Female│ 298│ 4%│
973 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
974 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
975 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
976 │drive safely will B. Have an accident? Total │ 1100│ 16%│
977 │ ╶──────────────────────────┼─────┼──────┤
978 │ Very S3a. Male │ 1104│ 16%│
979 │ likely GENDER: Female│ 1715│ 25%│
981 │ ╶──────────────────────────┼─────┼──────┤
982 │ Somewhat S3a. Male │ 1203│ 17%│
983 │ likely GENDER: Female│ 1214│ 18%│
985 │ ╶──────────────────────────┼─────┼──────┤
986 │ Somewhat S3a. Male │ 262│ 4%│
987 │ unlikely GENDER: Female│ 168│ 2%│
989 │ ╶──────────────────────────┼─────┼──────┤
990 │ Very S3a. Male │ 81│ 1%│
991 │ unlikely GENDER: Female│ 59│ 1%│
993 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
994 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
995 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
996 │drive safely will C. Be convicted for Total │ 1149│ 17%│
997 │drunk driving? ╶──────────────────────────┼─────┼──────┤
998 │ Very S3a. Male │ 988│ 14%│
999 │ likely GENDER: Female│ 1049│ 15%│
1000 │ Total │ 2037│ 30%│
1001 │ ╶──────────────────────────┼─────┼──────┤
1002 │ Somewhat S3a. Male │ 822│ 12%│
1003 │ likely GENDER: Female│ 1210│ 18%│
1004 │ Total │ 2032│ 30%│
1005 │ ╶──────────────────────────┼─────┼──────┤
1006 │ Somewhat S3a. Male │ 446│ 7%│
1007 │ unlikely GENDER: Female│ 548│ 8%│
1009 │ ╶──────────────────────────┼─────┼──────┤
1010 │ Very S3a. Male │ 268│ 4%│
1011 │ unlikely GENDER: Female│ 354│ 5%│
1013 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1014 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1015 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1016 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1017 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1018 │ Very S3a. Male │ 805│ 12%│
1019 │ likely GENDER: Female│ 1029│ 15%│
1020 │ Total │ 1834│ 27%│
1021 │ ╶──────────────────────────┼─────┼──────┤
1022 │ Somewhat S3a. Male │ 975│ 14%│
1023 │ likely GENDER: Female│ 1332│ 19%│
1024 │ Total │ 2307│ 34%│
1025 │ ╶──────────────────────────┼─────┼──────┤
1026 │ Somewhat S3a. Male │ 535│ 8%│
1027 │ unlikely GENDER: Female│ 560│ 8%│
1028 │ Total │ 1095│ 16%│
1029 │ ╶──────────────────────────┼─────┼──────┤
1030 │ Very S3a. Male │ 270│ 4%│
1031 │ unlikely GENDER: Female│ 279│ 4%│
1033 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1036 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1037 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1038 │ │ certain│likely│ likely │ unlikely│unlikely│
1039 │ ├────────┼──────┼─────────┼─────────┼────────┤
1041 │ │ Table %│ % │ Table % │ Table % │ Table %│
1042 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1043 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1044 │GENDER: is it that drivers│ │ │ │ │ │
1045 │ who have had too │ │ │ │ │ │
1046 │ much to drink to │ │ │ │ │ │
1047 │ drive safely will │ │ │ │ │ │
1048 │ A. Get stopped by │ │ │ │ │ │
1049 │ the police? │ │ │ │ │ │
1050 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1051 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1052 │ is it that drivers│ │ │ │ │ │
1053 │ who have had too │ │ │ │ │ │
1054 │ much to drink to │ │ │ │ │ │
1055 │ drive safely will │ │ │ │ │ │
1056 │ A. Get stopped by │ │ │ │ │ │
1057 │ the police? │ │ │ │ │ │
1058 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1059 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1060 │ is it that drivers│ │ │ │ │ │
1061 │ who have had too │ │ │ │ │ │
1062 │ much to drink to │ │ │ │ │ │
1063 │ drive safely will │ │ │ │ │ │
1064 │ A. Get stopped by │ │ │ │ │ │
1065 │ the police? │ │ │ │ │ │
1066 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1067 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1068 │GENDER: is it that drivers│ │ │ │ │ │
1069 │ who have had too │ │ │ │ │ │
1070 │ much to drink to │ │ │ │ │ │
1071 │ drive safely will │ │ │ │ │ │
1072 │ B. Have an │ │ │ │ │ │
1073 │ accident? │ │ │ │ │ │
1074 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1075 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1076 │ is it that drivers│ │ │ │ │ │
1077 │ who have had too │ │ │ │ │ │
1078 │ much to drink to │ │ │ │ │ │
1079 │ drive safely will │ │ │ │ │ │
1080 │ B. Have an │ │ │ │ │ │
1081 │ accident? │ │ │ │ │ │
1082 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1083 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1084 │ is it that drivers│ │ │ │ │ │
1085 │ who have had too │ │ │ │ │ │
1086 │ much to drink to │ │ │ │ │ │
1087 │ drive safely will │ │ │ │ │ │
1088 │ B. Have an │ │ │ │ │ │
1089 │ accident? │ │ │ │ │ │
1090 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1091 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1092 │GENDER: is it that drivers│ │ │ │ │ │
1093 │ who have had too │ │ │ │ │ │
1094 │ much to drink to │ │ │ │ │ │
1095 │ drive safely will │ │ │ │ │ │
1096 │ C. Be convicted │ │ │ │ │ │
1097 │ for drunk driving?│ │ │ │ │ │
1098 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1099 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1100 │ is it that drivers│ │ │ │ │ │
1101 │ who have had too │ │ │ │ │ │
1102 │ much to drink to │ │ │ │ │ │
1103 │ drive safely will │ │ │ │ │ │
1104 │ C. Be convicted │ │ │ │ │ │
1105 │ for drunk driving?│ │ │ │ │ │
1106 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1107 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1108 │ is it that drivers│ │ │ │ │ │
1109 │ who have had too │ │ │ │ │ │
1110 │ much to drink to │ │ │ │ │ │
1111 │ drive safely will │ │ │ │ │ │
1112 │ C. Be convicted │ │ │ │ │ │
1113 │ for drunk driving?│ │ │ │ │ │
1114 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1115 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1116 │GENDER: is it that drivers│ │ │ │ │ │
1117 │ who have had too │ │ │ │ │ │
1118 │ much to drink to │ │ │ │ │ │
1119 │ drive safely will │ │ │ │ │ │
1120 │ D. Be arrested for│ │ │ │ │ │
1121 │ drunk driving? │ │ │ │ │ │
1122 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1123 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1124 │ is it that drivers│ │ │ │ │ │
1125 │ who have had too │ │ │ │ │ │
1126 │ much to drink to │ │ │ │ │ │
1127 │ drive safely will │ │ │ │ │ │
1128 │ D. Be arrested for│ │ │ │ │ │
1129 │ drunk driving? │ │ │ │ │ │
1130 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1131 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1132 │ is it that drivers│ │ │ │ │ │
1133 │ who have had too │ │ │ │ │ │
1134 │ much to drink to │ │ │ │ │ │
1135 │ drive safely will │ │ │ │ │ │
1136 │ D. Be arrested for│ │ │ │ │ │
1137 │ drunk driving? │ │ │ │ │ │
1138 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1142 AT_SETUP([CTABLES nesting and scale variables])
1143 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1144 AT_DATA([ctables.sps],
1146 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1147 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1148 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1149 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1150 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1152 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1154 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1160 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1161 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1162 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1164 │ Once a week or │ 44│ 54│
1166 │ Only certain │ 34│ 41│
1167 │ times a year │ │ │
1169 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1172 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1173 │ │Minimum│Maximum│Mean│
1174 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1175 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1176 │What is GENDER: months, has there been a │ │ │ │
1177 │your time when you felt you │ │ │ │
1178 │age? should cut down on your No │ 16│ 86│ 46│
1180 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1181 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1182 │ months, has there been a │ │ │ │
1183 │ time when you felt you │ │ │ │
1184 │ should cut down on your No │ 16│ 86│ 48│
1186 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1187 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1188 │What is GENDER: months, has there been a │ │ │ │
1189 │your time when people criticized No │ 16│ 86│ 46│
1190 │age? your drinking? │ │ │ │
1191 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1192 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1193 │ months, has there been a │ │ │ │
1194 │ time when people criticized No │ 16│ 86│ 48│
1195 │ your drinking? │ │ │ │
1196 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1199 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1200 │ │S1. Including yourself, how many members of this│
1201 │ │ household are age 16 or older? │
1202 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1203 │ │ │ │ │ │ │ │ 6 or │
1204 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1205 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1206 │ │Column│Column│Column│Column│Column│Column│Column│
1207 │ │ % │ % │ % │ % │ % │ % │ % │
1208 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1209 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1210 │SAMPLE How certain │ │ │ │ │ │ │ │
1211 │SOURCE: likely │ │ │ │ │ │ │ │
1212 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1213 │ that likely │ │ │ │ │ │ │ │
1214 │ drivers │ │ │ │ │ │ │ │
1215 │ who have │ │ │ │ │ │ │ │
1216 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1217 │ much to likely │ │ │ │ │ │ │ │
1218 │ drink to │ │ │ │ │ │ │ │
1219 │ drive │ │ │ │ │ │ │ │
1220 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1221 │ will A. unlikely│ │ │ │ │ │ │ │
1222 │ Get │ │ │ │ │ │ │ │
1223 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1224 │ by the unlikely│ │ │ │ │ │ │ │
1225 │ police? │ │ │ │ │ │ │ │
1226 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1229 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1232 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1233 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1234 │group typical month did you have one or more │ │ │
1235 │ alcoholic beverages to drink? │ │ │
1236 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1237 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1238 │ typical month did you have one or more │ │ │
1239 │ alcoholic beverages to drink? │ │ │
1240 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1241 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1242 │ typical month did you have one or more │ │ │
1243 │ alcoholic beverages to drink? │ │ │
1244 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1245 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1246 │ typical month did you have one or more │ │ │
1247 │ alcoholic beverages to drink? │ │ │
1248 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1249 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1250 │ typical month did you have one or more │ │ │
1251 │ alcoholic beverages to drink? │ │ │
1252 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1253 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1254 │ older typical month did you have one or more │ │ │
1255 │ alcoholic beverages to drink? │ │ │
1256 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1261 AT_SETUP([CTABLES SLABELS])
1262 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1263 AT_DATA([ctables.sps],
1265 CTABLES /TABLE qn1 [COUNT COLPCT].
1266 CTABLES /TABLE qn1 [COUNT COLPCT]
1267 /SLABELS POSITION=ROW.
1268 CTABLES /TABLE qn1 [COUNT COLPCT]
1269 /SLABELS POSITION=ROW VISIBLE=NO.
1271 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1273 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1276 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1277 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1278 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1279 │ Once a week or less│ 361│ 5.2%│
1280 │ Only certain times │ 130│ 1.9%│
1282 │ Never │ 540│ 7.7%│
1283 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1286 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1287 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1288 │other motor vehicle? Column │66.9%│
1290 │ ╶───────────────────────────┼─────┤
1291 │ Several days a week Count │ 1274│
1294 │ ╶───────────────────────────┼─────┤
1295 │ Once a week or less Count │ 361│
1298 │ ╶───────────────────────────┼─────┤
1299 │ Only certain times Count │ 130│
1300 │ a year Column │ 1.9%│
1302 │ ╶───────────────────────────┼─────┤
1303 │ Never Count │ 540│
1306 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1309 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1310 │ 1. How often do you usually drive a car or other Every day │ 4667│
1311 │motor vehicle? │66.9%│
1312 │ Several days a week │ 1274│
1314 │ Once a week or less │ 361│
1316 │ Only certain times a │ 130│
1320 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1324 AT_SETUP([CTABLES simple totals])
1325 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1326 AT_DATA([ctables.sps],
1329 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1330 DESCRIPTIVES qn18/STATISTICS=MEAN.
1331 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1332 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1334 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1336 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1338 ├────────────────────────────────────────────────────────────────────────┼─────┤
1339 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1340 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1343 │ Wine coolers │ 137│
1344 │ Hard liquor or │ 888│
1346 │ Flavored malt │ 83│
1348 │ Number responding │ 4221│
1349 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1351 Descriptive Statistics
1352 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1354 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1355 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1356 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1357 │Valid N (listwise) │6999│ │
1358 │Missing N (listwise) │2781│ │
1359 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1362 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1363 │ │ │ │ Valid│Total│
1364 │ │Mean│Count│ N │ N │
1365 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1366 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1367 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1368 │ you usually drink per sitting? │ │ │ │ │
1369 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1370 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1371 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1372 │ you usually drink per sitting? │ │ │ │ │
1373 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1374 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1375 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1376 │ you usually drink per sitting? │ │ │ │ │
1377 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1378 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1379 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1380 │ you usually drink per sitting? │ │ │ │ │
1381 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1382 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1383 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1384 │ you usually drink per sitting? │ │ │ │ │
1385 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1389 AT_SETUP([CTABLES subtotals])
1390 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1391 AT_DATA([ctables.sps],
1393 CTABLES /TABLE=qn105ba BY qns1
1394 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1395 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1396 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1397 CTABLES /TABLE=qn105ba BY qns1
1398 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1399 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1401 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1403 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1404 │ │ S1. Including yourself, how many members of this household │
1405 │ │ are age 16 or older? │
1406 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1407 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1408 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1409 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1410 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1411 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1412 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1413 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1414 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1415 │ likely │ │ │ │ │ │ │ │
1416 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1417 │ unlikely │ │ │ │ │ │ │ │
1418 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1419 │ unlikely │ │ │ │ │ │ │ │
1420 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1423 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1424 │ │ S1. Including yourself, how many members of this household │
1425 │ │ are age 16 or older? │
1426 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1427 │ │ │ │ │ │ │ │ 6 or │
1428 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1429 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1430 │ │ │ │ │ │ Column│ │ │
1431 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1432 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1433 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1434 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1435 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1436 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1437 │ likely │ │ │ │ │ │ │ │
1438 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1439 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1440 │ unlikely │ │ │ │ │ │ │ │
1441 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1442 │ unlikely │ │ │ │ │ │ │ │
1443 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1444 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1447 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1448 │ │ S1. Including yourself, how many members of this household │
1449 │ │ are age 16 or older? │
1450 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1451 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1452 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1453 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1454 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1455 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1456 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1457 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1458 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1459 │ likely │ │ │ │ │ │ │ │
1460 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1461 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1462 │ unlikely │ │ │ │ │ │ │ │
1463 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1464 │ unlikely │ │ │ │ │ │ │ │
1465 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1466 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1470 AT_SETUP([CTABLES PCOMPUTE])
1471 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1472 AT_DATA([ctables.sps],
1475 /PCOMPUTE &x=EXPR([3] + [4])
1476 /PCOMPUTE &y=EXPR([4] + [5])
1477 /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
1478 /PPROPERTIES &y LABEL='4+5'
1479 /TABLE=qn105ba BY qns1
1480 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
1482 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1484 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1485 │ │ S1. Including yourself, how many members of this household │
1486 │ │ are age 16 or older? │
1487 │ ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
1488 │ │ 1 │ 2 │ Subtotal │ 5 │ 3+4 │ 4+5 │ Subtotal │
1489 │ ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1490 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1491 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1492 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 11│ 81.00│ 30│ 92│
1493 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1494 │A. Get stopped by the police? Very likely│ 384│ 552│ 936│ 14│ 171.00│ 65│ 185│
1495 │ Somewhat │ 590│ 1249│ 1839│ 20│ 265.00│ 92│ 285│
1496 │ likely │ │ │ │ │ │ │ │
1497 │ Somewhat │ 278│ 647│ 925│ 6│ 116.00│ 38│ 122│
1498 │ unlikely │ │ │ │ │ │ │ │
1499 │ Very │ 141│ 290│ 431│ 4│ 59.00│ 22│ 63│
1500 │ unlikely │ │ │ │ │ │ │ │
1501 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
1505 AT_SETUP([CTABLES CLABELS])
1506 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1507 AT_DATA([ctables.sps],
1509 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1510 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1512 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1514 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1516 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1518 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1519 │ │ 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 │
1520 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1521 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1522 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1523 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1524 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1525 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1526 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1529 ╭──────────────────────────────┬────────────╮
1533 ├──────────────────────────────┼────────────┤
1534 │Age group 15 or younger Male │ 0│
1536 │ ╶────────────────────┼────────────┤
1537 │ 16 to 25 Male │ 594│
1539 │ ╶────────────────────┼────────────┤
1540 │ 26 to 35 Male │ 476│
1542 │ ╶────────────────────┼────────────┤
1543 │ 36 to 45 Male │ 489│
1545 │ ╶────────────────────┼────────────┤
1546 │ 46 to 55 Male │ 526│
1548 │ ╶────────────────────┼────────────┤
1549 │ 56 to 65 Male │ 516│
1551 │ ╶────────────────────┼────────────┤
1552 │ 66 or older Male │ 531│
1554 ╰──────────────────────────────┴────────────╯
1558 AT_SETUP([CTABLES missing values])
1559 AT_DATA([ctables.sps],
1560 [[DATA LIST LIST NOTABLE/x y.
1599 MISSING VALUES x (1, 2) y (2, 3).
1600 VARIABLE LEVEL ALL (NOMINAL).
1602 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1603 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1604 /CATEGORIES VARIABLES=ALL TOTAL=YES.
1605 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1606 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1607 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1608 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1609 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1610 /CATEGORIES VARIABLES=ALL TOTAL=YES
1611 /SLABELS POSITION=ROW.
1612 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1613 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1614 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1615 /SLABELS POSITION=ROW.
1616 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1617 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1618 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
1619 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
1620 /SLABELS POSITION=ROW.
1622 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1624 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1625 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1626 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1627 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1628 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1629 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1630 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1631 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1632 dnl Note that Column Total N % doesn't add up to 100 because missing
1633 dnl values are included in the total but not shown as a category and this
1634 dnl is expected behavior.
1637 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1638 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1639 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1640 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1641 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1642 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1643 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1644 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1645 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1646 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1647 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1648 dnl values are included in the total but not shown as a category and this
1649 dnl is expected behavior.
1652 ╭────────────────────────┬───────────────────────────╮
1654 │ ├──────┬──────┬──────┬──────┤
1655 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
1656 ├────────────────────────┼──────┼──────┼──────┼──────┤
1657 │x 3.00 Count │ 1│ 1│ 1│ 3│
1658 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1659 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1660 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1661 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1662 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1663 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1664 │ Valid N │ │ │ │ 3│
1665 │ Total N │ │ │ │ 6│
1666 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1667 │ 4.00 Count │ 1│ 1│ 1│ 3│
1668 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1669 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1670 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1671 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1672 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1673 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1674 │ Valid N │ │ │ │ 3│
1675 │ Total N │ │ │ │ 6│
1676 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1677 │ 5.00 Count │ 1│ 1│ 1│ 3│
1678 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1679 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1680 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1681 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1682 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1683 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1684 │ Valid N │ │ │ │ 3│
1685 │ Total N │ │ │ │ 6│
1686 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1687 │ Total Count │ 3│ 3│ 3│ 9│
1688 │ Column % │100.0%│100.0%│100.0%│ .│
1689 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
1690 │ Column Total N %│100.0%│100.0%│100.0%│ .│
1691 │ Row % │ .│ .│ .│ .│
1692 │ Row Valid N % │ .│ .│ .│ .│
1693 │ Row Total N % │ .│ .│ .│ .│
1694 │ Valid N │ 3│ 3│ 3│ 9│
1695 │ Total N │ 6│ 6│ 6│ 36│
1696 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1699 ╭────────────────────────┬─────────────────────────────────────────╮
1701 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
1702 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1703 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1704 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1705 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1706 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1707 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1708 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1709 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1710 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1711 │ Valid N │ │ │ │ │ │ 0│
1712 │ Total N │ │ │ │ │ │ 6│
1713 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1714 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1715 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1716 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1717 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1718 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1719 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1720 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1721 │ Valid N │ │ │ │ │ │ 0│
1722 │ Total N │ │ │ │ │ │ 6│
1723 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1724 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1725 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1726 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1727 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1728 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1729 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1730 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1731 │ Valid N │ │ │ │ │ │ 3│
1732 │ Total N │ │ │ │ │ │ 6│
1733 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1734 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1735 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1736 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1737 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1738 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1739 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1740 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1741 │ Valid N │ │ │ │ │ │ 3│
1742 │ Total N │ │ │ │ │ │ 6│
1743 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1744 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1745 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1746 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1747 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1748 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1749 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1750 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1751 │ Valid N │ │ │ │ │ │ 3│
1752 │ Total N │ │ │ │ │ │ 6│
1753 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1754 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
1755 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1756 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
1757 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1758 │ Row % │ .│ .│ .│ .│ .│ .│
1759 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1760 │ Row Total N % │ .│ .│ .│ .│ .│ .│
1761 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
1762 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
1763 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
1766 ╭────────────────────────┬──────────────────────────────────╮
1768 │ ├──────┬──────┬──────┬──────┬──────┤
1769 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1770 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
1771 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
1772 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1773 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1774 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1775 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1776 │ Row Valid N % │ .│ .│ .│ .│ .│
1777 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1778 │ Valid N │ │ │ │ │ 0│
1779 │ Total N │ │ │ │ │ 6│
1780 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1781 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
1782 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1783 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1784 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1785 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1786 │ Row Valid N % │ .│ .│ .│ .│ .│
1787 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1788 │ Valid N │ │ │ │ │ 0│
1789 │ Total N │ │ │ │ │ 6│
1790 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1791 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
1792 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1793 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
1794 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1795 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1796 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
1797 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1798 │ Valid N │ │ │ │ │ 3│
1799 │ Total N │ │ │ │ │ 6│
1800 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1801 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
1802 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1803 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
1804 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1805 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1806 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
1807 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1808 │ Valid N │ │ │ │ │ 3│
1809 │ Total N │ │ │ │ │ 6│
1810 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1811 │ Total Count │ 4│ 4│ 4│ 4│ 16│
1812 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
1813 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
1814 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
1815 │ Row % │ .│ .│ .│ .│ .│
1816 │ Row Valid N % │ .│ .│ .│ .│ .│
1817 │ Row Total N % │ .│ .│ .│ .│ .│
1818 │ Valid N │ 2│ 0│ 2│ 2│ 6│
1819 │ Total N │ 5│ 5│ 5│ 5│ 30│
1820 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
1824 AT_SETUP([CTABLES SMISSING=LISTWISE])
1825 AT_KEYWORDS([SMISSING LISTWISE])
1826 AT_DATA([ctables.sps],
1827 [[DATA LIST LIST NOTABLE/x y z.
1835 VARIABLE LEVEL x (NOMINAL).
1837 CTABLES /TABLE (y + z) > x.
1838 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
1840 * The following doesn't come out as listwise because the tables are
1841 separate, not linked by an > operator.
1842 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
1844 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl