3 dnl Features not yet tested:
4 dnl - Preprocessing to distinguish categorical from scale.
5 dnl - Testing details of missing value handling in summaries.
6 dnl - Test WEIGHT and adjustment weights.
7 dnl - Summary functions:
8 dnl * Separate summary functions for totals and subtotals.
9 dnl * )CILEVEL in summary label specification
13 dnl * ascending/descending
16 dnl * THRU (numeric ranges)
18 dnl - Date/time variables and values
19 dnl - TITLES: )DATE, )TIME, )TABLE.
21 dnl * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
22 dnl * MISSING, OTHERNM
23 dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
27 dnl - Summary functions:
28 dnl * U-prefix for unweighted summaries.
29 dnl * areaPCT.SUM and UareaPCT.SUM functions.
30 dnl - SPLIT FILE with SEPARATE splits
31 dnl - Definition of columns/rows when labels are rotated from one axis to another.
34 dnl - Multiple response sets
35 dnl - MRSETS subcommand.
36 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
39 dnl - Summary functions:
40 dnl * .LCL and .UCL suffixes.
43 dnl * Data-dependent sorting.
45 AT_SETUP([CTABLES parsing])
46 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
47 AT_DATA([ctables.sps],
50 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
51 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
52 /FORMAT UNITS=CM EMPTY="(-)"
53 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
54 /VLABELS VARIABLES=qn17 DISPLAY=NAME
55 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
56 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
57 /VLABELS VARIABLES=qn20 DISPLAY=NONE
58 /MRSETS COUNTDUPLICATES=NO
59 /MRSETS COUNTDUPLICATES=YES
62 /WEIGHT VARIABLE=qns3a
64 /HIDESMALLCOUNTS COUNT=10
66 /SLABELS POSITION=COLUMN VISIBLE=YES
67 /SLABELS VISIBLE=NO POSITION=ROW
68 /SLABELS POSITION=LAYER
70 /CLABELS ROWLABELS=OPPOSITE
72 /CATEGORIES VARIABLES=qn1 qn17
73 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
74 POSITION=BEFORE EMPTY=INCLUDE.
75 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
76 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
77 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
79 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
82 ╭───────────────────┬────┬────╮
84 ├───────────────────┼────┼────┤
85 │Sa1. SAMPLE SOURCE:│5392│1607│
86 ╰───────────────────┴────┴────╯
90 ╭───────────────────┬─────╮
92 ├───────────────────┼─────┤
93 │Sa1. SAMPLE SOURCE:│ 5392│
94 ╰───────────────────┴─────╯
97 ╭────────────────────────┬─────╮
99 ├────────────────────────┼─────┤
100 │Sa1. SAMPLE SOURCE: RDD │ 5392│
102 ╰────────────────────────┴─────╯
105 ╭────────────────────────┬─────╮
107 ├────────────────────────┼─────┤
108 │Sa1. SAMPLE SOURCE: RDD │ 5392│
110 ╰────────────────────────┴─────╯
114 AT_SETUP([CTABLES parsing - negative])
115 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
116 AT_DATA([ctables.sps],
119 CTABLES /FORMAT MINCOLWIDTH='foo'.
120 CTABLES /TABLE qn1 [**].
121 CTABLES /TABLE qn1 [NOTAFUNCTION].
124 CTABLES /TABLE NOTAVAR.
126 CTABLES /TABLE string[S].
127 CTABLES /TABLE qn1 [PTILE 101].
128 CTABLES /TABLE qn1 [MEAN F0.1].
129 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
130 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
131 CTABLES /TABLE qn1 [MEAN TOTALS].
132 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
133 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
134 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
135 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
136 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
137 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
138 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
142 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
143 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
144 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
145 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
146 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
147 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
148 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
149 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
150 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
151 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
152 CTABLES /PCOMPUTE &k=EXPR([LO **]).
153 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
154 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
155 CTABLES /PCOMPUTE &k=EXPR([1**]).
156 CTABLES /PCOMPUTE &k=EXPR((1x)).
157 CTABLES /PCOMPUTE **k.
158 CTABLES /PCOMPUTE &1.
159 CTABLES /PCOMPUTE &k**.
160 CTABLES /PCOMPUTE &k=**.
161 CTABLES /PCOMPUTE &k=EXPR**.
162 CTABLES /PCOMPUTE &k=EXPR(1x).
163 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
164 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
165 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
166 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
167 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
168 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
169 CTABLES /FORMAT EMPTY=**.
170 CTABLES /FORMAT MISSING=**.
172 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
174 CTABLES /VLABELS VARIABLES=NOTAVAR.
175 CTABLES /VLABELS VARIABLES=qn1 **.
176 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
178 CTABLES /MRSETS COUNTDUPLICATES=**.
179 CTABLES /SMISSING **.
181 CTABLES /WEIGHT VARIABLE=NOTAVAR.
182 CTABLES /HIDESMALLCOUNTS COUNT=1.
184 CTABLES /HIDESMALLCOUNTS COUNT=2.
185 CTABLES /TABLE qn1**.
186 CTABLES /TABLE qn1 /SLABELS POSITION=**.
187 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
188 CTABLES /TABLE qn1 /SLABELS **.
189 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
190 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
191 CTABLES /TABLE qn1 /CLABELS **.
192 CTABLES /TABLE qn1 /CRITERIA **.
193 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
194 CTABLES /TABLE qn1 /TITLES **.
195 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
196 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
197 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
198 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
199 CTABLES /TABLE qn1 /SIGTEST **.
200 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
201 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
202 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
203 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
204 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
205 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
206 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
207 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
208 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
209 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
210 CTABLES /TABLE qn1 /COMPARETEST **.
211 CTABLES /TABLE qn1 / **.
212 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
213 CTABLES /TABLE qn20 > qnd1.
214 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
215 NUMERIC datetime (DATETIME17.0).
216 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
218 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
219 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
221 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
222 negative number for MINCOLWIDTH.
224 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
227 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
228 summary function name.
230 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
232 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
235 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
237 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
239 10 | CTABLES /TABLE string[S].
242 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
243 between 0 and 100 for PTILE.
245 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
246 requires a width between 1 and 40.
248 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
249 format NEGPAREN requires width 2 or greater.
251 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
252 format NEGPAREN requires width greater than decimals.
254 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
256 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
259 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
260 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
263 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
265 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
267 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
270 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
271 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
274 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
276 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
278 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
280 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
282 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
284 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
286 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
289 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
290 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
293 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
294 between 0 and 100 for PTILE.
296 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
299 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
302 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
305 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
308 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
310 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
313 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
316 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
317 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
319 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
320 LABEL, POSITION, or EMPTY.
322 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
323 integer for SUBTOTAL.
325 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
327 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
329 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
331 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
333 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
335 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
337 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
339 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
341 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
343 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
345 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
347 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
349 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
350 the previous definition.
351 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
352 | ^~~~~~~~~~~~~~~~~~~
354 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
355 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
356 | ^~~~~~~~~~~~~~~~~~~
358 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
361 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
362 Expecting summary function name.
364 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
365 between 0 and 100 for PTILE.
367 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
369 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
372 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
373 FORMAT, or HIDESOURCECATS.
375 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
377 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
379 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
380 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
382 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
385 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
388 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
390 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
393 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
394 DEFAULT, NAME, LABEL, BOTH, or NONE.
396 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
399 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
402 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
403 VARIABLE or LISTWISE.
405 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
408 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
410 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
411 greater for HIDESMALLCOUNTS COUNT.
413 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
414 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
415 HIDESMALLCOUNTS, or TABLE.
417 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
420 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
422 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
425 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
428 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
431 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
434 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
437 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
438 ROWLABELS, or COLLABELS.
440 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
443 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
444 in @<:@0,100@:}@ for CILEVEL.
446 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
447 CAPTION, CORNER, or TITLE.
449 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
452 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
453 in @<:@0,1@:}@ for ALPHA.
455 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
458 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
459 ALLVISIBLE or SUBTOTALS.
461 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
462 ALPHA, INCLUDEMRSETS, or CATEGORIES.
464 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
467 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
470 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
473 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
474 BONFERRONI, BH, or NONE.
476 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
479 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
482 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
483 ALLVISIBLE or SUBTOTALS.
485 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
488 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
491 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
494 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
495 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
498 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
499 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
501 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
504 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
505 97 | CTABLES /TABLE qn20 > qnd1.
508 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
509 97 | CTABLES /TABLE qn20 > qnd1.
512 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
513 97 | CTABLES /TABLE qn20 > qnd1.
516 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
517 categorical variables at the innermost nesting level.
518 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
519 | ^~~~~~~~~~~~~~~~~~~~
521 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
523 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
526 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
527 specification as format DATETIME: Day (123) must be between 1 and 31..
528 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
533 AT_SETUP([CTABLES parsing - more negative])
534 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
535 AT_DATA([ctables.sps],
537 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
538 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
539 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
542 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
543 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
545 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
547 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
548 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
549 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
550 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
552 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
553 CTABLES /PCOMPUTE &x=EXPR([**]).
554 CTABLES /PCOMPUTE &x=EXPR(**).
558 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
560 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
561 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
562 category not included in the category list.
563 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
568 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
569 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
573 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
574 list of categories here.
575 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
580 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
581 category not included in the category list.
582 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
587 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
588 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
592 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
593 variable's CATEGORIES specification.
595 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
596 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
597 subtotals by position, e.g. SUBTOTAL[1].
598 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
599 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
601 ^~~~~~~~~~~~~~~~~~~~~~~~
603 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
605 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
606 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
609 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
610 applied only to string variables, but this subcommand tries to apply it to
611 numeric variable QN1.
612 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
615 ctables.sps:8.53: error: CTABLES: This category specification may be applied
616 only to numeric variables, but this subcommand tries to apply it to string
618 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
621 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
622 based on a summary function.
624 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
625 moved to be categorical, but qnd1 is a scale variable.
627 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
628 moved to have the same width, but QN1 has width 0 and string has width 8.
630 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
631 moved to have the same value labels, but QN1 and QNSA1 have different value
634 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
635 moved to have the same category specifications, but QN105BA and QN105BB have
636 different category specifications.
638 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
639 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
640 this warning, insert parentheses.
641 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
644 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
647 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
649 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
651 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
652 variable must be specified.
654 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
656 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
658 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
661 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
663 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
666 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
668 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
673 AT_SETUP([CTABLES one categorical variable])
674 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
675 AT_DATA([ctables.sps],
678 CTABLES /TABLE BY qn1.
679 CTABLES /TABLE BY BY qn1.
681 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
683 ╭────────────────────────────────────────────────────────────────────────┬─────╮
685 ├────────────────────────────────────────────────────────────────────────┼─────┤
686 │ 1. How often do you usually drive a car or other Every day │ 4667│
687 │motor vehicle? Several days a week │ 1274│
688 │ Once a week or less │ 361│
689 │ Only certain times a │ 130│
692 ╰────────────────────────────────────────────────────────────────────────┴─────╯
695 ╭──────────────────────────────────────────────────────────────────────────────╮
696 │ 1. How often do you usually drive a car or other motor vehicle? │
697 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
698 │ │ Several days a │ Once a week or │ Only certain times a │ │
699 │Every day│ week │ less │ year │Never│
700 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
701 │ Count │ Count │ Count │ Count │Count│
702 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
703 │ 4667│ 1274│ 361│ 130│ 540│
704 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
716 AT_SETUP([CTABLES one string variable])
717 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
718 AT_DATA([ctables.sps],
721 MISSING VALUES licensed('DontKnow', 'Refused').
722 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
723 CTABLES /TABLE licensed.
724 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
725 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
726 * Notice that the string matching is case-sensitive.
727 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
728 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
730 /PCOMPUTE ¬yes=EXPR(['No']+['DontKnow']+['Refused'])
731 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
733 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'No', 'DontKnow', 'Refused'].
735 /PCOMPUTE ¬yes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
736 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
738 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'DontKnow' THRU 'No', 'Refused'].
740 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
750 ╭─────────────────┬─────┬───────╮
752 ├─────────────────┼─────┼───────┤
753 │licensed DontKnow│ 4│ │
757 │ Total │ 6999│ 6951│
758 ╰─────────────────┴─────┴───────╯
761 ╭──────────────┬─────╮
763 ├──────────────┼─────┤
764 │licensed Yes │ 6379│
767 ╰──────────────┴─────╯
770 ╭──────────────┬─────╮
772 ├──────────────┼─────┤
773 │licensed Yes │ 6379│
776 ╰──────────────┴─────╯
779 ╭────────────────┬─────╮
781 ├────────────────┼─────┤
786 ╰────────────────┴─────╯
789 ╭────────────────┬─────╮
791 ├────────────────┼─────┤
792 │licensed Yes │ 6379│
794 ╰────────────────┴─────╯
797 ╭────────────────┬─────╮
799 ├────────────────┼─────┤
800 │licensed Yes │ 6379│
802 ╰────────────────┴─────╯
806 AT_SETUP([CTABLES one scale variable])
807 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
808 AT_DATA([ctables.sps],
810 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
811 CTABLES /TABLE BY qnd1.
812 CTABLES /TABLE BY BY qnd1.
814 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
816 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
817 │ │ │ │ │ │ Std │ │ │
818 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
819 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
820 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
821 │age? │ │ │ │ │ │ │ │
822 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
825 ╭──────────────────────────╮
826 │D1. AGE: What is your age?│
827 ├──────────────────────────┤
829 ├──────────────────────────┤
831 ╰──────────────────────────╯
834 D1. AGE: What is your age?
843 AT_SETUP([CTABLES simple stacking])
844 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
845 AT_DATA([ctables.sps],
847 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
849 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
851 ╭───────────────────────────────────────────────────────────────┬──────────────╮
858 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
859 │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│
860 │too much to drink to drive safely will A. Get certain │ │ │
861 │stopped by the police? Very likely │ 21%│ 22%│
862 │ Somewhat │ 38%│ 42%│
864 │ Somewhat │ 21%│ 18%│
868 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
869 │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│
870 │too much to drink to drive safely will B. Have an certain │ │ │
871 │accident? Very likely │ 36%│ 45%│
872 │ Somewhat │ 39%│ 32%│
878 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
879 │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│
880 │too much to drink to drive safely will C. Be certain │ │ │
881 │convicted for drunk driving? Very likely │ 32%│ 28%│
882 │ Somewhat │ 27%│ 32%│
884 │ Somewhat │ 15%│ 15%│
888 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
889 │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│
890 │too much to drink to drive safely will D. Be certain │ │ │
891 │arrested for drunk driving? Very likely │ 26%│ 27%│
892 │ Somewhat │ 32%│ 35%│
894 │ Somewhat │ 17%│ 15%│
898 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
902 AT_SETUP([CTABLES show or hide empty categories])
903 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
904 AT_DATA([ctables.sps],
906 IF (qn105ba = 2) qn105ba = 1.
907 IF (qns3a = 1) qns3a = 2.
908 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
909 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
910 /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
911 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
912 /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
913 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
914 /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
916 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
918 ╭──────────────────────────────────────────────────────────────┬───────────────╮
925 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
926 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
927 │too much to drink to drive safely will A. Get certain │ │ │
928 │stopped by the police? Very likely│ .│ 0%│
935 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
938 ╭──────────────────────────────────────────────────────────────┬───────────────╮
945 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
946 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
947 │too much to drink to drive safely will A. Get certain │ │ │
948 │stopped by the police? Somewhat │ .│ 40%│
954 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
957 ╭────────────────────────────────────────────────────────────────────┬─────────╮
964 ├────────────────────────────────────────────────────────────────────┼─────────┤
965 │105b. How likely is it that drivers who have had too Almost │ 32%│
966 │much to drink to drive safely will A. Get stopped by certain │ │
967 │the police? Very likely │ 0%│
974 ╰────────────────────────────────────────────────────────────────────┴─────────╯
977 ╭────────────────────────────────────────────────────────────────────┬─────────╮
984 ├────────────────────────────────────────────────────────────────────┼─────────┤
985 │105b. How likely is it that drivers who have had too Almost │ 32%│
986 │much to drink to drive safely will A. Get stopped by certain │ │
987 │the police? Somewhat │ 40%│
993 ╰────────────────────────────────────────────────────────────────────┴─────────╯
997 AT_SETUP([CTABLES simple nesting])
998 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
999 AT_DATA([ctables.sps],
1001 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1002 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1003 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1004 /CATEGORIES VARIABLES=qns3a TOTAL=YES
1005 /CLABELS ROW=OPPOSITE.
1007 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1009 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1012 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1013 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
1014 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
1015 │drive safely will A. Get stopped by Total │ 700│ 10%│
1016 │the police? ╶──────────────────────────┼─────┼──────┤
1017 │ Very S3a. Male │ 660│ 10%│
1018 │ likely GENDER: Female│ 842│ 12%│
1019 │ Total │ 1502│ 22%│
1020 │ ╶──────────────────────────┼─────┼──────┤
1021 │ Somewhat S3a. Male │ 1174│ 17%│
1022 │ likely GENDER: Female│ 1589│ 23%│
1023 │ Total │ 2763│ 40%│
1024 │ ╶──────────────────────────┼─────┼──────┤
1025 │ Somewhat S3a. Male │ 640│ 9%│
1026 │ unlikely GENDER: Female│ 667│ 10%│
1027 │ Total │ 1307│ 19%│
1028 │ ╶──────────────────────────┼─────┼──────┤
1029 │ Very S3a. Male │ 311│ 5%│
1030 │ unlikely GENDER: Female│ 298│ 4%│
1032 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1033 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
1034 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
1035 │drive safely will B. Have an accident? Total │ 1100│ 16%│
1036 │ ╶──────────────────────────┼─────┼──────┤
1037 │ Very S3a. Male │ 1104│ 16%│
1038 │ likely GENDER: Female│ 1715│ 25%│
1039 │ Total │ 2819│ 41%│
1040 │ ╶──────────────────────────┼─────┼──────┤
1041 │ Somewhat S3a. Male │ 1203│ 17%│
1042 │ likely GENDER: Female│ 1214│ 18%│
1043 │ Total │ 2417│ 35%│
1044 │ ╶──────────────────────────┼─────┼──────┤
1045 │ Somewhat S3a. Male │ 262│ 4%│
1046 │ unlikely GENDER: Female│ 168│ 2%│
1048 │ ╶──────────────────────────┼─────┼──────┤
1049 │ Very S3a. Male │ 81│ 1%│
1050 │ unlikely GENDER: Female│ 59│ 1%│
1052 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1053 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
1054 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
1055 │drive safely will C. Be convicted for Total │ 1149│ 17%│
1056 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1057 │ Very S3a. Male │ 988│ 14%│
1058 │ likely GENDER: Female│ 1049│ 15%│
1059 │ Total │ 2037│ 30%│
1060 │ ╶──────────────────────────┼─────┼──────┤
1061 │ Somewhat S3a. Male │ 822│ 12%│
1062 │ likely GENDER: Female│ 1210│ 18%│
1063 │ Total │ 2032│ 30%│
1064 │ ╶──────────────────────────┼─────┼──────┤
1065 │ Somewhat S3a. Male │ 446│ 7%│
1066 │ unlikely GENDER: Female│ 548│ 8%│
1068 │ ╶──────────────────────────┼─────┼──────┤
1069 │ Very S3a. Male │ 268│ 4%│
1070 │ unlikely GENDER: Female│ 354│ 5%│
1072 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1073 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1074 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1075 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1076 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1077 │ Very S3a. Male │ 805│ 12%│
1078 │ likely GENDER: Female│ 1029│ 15%│
1079 │ Total │ 1834│ 27%│
1080 │ ╶──────────────────────────┼─────┼──────┤
1081 │ Somewhat S3a. Male │ 975│ 14%│
1082 │ likely GENDER: Female│ 1332│ 19%│
1083 │ Total │ 2307│ 34%│
1084 │ ╶──────────────────────────┼─────┼──────┤
1085 │ Somewhat S3a. Male │ 535│ 8%│
1086 │ unlikely GENDER: Female│ 560│ 8%│
1087 │ Total │ 1095│ 16%│
1088 │ ╶──────────────────────────┼─────┼──────┤
1089 │ Very S3a. Male │ 270│ 4%│
1090 │ unlikely GENDER: Female│ 279│ 4%│
1092 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1095 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1096 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1097 │ │ certain│likely│ likely │ unlikely│unlikely│
1098 │ ├────────┼──────┼─────────┼─────────┼────────┤
1100 │ │ Table %│ % │ Table % │ Table % │ Table %│
1101 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1102 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1103 │GENDER: is it that drivers│ │ │ │ │ │
1104 │ who have had too │ │ │ │ │ │
1105 │ much to drink to │ │ │ │ │ │
1106 │ drive safely will │ │ │ │ │ │
1107 │ A. Get stopped by │ │ │ │ │ │
1108 │ the police? │ │ │ │ │ │
1109 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1110 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1111 │ is it that drivers│ │ │ │ │ │
1112 │ who have had too │ │ │ │ │ │
1113 │ much to drink to │ │ │ │ │ │
1114 │ drive safely will │ │ │ │ │ │
1115 │ A. Get stopped by │ │ │ │ │ │
1116 │ the police? │ │ │ │ │ │
1117 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1118 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1119 │ is it that drivers│ │ │ │ │ │
1120 │ who have had too │ │ │ │ │ │
1121 │ much to drink to │ │ │ │ │ │
1122 │ drive safely will │ │ │ │ │ │
1123 │ A. Get stopped by │ │ │ │ │ │
1124 │ the police? │ │ │ │ │ │
1125 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1126 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1127 │GENDER: is it that drivers│ │ │ │ │ │
1128 │ who have had too │ │ │ │ │ │
1129 │ much to drink to │ │ │ │ │ │
1130 │ drive safely will │ │ │ │ │ │
1131 │ B. Have an │ │ │ │ │ │
1132 │ accident? │ │ │ │ │ │
1133 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1134 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1135 │ is it that drivers│ │ │ │ │ │
1136 │ who have had too │ │ │ │ │ │
1137 │ much to drink to │ │ │ │ │ │
1138 │ drive safely will │ │ │ │ │ │
1139 │ B. Have an │ │ │ │ │ │
1140 │ accident? │ │ │ │ │ │
1141 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1142 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1143 │ is it that drivers│ │ │ │ │ │
1144 │ who have had too │ │ │ │ │ │
1145 │ much to drink to │ │ │ │ │ │
1146 │ drive safely will │ │ │ │ │ │
1147 │ B. Have an │ │ │ │ │ │
1148 │ accident? │ │ │ │ │ │
1149 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1150 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1151 │GENDER: is it that drivers│ │ │ │ │ │
1152 │ who have had too │ │ │ │ │ │
1153 │ much to drink to │ │ │ │ │ │
1154 │ drive safely will │ │ │ │ │ │
1155 │ C. Be convicted │ │ │ │ │ │
1156 │ for drunk driving?│ │ │ │ │ │
1157 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1158 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1159 │ is it that drivers│ │ │ │ │ │
1160 │ who have had too │ │ │ │ │ │
1161 │ much to drink to │ │ │ │ │ │
1162 │ drive safely will │ │ │ │ │ │
1163 │ C. Be convicted │ │ │ │ │ │
1164 │ for drunk driving?│ │ │ │ │ │
1165 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1166 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1167 │ is it that drivers│ │ │ │ │ │
1168 │ who have had too │ │ │ │ │ │
1169 │ much to drink to │ │ │ │ │ │
1170 │ drive safely will │ │ │ │ │ │
1171 │ C. Be convicted │ │ │ │ │ │
1172 │ for drunk driving?│ │ │ │ │ │
1173 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1174 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1175 │GENDER: is it that drivers│ │ │ │ │ │
1176 │ who have had too │ │ │ │ │ │
1177 │ much to drink to │ │ │ │ │ │
1178 │ drive safely will │ │ │ │ │ │
1179 │ D. Be arrested for│ │ │ │ │ │
1180 │ drunk driving? │ │ │ │ │ │
1181 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1182 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1183 │ is it that drivers│ │ │ │ │ │
1184 │ who have had too │ │ │ │ │ │
1185 │ much to drink to │ │ │ │ │ │
1186 │ drive safely will │ │ │ │ │ │
1187 │ D. Be arrested for│ │ │ │ │ │
1188 │ drunk driving? │ │ │ │ │ │
1189 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1190 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1191 │ is it that drivers│ │ │ │ │ │
1192 │ who have had too │ │ │ │ │ │
1193 │ much to drink to │ │ │ │ │ │
1194 │ drive safely will │ │ │ │ │ │
1195 │ D. Be arrested for│ │ │ │ │ │
1196 │ drunk driving? │ │ │ │ │ │
1197 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1201 AT_SETUP([CTABLES nesting and scale variables])
1202 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1203 AT_DATA([ctables.sps],
1205 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1206 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1207 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1208 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1209 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1211 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1213 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1219 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1220 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1221 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1223 │ Once a week or │ 44│ 54│
1225 │ Only certain │ 34│ 41│
1226 │ times a year │ │ │
1228 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1231 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1232 │ │Minimum│Maximum│Mean│
1233 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1234 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1235 │What is GENDER: months, has there been a │ │ │ │
1236 │your time when you felt you │ │ │ │
1237 │age? should cut down on your No │ 16│ 86│ 46│
1239 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1240 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1241 │ months, has there been a │ │ │ │
1242 │ time when you felt you │ │ │ │
1243 │ should cut down on your No │ 16│ 86│ 48│
1245 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1246 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1247 │What is GENDER: months, has there been a │ │ │ │
1248 │your time when people criticized No │ 16│ 86│ 46│
1249 │age? your drinking? │ │ │ │
1250 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1251 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1252 │ months, has there been a │ │ │ │
1253 │ time when people criticized No │ 16│ 86│ 48│
1254 │ your drinking? │ │ │ │
1255 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1258 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1259 │ │S1. Including yourself, how many members of this│
1260 │ │ household are age 16 or older? │
1261 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1262 │ │ │ │ │ │ │ │ 6 or │
1263 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1264 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1265 │ │Column│Column│Column│Column│Column│Column│Column│
1266 │ │ % │ % │ % │ % │ % │ % │ % │
1267 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1268 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1269 │SAMPLE How certain │ │ │ │ │ │ │ │
1270 │SOURCE: likely │ │ │ │ │ │ │ │
1271 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1272 │ that likely │ │ │ │ │ │ │ │
1273 │ drivers │ │ │ │ │ │ │ │
1274 │ who have │ │ │ │ │ │ │ │
1275 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1276 │ much to likely │ │ │ │ │ │ │ │
1277 │ drink to │ │ │ │ │ │ │ │
1278 │ drive │ │ │ │ │ │ │ │
1279 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1280 │ will A. unlikely│ │ │ │ │ │ │ │
1281 │ Get │ │ │ │ │ │ │ │
1282 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1283 │ by the unlikely│ │ │ │ │ │ │ │
1284 │ police? │ │ │ │ │ │ │ │
1285 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1288 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1291 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1292 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1293 │group typical month did you have one or more │ │ │
1294 │ alcoholic beverages to drink? │ │ │
1295 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1296 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1297 │ typical month did you have one or more │ │ │
1298 │ alcoholic beverages to drink? │ │ │
1299 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1300 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1301 │ typical month did you have one or more │ │ │
1302 │ alcoholic beverages to drink? │ │ │
1303 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1304 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1305 │ typical month did you have one or more │ │ │
1306 │ alcoholic beverages to drink? │ │ │
1307 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1308 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1309 │ typical month did you have one or more │ │ │
1310 │ alcoholic beverages to drink? │ │ │
1311 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1312 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1313 │ older typical month did you have one or more │ │ │
1314 │ alcoholic beverages to drink? │ │ │
1315 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1320 AT_SETUP([CTABLES SLABELS])
1321 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1322 AT_DATA([ctables.sps],
1324 CTABLES /TABLE qn1 [COUNT COLPCT].
1325 CTABLES /TABLE qn1 [COUNT COLPCT]
1326 /SLABELS POSITION=ROW.
1327 CTABLES /TABLE qn1 [COUNT COLPCT]
1328 /SLABELS POSITION=ROW VISIBLE=NO.
1330 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1332 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1335 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1336 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1337 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1338 │ Once a week or less│ 361│ 5.2%│
1339 │ Only certain times │ 130│ 1.9%│
1341 │ Never │ 540│ 7.7%│
1342 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1345 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1346 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1347 │other motor vehicle? Column │66.9%│
1349 │ ╶───────────────────────────┼─────┤
1350 │ Several days a week Count │ 1274│
1353 │ ╶───────────────────────────┼─────┤
1354 │ Once a week or less Count │ 361│
1357 │ ╶───────────────────────────┼─────┤
1358 │ Only certain times Count │ 130│
1359 │ a year Column │ 1.9%│
1361 │ ╶───────────────────────────┼─────┤
1362 │ Never Count │ 540│
1365 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1368 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1369 │ 1. How often do you usually drive a car or other Every day │ 4667│
1370 │motor vehicle? │66.9%│
1371 │ Several days a week │ 1274│
1373 │ Once a week or less │ 361│
1375 │ Only certain times a │ 130│
1379 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1383 AT_SETUP([CTABLES simple totals])
1384 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1385 AT_DATA([ctables.sps],
1388 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1389 DESCRIPTIVES qn18/STATISTICS=MEAN.
1390 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1391 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1393 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1395 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1397 ├────────────────────────────────────────────────────────────────────────┼─────┤
1398 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1399 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1402 │ Wine coolers │ 137│
1403 │ Hard liquor or │ 888│
1405 │ Flavored malt │ 83│
1407 │ Number responding │ 4221│
1408 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1410 Descriptive Statistics
1411 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1413 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1414 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1415 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1416 │Valid N (listwise) │6999│ │
1417 │Missing N (listwise) │2781│ │
1418 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1421 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1422 │ │ │ │ Valid│Total│
1423 │ │Mean│Count│ N │ N │
1424 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1425 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1426 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1427 │ you usually drink per sitting? │ │ │ │ │
1428 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1429 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1430 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1431 │ you usually drink per sitting? │ │ │ │ │
1432 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1433 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1434 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1435 │ you usually drink per sitting? │ │ │ │ │
1436 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1437 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1438 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1439 │ you usually drink per sitting? │ │ │ │ │
1440 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1441 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1442 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1443 │ you usually drink per sitting? │ │ │ │ │
1444 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1448 AT_SETUP([CTABLES subtotals])
1449 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1450 AT_DATA([ctables.sps],
1452 CTABLES /TABLE=qn105ba BY qns1
1453 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1454 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1455 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1456 CTABLES /TABLE=qn105ba BY qns1
1457 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1458 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1460 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1462 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1463 │ │ S1. Including yourself, how many members of this household │
1464 │ │ are age 16 or older? │
1465 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1466 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1467 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1468 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1469 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1470 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1471 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1472 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1473 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1474 │ likely │ │ │ │ │ │ │ │
1475 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1476 │ unlikely │ │ │ │ │ │ │ │
1477 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1478 │ unlikely │ │ │ │ │ │ │ │
1479 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1482 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1483 │ │ S1. Including yourself, how many members of this household │
1484 │ │ are age 16 or older? │
1485 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1486 │ │ │ │ │ │ │ │ 6 or │
1487 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1488 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1489 │ │ │ │ │ │ Column│ │ │
1490 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1491 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1492 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1493 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1494 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1495 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1496 │ likely │ │ │ │ │ │ │ │
1497 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1498 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1499 │ unlikely │ │ │ │ │ │ │ │
1500 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1501 │ unlikely │ │ │ │ │ │ │ │
1502 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1503 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1506 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1507 │ │ S1. Including yourself, how many members of this household │
1508 │ │ are age 16 or older? │
1509 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1510 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1511 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1512 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1513 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1514 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1515 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1516 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1517 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1518 │ likely │ │ │ │ │ │ │ │
1519 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1520 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1521 │ unlikely │ │ │ │ │ │ │ │
1522 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1523 │ unlikely │ │ │ │ │ │ │ │
1524 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1525 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1529 AT_SETUP([CTABLES PCOMPUTE])
1530 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1531 AT_DATA([ctables.sps],
1534 /PCOMPUTE &x=EXPR([3] + [4])
1535 /PCOMPUTE &y=EXPR([4] + [5])
1536 /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
1537 /PPROPERTIES &y LABEL='4+5'
1538 /TABLE=qn105ba BY qns1
1539 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
1541 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1543 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1544 │ │ S1. Including yourself, how many members of this household │
1545 │ │ are age 16 or older? │
1546 │ ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
1547 │ │ 1 │ 2 │ Subtotal │ 5 │ 3+4 │ 4+5 │ Subtotal │
1548 │ ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1549 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1550 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1551 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 11│ 81.00│ 30│ 92│
1552 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1553 │A. Get stopped by the police? Very likely│ 384│ 552│ 936│ 14│ 171.00│ 65│ 185│
1554 │ Somewhat │ 590│ 1249│ 1839│ 20│ 265.00│ 92│ 285│
1555 │ likely │ │ │ │ │ │ │ │
1556 │ Somewhat │ 278│ 647│ 925│ 6│ 116.00│ 38│ 122│
1557 │ unlikely │ │ │ │ │ │ │ │
1558 │ Very │ 141│ 290│ 431│ 4│ 59.00│ 22│ 63│
1559 │ unlikely │ │ │ │ │ │ │ │
1560 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
1564 AT_SETUP([CTABLES CLABELS])
1565 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1566 AT_DATA([ctables.sps],
1568 CTABLES /TABLE AgeGroup BY qns3a.
1569 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1570 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1571 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1572 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1575 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1577 ╭───────────────────────┬────────────╮
1583 ├───────────────────────┼─────┼──────┤
1584 │Age group 15 or younger│ 0│ 0│
1585 │ 16 to 25 │ 594│ 505│
1586 │ 26 to 35 │ 476│ 491│
1587 │ 36 to 45 │ 489│ 548│
1588 │ 46 to 55 │ 526│ 649│
1589 │ 56 to 65 │ 516│ 731│
1590 │ 66 or older │ 531│ 943│
1591 ╰───────────────────────┴─────┴──────╯
1594 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1596 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1598 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1599 │ │ 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 │
1600 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1601 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1602 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1603 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1604 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1605 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1606 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1609 ╭──────────────────────────────┬────────────╮
1613 ├──────────────────────────────┼────────────┤
1614 │Age group 15 or younger Male │ 0│
1616 │ ╶────────────────────┼────────────┤
1617 │ 16 to 25 Male │ 594│
1619 │ ╶────────────────────┼────────────┤
1620 │ 26 to 35 Male │ 476│
1622 │ ╶────────────────────┼────────────┤
1623 │ 36 to 45 Male │ 489│
1625 │ ╶────────────────────┼────────────┤
1626 │ 46 to 55 Male │ 526│
1628 │ ╶────────────────────┼────────────┤
1629 │ 56 to 65 Male │ 516│
1631 │ ╶────────────────────┼────────────┤
1632 │ 66 or older Male │ 531│
1634 ╰──────────────────────────────┴────────────╯
1638 ╭─────────┬────────────╮
1644 ├─────────┼─────┼──────┤
1646 ╰─────────┴─────┴──────╯
1650 ╭─────────┬────────────╮
1656 ├─────────┼─────┼──────┤
1657 │Age group│ 594│ 505│
1658 ╰─────────┴─────┴──────╯
1662 ╭─────────┬────────────╮
1668 ├─────────┼─────┼──────┤
1669 │Age group│ 476│ 491│
1670 ╰─────────┴─────┴──────╯
1674 ╭─────────┬────────────╮
1680 ├─────────┼─────┼──────┤
1681 │Age group│ 489│ 548│
1682 ╰─────────┴─────┴──────╯
1686 ╭─────────┬────────────╮
1692 ├─────────┼─────┼──────┤
1693 │Age group│ 526│ 649│
1694 ╰─────────┴─────┴──────╯
1698 ╭─────────┬────────────╮
1704 ├─────────┼─────┼──────┤
1705 │Age group│ 516│ 731│
1706 ╰─────────┴─────┴──────╯
1710 ╭─────────┬────────────╮
1716 ├─────────┼─────┼──────┤
1717 │Age group│ 531│ 943│
1718 ╰─────────┴─────┴──────╯
1722 ╭───────────────────────┬────────────╮
1726 ├───────────────────────┼────────────┤
1727 │Age group 15 or younger│ 0│
1733 │ 66 or older │ 531│
1734 ╰───────────────────────┴────────────╯
1738 ╭───────────────────────┬────────────╮
1742 ├───────────────────────┼────────────┤
1743 │Age group 15 or younger│ 0│
1749 │ 66 or older │ 943│
1750 ╰───────────────────────┴────────────╯
1754 AT_SETUP([CTABLES missing values])
1755 AT_DATA([ctables.sps],
1756 [[DATA LIST LIST NOTABLE/x y.
1795 MISSING VALUES x (1, 2) y (2, 3).
1796 VARIABLE LEVEL ALL (NOMINAL).
1798 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1799 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1800 /CATEGORIES VARIABLES=ALL TOTAL=YES.
1801 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1802 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1803 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1804 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1805 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1806 /CATEGORIES VARIABLES=ALL TOTAL=YES
1807 /SLABELS POSITION=ROW.
1808 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1809 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1810 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1811 /SLABELS POSITION=ROW.
1812 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1813 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1814 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
1815 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
1816 /SLABELS POSITION=ROW.
1818 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1820 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1821 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1822 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1823 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1824 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1825 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1826 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1827 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1828 dnl Note that Column Total N % doesn't add up to 100 because missing
1829 dnl values are included in the total but not shown as a category and this
1830 dnl is expected behavior.
1833 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1834 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1835 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1836 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1837 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1838 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1839 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1840 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1841 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1842 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1843 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1844 dnl values are included in the total but not shown as a category and this
1845 dnl is expected behavior.
1848 ╭────────────────────────┬───────────────────────────╮
1850 │ ├──────┬──────┬──────┬──────┤
1851 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
1852 ├────────────────────────┼──────┼──────┼──────┼──────┤
1853 │x 3.00 Count │ 1│ 1│ 1│ 3│
1854 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1855 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1856 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1857 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1858 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1859 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1860 │ Valid N │ │ │ │ 3│
1861 │ Total N │ │ │ │ 6│
1862 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1863 │ 4.00 Count │ 1│ 1│ 1│ 3│
1864 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1865 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1866 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1867 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1868 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1869 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1870 │ Valid N │ │ │ │ 3│
1871 │ Total N │ │ │ │ 6│
1872 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1873 │ 5.00 Count │ 1│ 1│ 1│ 3│
1874 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1875 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1876 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1877 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1878 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1879 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1880 │ Valid N │ │ │ │ 3│
1881 │ Total N │ │ │ │ 6│
1882 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1883 │ Total Count │ 3│ 3│ 3│ 9│
1884 │ Column % │100.0%│100.0%│100.0%│ .│
1885 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
1886 │ Column Total N %│100.0%│100.0%│100.0%│ .│
1887 │ Row % │ .│ .│ .│ .│
1888 │ Row Valid N % │ .│ .│ .│ .│
1889 │ Row Total N % │ .│ .│ .│ .│
1890 │ Valid N │ 3│ 3│ 3│ 9│
1891 │ Total N │ 6│ 6│ 6│ 36│
1892 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1895 ╭────────────────────────┬─────────────────────────────────────────╮
1897 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
1898 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1899 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1900 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1901 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1902 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1903 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1904 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1905 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1906 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1907 │ Valid N │ │ │ │ │ │ 0│
1908 │ Total N │ │ │ │ │ │ 6│
1909 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1910 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1911 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1912 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1913 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1914 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1915 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1916 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1917 │ Valid N │ │ │ │ │ │ 0│
1918 │ Total N │ │ │ │ │ │ 6│
1919 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1920 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1921 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1922 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1923 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1924 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1925 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1926 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1927 │ Valid N │ │ │ │ │ │ 3│
1928 │ Total N │ │ │ │ │ │ 6│
1929 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1930 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1931 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1932 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1933 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1934 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1935 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1936 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1937 │ Valid N │ │ │ │ │ │ 3│
1938 │ Total N │ │ │ │ │ │ 6│
1939 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1940 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1941 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1942 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1943 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1944 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1945 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1946 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1947 │ Valid N │ │ │ │ │ │ 3│
1948 │ Total N │ │ │ │ │ │ 6│
1949 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1950 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
1951 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1952 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
1953 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1954 │ Row % │ .│ .│ .│ .│ .│ .│
1955 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1956 │ Row Total N % │ .│ .│ .│ .│ .│ .│
1957 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
1958 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
1959 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
1962 ╭────────────────────────┬──────────────────────────────────╮
1964 │ ├──────┬──────┬──────┬──────┬──────┤
1965 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1966 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
1967 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
1968 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1969 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1970 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1971 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1972 │ Row Valid N % │ .│ .│ .│ .│ .│
1973 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1974 │ Valid N │ │ │ │ │ 0│
1975 │ Total N │ │ │ │ │ 6│
1976 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1977 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
1978 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1979 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1980 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1981 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1982 │ Row Valid N % │ .│ .│ .│ .│ .│
1983 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1984 │ Valid N │ │ │ │ │ 0│
1985 │ Total N │ │ │ │ │ 6│
1986 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1987 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
1988 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1989 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
1990 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1991 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1992 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
1993 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1994 │ Valid N │ │ │ │ │ 3│
1995 │ Total N │ │ │ │ │ 6│
1996 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1997 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
1998 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1999 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2000 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2001 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2002 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2003 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2004 │ Valid N │ │ │ │ │ 3│
2005 │ Total N │ │ │ │ │ 6│
2006 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2007 │ Total Count │ 4│ 4│ 4│ 4│ 16│
2008 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
2009 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
2010 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
2011 │ Row % │ .│ .│ .│ .│ .│
2012 │ Row Valid N % │ .│ .│ .│ .│ .│
2013 │ Row Total N % │ .│ .│ .│ .│ .│
2014 │ Valid N │ 2│ 0│ 2│ 2│ 6│
2015 │ Total N │ 5│ 5│ 5│ 5│ 30│
2016 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2020 AT_SETUP([CTABLES SMISSING=LISTWISE])
2021 AT_KEYWORDS([SMISSING LISTWISE])
2022 AT_DATA([ctables.sps],
2023 [[DATA LIST LIST NOTABLE/x y z.
2031 VARIABLE LEVEL x (NOMINAL).
2033 CTABLES /TABLE (y + z) > x.
2034 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2036 * The following doesn't come out as listwise because the tables are
2037 separate, not linked by an > operator.
2038 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2040 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2070 AT_SETUP([CTABLES VLABELS])
2071 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2072 AT_DATA([ctables.sps],
2074 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2075 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME /TABLE qnd5a BY qns3a.
2076 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL /TABLE qnd5a BY qns3a.
2077 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH /TABLE qnd5a BY qns3a.
2078 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a BY qns3a.
2080 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2082 ╭────────────────────────────────────────────────────────────────┬────────────╮
2088 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2089 │D5a. What would you say is your primary Cuban │ 13│ 7│
2090 │ethnic background? Mexican │ 175│ 136│
2092 │ South American │ 21│ 13│
2093 │ Central American │ 27│ 25│
2094 │ Puerto Rican, OR │ 37│ 41│
2095 │ Something else │ 35│ 33│
2096 │ Multiple - cannot │ 2│ 5│
2098 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2101 ╭──────────────────────────────────┬────────────╮
2107 ├──────────────────────────────────┼─────┼──────┤
2108 │QND5A Cuban │ 13│ 7│
2109 │ Mexican │ 175│ 136│
2111 │ South American │ 21│ 13│
2112 │ Central American │ 27│ 25│
2113 │ Puerto Rican, OR │ 37│ 41│
2114 │ Something else │ 35│ 33│
2115 │ Multiple - cannot choose one│ 2│ 5│
2116 ╰──────────────────────────────────┴─────┴──────╯
2119 ╭────────────────────────────────────────────────────────────────┬────────────╮
2125 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2126 │D5a. What would you say is your primary Cuban │ 13│ 7│
2127 │ethnic background? Mexican │ 175│ 136│
2129 │ South American │ 21│ 13│
2130 │ Central American │ 27│ 25│
2131 │ Puerto Rican, OR │ 37│ 41│
2132 │ Something else │ 35│ 33│
2133 │ Multiple - cannot │ 2│ 5│
2135 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2138 ╭────────────────────────────────────────────────────────────┬────────────────╮
2141 │ ├───────┬────────┤
2143 │ ├───────┼────────┤
2145 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2146 │QND5A D5a. What would you say is your Cuban │ 13│ 7│
2147 │primary ethnic background? Mexican │ 175│ 136│
2149 │ South American │ 21│ 13│
2150 │ Central American │ 27│ 25│
2151 │ Puerto Rican, OR │ 37│ 41│
2152 │ Something else │ 35│ 33│
2153 │ Multiple - cannot │ 2│ 5│
2155 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2158 ╭────────────────────────────┬─────┬──────╮
2162 ├────────────────────────────┼─────┼──────┤
2164 │Mexican │ 175│ 136│
2166 │South American │ 21│ 13│
2167 │Central American │ 27│ 25│
2168 │Puerto Rican, OR │ 37│ 41│
2169 │Something else │ 35│ 33│
2170 │Multiple - cannot choose one│ 2│ 5│
2171 ╰────────────────────────────┴─────┴──────╯
2175 AT_SETUP([CTABLES FORMAT EMPTY])
2176 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2177 AT_DATA([ctables.sps],
2179 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2180 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2181 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2183 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2185 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2186 │ │ D5. ETHNICITY: Are you of │
2187 │ │ Hispanic or Latino origin or │
2189 │ ├───────────────┬───────────────┤
2191 │ ├───────────────┼───────────────┤
2193 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2194 │D5a. What would you say is Cuban │ 20│ 0│
2195 │your primary ethnic Mexican │ 311│ 0│
2196 │background? Spanish │ 48│ 0│
2197 │ South American │ 34│ 0│
2198 │ Central American│ 52│ 0│
2199 │ Puerto Rican, OR│ 78│ 0│
2200 │ Something else │ 68│ 0│
2201 │ Multiple - │ 7│ 0│
2202 │ cannot choose │ │ │
2204 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2207 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2208 │ │ D5. ETHNICITY: Are you of │
2209 │ │ Hispanic or Latino origin or │
2211 │ ├───────────────┬───────────────┤
2213 │ ├───────────────┼───────────────┤
2215 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2216 │D5a. What would you say is Cuban │ 20│ │
2217 │your primary ethnic Mexican │ 311│ │
2218 │background? Spanish │ 48│ │
2219 │ South American │ 34│ │
2220 │ Central American│ 52│ │
2221 │ Puerto Rican, OR│ 78│ │
2222 │ Something else │ 68│ │
2224 │ cannot choose │ │ │
2226 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2229 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2230 │ │ D5. ETHNICITY: Are you of │
2231 │ │ Hispanic or Latino origin or │
2233 │ ├───────────────┬───────────────┤
2235 │ ├───────────────┼───────────────┤
2237 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2238 │D5a. What would you say is Cuban │ 20│n/a │
2239 │your primary ethnic Mexican │ 311│n/a │
2240 │background? Spanish │ 48│n/a │
2241 │ South American │ 34│n/a │
2242 │ Central American│ 52│n/a │
2243 │ Puerto Rican, OR│ 78│n/a │
2244 │ Something else │ 68│n/a │
2245 │ Multiple - │ 7│n/a │
2246 │ cannot choose │ │ │
2248 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2252 AT_SETUP([CTABLES FORMAT MISSING])
2253 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2254 AT_DATA([ctables.sps],
2256 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2258 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2260 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2261 │ │ D5. ETHNICITY: Are you of │
2262 │ │ Hispanic or Latino origin or │
2264 │ ├───────────────┬───────────────┤
2266 │ ├───────────────┼───────────────┤
2267 │ │ Column % │ Column % │
2268 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2269 │D5a. What would you say is Cuban │ 3.2%│(no data) │
2270 │your primary ethnic Mexican │ 50.3%│(no data) │
2271 │background? Spanish │ 7.8%│(no data) │
2272 │ South American │ 5.5%│(no data) │
2273 │ Central American│ 8.4%│(no data) │
2274 │ Puerto Rican, OR│ 12.6%│(no data) │
2275 │ Something else │ 11.0%│(no data) │
2276 │ Multiple - │ 1.1%│(no data) │
2277 │ cannot choose │ │ │
2279 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2283 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2284 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2285 AT_DATA([ctables.sps],
2287 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2288 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2289 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2291 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2293 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2295 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2296 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2297 │occasion? 1 │ 491│ 34.9%│
2317 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2320 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2322 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2323 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2324 │occasion? 1 │ 491│ 34.9%│
2344 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2347 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2349 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2350 │38. How many drinks did you have on that Less than one│<10 │ .5%│
2351 │occasion? 1 │ 491│ 34.9%│
2371 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2375 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2376 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2377 AT_DATA([ctables.sps],
2379 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2381 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2393 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2394 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2395 maximumColumnWidth="192"
2396 minimumColumnWidth="96"
2400 AT_SETUP([CTABLES special formats])
2401 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2402 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2403 AT_DATA([ctables.sps],
2405 COMPUTE x = qnd3 - 4.
2406 CTABLES /TABLE x[MINIMUM NEGPAREN8.1, MINIMUM NEQUAL8.1, MINIMUM PAREN8.1, MINIMUM PCTPAREN8.1, MAXIMUM NEGPAREN8.1, MAXIMUM NEQUAL8.1, MAXIMUM PAREN8.1, MAXIMUM PCTPAREN8.1].
2408 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2410 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2411 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2412 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2413 │x│(3.0) │N=-3.0 │(-3.0) │(-3.0%)│8.0 │N=8.0 │(8.0) │(8.0%) │
2414 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯