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 - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
20 dnl - TITLES: )DATE, )TIME, )TABLE.
22 dnl * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
23 dnl * MISSING, OTHERNM
24 dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
28 dnl - Summary functions:
29 dnl * U-prefix for unweighted summaries.
30 dnl * areaPCT.SUM and UareaPCT.SUM functions.
31 dnl - SPLIT FILE with SEPARATE splits
32 dnl - Definition of columns/rows when labels are rotated from one axis to another.
35 dnl - Multiple response sets
36 dnl - MRSETS subcommand.
37 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
40 dnl - Summary functions:
41 dnl * .LCL and .UCL suffixes.
44 dnl * Data-dependent sorting.
46 AT_SETUP([CTABLES parsing])
47 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
48 AT_DATA([ctables.sps],
51 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
52 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
53 /FORMAT UNITS=CM EMPTY="(-)"
54 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
55 /VLABELS VARIABLES=qn17 DISPLAY=NAME
56 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
57 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
58 /VLABELS VARIABLES=qn20 DISPLAY=NONE
59 /MRSETS COUNTDUPLICATES=NO
60 /MRSETS COUNTDUPLICATES=YES
63 /WEIGHT VARIABLE=qns3a
65 /HIDESMALLCOUNTS COUNT=10
67 /SLABELS POSITION=COLUMN VISIBLE=YES
68 /SLABELS VISIBLE=NO POSITION=ROW
69 /SLABELS POSITION=LAYER
71 /CLABELS ROWLABELS=OPPOSITE
73 /CATEGORIES VARIABLES=qn1 qn17
74 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
75 POSITION=BEFORE EMPTY=INCLUDE.
76 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
77 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
78 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
80 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
83 ╭───────────────────┬────┬────╮
85 ├───────────────────┼────┼────┤
86 │Sa1. SAMPLE SOURCE:│5392│1607│
87 ╰───────────────────┴────┴────╯
91 ╭───────────────────┬─────╮
93 ├───────────────────┼─────┤
94 │Sa1. SAMPLE SOURCE:│ 5392│
95 ╰───────────────────┴─────╯
98 ╭────────────────────────┬─────╮
100 ├────────────────────────┼─────┤
101 │Sa1. SAMPLE SOURCE: RDD │ 5392│
103 ╰────────────────────────┴─────╯
106 ╭────────────────────────┬─────╮
108 ├────────────────────────┼─────┤
109 │Sa1. SAMPLE SOURCE: RDD │ 5392│
111 ╰────────────────────────┴─────╯
115 AT_SETUP([CTABLES parsing - negative])
116 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
117 AT_DATA([ctables.sps],
120 CTABLES /FORMAT MINCOLWIDTH='foo'.
121 CTABLES /TABLE qn1 [**].
122 CTABLES /TABLE qn1 [NOTAFUNCTION].
125 CTABLES /TABLE NOTAVAR.
127 CTABLES /TABLE string[S].
128 CTABLES /TABLE qn1 [PTILE 101].
129 CTABLES /TABLE qn1 [MEAN F0.1].
130 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
131 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
132 CTABLES /TABLE qn1 [MEAN TOTALS].
133 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
134 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
135 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
136 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
137 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
138 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
142 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
143 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
144 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
145 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
146 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
147 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
148 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
149 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
150 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
151 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
152 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
153 CTABLES /PCOMPUTE &k=EXPR([LO **]).
154 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
155 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
156 CTABLES /PCOMPUTE &k=EXPR([1**]).
157 CTABLES /PCOMPUTE &k=EXPR((1x)).
158 CTABLES /PCOMPUTE **k.
159 CTABLES /PCOMPUTE &1.
160 CTABLES /PCOMPUTE &k**.
161 CTABLES /PCOMPUTE &k=**.
162 CTABLES /PCOMPUTE &k=EXPR**.
163 CTABLES /PCOMPUTE &k=EXPR(1x).
164 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
165 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
166 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
167 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
168 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
169 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
170 CTABLES /FORMAT EMPTY=**.
171 CTABLES /FORMAT MISSING=**.
173 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
175 CTABLES /VLABELS VARIABLES=NOTAVAR.
176 CTABLES /VLABELS VARIABLES=qn1 **.
177 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
179 CTABLES /MRSETS COUNTDUPLICATES=**.
180 CTABLES /SMISSING **.
182 CTABLES /WEIGHT VARIABLE=NOTAVAR.
183 CTABLES /HIDESMALLCOUNTS COUNT=1.
185 CTABLES /HIDESMALLCOUNTS COUNT=2.
186 CTABLES /TABLE qn1**.
187 CTABLES /TABLE qn1 /SLABELS POSITION=**.
188 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
189 CTABLES /TABLE qn1 /SLABELS **.
190 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
191 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
192 CTABLES /TABLE qn1 /CLABELS **.
193 CTABLES /TABLE qn1 /CRITERIA **.
194 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
195 CTABLES /TABLE qn1 /TITLES **.
196 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
197 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
198 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
199 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
200 CTABLES /TABLE qn1 /SIGTEST **.
201 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
202 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
203 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
204 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
205 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
206 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
207 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
208 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
209 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
210 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
211 CTABLES /TABLE qn1 /COMPARETEST **.
212 CTABLES /TABLE qn1 / **.
213 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
214 CTABLES /TABLE qn20 > qnd1.
215 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
216 NUMERIC datetime (DATETIME17.0).
217 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
219 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
220 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
222 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
223 negative number for MINCOLWIDTH.
225 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
228 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
229 summary function name.
231 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
233 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
236 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
238 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
240 10 | CTABLES /TABLE string[S].
243 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
244 between 0 and 100 for PTILE.
246 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
247 requires a width between 1 and 40.
249 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
250 format NEGPAREN requires width 2 or greater.
252 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
253 format NEGPAREN requires width greater than decimals.
255 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
257 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
260 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
261 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
264 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
266 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
268 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
271 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
272 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
275 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
277 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
279 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
281 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
283 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
285 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
287 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
290 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
291 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
294 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
295 between 0 and 100 for PTILE.
297 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
300 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
303 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
306 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
309 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
311 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
314 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
317 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
318 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
320 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
321 LABEL, POSITION, or EMPTY.
323 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
324 integer for SUBTOTAL.
326 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
328 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
330 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
332 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
334 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
336 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
338 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
340 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
342 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
344 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
346 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
348 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
350 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
351 the previous definition.
352 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
353 | ^~~~~~~~~~~~~~~~~~~
355 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
356 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
357 | ^~~~~~~~~~~~~~~~~~~
359 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
362 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
363 Expecting summary function name.
365 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
366 between 0 and 100 for PTILE.
368 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
370 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
373 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
374 FORMAT, or HIDESOURCECATS.
376 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
378 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
380 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
381 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
383 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
386 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
389 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
391 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
394 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
395 DEFAULT, NAME, LABEL, BOTH, or NONE.
397 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
400 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
403 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
404 VARIABLE or LISTWISE.
406 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
409 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
411 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
412 greater for HIDESMALLCOUNTS COUNT.
414 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
415 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
416 HIDESMALLCOUNTS, or TABLE.
418 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
421 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
423 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
426 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
429 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
432 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
435 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
438 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
439 ROWLABELS, or COLLABELS.
441 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
444 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
445 in @<:@0,100@:}@ for CILEVEL.
447 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
448 CAPTION, CORNER, or TITLE.
450 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
453 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
454 in @<:@0,1@:}@ for ALPHA.
456 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
459 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
460 ALLVISIBLE or SUBTOTALS.
462 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
463 ALPHA, INCLUDEMRSETS, or CATEGORIES.
465 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
468 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
471 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
474 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
475 BONFERRONI, BH, or NONE.
477 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
480 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
483 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
484 ALLVISIBLE or SUBTOTALS.
486 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
489 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
492 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
495 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
496 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
499 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
500 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
502 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
505 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
506 97 | CTABLES /TABLE qn20 > qnd1.
509 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
510 97 | CTABLES /TABLE qn20 > qnd1.
513 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
514 97 | CTABLES /TABLE qn20 > qnd1.
517 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
518 categorical variables at the innermost nesting level.
519 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
520 | ^~~~~~~~~~~~~~~~~~~~
522 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
524 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
527 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
528 specification as format DATETIME: Day (123) must be between 1 and 31..
529 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
534 AT_SETUP([CTABLES parsing - more negative])
535 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
536 AT_DATA([ctables.sps],
538 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
539 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
540 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
543 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
544 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
546 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
548 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
549 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
550 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
551 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
553 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
554 CTABLES /PCOMPUTE &x=EXPR([**]).
555 CTABLES /PCOMPUTE &x=EXPR(**).
559 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
561 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
562 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
563 category not included in the category list.
564 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
569 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
570 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
574 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
575 list of categories here.
576 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
581 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
582 category not included in the category list.
583 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
588 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
589 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
593 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
594 variable's CATEGORIES specification.
596 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
597 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
598 subtotals by position, e.g. SUBTOTAL[1].
599 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
600 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
602 ^~~~~~~~~~~~~~~~~~~~~~~~
604 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
606 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
607 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
610 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
611 applied only to string variables, but this subcommand tries to apply it to
612 numeric variable QN1.
613 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
616 ctables.sps:8.53: error: CTABLES: This category specification may be applied
617 only to numeric variables, but this subcommand tries to apply it to string
619 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
622 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
623 based on a summary function.
625 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
626 moved to be categorical, but qnd1 is a scale variable.
628 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
629 moved to have the same width, but QN1 has width 0 and string has width 8.
631 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
632 moved to have the same value labels, but QN1 and QNSA1 have different value
635 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
636 moved to have the same category specifications, but QN105BA and QN105BB have
637 different category specifications.
639 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
640 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
641 this warning, insert parentheses.
642 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
645 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
648 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
650 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
652 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
653 variable must be specified.
655 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
657 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
659 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
662 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
664 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
667 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
669 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
674 AT_SETUP([CTABLES one categorical variable])
675 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
676 AT_DATA([ctables.sps],
679 CTABLES /TABLE BY qn1.
680 CTABLES /TABLE BY BY qn1.
682 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
684 ╭────────────────────────────────────────────────────────────────────────┬─────╮
686 ├────────────────────────────────────────────────────────────────────────┼─────┤
687 │ 1. How often do you usually drive a car or other Every day │ 4667│
688 │motor vehicle? Several days a week │ 1274│
689 │ Once a week or less │ 361│
690 │ Only certain times a │ 130│
693 ╰────────────────────────────────────────────────────────────────────────┴─────╯
696 ╭──────────────────────────────────────────────────────────────────────────────╮
697 │ 1. How often do you usually drive a car or other motor vehicle? │
698 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
699 │ │ Several days a │ Once a week or │ Only certain times a │ │
700 │Every day│ week │ less │ year │Never│
701 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
702 │ Count │ Count │ Count │ Count │Count│
703 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
704 │ 4667│ 1274│ 361│ 130│ 540│
705 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
717 AT_SETUP([CTABLES one string variable])
718 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
719 AT_DATA([ctables.sps],
722 MISSING VALUES licensed('DontKnow', 'Refused').
723 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
724 CTABLES /TABLE licensed.
725 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
726 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
727 * Notice that the string matching is case-sensitive.
728 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
729 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
731 /PCOMPUTE ¬yes=EXPR(['No']+['DontKnow']+['Refused'])
732 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
734 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'No', 'DontKnow', 'Refused'].
736 /PCOMPUTE ¬yes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
737 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
739 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'DontKnow' THRU 'No', 'Refused'].
741 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
751 ╭─────────────────┬─────┬───────╮
753 ├─────────────────┼─────┼───────┤
754 │licensed DontKnow│ 4│ │
758 │ Total │ 6999│ 6951│
759 ╰─────────────────┴─────┴───────╯
762 ╭──────────────┬─────╮
764 ├──────────────┼─────┤
765 │licensed Yes │ 6379│
768 ╰──────────────┴─────╯
771 ╭──────────────┬─────╮
773 ├──────────────┼─────┤
774 │licensed Yes │ 6379│
777 ╰──────────────┴─────╯
780 ╭────────────────┬─────╮
782 ├────────────────┼─────┤
787 ╰────────────────┴─────╯
790 ╭────────────────┬─────╮
792 ├────────────────┼─────┤
793 │licensed Yes │ 6379│
795 ╰────────────────┴─────╯
798 ╭────────────────┬─────╮
800 ├────────────────┼─────┤
801 │licensed Yes │ 6379│
803 ╰────────────────┴─────╯
807 AT_SETUP([CTABLES one scale variable])
808 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
809 AT_DATA([ctables.sps],
811 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
812 CTABLES /TABLE BY qnd1.
813 CTABLES /TABLE BY BY qnd1.
815 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
817 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
818 │ │ │ │ │ │ Std │ │ │
819 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
820 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
821 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
822 │age? │ │ │ │ │ │ │ │
823 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
826 ╭──────────────────────────╮
827 │D1. AGE: What is your age?│
828 ├──────────────────────────┤
830 ├──────────────────────────┤
832 ╰──────────────────────────╯
835 D1. AGE: What is your age?
844 AT_SETUP([CTABLES simple stacking])
845 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
846 AT_DATA([ctables.sps],
848 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
850 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
852 ╭───────────────────────────────────────────────────────────────┬──────────────╮
859 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
860 │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│
861 │too much to drink to drive safely will A. Get certain │ │ │
862 │stopped by the police? Very likely │ 21%│ 22%│
863 │ Somewhat │ 38%│ 42%│
865 │ Somewhat │ 21%│ 18%│
869 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
870 │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│
871 │too much to drink to drive safely will B. Have an certain │ │ │
872 │accident? Very likely │ 36%│ 45%│
873 │ Somewhat │ 39%│ 32%│
879 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
880 │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│
881 │too much to drink to drive safely will C. Be certain │ │ │
882 │convicted for drunk driving? Very likely │ 32%│ 28%│
883 │ Somewhat │ 27%│ 32%│
885 │ Somewhat │ 15%│ 15%│
889 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
890 │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│
891 │too much to drink to drive safely will D. Be certain │ │ │
892 │arrested for drunk driving? Very likely │ 26%│ 27%│
893 │ Somewhat │ 32%│ 35%│
895 │ Somewhat │ 17%│ 15%│
899 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
903 AT_SETUP([CTABLES show or hide empty categories])
904 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
905 AT_DATA([ctables.sps],
907 IF (qn105ba = 2) qn105ba = 1.
908 IF (qns3a = 1) qns3a = 2.
909 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
910 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
911 /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
912 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
913 /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
914 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
915 /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
917 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
919 ╭──────────────────────────────────────────────────────────────┬───────────────╮
926 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
927 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
928 │too much to drink to drive safely will A. Get certain │ │ │
929 │stopped by the police? Very likely│ .│ 0%│
936 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
939 ╭──────────────────────────────────────────────────────────────┬───────────────╮
946 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
947 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
948 │too much to drink to drive safely will A. Get certain │ │ │
949 │stopped by the police? Somewhat │ .│ 40%│
955 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
958 ╭────────────────────────────────────────────────────────────────────┬─────────╮
965 ├────────────────────────────────────────────────────────────────────┼─────────┤
966 │105b. How likely is it that drivers who have had too Almost │ 32%│
967 │much to drink to drive safely will A. Get stopped by certain │ │
968 │the police? Very likely │ 0%│
975 ╰────────────────────────────────────────────────────────────────────┴─────────╯
978 ╭────────────────────────────────────────────────────────────────────┬─────────╮
985 ├────────────────────────────────────────────────────────────────────┼─────────┤
986 │105b. How likely is it that drivers who have had too Almost │ 32%│
987 │much to drink to drive safely will A. Get stopped by certain │ │
988 │the police? Somewhat │ 40%│
994 ╰────────────────────────────────────────────────────────────────────┴─────────╯
998 AT_SETUP([CTABLES simple nesting])
999 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1000 AT_DATA([ctables.sps],
1002 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1003 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1004 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1005 /CATEGORIES VARIABLES=qns3a TOTAL=YES
1006 /CLABELS ROW=OPPOSITE.
1008 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1010 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1013 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1014 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
1015 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
1016 │drive safely will A. Get stopped by Total │ 700│ 10%│
1017 │the police? ╶──────────────────────────┼─────┼──────┤
1018 │ Very S3a. Male │ 660│ 10%│
1019 │ likely GENDER: Female│ 842│ 12%│
1020 │ Total │ 1502│ 22%│
1021 │ ╶──────────────────────────┼─────┼──────┤
1022 │ Somewhat S3a. Male │ 1174│ 17%│
1023 │ likely GENDER: Female│ 1589│ 23%│
1024 │ Total │ 2763│ 40%│
1025 │ ╶──────────────────────────┼─────┼──────┤
1026 │ Somewhat S3a. Male │ 640│ 9%│
1027 │ unlikely GENDER: Female│ 667│ 10%│
1028 │ Total │ 1307│ 19%│
1029 │ ╶──────────────────────────┼─────┼──────┤
1030 │ Very S3a. Male │ 311│ 5%│
1031 │ unlikely GENDER: Female│ 298│ 4%│
1033 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1034 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
1035 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
1036 │drive safely will B. Have an accident? Total │ 1100│ 16%│
1037 │ ╶──────────────────────────┼─────┼──────┤
1038 │ Very S3a. Male │ 1104│ 16%│
1039 │ likely GENDER: Female│ 1715│ 25%│
1040 │ Total │ 2819│ 41%│
1041 │ ╶──────────────────────────┼─────┼──────┤
1042 │ Somewhat S3a. Male │ 1203│ 17%│
1043 │ likely GENDER: Female│ 1214│ 18%│
1044 │ Total │ 2417│ 35%│
1045 │ ╶──────────────────────────┼─────┼──────┤
1046 │ Somewhat S3a. Male │ 262│ 4%│
1047 │ unlikely GENDER: Female│ 168│ 2%│
1049 │ ╶──────────────────────────┼─────┼──────┤
1050 │ Very S3a. Male │ 81│ 1%│
1051 │ unlikely GENDER: Female│ 59│ 1%│
1053 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1054 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
1055 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
1056 │drive safely will C. Be convicted for Total │ 1149│ 17%│
1057 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1058 │ Very S3a. Male │ 988│ 14%│
1059 │ likely GENDER: Female│ 1049│ 15%│
1060 │ Total │ 2037│ 30%│
1061 │ ╶──────────────────────────┼─────┼──────┤
1062 │ Somewhat S3a. Male │ 822│ 12%│
1063 │ likely GENDER: Female│ 1210│ 18%│
1064 │ Total │ 2032│ 30%│
1065 │ ╶──────────────────────────┼─────┼──────┤
1066 │ Somewhat S3a. Male │ 446│ 7%│
1067 │ unlikely GENDER: Female│ 548│ 8%│
1069 │ ╶──────────────────────────┼─────┼──────┤
1070 │ Very S3a. Male │ 268│ 4%│
1071 │ unlikely GENDER: Female│ 354│ 5%│
1073 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1074 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1075 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1076 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1077 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1078 │ Very S3a. Male │ 805│ 12%│
1079 │ likely GENDER: Female│ 1029│ 15%│
1080 │ Total │ 1834│ 27%│
1081 │ ╶──────────────────────────┼─────┼──────┤
1082 │ Somewhat S3a. Male │ 975│ 14%│
1083 │ likely GENDER: Female│ 1332│ 19%│
1084 │ Total │ 2307│ 34%│
1085 │ ╶──────────────────────────┼─────┼──────┤
1086 │ Somewhat S3a. Male │ 535│ 8%│
1087 │ unlikely GENDER: Female│ 560│ 8%│
1088 │ Total │ 1095│ 16%│
1089 │ ╶──────────────────────────┼─────┼──────┤
1090 │ Very S3a. Male │ 270│ 4%│
1091 │ unlikely GENDER: Female│ 279│ 4%│
1093 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1096 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1097 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1098 │ │ certain│likely│ likely │ unlikely│unlikely│
1099 │ ├────────┼──────┼─────────┼─────────┼────────┤
1101 │ │ Table %│ % │ Table % │ Table % │ Table %│
1102 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1103 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1104 │GENDER: is it that drivers│ │ │ │ │ │
1105 │ who have had too │ │ │ │ │ │
1106 │ much to drink to │ │ │ │ │ │
1107 │ drive safely will │ │ │ │ │ │
1108 │ A. Get stopped by │ │ │ │ │ │
1109 │ the police? │ │ │ │ │ │
1110 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1111 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1112 │ is it that drivers│ │ │ │ │ │
1113 │ who have had too │ │ │ │ │ │
1114 │ much to drink to │ │ │ │ │ │
1115 │ drive safely will │ │ │ │ │ │
1116 │ A. Get stopped by │ │ │ │ │ │
1117 │ the police? │ │ │ │ │ │
1118 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1119 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1120 │ is it that drivers│ │ │ │ │ │
1121 │ who have had too │ │ │ │ │ │
1122 │ much to drink to │ │ │ │ │ │
1123 │ drive safely will │ │ │ │ │ │
1124 │ A. Get stopped by │ │ │ │ │ │
1125 │ the police? │ │ │ │ │ │
1126 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1127 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1128 │GENDER: is it that drivers│ │ │ │ │ │
1129 │ who have had too │ │ │ │ │ │
1130 │ much to drink to │ │ │ │ │ │
1131 │ drive safely will │ │ │ │ │ │
1132 │ B. Have an │ │ │ │ │ │
1133 │ accident? │ │ │ │ │ │
1134 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1135 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1136 │ is it that drivers│ │ │ │ │ │
1137 │ who have had too │ │ │ │ │ │
1138 │ much to drink to │ │ │ │ │ │
1139 │ drive safely will │ │ │ │ │ │
1140 │ B. Have an │ │ │ │ │ │
1141 │ accident? │ │ │ │ │ │
1142 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1143 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1144 │ is it that drivers│ │ │ │ │ │
1145 │ who have had too │ │ │ │ │ │
1146 │ much to drink to │ │ │ │ │ │
1147 │ drive safely will │ │ │ │ │ │
1148 │ B. Have an │ │ │ │ │ │
1149 │ accident? │ │ │ │ │ │
1150 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1151 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1152 │GENDER: is it that drivers│ │ │ │ │ │
1153 │ who have had too │ │ │ │ │ │
1154 │ much to drink to │ │ │ │ │ │
1155 │ drive safely will │ │ │ │ │ │
1156 │ C. Be convicted │ │ │ │ │ │
1157 │ for drunk driving?│ │ │ │ │ │
1158 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1159 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1160 │ is it that drivers│ │ │ │ │ │
1161 │ who have had too │ │ │ │ │ │
1162 │ much to drink to │ │ │ │ │ │
1163 │ drive safely will │ │ │ │ │ │
1164 │ C. Be convicted │ │ │ │ │ │
1165 │ for drunk driving?│ │ │ │ │ │
1166 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1167 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1168 │ is it that drivers│ │ │ │ │ │
1169 │ who have had too │ │ │ │ │ │
1170 │ much to drink to │ │ │ │ │ │
1171 │ drive safely will │ │ │ │ │ │
1172 │ C. Be convicted │ │ │ │ │ │
1173 │ for drunk driving?│ │ │ │ │ │
1174 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1175 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1176 │GENDER: is it that drivers│ │ │ │ │ │
1177 │ who have had too │ │ │ │ │ │
1178 │ much to drink to │ │ │ │ │ │
1179 │ drive safely will │ │ │ │ │ │
1180 │ D. Be arrested for│ │ │ │ │ │
1181 │ drunk driving? │ │ │ │ │ │
1182 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1183 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1184 │ is it that drivers│ │ │ │ │ │
1185 │ who have had too │ │ │ │ │ │
1186 │ much to drink to │ │ │ │ │ │
1187 │ drive safely will │ │ │ │ │ │
1188 │ D. Be arrested for│ │ │ │ │ │
1189 │ drunk driving? │ │ │ │ │ │
1190 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1191 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1192 │ is it that drivers│ │ │ │ │ │
1193 │ who have had too │ │ │ │ │ │
1194 │ much to drink to │ │ │ │ │ │
1195 │ drive safely will │ │ │ │ │ │
1196 │ D. Be arrested for│ │ │ │ │ │
1197 │ drunk driving? │ │ │ │ │ │
1198 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1202 AT_SETUP([CTABLES nesting and scale variables])
1203 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1204 AT_DATA([ctables.sps],
1206 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1207 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1208 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1209 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1210 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1212 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1214 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1220 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1221 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1222 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1224 │ Once a week or │ 44│ 54│
1226 │ Only certain │ 34│ 41│
1227 │ times a year │ │ │
1229 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1232 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1233 │ │Minimum│Maximum│Mean│
1234 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1235 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1236 │What is GENDER: months, has there been a │ │ │ │
1237 │your time when you felt you │ │ │ │
1238 │age? should cut down on your No │ 16│ 86│ 46│
1240 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1241 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1242 │ months, has there been a │ │ │ │
1243 │ time when you felt you │ │ │ │
1244 │ should cut down on your No │ 16│ 86│ 48│
1246 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1247 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1248 │What is GENDER: months, has there been a │ │ │ │
1249 │your time when people criticized No │ 16│ 86│ 46│
1250 │age? your drinking? │ │ │ │
1251 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1252 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1253 │ months, has there been a │ │ │ │
1254 │ time when people criticized No │ 16│ 86│ 48│
1255 │ your drinking? │ │ │ │
1256 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1259 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1260 │ │S1. Including yourself, how many members of this│
1261 │ │ household are age 16 or older? │
1262 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1263 │ │ │ │ │ │ │ │ 6 or │
1264 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1265 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1266 │ │Column│Column│Column│Column│Column│Column│Column│
1267 │ │ % │ % │ % │ % │ % │ % │ % │
1268 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1269 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1270 │SAMPLE How certain │ │ │ │ │ │ │ │
1271 │SOURCE: likely │ │ │ │ │ │ │ │
1272 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1273 │ that likely │ │ │ │ │ │ │ │
1274 │ drivers │ │ │ │ │ │ │ │
1275 │ who have │ │ │ │ │ │ │ │
1276 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1277 │ much to likely │ │ │ │ │ │ │ │
1278 │ drink to │ │ │ │ │ │ │ │
1279 │ drive │ │ │ │ │ │ │ │
1280 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1281 │ will A. unlikely│ │ │ │ │ │ │ │
1282 │ Get │ │ │ │ │ │ │ │
1283 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1284 │ by the unlikely│ │ │ │ │ │ │ │
1285 │ police? │ │ │ │ │ │ │ │
1286 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1289 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1292 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1293 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1294 │group typical month did you have one or more │ │ │
1295 │ alcoholic beverages to drink? │ │ │
1296 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1297 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1298 │ typical month did you have one or more │ │ │
1299 │ alcoholic beverages to drink? │ │ │
1300 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1301 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1302 │ typical month did you have one or more │ │ │
1303 │ alcoholic beverages to drink? │ │ │
1304 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1305 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1306 │ typical month did you have one or more │ │ │
1307 │ alcoholic beverages to drink? │ │ │
1308 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1309 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1310 │ typical month did you have one or more │ │ │
1311 │ alcoholic beverages to drink? │ │ │
1312 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1313 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1314 │ older typical month did you have one or more │ │ │
1315 │ alcoholic beverages to drink? │ │ │
1316 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1321 AT_SETUP([CTABLES SLABELS])
1322 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1323 AT_DATA([ctables.sps],
1325 CTABLES /TABLE qn1 [COUNT COLPCT].
1326 CTABLES /TABLE qn1 [COUNT COLPCT]
1327 /SLABELS POSITION=ROW.
1328 CTABLES /TABLE qn1 [COUNT COLPCT]
1329 /SLABELS POSITION=ROW VISIBLE=NO.
1331 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1333 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1336 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1337 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1338 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1339 │ Once a week or less│ 361│ 5.2%│
1340 │ Only certain times │ 130│ 1.9%│
1342 │ Never │ 540│ 7.7%│
1343 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1346 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1347 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1348 │other motor vehicle? Column │66.9%│
1350 │ ╶───────────────────────────┼─────┤
1351 │ Several days a week Count │ 1274│
1354 │ ╶───────────────────────────┼─────┤
1355 │ Once a week or less Count │ 361│
1358 │ ╶───────────────────────────┼─────┤
1359 │ Only certain times Count │ 130│
1360 │ a year Column │ 1.9%│
1362 │ ╶───────────────────────────┼─────┤
1363 │ Never Count │ 540│
1366 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1369 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1370 │ 1. How often do you usually drive a car or other Every day │ 4667│
1371 │motor vehicle? │66.9%│
1372 │ Several days a week │ 1274│
1374 │ Once a week or less │ 361│
1376 │ Only certain times a │ 130│
1380 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1384 AT_SETUP([CTABLES simple totals])
1385 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1386 AT_DATA([ctables.sps],
1389 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1390 DESCRIPTIVES qn18/STATISTICS=MEAN.
1391 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1392 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1394 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1396 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1398 ├────────────────────────────────────────────────────────────────────────┼─────┤
1399 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1400 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1403 │ Wine coolers │ 137│
1404 │ Hard liquor or │ 888│
1406 │ Flavored malt │ 83│
1408 │ Number responding │ 4221│
1409 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1411 Descriptive Statistics
1412 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1414 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1415 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1416 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1417 │Valid N (listwise) │6999│ │
1418 │Missing N (listwise) │2781│ │
1419 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1422 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1423 │ │ │ │ Valid│Total│
1424 │ │Mean│Count│ N │ N │
1425 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1426 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1427 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1428 │ you usually drink per sitting? │ │ │ │ │
1429 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1430 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1431 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1432 │ you usually drink per sitting? │ │ │ │ │
1433 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1434 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1435 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1436 │ you usually drink per sitting? │ │ │ │ │
1437 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1438 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1439 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1440 │ you usually drink per sitting? │ │ │ │ │
1441 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1442 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1443 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1444 │ you usually drink per sitting? │ │ │ │ │
1445 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1449 AT_SETUP([CTABLES subtotals])
1450 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1451 AT_DATA([ctables.sps],
1453 CTABLES /TABLE=qn105ba BY qns1
1454 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1455 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1456 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1457 CTABLES /TABLE=qn105ba BY qns1
1458 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1459 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1461 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1463 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1464 │ │ S1. Including yourself, how many members of this household │
1465 │ │ are age 16 or older? │
1466 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1467 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1468 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1469 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1470 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1471 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1472 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1473 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1474 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1475 │ likely │ │ │ │ │ │ │ │
1476 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1477 │ unlikely │ │ │ │ │ │ │ │
1478 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1479 │ unlikely │ │ │ │ │ │ │ │
1480 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1483 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1484 │ │ S1. Including yourself, how many members of this household │
1485 │ │ are age 16 or older? │
1486 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1487 │ │ │ │ │ │ │ │ 6 or │
1488 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1489 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1490 │ │ │ │ │ │ Column│ │ │
1491 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1492 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1493 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1494 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1495 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1496 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1497 │ likely │ │ │ │ │ │ │ │
1498 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1499 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1500 │ unlikely │ │ │ │ │ │ │ │
1501 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1502 │ unlikely │ │ │ │ │ │ │ │
1503 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1504 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1507 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1508 │ │ S1. Including yourself, how many members of this household │
1509 │ │ are age 16 or older? │
1510 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1511 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1512 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1513 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1514 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1515 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1516 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1517 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1518 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1519 │ likely │ │ │ │ │ │ │ │
1520 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1521 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1522 │ unlikely │ │ │ │ │ │ │ │
1523 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1524 │ unlikely │ │ │ │ │ │ │ │
1525 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1526 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1530 AT_SETUP([CTABLES PCOMPUTE])
1531 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1532 AT_DATA([ctables.sps],
1535 /PCOMPUTE &x=EXPR([3] + [4])
1536 /PCOMPUTE &y=EXPR([4] + [5])
1537 /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
1538 /PPROPERTIES &y LABEL='4+5'
1539 /TABLE=qn105ba BY qns1
1540 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
1542 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1544 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1545 │ │ S1. Including yourself, how many members of this household │
1546 │ │ are age 16 or older? │
1547 │ ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
1548 │ │ 1 │ 2 │ Subtotal │ 5 │ 3+4 │ 4+5 │ Subtotal │
1549 │ ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1550 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1551 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1552 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 11│ 81.00│ 30│ 92│
1553 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1554 │A. Get stopped by the police? Very likely│ 384│ 552│ 936│ 14│ 171.00│ 65│ 185│
1555 │ Somewhat │ 590│ 1249│ 1839│ 20│ 265.00│ 92│ 285│
1556 │ likely │ │ │ │ │ │ │ │
1557 │ Somewhat │ 278│ 647│ 925│ 6│ 116.00│ 38│ 122│
1558 │ unlikely │ │ │ │ │ │ │ │
1559 │ Very │ 141│ 290│ 431│ 4│ 59.00│ 22│ 63│
1560 │ unlikely │ │ │ │ │ │ │ │
1561 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
1565 AT_SETUP([CTABLES CLABELS])
1566 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1567 AT_DATA([ctables.sps],
1569 CTABLES /TABLE AgeGroup BY qns3a.
1570 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1571 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1572 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1573 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1576 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1578 ╭───────────────────────┬────────────╮
1584 ├───────────────────────┼─────┼──────┤
1585 │Age group 15 or younger│ 0│ 0│
1586 │ 16 to 25 │ 594│ 505│
1587 │ 26 to 35 │ 476│ 491│
1588 │ 36 to 45 │ 489│ 548│
1589 │ 46 to 55 │ 526│ 649│
1590 │ 56 to 65 │ 516│ 731│
1591 │ 66 or older │ 531│ 943│
1592 ╰───────────────────────┴─────┴──────╯
1595 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1597 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1599 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1600 │ │ 15 or │ 16 to │ 26 to│ 36 to│ 46 to│ 56 to │ 66 or │ 15 or │ 16 to│ 26 to │ 36 to│ 46 to│ 56 to│ 66 or │
1601 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1602 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1603 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1604 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1605 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1606 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1607 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1610 ╭──────────────────────────────┬────────────╮
1614 ├──────────────────────────────┼────────────┤
1615 │Age group 15 or younger Male │ 0│
1617 │ ╶────────────────────┼────────────┤
1618 │ 16 to 25 Male │ 594│
1620 │ ╶────────────────────┼────────────┤
1621 │ 26 to 35 Male │ 476│
1623 │ ╶────────────────────┼────────────┤
1624 │ 36 to 45 Male │ 489│
1626 │ ╶────────────────────┼────────────┤
1627 │ 46 to 55 Male │ 526│
1629 │ ╶────────────────────┼────────────┤
1630 │ 56 to 65 Male │ 516│
1632 │ ╶────────────────────┼────────────┤
1633 │ 66 or older Male │ 531│
1635 ╰──────────────────────────────┴────────────╯
1639 ╭─────────┬────────────╮
1645 ├─────────┼─────┼──────┤
1647 ╰─────────┴─────┴──────╯
1651 ╭─────────┬────────────╮
1657 ├─────────┼─────┼──────┤
1658 │Age group│ 594│ 505│
1659 ╰─────────┴─────┴──────╯
1663 ╭─────────┬────────────╮
1669 ├─────────┼─────┼──────┤
1670 │Age group│ 476│ 491│
1671 ╰─────────┴─────┴──────╯
1675 ╭─────────┬────────────╮
1681 ├─────────┼─────┼──────┤
1682 │Age group│ 489│ 548│
1683 ╰─────────┴─────┴──────╯
1687 ╭─────────┬────────────╮
1693 ├─────────┼─────┼──────┤
1694 │Age group│ 526│ 649│
1695 ╰─────────┴─────┴──────╯
1699 ╭─────────┬────────────╮
1705 ├─────────┼─────┼──────┤
1706 │Age group│ 516│ 731│
1707 ╰─────────┴─────┴──────╯
1711 ╭─────────┬────────────╮
1717 ├─────────┼─────┼──────┤
1718 │Age group│ 531│ 943│
1719 ╰─────────┴─────┴──────╯
1723 ╭───────────────────────┬────────────╮
1727 ├───────────────────────┼────────────┤
1728 │Age group 15 or younger│ 0│
1734 │ 66 or older │ 531│
1735 ╰───────────────────────┴────────────╯
1739 ╭───────────────────────┬────────────╮
1743 ├───────────────────────┼────────────┤
1744 │Age group 15 or younger│ 0│
1750 │ 66 or older │ 943│
1751 ╰───────────────────────┴────────────╯
1755 AT_SETUP([CTABLES missing values])
1756 AT_DATA([ctables.sps],
1757 [[DATA LIST LIST NOTABLE/x y.
1796 MISSING VALUES x (1, 2) y (2, 3).
1797 VARIABLE LEVEL ALL (NOMINAL).
1799 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1800 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1801 /CATEGORIES VARIABLES=ALL TOTAL=YES.
1802 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1803 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1804 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1805 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1806 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1807 /CATEGORIES VARIABLES=ALL TOTAL=YES
1808 /SLABELS POSITION=ROW.
1809 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1810 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1811 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1812 /SLABELS POSITION=ROW.
1813 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1814 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1815 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
1816 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
1817 /SLABELS POSITION=ROW.
1819 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1821 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1822 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1823 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1824 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1825 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1826 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1827 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1828 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1829 dnl Note that Column Total N % doesn't add up to 100 because missing
1830 dnl values are included in the total but not shown as a category and this
1831 dnl is expected behavior.
1834 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1835 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1836 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1837 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1838 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1839 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1840 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1841 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1842 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1843 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1844 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1845 dnl values are included in the total but not shown as a category and this
1846 dnl is expected behavior.
1849 ╭────────────────────────┬───────────────────────────╮
1851 │ ├──────┬──────┬──────┬──────┤
1852 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
1853 ├────────────────────────┼──────┼──────┼──────┼──────┤
1854 │x 3.00 Count │ 1│ 1│ 1│ 3│
1855 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1856 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1857 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1858 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1859 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1860 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1861 │ Valid N │ │ │ │ 3│
1862 │ Total N │ │ │ │ 6│
1863 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1864 │ 4.00 Count │ 1│ 1│ 1│ 3│
1865 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1866 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1867 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1868 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1869 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1870 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1871 │ Valid N │ │ │ │ 3│
1872 │ Total N │ │ │ │ 6│
1873 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1874 │ 5.00 Count │ 1│ 1│ 1│ 3│
1875 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1876 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1877 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1878 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1879 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1880 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1881 │ Valid N │ │ │ │ 3│
1882 │ Total N │ │ │ │ 6│
1883 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1884 │ Total Count │ 3│ 3│ 3│ 9│
1885 │ Column % │100.0%│100.0%│100.0%│ .│
1886 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
1887 │ Column Total N %│100.0%│100.0%│100.0%│ .│
1888 │ Row % │ .│ .│ .│ .│
1889 │ Row Valid N % │ .│ .│ .│ .│
1890 │ Row Total N % │ .│ .│ .│ .│
1891 │ Valid N │ 3│ 3│ 3│ 9│
1892 │ Total N │ 6│ 6│ 6│ 36│
1893 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1896 ╭────────────────────────┬─────────────────────────────────────────╮
1898 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
1899 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1900 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1901 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1902 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1903 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1904 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1905 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1906 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1907 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1908 │ Valid N │ │ │ │ │ │ 0│
1909 │ Total N │ │ │ │ │ │ 6│
1910 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1911 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1912 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1913 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1914 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1915 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1916 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1917 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1918 │ Valid N │ │ │ │ │ │ 0│
1919 │ Total N │ │ │ │ │ │ 6│
1920 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1921 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1922 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1923 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1924 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1925 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1926 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1927 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1928 │ Valid N │ │ │ │ │ │ 3│
1929 │ Total N │ │ │ │ │ │ 6│
1930 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1931 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1932 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1933 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1934 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1935 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1936 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1937 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1938 │ Valid N │ │ │ │ │ │ 3│
1939 │ Total N │ │ │ │ │ │ 6│
1940 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1941 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1942 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1943 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
1944 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1945 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1946 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
1947 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1948 │ Valid N │ │ │ │ │ │ 3│
1949 │ Total N │ │ │ │ │ │ 6│
1950 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1951 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
1952 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1953 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
1954 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
1955 │ Row % │ .│ .│ .│ .│ .│ .│
1956 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1957 │ Row Total N % │ .│ .│ .│ .│ .│ .│
1958 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
1959 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
1960 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
1963 ╭────────────────────────┬──────────────────────────────────╮
1965 │ ├──────┬──────┬──────┬──────┬──────┤
1966 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1967 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
1968 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
1969 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1970 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1971 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1972 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1973 │ Row Valid N % │ .│ .│ .│ .│ .│
1974 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1975 │ Valid N │ │ │ │ │ 0│
1976 │ Total N │ │ │ │ │ 6│
1977 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1978 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
1979 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1980 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
1981 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1982 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1983 │ Row Valid N % │ .│ .│ .│ .│ .│
1984 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1985 │ Valid N │ │ │ │ │ 0│
1986 │ Total N │ │ │ │ │ 6│
1987 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1988 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
1989 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
1990 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
1991 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1992 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1993 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
1994 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1995 │ Valid N │ │ │ │ │ 3│
1996 │ Total N │ │ │ │ │ 6│
1997 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1998 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
1999 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2000 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2001 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2002 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2003 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2004 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2005 │ Valid N │ │ │ │ │ 3│
2006 │ Total N │ │ │ │ │ 6│
2007 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2008 │ Total Count │ 4│ 4│ 4│ 4│ 16│
2009 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
2010 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
2011 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
2012 │ Row % │ .│ .│ .│ .│ .│
2013 │ Row Valid N % │ .│ .│ .│ .│ .│
2014 │ Row Total N % │ .│ .│ .│ .│ .│
2015 │ Valid N │ 2│ 0│ 2│ 2│ 6│
2016 │ Total N │ 5│ 5│ 5│ 5│ 30│
2017 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2021 AT_SETUP([CTABLES SMISSING=LISTWISE])
2022 AT_KEYWORDS([SMISSING LISTWISE])
2023 AT_DATA([ctables.sps],
2024 [[DATA LIST LIST NOTABLE/x y z.
2032 VARIABLE LEVEL x (NOMINAL).
2034 CTABLES /TABLE (y + z) > x.
2035 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2037 * The following doesn't come out as listwise because the tables are
2038 separate, not linked by an > operator.
2039 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2041 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2071 AT_SETUP([CTABLES VLABELS])
2072 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2073 AT_DATA([ctables.sps],
2075 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2076 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME /TABLE qnd5a BY qns3a.
2077 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL /TABLE qnd5a BY qns3a.
2078 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH /TABLE qnd5a BY qns3a.
2079 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a BY qns3a.
2081 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2083 ╭────────────────────────────────────────────────────────────────┬────────────╮
2089 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2090 │D5a. What would you say is your primary Cuban │ 13│ 7│
2091 │ethnic background? Mexican │ 175│ 136│
2093 │ South American │ 21│ 13│
2094 │ Central American │ 27│ 25│
2095 │ Puerto Rican, OR │ 37│ 41│
2096 │ Something else │ 35│ 33│
2097 │ Multiple - cannot │ 2│ 5│
2099 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2102 ╭──────────────────────────────────┬────────────╮
2108 ├──────────────────────────────────┼─────┼──────┤
2109 │QND5A Cuban │ 13│ 7│
2110 │ Mexican │ 175│ 136│
2112 │ South American │ 21│ 13│
2113 │ Central American │ 27│ 25│
2114 │ Puerto Rican, OR │ 37│ 41│
2115 │ Something else │ 35│ 33│
2116 │ Multiple - cannot choose one│ 2│ 5│
2117 ╰──────────────────────────────────┴─────┴──────╯
2120 ╭────────────────────────────────────────────────────────────────┬────────────╮
2126 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2127 │D5a. What would you say is your primary Cuban │ 13│ 7│
2128 │ethnic background? Mexican │ 175│ 136│
2130 │ South American │ 21│ 13│
2131 │ Central American │ 27│ 25│
2132 │ Puerto Rican, OR │ 37│ 41│
2133 │ Something else │ 35│ 33│
2134 │ Multiple - cannot │ 2│ 5│
2136 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2139 ╭────────────────────────────────────────────────────────────┬────────────────╮
2142 │ ├───────┬────────┤
2144 │ ├───────┼────────┤
2146 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2147 │QND5A D5a. What would you say is your Cuban │ 13│ 7│
2148 │primary ethnic background? Mexican │ 175│ 136│
2150 │ South American │ 21│ 13│
2151 │ Central American │ 27│ 25│
2152 │ Puerto Rican, OR │ 37│ 41│
2153 │ Something else │ 35│ 33│
2154 │ Multiple - cannot │ 2│ 5│
2156 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2159 ╭────────────────────────────┬─────┬──────╮
2163 ├────────────────────────────┼─────┼──────┤
2165 │Mexican │ 175│ 136│
2167 │South American │ 21│ 13│
2168 │Central American │ 27│ 25│
2169 │Puerto Rican, OR │ 37│ 41│
2170 │Something else │ 35│ 33│
2171 │Multiple - cannot choose one│ 2│ 5│
2172 ╰────────────────────────────┴─────┴──────╯
2176 AT_SETUP([CTABLES FORMAT EMPTY])
2177 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2178 AT_DATA([ctables.sps],
2180 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2181 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2182 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2184 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2186 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2187 │ │ D5. ETHNICITY: Are you of │
2188 │ │ Hispanic or Latino origin or │
2190 │ ├───────────────┬───────────────┤
2192 │ ├───────────────┼───────────────┤
2194 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2195 │D5a. What would you say is Cuban │ 20│ 0│
2196 │your primary ethnic Mexican │ 311│ 0│
2197 │background? Spanish │ 48│ 0│
2198 │ South American │ 34│ 0│
2199 │ Central American│ 52│ 0│
2200 │ Puerto Rican, OR│ 78│ 0│
2201 │ Something else │ 68│ 0│
2202 │ Multiple - │ 7│ 0│
2203 │ cannot choose │ │ │
2205 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2208 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2209 │ │ D5. ETHNICITY: Are you of │
2210 │ │ Hispanic or Latino origin or │
2212 │ ├───────────────┬───────────────┤
2214 │ ├───────────────┼───────────────┤
2216 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2217 │D5a. What would you say is Cuban │ 20│ │
2218 │your primary ethnic Mexican │ 311│ │
2219 │background? Spanish │ 48│ │
2220 │ South American │ 34│ │
2221 │ Central American│ 52│ │
2222 │ Puerto Rican, OR│ 78│ │
2223 │ Something else │ 68│ │
2225 │ cannot choose │ │ │
2227 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2230 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2231 │ │ D5. ETHNICITY: Are you of │
2232 │ │ Hispanic or Latino origin or │
2234 │ ├───────────────┬───────────────┤
2236 │ ├───────────────┼───────────────┤
2238 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2239 │D5a. What would you say is Cuban │ 20│n/a │
2240 │your primary ethnic Mexican │ 311│n/a │
2241 │background? Spanish │ 48│n/a │
2242 │ South American │ 34│n/a │
2243 │ Central American│ 52│n/a │
2244 │ Puerto Rican, OR│ 78│n/a │
2245 │ Something else │ 68│n/a │
2246 │ Multiple - │ 7│n/a │
2247 │ cannot choose │ │ │
2249 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2253 AT_SETUP([CTABLES FORMAT MISSING])
2254 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2255 AT_DATA([ctables.sps],
2257 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2259 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2261 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2262 │ │ D5. ETHNICITY: Are you of │
2263 │ │ Hispanic or Latino origin or │
2265 │ ├───────────────┬───────────────┤
2267 │ ├───────────────┼───────────────┤
2268 │ │ Column % │ Column % │
2269 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2270 │D5a. What would you say is Cuban │ 3.2%│(no data) │
2271 │your primary ethnic Mexican │ 50.3%│(no data) │
2272 │background? Spanish │ 7.8%│(no data) │
2273 │ South American │ 5.5%│(no data) │
2274 │ Central American│ 8.4%│(no data) │
2275 │ Puerto Rican, OR│ 12.6%│(no data) │
2276 │ Something else │ 11.0%│(no data) │
2277 │ Multiple - │ 1.1%│(no data) │
2278 │ cannot choose │ │ │
2280 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2284 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2285 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2286 AT_DATA([ctables.sps],
2288 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2289 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2290 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2292 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2294 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2296 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2297 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2298 │occasion? 1 │ 491│ 34.9%│
2318 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2321 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2323 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2324 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2325 │occasion? 1 │ 491│ 34.9%│
2345 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2348 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2350 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2351 │38. How many drinks did you have on that Less than one│<10 │ .5%│
2352 │occasion? 1 │ 491│ 34.9%│
2372 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2376 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2377 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2378 AT_DATA([ctables.sps],
2380 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2382 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2394 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2395 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2396 maximumColumnWidth="192"
2397 minimumColumnWidth="96"