3 dnl Features not yet tested:
4 dnl - Preprocessing to distinguish categorical from scale.
5 dnl - String variables and values
6 dnl - Testing details of missing value handling in summaries.
7 dnl - test CLABELS ROWLABELS=LAYER.
9 dnl - Test WEIGHT and adjustment weights.
10 dnl - EMPTY=INCLUDE For string ranges.
11 dnl - Summary functions:
12 dnl * Separate summary functions for totals and subtotals.
13 dnl * )CILEVEL in summary label specification
17 dnl * ascending/descending
21 dnl * THRU (numeric ranges)
22 dnl * THRU (string ranges)
25 dnl * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
28 dnl - HIDESMALLCOUNTS.
29 dnl - Date/time variables and values
30 dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
31 dnl - TITLES: )DATE, )TIME, )TABLE.
33 dnl * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
34 dnl * MISSING, OTHERNM
35 dnl * strings and string ranges
36 dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
40 dnl - Summary functions:
41 dnl * U-prefix for unweighted summaries.
42 dnl * areaPCT.SUM and UareaPCT.SUM functions.
43 dnl - SPLIT FILE with SEPARATE splits
44 dnl - Definition of columns/rows when labels are rotated from one axis to another.
47 dnl - Multiple response sets
48 dnl - MRSETS subcommand.
49 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
52 dnl - Summary functions:
53 dnl * .LCL and .UCL suffixes.
56 dnl * Data-dependent sorting.
60 dnl CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a.
61 dnl produces a bad median:
63 dnl +--------------------------+-----------------------+
64 dnl | | S3a. GENDER: |
65 dnl | +-----------+-----------+
66 dnl | | Male | Female |
67 dnl | +----+------+----+------+
68 dnl | |Mean|Median|Mean|Median|
69 dnl +--------------------------+----+------+----+------+
70 dnl |D1. AGE: What is your age?| 46| 999| 50| 999|
71 dnl +--------------------------+----+------+----+------+
75 AT_SETUP([CTABLES parsing])
76 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
77 AT_DATA([ctables.sps],
80 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
81 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
82 /FORMAT UNITS=CM EMPTY="(-)"
83 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
84 /VLABELS VARIABLES=qn17 DISPLAY=NAME
85 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
86 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
87 /VLABELS VARIABLES=qn20 DISPLAY=NONE
88 /MRSETS COUNTDUPLICATES=NO
89 /MRSETS COUNTDUPLICATES=YES
92 /WEIGHT VARIABLE=qns3a
94 /HIDESMALLCOUNTS COUNT=10
96 /SLABELS POSITION=COLUMN VISIBLE=YES
97 /SLABELS VISIBLE=NO POSITION=ROW
98 /SLABELS POSITION=LAYER
100 /CLABELS ROWLABELS=OPPOSITE
102 /CATEGORIES VARIABLES=qn1 qn17
103 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
104 POSITION=BEFORE EMPTY=INCLUDE.
105 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
106 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
107 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
109 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
112 ╭───────────────────┬────┬────╮
114 ├───────────────────┼────┼────┤
115 │Sa1. SAMPLE SOURCE:│5392│1607│
116 ╰───────────────────┴────┴────╯
120 ╭───────────────────┬─────╮
122 ├───────────────────┼─────┤
123 │Sa1. SAMPLE SOURCE:│ 5392│
124 ╰───────────────────┴─────╯
127 ╭────────────────────────┬─────╮
129 ├────────────────────────┼─────┤
130 │Sa1. SAMPLE SOURCE: RDD │ 5392│
132 ╰────────────────────────┴─────╯
135 ╭────────────────────────┬─────╮
137 ├────────────────────────┼─────┤
138 │Sa1. SAMPLE SOURCE: RDD │ 5392│
140 ╰────────────────────────┴─────╯
144 AT_SETUP([CTABLES parsing - negative])
145 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
146 AT_DATA([ctables.sps],
149 CTABLES /FORMAT MINCOLWIDTH='foo'.
150 CTABLES /TABLE qn1 [**].
151 CTABLES /TABLE qn1 [NOTAFUNCTION].
154 CTABLES /TABLE NOTAVAR.
156 CTABLES /TABLE string[S].
157 CTABLES /TABLE qn1 [PTILE 101].
158 CTABLES /TABLE qn1 [MEAN F0.1].
159 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
160 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
161 CTABLES /TABLE qn1 [MEAN TOTALS].
162 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
163 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
164 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
165 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
166 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
167 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
168 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
169 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
170 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
171 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
172 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
173 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
174 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
175 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
176 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
177 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
178 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
179 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
180 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
181 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
182 CTABLES /PCOMPUTE &k=EXPR([LO **]).
183 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
184 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
185 CTABLES /PCOMPUTE &k=EXPR([1**]).
186 CTABLES /PCOMPUTE &k=EXPR((1x)).
187 CTABLES /PCOMPUTE **k.
188 CTABLES /PCOMPUTE &1.
189 CTABLES /PCOMPUTE &k**.
190 CTABLES /PCOMPUTE &k=**.
191 CTABLES /PCOMPUTE &k=EXPR**.
192 CTABLES /PCOMPUTE &k=EXPR(1x).
193 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
194 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
195 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
196 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
197 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
198 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
199 CTABLES /FORMAT EMPTY=**.
200 CTABLES /FORMAT MISSING=**.
202 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
204 CTABLES /VLABELS VARIABLES=NOTAVAR.
205 CTABLES /VLABELS VARIABLES=qn1 **.
206 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
208 CTABLES /MRSETS COUNTDUPLICATES=**.
209 CTABLES /SMISSING **.
211 CTABLES /WEIGHT VARIABLE=NOTAVAR.
212 CTABLES /HIDESMALLCOUNTS COUNT=1.
214 CTABLES /HIDESMALLCOUNTS COUNT=2.
215 CTABLES /TABLE qn1**.
216 CTABLES /TABLE qn1 /SLABELS POSITION=**.
217 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
218 CTABLES /TABLE qn1 /SLABELS **.
219 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
220 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
221 CTABLES /TABLE qn1 /CLABELS **.
222 CTABLES /TABLE qn1 /CRITERIA **.
223 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
224 CTABLES /TABLE qn1 /TITLES **.
225 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
226 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
227 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
228 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
229 CTABLES /TABLE qn1 /SIGTEST **.
230 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
231 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
232 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
233 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
234 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
235 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
236 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
237 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
238 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
239 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
240 CTABLES /TABLE qn1 /COMPARETEST **.
241 CTABLES /TABLE qn1 / **.
242 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
243 CTABLES /TABLE qn20 > qnd1.
244 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
245 NUMERIC datetime (DATETIME17.0).
246 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
248 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
249 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
251 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
252 negative number for MINCOLWIDTH.
254 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
257 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
258 summary function name.
260 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
262 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
265 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
267 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
269 10 | CTABLES /TABLE string[S].
272 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
273 between 0 and 100 for PTILE.
275 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
276 requires a width between 1 and 40.
278 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
279 format NEGPAREN requires width 2 or greater.
281 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
282 format NEGPAREN requires width greater than decimals.
284 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
286 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
289 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
290 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
293 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
295 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
297 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
300 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
301 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
304 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
306 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
308 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
310 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
312 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
314 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
316 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
319 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
320 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
323 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
324 between 0 and 100 for PTILE.
326 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
329 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
332 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
335 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
338 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
340 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
343 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
346 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
347 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
349 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
350 LABEL, POSITION, or EMPTY.
352 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
353 integer for SUBTOTAL.
355 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
357 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
359 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
361 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
363 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
365 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
367 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
369 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
371 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
373 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
375 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
377 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
379 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
380 the previous definition.
381 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
382 | ^~~~~~~~~~~~~~~~~~~
384 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
385 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
386 | ^~~~~~~~~~~~~~~~~~~
388 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
391 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
392 Expecting summary function name.
394 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
395 between 0 and 100 for PTILE.
397 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
399 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
402 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
403 FORMAT, or HIDESOURCECATS.
405 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
407 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
409 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
410 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
412 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
415 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
418 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
420 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
423 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
424 DEFAULT, NAME, LABEL, BOTH, or NONE.
426 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
429 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
432 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
433 VARIABLE or LISTWISE.
435 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
438 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
440 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
441 greater for HIDESMALLCOUNTS COUNT.
443 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
444 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
445 HIDESMALLCOUNTS, or TABLE.
447 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
450 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
452 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
455 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
458 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
461 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
464 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
467 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
468 ROWLABELS, or COLLABELS.
470 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
473 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
474 in @<:@0,100@:}@ for CILEVEL.
476 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
477 CAPTION, CORNER, or TITLE.
479 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
482 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
483 in @<:@0,1@:}@ for ALPHA.
485 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
488 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
489 ALLVISIBLE or SUBTOTALS.
491 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
492 ALPHA, INCLUDEMRSETS, or CATEGORIES.
494 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
497 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
500 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
503 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
504 BONFERRONI, BH, or NONE.
506 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
509 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
512 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
513 ALLVISIBLE or SUBTOTALS.
515 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
518 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
521 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
524 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
525 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
528 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
529 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
531 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
534 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
535 97 | CTABLES /TABLE qn20 > qnd1.
538 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
539 97 | CTABLES /TABLE qn20 > qnd1.
542 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
543 97 | CTABLES /TABLE qn20 > qnd1.
546 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
547 categorical variables at the innermost nesting level.
548 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
549 | ^~~~~~~~~~~~~~~~~~~~
551 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
553 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
556 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
557 specification as format DATETIME: Day (123) must be between 1 and 31..
558 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
561 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
563 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
565 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
568 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
570 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
573 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
575 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
580 AT_SETUP([CTABLES parsing - more negative])
581 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
582 AT_DATA([ctables.sps],
584 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
585 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
586 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
589 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
590 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
592 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
594 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
595 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
596 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
597 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
599 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
600 CTABLES /PCOMPUTE &x=EXPR([**]).
601 CTABLES /PCOMPUTE &x=EXPR(**).
605 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
607 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
608 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
609 category not included in the category list.
610 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
615 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
616 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
620 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
621 list of categories here.
622 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
627 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
628 category not included in the category list.
629 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
634 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
635 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
639 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
640 variable's CATEGORIES specification.
642 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
643 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
644 subtotals by position, e.g. SUBTOTAL[1].
645 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
646 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
648 ^~~~~~~~~~~~~~~~~~~~~~~~
650 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
652 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
653 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
656 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
657 applied only to string variables, but this subcommand tries to apply it to
658 numeric variable QN1.
659 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
662 ctables.sps:8.53: error: CTABLES: This category specification may be applied
663 only to numeric variables, but this subcommand tries to apply it to string
665 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
668 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
669 based on a summary function.
671 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
672 moved to be categorical, but qnd1 is a scale variable.
674 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
675 moved to have the same width, but QN1 has width 0 and string has width 8.
677 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
678 moved to have the same value labels, but QN1 and QNSA1 have different value
681 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
682 moved to have the same category specifications, but QN105BA and QN105BB have
683 different category specifications.
685 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
686 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
687 this warning, insert parentheses.
688 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
691 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
694 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
696 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
698 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
699 variable must be specified.
701 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
703 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
705 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
708 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
710 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
713 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
715 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
720 AT_SETUP([CTABLES one categorical variable])
721 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
722 AT_DATA([ctables.sps],
725 CTABLES /TABLE BY qn1.
726 CTABLES /TABLE BY BY qn1.
728 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
730 ╭────────────────────────────────────────────────────────────────────────┬─────╮
732 ├────────────────────────────────────────────────────────────────────────┼─────┤
733 │ 1. How often do you usually drive a car or other Every day │ 4667│
734 │motor vehicle? Several days a week │ 1274│
735 │ Once a week or less │ 361│
736 │ Only certain times a │ 130│
739 ╰────────────────────────────────────────────────────────────────────────┴─────╯
742 ╭──────────────────────────────────────────────────────────────────────────────╮
743 │ 1. How often do you usually drive a car or other motor vehicle? │
744 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
745 │ │ Several days a │ Once a week or │ Only certain times a │ │
746 │Every day│ week │ less │ year │Never│
747 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
748 │ Count │ Count │ Count │ Count │Count│
749 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
750 │ 4667│ 1274│ 361│ 130│ 540│
751 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
763 AT_SETUP([CTABLES one scale variable])
764 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
765 AT_DATA([ctables.sps],
767 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
768 CTABLES /TABLE BY qnd1.
769 CTABLES /TABLE BY BY qnd1.
771 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
773 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
774 │ │ │ │ │ │ Std │ │ │
775 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
776 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
777 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
778 │age? │ │ │ │ │ │ │ │
779 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
782 ╭──────────────────────────╮
783 │D1. AGE: What is your age?│
784 ├──────────────────────────┤
786 ├──────────────────────────┤
788 ╰──────────────────────────╯
791 D1. AGE: What is your age?
800 AT_SETUP([CTABLES simple stacking])
801 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
802 AT_DATA([ctables.sps],
804 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
806 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
808 ╭───────────────────────────────────────────────────────────────┬──────────────╮
815 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
816 │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│
817 │too much to drink to drive safely will A. Get certain │ │ │
818 │stopped by the police? Very likely │ 21%│ 22%│
819 │ Somewhat │ 38%│ 42%│
821 │ Somewhat │ 21%│ 18%│
825 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
826 │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│
827 │too much to drink to drive safely will B. Have an certain │ │ │
828 │accident? Very likely │ 36%│ 45%│
829 │ Somewhat │ 39%│ 32%│
835 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
836 │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│
837 │too much to drink to drive safely will C. Be certain │ │ │
838 │convicted for drunk driving? Very likely │ 32%│ 28%│
839 │ Somewhat │ 27%│ 32%│
841 │ Somewhat │ 15%│ 15%│
845 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
846 │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│
847 │too much to drink to drive safely will D. Be certain │ │ │
848 │arrested for drunk driving? Very likely │ 26%│ 27%│
849 │ Somewhat │ 32%│ 35%│
851 │ Somewhat │ 17%│ 15%│
855 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
859 AT_SETUP([CTABLES show or hide empty categories])
860 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
861 AT_DATA([ctables.sps],
863 IF (qn105ba = 2) qn105ba = 1.
864 IF (qns3a = 1) qns3a = 2.
865 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
866 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
867 /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
868 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
869 /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
870 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
871 /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
873 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
875 ╭──────────────────────────────────────────────────────────────┬───────────────╮
882 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
883 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
884 │too much to drink to drive safely will A. Get certain │ │ │
885 │stopped by the police? Very likely│ .│ 0%│
892 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
895 ╭──────────────────────────────────────────────────────────────┬───────────────╮
902 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
903 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
904 │too much to drink to drive safely will A. Get certain │ │ │
905 │stopped by the police? Somewhat │ .│ 40%│
911 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
914 ╭────────────────────────────────────────────────────────────────────┬─────────╮
921 ├────────────────────────────────────────────────────────────────────┼─────────┤
922 │105b. How likely is it that drivers who have had too Almost │ 32%│
923 │much to drink to drive safely will A. Get stopped by certain │ │
924 │the police? Very likely │ 0%│
931 ╰────────────────────────────────────────────────────────────────────┴─────────╯
934 ╭────────────────────────────────────────────────────────────────────┬─────────╮
941 ├────────────────────────────────────────────────────────────────────┼─────────┤
942 │105b. How likely is it that drivers who have had too Almost │ 32%│
943 │much to drink to drive safely will A. Get stopped by certain │ │
944 │the police? Somewhat │ 40%│
950 ╰────────────────────────────────────────────────────────────────────┴─────────╯
954 AT_SETUP([CTABLES simple nesting])
955 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
956 AT_DATA([ctables.sps],
958 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
959 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
960 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
961 /CATEGORIES VARIABLES=qns3a TOTAL=YES
962 /CLABELS ROW=OPPOSITE.
964 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
966 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
969 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
970 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
971 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
972 │drive safely will A. Get stopped by Total │ 700│ 10%│
973 │the police? ╶──────────────────────────┼─────┼──────┤
974 │ Very S3a. Male │ 660│ 10%│
975 │ likely GENDER: Female│ 842│ 12%│
977 │ ╶──────────────────────────┼─────┼──────┤
978 │ Somewhat S3a. Male │ 1174│ 17%│
979 │ likely GENDER: Female│ 1589│ 23%│
981 │ ╶──────────────────────────┼─────┼──────┤
982 │ Somewhat S3a. Male │ 640│ 9%│
983 │ unlikely GENDER: Female│ 667│ 10%│
985 │ ╶──────────────────────────┼─────┼──────┤
986 │ Very S3a. Male │ 311│ 5%│
987 │ unlikely GENDER: Female│ 298│ 4%│
989 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
990 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
991 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
992 │drive safely will B. Have an accident? Total │ 1100│ 16%│
993 │ ╶──────────────────────────┼─────┼──────┤
994 │ Very S3a. Male │ 1104│ 16%│
995 │ likely GENDER: Female│ 1715│ 25%│
997 │ ╶──────────────────────────┼─────┼──────┤
998 │ Somewhat S3a. Male │ 1203│ 17%│
999 │ likely GENDER: Female│ 1214│ 18%│
1000 │ Total │ 2417│ 35%│
1001 │ ╶──────────────────────────┼─────┼──────┤
1002 │ Somewhat S3a. Male │ 262│ 4%│
1003 │ unlikely GENDER: Female│ 168│ 2%│
1005 │ ╶──────────────────────────┼─────┼──────┤
1006 │ Very S3a. Male │ 81│ 1%│
1007 │ unlikely GENDER: Female│ 59│ 1%│
1009 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1010 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
1011 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
1012 │drive safely will C. Be convicted for Total │ 1149│ 17%│
1013 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1014 │ Very S3a. Male │ 988│ 14%│
1015 │ likely GENDER: Female│ 1049│ 15%│
1016 │ Total │ 2037│ 30%│
1017 │ ╶──────────────────────────┼─────┼──────┤
1018 │ Somewhat S3a. Male │ 822│ 12%│
1019 │ likely GENDER: Female│ 1210│ 18%│
1020 │ Total │ 2032│ 30%│
1021 │ ╶──────────────────────────┼─────┼──────┤
1022 │ Somewhat S3a. Male │ 446│ 7%│
1023 │ unlikely GENDER: Female│ 548│ 8%│
1025 │ ╶──────────────────────────┼─────┼──────┤
1026 │ Very S3a. Male │ 268│ 4%│
1027 │ unlikely GENDER: Female│ 354│ 5%│
1029 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1030 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1031 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1032 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1033 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1034 │ Very S3a. Male │ 805│ 12%│
1035 │ likely GENDER: Female│ 1029│ 15%│
1036 │ Total │ 1834│ 27%│
1037 │ ╶──────────────────────────┼─────┼──────┤
1038 │ Somewhat S3a. Male │ 975│ 14%│
1039 │ likely GENDER: Female│ 1332│ 19%│
1040 │ Total │ 2307│ 34%│
1041 │ ╶──────────────────────────┼─────┼──────┤
1042 │ Somewhat S3a. Male │ 535│ 8%│
1043 │ unlikely GENDER: Female│ 560│ 8%│
1044 │ Total │ 1095│ 16%│
1045 │ ╶──────────────────────────┼─────┼──────┤
1046 │ Very S3a. Male │ 270│ 4%│
1047 │ unlikely GENDER: Female│ 279│ 4%│
1049 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1052 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1053 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1054 │ │ certain│likely│ likely │ unlikely│unlikely│
1055 │ ├────────┼──────┼─────────┼─────────┼────────┤
1057 │ │ Table %│ % │ Table % │ Table % │ Table %│
1058 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1059 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1060 │GENDER: 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 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1068 │ is it that drivers│ │ │ │ │ │
1069 │ who have had too │ │ │ │ │ │
1070 │ much to drink to │ │ │ │ │ │
1071 │ drive safely will │ │ │ │ │ │
1072 │ A. Get stopped by │ │ │ │ │ │
1073 │ the police? │ │ │ │ │ │
1074 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1075 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1076 │ is it that drivers│ │ │ │ │ │
1077 │ who have had too │ │ │ │ │ │
1078 │ much to drink to │ │ │ │ │ │
1079 │ drive safely will │ │ │ │ │ │
1080 │ A. Get stopped by │ │ │ │ │ │
1081 │ the police? │ │ │ │ │ │
1082 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1083 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1084 │GENDER: 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 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1092 │ is it that drivers│ │ │ │ │ │
1093 │ who have had too │ │ │ │ │ │
1094 │ much to drink to │ │ │ │ │ │
1095 │ drive safely will │ │ │ │ │ │
1096 │ B. Have an │ │ │ │ │ │
1097 │ accident? │ │ │ │ │ │
1098 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1099 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1100 │ is it that drivers│ │ │ │ │ │
1101 │ who have had too │ │ │ │ │ │
1102 │ much to drink to │ │ │ │ │ │
1103 │ drive safely will │ │ │ │ │ │
1104 │ B. Have an │ │ │ │ │ │
1105 │ accident? │ │ │ │ │ │
1106 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1107 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1108 │GENDER: 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 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1116 │ is it that drivers│ │ │ │ │ │
1117 │ who have had too │ │ │ │ │ │
1118 │ much to drink to │ │ │ │ │ │
1119 │ drive safely will │ │ │ │ │ │
1120 │ C. Be convicted │ │ │ │ │ │
1121 │ for drunk driving?│ │ │ │ │ │
1122 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1123 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1124 │ is it that drivers│ │ │ │ │ │
1125 │ who have had too │ │ │ │ │ │
1126 │ much to drink to │ │ │ │ │ │
1127 │ drive safely will │ │ │ │ │ │
1128 │ C. Be convicted │ │ │ │ │ │
1129 │ for drunk driving?│ │ │ │ │ │
1130 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1131 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1132 │GENDER: 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 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1139 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1140 │ is it that drivers│ │ │ │ │ │
1141 │ who have had too │ │ │ │ │ │
1142 │ much to drink to │ │ │ │ │ │
1143 │ drive safely will │ │ │ │ │ │
1144 │ D. Be arrested for│ │ │ │ │ │
1145 │ drunk driving? │ │ │ │ │ │
1146 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1147 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1148 │ is it that drivers│ │ │ │ │ │
1149 │ who have had too │ │ │ │ │ │
1150 │ much to drink to │ │ │ │ │ │
1151 │ drive safely will │ │ │ │ │ │
1152 │ D. Be arrested for│ │ │ │ │ │
1153 │ drunk driving? │ │ │ │ │ │
1154 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1158 AT_SETUP([CTABLES nesting and scale variables])
1159 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1160 AT_DATA([ctables.sps],
1162 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1163 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1164 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1165 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1166 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1168 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1170 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1176 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1177 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1178 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1180 │ Once a week or │ 44│ 54│
1182 │ Only certain │ 34│ 41│
1183 │ times a year │ │ │
1185 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1188 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1189 │ │Minimum│Maximum│Mean│
1190 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1191 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1192 │What is GENDER: months, has there been a │ │ │ │
1193 │your time when you felt you │ │ │ │
1194 │age? should cut down on your No │ 16│ 86│ 46│
1196 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1197 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1198 │ months, has there been a │ │ │ │
1199 │ time when you felt you │ │ │ │
1200 │ should cut down on your No │ 16│ 86│ 48│
1202 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1203 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1204 │What is GENDER: months, has there been a │ │ │ │
1205 │your time when people criticized No │ 16│ 86│ 46│
1206 │age? your drinking? │ │ │ │
1207 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1208 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1209 │ months, has there been a │ │ │ │
1210 │ time when people criticized No │ 16│ 86│ 48│
1211 │ your drinking? │ │ │ │
1212 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1215 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1216 │ │S1. Including yourself, how many members of this│
1217 │ │ household are age 16 or older? │
1218 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1219 │ │ │ │ │ │ │ │ 6 or │
1220 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1221 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1222 │ │Column│Column│Column│Column│Column│Column│Column│
1223 │ │ % │ % │ % │ % │ % │ % │ % │
1224 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1225 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1226 │SAMPLE How certain │ │ │ │ │ │ │ │
1227 │SOURCE: likely │ │ │ │ │ │ │ │
1228 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1229 │ that likely │ │ │ │ │ │ │ │
1230 │ drivers │ │ │ │ │ │ │ │
1231 │ who have │ │ │ │ │ │ │ │
1232 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1233 │ much to likely │ │ │ │ │ │ │ │
1234 │ drink to │ │ │ │ │ │ │ │
1235 │ drive │ │ │ │ │ │ │ │
1236 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1237 │ will A. unlikely│ │ │ │ │ │ │ │
1238 │ Get │ │ │ │ │ │ │ │
1239 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1240 │ by the unlikely│ │ │ │ │ │ │ │
1241 │ police? │ │ │ │ │ │ │ │
1242 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1245 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1248 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1249 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1250 │group typical month did you have one or more │ │ │
1251 │ alcoholic beverages to drink? │ │ │
1252 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1253 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1254 │ typical month did you have one or more │ │ │
1255 │ alcoholic beverages to drink? │ │ │
1256 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1257 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1258 │ typical month did you have one or more │ │ │
1259 │ alcoholic beverages to drink? │ │ │
1260 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1261 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1262 │ typical month did you have one or more │ │ │
1263 │ alcoholic beverages to drink? │ │ │
1264 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1265 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1266 │ typical month did you have one or more │ │ │
1267 │ alcoholic beverages to drink? │ │ │
1268 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1269 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1270 │ older typical month did you have one or more │ │ │
1271 │ alcoholic beverages to drink? │ │ │
1272 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1277 AT_SETUP([CTABLES SLABELS])
1278 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1279 AT_DATA([ctables.sps],
1281 CTABLES /TABLE qn1 [COUNT COLPCT].
1282 CTABLES /TABLE qn1 [COUNT COLPCT]
1283 /SLABELS POSITION=ROW.
1284 CTABLES /TABLE qn1 [COUNT COLPCT]
1285 /SLABELS POSITION=ROW VISIBLE=NO.
1287 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1289 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1292 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1293 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1294 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1295 │ Once a week or less│ 361│ 5.2%│
1296 │ Only certain times │ 130│ 1.9%│
1298 │ Never │ 540│ 7.7%│
1299 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1302 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1303 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1304 │other motor vehicle? Column │66.9%│
1306 │ ╶───────────────────────────┼─────┤
1307 │ Several days a week Count │ 1274│
1310 │ ╶───────────────────────────┼─────┤
1311 │ Once a week or less Count │ 361│
1314 │ ╶───────────────────────────┼─────┤
1315 │ Only certain times Count │ 130│
1316 │ a year Column │ 1.9%│
1318 │ ╶───────────────────────────┼─────┤
1319 │ Never Count │ 540│
1322 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1325 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1326 │ 1. How often do you usually drive a car or other Every day │ 4667│
1327 │motor vehicle? │66.9%│
1328 │ Several days a week │ 1274│
1330 │ Once a week or less │ 361│
1332 │ Only certain times a │ 130│
1336 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1340 AT_SETUP([CTABLES simple totals])
1341 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1342 AT_DATA([ctables.sps],
1345 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1346 DESCRIPTIVES qn18/STATISTICS=MEAN.
1347 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1348 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1350 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1352 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1354 ├────────────────────────────────────────────────────────────────────────┼─────┤
1355 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1356 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1359 │ Wine coolers │ 137│
1360 │ Hard liquor or │ 888│
1362 │ Flavored malt │ 83│
1364 │ Number responding │ 4221│
1365 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1367 Descriptive Statistics
1368 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1370 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1371 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1372 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1373 │Valid N (listwise) │6999│ │
1374 │Missing N (listwise) │2781│ │
1375 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1378 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1379 │ │ │ │ Valid│Total│
1380 │ │Mean│Count│ N │ N │
1381 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1382 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1383 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1384 │ you usually drink per sitting? │ │ │ │ │
1385 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1386 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1387 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1388 │ you usually drink per sitting? │ │ │ │ │
1389 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1390 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1391 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1392 │ you usually drink per sitting? │ │ │ │ │
1393 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1394 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1395 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1396 │ you usually drink per sitting? │ │ │ │ │
1397 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1398 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1399 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1400 │ you usually drink per sitting? │ │ │ │ │
1401 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1405 AT_SETUP([CTABLES subtotals])
1406 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1407 AT_DATA([ctables.sps],
1409 CTABLES /TABLE=qn105ba BY qns1
1410 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1411 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1412 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1413 CTABLES /TABLE=qn105ba BY qns1
1414 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1415 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1417 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1419 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1420 │ │ S1. Including yourself, how many members of this household │
1421 │ │ are age 16 or older? │
1422 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1423 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1424 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1425 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1426 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1427 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1428 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1429 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1430 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1431 │ likely │ │ │ │ │ │ │ │
1432 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1433 │ unlikely │ │ │ │ │ │ │ │
1434 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1435 │ unlikely │ │ │ │ │ │ │ │
1436 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1439 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1440 │ │ S1. Including yourself, how many members of this household │
1441 │ │ are age 16 or older? │
1442 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1443 │ │ │ │ │ │ │ │ 6 or │
1444 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1445 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1446 │ │ │ │ │ │ Column│ │ │
1447 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1448 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1449 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1450 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1451 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1452 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1453 │ likely │ │ │ │ │ │ │ │
1454 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1455 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1456 │ unlikely │ │ │ │ │ │ │ │
1457 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1458 │ unlikely │ │ │ │ │ │ │ │
1459 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1460 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1463 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1464 │ │ S1. Including yourself, how many members of this household │
1465 │ │ are age 16 or older? │
1466 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1467 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1468 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1469 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1470 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1471 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1472 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1473 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1474 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1475 │ likely │ │ │ │ │ │ │ │
1476 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1477 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1478 │ unlikely │ │ │ │ │ │ │ │
1479 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1480 │ unlikely │ │ │ │ │ │ │ │
1481 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1482 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1486 AT_SETUP([CTABLES PCOMPUTE])
1487 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1488 AT_DATA([ctables.sps],
1491 /PCOMPUTE &x=EXPR([3] + [4])
1492 /PCOMPUTE &y=EXPR([4] + [5])
1493 /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
1494 /PPROPERTIES &y LABEL='4+5'
1495 /TABLE=qn105ba BY qns1
1496 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
1498 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1500 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1501 │ │ S1. Including yourself, how many members of this household │
1502 │ │ are age 16 or older? │
1503 │ ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
1504 │ │ 1 │ 2 │ Subtotal │ 5 │ 3+4 │ 4+5 │ Subtotal │
1505 │ ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1506 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1507 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1508 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 11│ 81.00│ 30│ 92│
1509 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1510 │A. Get stopped by the police? Very likely│ 384│ 552│ 936│ 14│ 171.00│ 65│ 185│
1511 │ Somewhat │ 590│ 1249│ 1839│ 20│ 265.00│ 92│ 285│
1512 │ likely │ │ │ │ │ │ │ │
1513 │ Somewhat │ 278│ 647│ 925│ 6│ 116.00│ 38│ 122│
1514 │ unlikely │ │ │ │ │ │ │ │
1515 │ Very │ 141│ 290│ 431│ 4│ 59.00│ 22│ 63│
1516 │ unlikely │ │ │ │ │ │ │ │
1517 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
1521 AT_SETUP([CTABLES CLABELS])
1522 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1523 AT_DATA([ctables.sps],
1525 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1526 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1528 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1530 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1532 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1534 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1535 │ │ 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 │
1536 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1537 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1538 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1539 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1540 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1541 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1542 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1545 ╭──────────────────────────────┬────────────╮
1549 ├──────────────────────────────┼────────────┤
1550 │Age group 15 or younger Male │ 0│
1552 │ ╶────────────────────┼────────────┤
1553 │ 16 to 25 Male │ 594│
1555 │ ╶────────────────────┼────────────┤
1556 │ 26 to 35 Male │ 476│
1558 │ ╶────────────────────┼────────────┤
1559 │ 36 to 45 Male │ 489│
1561 │ ╶────────────────────┼────────────┤
1562 │ 46 to 55 Male │ 526│
1564 │ ╶────────────────────┼────────────┤
1565 │ 56 to 65 Male │ 516│
1567 │ ╶────────────────────┼────────────┤
1568 │ 66 or older Male │ 531│
1570 ╰──────────────────────────────┴────────────╯
1574 AT_SETUP([CTABLES missing values])
1575 AT_DATA([ctables.sps],
1576 [[DATA LIST LIST NOTABLE/x y.
1615 MISSING VALUES x (1, 2) y (2, 3).
1616 VARIABLE LEVEL ALL (NOMINAL).
1618 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1619 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1620 /CATEGORIES VARIABLES=ALL TOTAL=YES.
1621 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1622 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1623 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1624 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1625 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1626 /CATEGORIES VARIABLES=ALL TOTAL=YES
1627 /SLABELS POSITION=ROW.
1628 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1629 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1630 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1631 /SLABELS POSITION=ROW.
1632 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1633 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1634 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
1635 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
1636 /SLABELS POSITION=ROW.
1638 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1640 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1641 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1642 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1643 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1644 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1645 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1646 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1647 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1648 dnl Note that Column Total N % doesn't add up to 100 because missing
1649 dnl values are included in the total but not shown as a category and this
1650 dnl is expected behavior.
1653 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1654 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1655 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1656 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1657 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1658 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1659 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1660 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1661 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1662 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1663 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1664 dnl values are included in the total but not shown as a category and this
1665 dnl is expected behavior.
1668 ╭────────────────────────┬───────────────────────────╮
1670 │ ├──────┬──────┬──────┬──────┤
1671 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
1672 ├────────────────────────┼──────┼──────┼──────┼──────┤
1673 │x 3.00 Count │ 1│ 1│ 1│ 3│
1674 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1675 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1676 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1677 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1678 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1679 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1680 │ Valid N │ │ │ │ 3│
1681 │ Total N │ │ │ │ 6│
1682 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1683 │ 4.00 Count │ 1│ 1│ 1│ 3│
1684 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1685 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1686 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1687 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1688 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1689 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1690 │ Valid N │ │ │ │ 3│
1691 │ Total N │ │ │ │ 6│
1692 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1693 │ 5.00 Count │ 1│ 1│ 1│ 3│
1694 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1695 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1696 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1697 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1698 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1699 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1700 │ Valid N │ │ │ │ 3│
1701 │ Total N │ │ │ │ 6│
1702 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1703 │ Total Count │ 3│ 3│ 3│ 9│
1704 │ Column % │100.0%│100.0%│100.0%│ .│
1705 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
1706 │ Column Total N %│100.0%│100.0%│100.0%│ .│
1707 │ Row % │ .│ .│ .│ .│
1708 │ Row Valid N % │ .│ .│ .│ .│
1709 │ Row Total N % │ .│ .│ .│ .│
1710 │ Valid N │ 3│ 3│ 3│ 9│
1711 │ Total N │ 6│ 6│ 6│ 36│
1712 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1715 ╭────────────────────────┬─────────────────────────────────────────╮
1717 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
1718 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1719 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1720 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1721 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1722 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1723 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1724 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1725 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1726 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1727 │ Valid N │ │ │ │ │ │ 0│
1728 │ Total N │ │ │ │ │ │ 6│
1729 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1730 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1731 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1732 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1733 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1734 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1735 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1736 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1737 │ Valid N │ │ │ │ │ │ 0│
1738 │ Total N │ │ │ │ │ │ 6│
1739 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1740 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1741 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1742 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1743 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1744 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1745 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1746 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1747 │ Valid N │ │ │ │ │ │ 3│
1748 │ Total N │ │ │ │ │ │ 6│
1749 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1750 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1751 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1752 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1753 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1754 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1755 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1756 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1757 │ Valid N │ │ │ │ │ │ 3│
1758 │ Total N │ │ │ │ │ │ 6│
1759 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1760 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1761 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1762 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1763 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1764 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1765 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1766 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1767 │ Valid N │ │ │ │ │ │ 3│
1768 │ Total N │ │ │ │ │ │ 6│
1769 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1770 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
1771 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1772 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
1773 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1774 │ Row % │ .│ .│ .│ .│ .│ .│
1775 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1776 │ Row Total N % │ .│ .│ .│ .│ .│ .│
1777 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
1778 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
1779 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
1782 ╭────────────────────────┬──────────────────────────────────╮
1784 │ ├──────┬──────┬──────┬──────┬──────┤
1785 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1786 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
1787 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
1788 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1789 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1790 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1791 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1792 │ Row Valid N % │ .│ .│ .│ .│ .│
1793 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1794 │ Valid N │ │ │ │ │ 0│
1795 │ Total N │ │ │ │ │ 6│
1796 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1797 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
1798 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1799 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1800 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1801 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1802 │ Row Valid N % │ .│ .│ .│ .│ .│
1803 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1804 │ Valid N │ │ │ │ │ 0│
1805 │ Total N │ │ │ │ │ 6│
1806 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1807 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
1808 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1809 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
1810 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1811 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1812 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
1813 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1814 │ Valid N │ │ │ │ │ 3│
1815 │ Total N │ │ │ │ │ 6│
1816 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1817 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
1818 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1819 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
1820 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1821 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1822 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
1823 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1824 │ Valid N │ │ │ │ │ 3│
1825 │ Total N │ │ │ │ │ 6│
1826 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1827 │ Total Count │ 4│ 4│ 4│ 4│ 16│
1828 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
1829 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
1830 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
1831 │ Row % │ .│ .│ .│ .│ .│
1832 │ Row Valid N % │ .│ .│ .│ .│ .│
1833 │ Row Total N % │ .│ .│ .│ .│ .│
1834 │ Valid N │ 2│ 0│ 2│ 2│ 6│
1835 │ Total N │ 5│ 5│ 5│ 5│ 30│
1836 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
1840 AT_SETUP([CTABLES SMISSING=LISTWISE])
1841 AT_KEYWORDS([SMISSING LISTWISE])
1842 AT_DATA([ctables.sps],
1843 [[DATA LIST LIST NOTABLE/x y z.
1851 VARIABLE LEVEL x (NOMINAL).
1853 CTABLES /TABLE (y + z) > x.
1854 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
1856 * The following doesn't come out as listwise because the tables are
1857 separate, not linked by an > operator.
1858 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
1860 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl