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
12 dnl * THRU (numeric ranges)
14 dnl - Date/time variables and values
15 dnl - TITLES: )DATE, )TIME, )TABLE.
17 dnl * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
18 dnl * MISSING, OTHERNM
19 dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
23 dnl - Summary functions:
24 dnl * U-prefix for unweighted summaries.
25 dnl * areaPCT.SUM and UareaPCT.SUM functions.
26 dnl - SPLIT FILE with SEPARATE splits
27 dnl - Definition of columns/rows when labels are rotated from one axis to another.
30 dnl - Multiple response sets
31 dnl - MRSETS subcommand.
32 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
35 dnl - Summary functions:
36 dnl * .LCL and .UCL suffixes.
39 dnl * Data-dependent sorting.
41 AT_SETUP([CTABLES parsing])
42 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
43 AT_DATA([ctables.sps],
46 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
47 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
48 /FORMAT UNITS=CM EMPTY="(-)"
49 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
50 /VLABELS VARIABLES=qn17 DISPLAY=NAME
51 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
52 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
53 /VLABELS VARIABLES=qn20 DISPLAY=NONE
54 /MRSETS COUNTDUPLICATES=NO
55 /MRSETS COUNTDUPLICATES=YES
58 /WEIGHT VARIABLE=qns3a
60 /HIDESMALLCOUNTS COUNT=10
62 /SLABELS POSITION=COLUMN VISIBLE=YES
63 /SLABELS VISIBLE=NO POSITION=ROW
64 /SLABELS POSITION=LAYER
66 /CLABELS ROWLABELS=OPPOSITE
68 /CATEGORIES VARIABLES=qn1 qn17
69 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
70 POSITION=BEFORE EMPTY=INCLUDE.
71 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
72 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
73 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
75 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
78 ╭───────────────────┬────┬────╮
80 ├───────────────────┼────┼────┤
81 │Sa1. SAMPLE SOURCE:│5392│1607│
82 ╰───────────────────┴────┴────╯
86 ╭───────────────────┬─────╮
88 ├───────────────────┼─────┤
89 │Sa1. SAMPLE SOURCE:│ 5392│
90 ╰───────────────────┴─────╯
93 ╭────────────────────────┬─────╮
95 ├────────────────────────┼─────┤
96 │Sa1. SAMPLE SOURCE: RDD │ 5392│
98 ╰────────────────────────┴─────╯
101 ╭────────────────────────┬─────╮
103 ├────────────────────────┼─────┤
104 │Sa1. SAMPLE SOURCE: RDD │ 5392│
106 ╰────────────────────────┴─────╯
110 AT_SETUP([CTABLES parsing - negative])
111 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
112 AT_DATA([ctables.sps],
115 CTABLES /FORMAT MINCOLWIDTH='foo'.
116 CTABLES /TABLE qn1 [**].
117 CTABLES /TABLE qn1 [NOTAFUNCTION].
120 CTABLES /TABLE NOTAVAR.
122 CTABLES /TABLE string[S].
123 CTABLES /TABLE qn1 [PTILE 101].
124 CTABLES /TABLE qn1 [MEAN F0.1].
125 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
126 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
127 CTABLES /TABLE qn1 [MEAN TOTALS].
128 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
129 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
130 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
131 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
132 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
133 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
134 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
135 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
136 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
137 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
138 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
140 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
141 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
142 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
143 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
144 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
145 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
146 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
147 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
148 CTABLES /PCOMPUTE &k=EXPR([LO **]).
149 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
150 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
151 CTABLES /PCOMPUTE &k=EXPR([1**]).
152 CTABLES /PCOMPUTE &k=EXPR((1x)).
153 CTABLES /PCOMPUTE **k.
154 CTABLES /PCOMPUTE &1.
155 CTABLES /PCOMPUTE &k**.
156 CTABLES /PCOMPUTE &k=**.
157 CTABLES /PCOMPUTE &k=EXPR**.
158 CTABLES /PCOMPUTE &k=EXPR(1x).
159 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
160 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
161 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
162 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
163 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
164 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
165 CTABLES /FORMAT EMPTY=**.
166 CTABLES /FORMAT MISSING=**.
168 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
170 CTABLES /VLABELS VARIABLES=NOTAVAR.
171 CTABLES /VLABELS VARIABLES=qn1 **.
172 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
174 CTABLES /MRSETS COUNTDUPLICATES=**.
175 CTABLES /SMISSING **.
177 CTABLES /WEIGHT VARIABLE=NOTAVAR.
178 CTABLES /HIDESMALLCOUNTS COUNT=1.
180 CTABLES /HIDESMALLCOUNTS COUNT=2.
181 CTABLES /TABLE qn1**.
182 CTABLES /TABLE qn1 /SLABELS POSITION=**.
183 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
184 CTABLES /TABLE qn1 /SLABELS **.
185 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
186 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
187 CTABLES /TABLE qn1 /CLABELS **.
188 CTABLES /TABLE qn1 /CRITERIA **.
189 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
190 CTABLES /TABLE qn1 /TITLES **.
191 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
192 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
193 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
194 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
195 CTABLES /TABLE qn1 /SIGTEST **.
196 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
197 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
198 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
199 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
200 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
201 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
202 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
203 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
204 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
205 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
206 CTABLES /TABLE qn1 /COMPARETEST **.
207 CTABLES /TABLE qn1 / **.
208 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
209 CTABLES /TABLE qn20 > qnd1.
210 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
211 NUMERIC datetime (DATETIME17.0).
212 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
214 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
215 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
217 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
218 negative number for MINCOLWIDTH.
220 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
223 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
224 summary function name.
226 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
228 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
231 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
233 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
235 10 | CTABLES /TABLE string[S].
238 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
239 between 0 and 100 for PTILE.
241 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
242 requires a width between 1 and 40.
244 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
245 format NEGPAREN requires width 2 or greater.
247 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
248 format NEGPAREN requires width greater than decimals.
250 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
252 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
255 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
256 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
259 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
261 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
263 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
266 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
267 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
270 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
272 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
274 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
276 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
278 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
280 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
282 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
285 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
286 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
289 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
290 between 0 and 100 for PTILE.
292 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
295 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
298 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
301 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
304 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
306 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
309 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
312 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
313 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
315 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
316 LABEL, POSITION, or EMPTY.
318 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
319 integer for SUBTOTAL.
321 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
323 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
325 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
327 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
329 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
331 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
333 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
335 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
337 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
339 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
341 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
343 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
345 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
346 the previous definition.
347 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
348 | ^~~~~~~~~~~~~~~~~~~
350 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
351 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
352 | ^~~~~~~~~~~~~~~~~~~
354 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
357 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
358 Expecting summary function name.
360 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
361 between 0 and 100 for PTILE.
363 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
365 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
368 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
369 FORMAT, or HIDESOURCECATS.
371 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
373 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
375 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
376 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
378 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
381 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
384 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
386 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
389 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
390 DEFAULT, NAME, LABEL, BOTH, or NONE.
392 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
395 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
398 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
399 VARIABLE or LISTWISE.
401 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
404 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
406 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
407 greater for HIDESMALLCOUNTS COUNT.
409 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
410 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
411 HIDESMALLCOUNTS, or TABLE.
413 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
416 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
418 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
421 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
424 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
427 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
430 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
433 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
434 ROWLABELS, or COLLABELS.
436 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
439 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
440 in @<:@0,100@:}@ for CILEVEL.
442 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
443 CAPTION, CORNER, or TITLE.
445 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
448 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
449 in @<:@0,1@:}@ for ALPHA.
451 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
454 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
455 ALLVISIBLE or SUBTOTALS.
457 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
458 ALPHA, INCLUDEMRSETS, or CATEGORIES.
460 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
463 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
466 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
469 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
470 BONFERRONI, BH, or NONE.
472 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
475 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
478 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
479 ALLVISIBLE or SUBTOTALS.
481 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
484 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
487 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
490 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
491 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
494 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
495 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
497 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
500 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
501 97 | CTABLES /TABLE qn20 > qnd1.
504 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
505 97 | CTABLES /TABLE qn20 > qnd1.
508 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
509 97 | CTABLES /TABLE qn20 > qnd1.
512 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
513 categorical variables at the innermost nesting level.
514 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
515 | ^~~~~~~~~~~~~~~~~~~~
517 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
519 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
522 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
523 specification as format DATETIME: Day (123) must be between 1 and 31..
524 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
529 AT_SETUP([CTABLES parsing - more negative])
530 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
531 AT_DATA([ctables.sps],
533 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
534 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
535 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
538 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
539 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
541 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
543 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
544 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
545 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
546 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
548 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
549 CTABLES /PCOMPUTE &x=EXPR([**]).
550 CTABLES /PCOMPUTE &x=EXPR(**).
554 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
556 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
557 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
558 category not included in the category list.
559 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
564 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
565 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
569 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
570 list of categories here.
571 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
576 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
577 category not included in the category list.
578 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
583 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
584 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
588 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
589 variable's CATEGORIES specification.
591 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
592 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
593 subtotals by position, e.g. SUBTOTAL[1].
594 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
595 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
597 ^~~~~~~~~~~~~~~~~~~~~~~~
599 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
601 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
602 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
605 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
606 applied only to string variables, but this subcommand tries to apply it to
607 numeric variable QN1.
608 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
611 ctables.sps:8.53: error: CTABLES: This category specification may be applied
612 only to numeric variables, but this subcommand tries to apply it to string
614 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
617 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
618 based on a summary function.
620 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
621 moved to be categorical, but qnd1 is a scale variable.
623 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
624 moved to have the same width, but QN1 has width 0 and string has width 8.
626 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
627 moved to have the same value labels, but QN1 and QNSA1 have different value
630 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
631 moved to have the same category specifications, but QN105BA and QN105BB have
632 different category specifications.
634 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
635 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
636 this warning, insert parentheses.
637 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
640 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
643 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
645 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
647 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
648 variable must be specified.
650 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
652 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
654 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
657 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
659 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
662 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
664 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
669 AT_SETUP([CTABLES one categorical variable])
670 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
671 AT_DATA([ctables.sps],
674 CTABLES /TABLE BY qn1.
675 CTABLES /TABLE BY BY qn1.
677 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
679 ╭────────────────────────────────────────────────────────────────────────┬─────╮
681 ├────────────────────────────────────────────────────────────────────────┼─────┤
682 │ 1. How often do you usually drive a car or other Every day │ 4667│
683 │motor vehicle? Several days a week │ 1274│
684 │ Once a week or less │ 361│
685 │ Only certain times a │ 130│
688 ╰────────────────────────────────────────────────────────────────────────┴─────╯
691 ╭──────────────────────────────────────────────────────────────────────────────╮
692 │ 1. How often do you usually drive a car or other motor vehicle? │
693 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
694 │ │ Several days a │ Once a week or │ Only certain times a │ │
695 │Every day│ week │ less │ year │Never│
696 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
697 │ Count │ Count │ Count │ Count │Count│
698 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
699 │ 4667│ 1274│ 361│ 130│ 540│
700 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
712 AT_SETUP([CTABLES one string variable])
713 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
714 AT_DATA([ctables.sps],
717 MISSING VALUES licensed('DontKnow', 'Refused').
718 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
719 CTABLES /TABLE licensed.
720 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
721 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
722 * Notice that the string matching is case-sensitive.
723 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
724 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
726 /PCOMPUTE ¬yes=EXPR(['No']+['DontKnow']+['Refused'])
727 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
729 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'No', 'DontKnow', 'Refused'].
731 /PCOMPUTE ¬yes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
732 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
734 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'DontKnow' THRU 'No', 'Refused'].
736 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
746 ╭─────────────────┬─────┬───────╮
748 ├─────────────────┼─────┼───────┤
749 │licensed DontKnow│ 4│ │
753 │ Total │ 6999│ 6951│
754 ╰─────────────────┴─────┴───────╯
757 ╭──────────────┬─────╮
759 ├──────────────┼─────┤
760 │licensed Yes │ 6379│
763 ╰──────────────┴─────╯
766 ╭──────────────┬─────╮
768 ├──────────────┼─────┤
769 │licensed Yes │ 6379│
772 ╰──────────────┴─────╯
775 ╭────────────────┬─────╮
777 ├────────────────┼─────┤
782 ╰────────────────┴─────╯
785 ╭────────────────┬─────╮
787 ├────────────────┼─────┤
788 │licensed Yes │ 6379│
790 ╰────────────────┴─────╯
793 ╭────────────────┬─────╮
795 ├────────────────┼─────┤
796 │licensed Yes │ 6379│
798 ╰────────────────┴─────╯
802 AT_SETUP([CTABLES one scale variable])
803 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
804 AT_DATA([ctables.sps],
806 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
807 CTABLES /TABLE BY qnd1.
808 CTABLES /TABLE BY BY qnd1.
810 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
812 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
813 │ │ │ │ │ │ Std │ │ │
814 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
815 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
816 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
817 │age? │ │ │ │ │ │ │ │
818 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
821 ╭──────────────────────────╮
822 │D1. AGE: What is your age?│
823 ├──────────────────────────┤
825 ├──────────────────────────┤
827 ╰──────────────────────────╯
830 D1. AGE: What is your age?
839 AT_SETUP([CTABLES simple stacking])
840 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
841 AT_DATA([ctables.sps],
843 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
845 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
847 ╭───────────────────────────────────────────────────────────────┬──────────────╮
854 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
855 │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│
856 │too much to drink to drive safely will A. Get certain │ │ │
857 │stopped by the police? Very likely │ 21%│ 22%│
858 │ Somewhat │ 38%│ 42%│
860 │ Somewhat │ 21%│ 18%│
864 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
865 │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│
866 │too much to drink to drive safely will B. Have an certain │ │ │
867 │accident? Very likely │ 36%│ 45%│
868 │ Somewhat │ 39%│ 32%│
874 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
875 │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│
876 │too much to drink to drive safely will C. Be certain │ │ │
877 │convicted for drunk driving? Very likely │ 32%│ 28%│
878 │ Somewhat │ 27%│ 32%│
880 │ Somewhat │ 15%│ 15%│
884 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
885 │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│
886 │too much to drink to drive safely will D. Be certain │ │ │
887 │arrested for drunk driving? Very likely │ 26%│ 27%│
888 │ Somewhat │ 32%│ 35%│
890 │ Somewhat │ 17%│ 15%│
894 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
898 AT_SETUP([CTABLES show or hide empty categories])
899 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
900 AT_DATA([ctables.sps],
902 IF (qn105ba = 2) qn105ba = 1.
903 IF (qns3a = 1) qns3a = 2.
904 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
905 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
906 /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
907 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
908 /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
909 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
910 /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
912 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
914 ╭──────────────────────────────────────────────────────────────┬───────────────╮
921 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
922 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
923 │too much to drink to drive safely will A. Get certain │ │ │
924 │stopped by the police? Very likely│ .│ 0%│
931 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
934 ╭──────────────────────────────────────────────────────────────┬───────────────╮
941 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
942 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
943 │too much to drink to drive safely will A. Get certain │ │ │
944 │stopped by the police? Somewhat │ .│ 40%│
950 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
953 ╭────────────────────────────────────────────────────────────────────┬─────────╮
960 ├────────────────────────────────────────────────────────────────────┼─────────┤
961 │105b. How likely is it that drivers who have had too Almost │ 32%│
962 │much to drink to drive safely will A. Get stopped by certain │ │
963 │the police? Very likely │ 0%│
970 ╰────────────────────────────────────────────────────────────────────┴─────────╯
973 ╭────────────────────────────────────────────────────────────────────┬─────────╮
980 ├────────────────────────────────────────────────────────────────────┼─────────┤
981 │105b. How likely is it that drivers who have had too Almost │ 32%│
982 │much to drink to drive safely will A. Get stopped by certain │ │
983 │the police? Somewhat │ 40%│
989 ╰────────────────────────────────────────────────────────────────────┴─────────╯
993 AT_SETUP([CTABLES sorting categories])
994 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
995 AT_DATA([ctables.sps],
997 IF (QND5A=6) QND5A=-1.
998 IF (QND5A=5) QND5A=-2.
999 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
1000 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
1001 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
1002 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
1004 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1006 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1008 ├────────────────────────────────────────────────────────────────────────┼─────┤
1009 │D5a. What would you say is your primary ethnic -2.00 │ 52│
1010 │background? -1.00 │ 78│
1014 │ South American │ 34│
1015 │ Central American │ 0│
1016 │ Puerto Rican, OR │ 0│
1017 │ Something else │ 68│
1018 │ Multiple - cannot choose│ 7│
1020 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1023 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1025 ├────────────────────────────────────────────────────────────────────────┼─────┤
1026 │D5a. What would you say is your primary ethnic Multiple - cannot choose│ 7│
1027 │background? one │ │
1028 │ Something else │ 68│
1029 │ Puerto Rican, OR │ 0│
1030 │ Central American │ 0│
1031 │ South American │ 34│
1037 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1040 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1042 ├────────────────────────────────────────────────────────────────────────┼─────┤
1043 │D5a. What would you say is your primary ethnic Central American │ 0│
1044 │background? Cuban │ 20│
1046 │ Multiple - cannot choose│ 7│
1048 │ Puerto Rican, OR │ 0│
1049 │ Something else │ 68│
1050 │ South American │ 34│
1054 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1057 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1059 ├────────────────────────────────────────────────────────────────────────┼─────┤
1060 │D5a. What would you say is your primary ethnic Spanish │ 48│
1061 │background? South American │ 34│
1062 │ Something else │ 68│
1063 │ Puerto Rican, OR │ 0│
1064 │ Multiple - cannot choose│ 7│
1068 │ Central American │ 0│
1071 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1075 AT_SETUP([CTABLES simple nesting])
1076 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1077 AT_DATA([ctables.sps],
1079 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1080 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1081 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1082 /CATEGORIES VARIABLES=qns3a TOTAL=YES
1083 /CLABELS ROW=OPPOSITE.
1085 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1087 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1090 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1091 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
1092 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
1093 │drive safely will A. Get stopped by Total │ 700│ 10%│
1094 │the police? ╶──────────────────────────┼─────┼──────┤
1095 │ Very S3a. Male │ 660│ 10%│
1096 │ likely GENDER: Female│ 842│ 12%│
1097 │ Total │ 1502│ 22%│
1098 │ ╶──────────────────────────┼─────┼──────┤
1099 │ Somewhat S3a. Male │ 1174│ 17%│
1100 │ likely GENDER: Female│ 1589│ 23%│
1101 │ Total │ 2763│ 40%│
1102 │ ╶──────────────────────────┼─────┼──────┤
1103 │ Somewhat S3a. Male │ 640│ 9%│
1104 │ unlikely GENDER: Female│ 667│ 10%│
1105 │ Total │ 1307│ 19%│
1106 │ ╶──────────────────────────┼─────┼──────┤
1107 │ Very S3a. Male │ 311│ 5%│
1108 │ unlikely GENDER: Female│ 298│ 4%│
1110 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1111 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
1112 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
1113 │drive safely will B. Have an accident? Total │ 1100│ 16%│
1114 │ ╶──────────────────────────┼─────┼──────┤
1115 │ Very S3a. Male │ 1104│ 16%│
1116 │ likely GENDER: Female│ 1715│ 25%│
1117 │ Total │ 2819│ 41%│
1118 │ ╶──────────────────────────┼─────┼──────┤
1119 │ Somewhat S3a. Male │ 1203│ 17%│
1120 │ likely GENDER: Female│ 1214│ 18%│
1121 │ Total │ 2417│ 35%│
1122 │ ╶──────────────────────────┼─────┼──────┤
1123 │ Somewhat S3a. Male │ 262│ 4%│
1124 │ unlikely GENDER: Female│ 168│ 2%│
1126 │ ╶──────────────────────────┼─────┼──────┤
1127 │ Very S3a. Male │ 81│ 1%│
1128 │ unlikely GENDER: Female│ 59│ 1%│
1130 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1131 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
1132 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
1133 │drive safely will C. Be convicted for Total │ 1149│ 17%│
1134 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1135 │ Very S3a. Male │ 988│ 14%│
1136 │ likely GENDER: Female│ 1049│ 15%│
1137 │ Total │ 2037│ 30%│
1138 │ ╶──────────────────────────┼─────┼──────┤
1139 │ Somewhat S3a. Male │ 822│ 12%│
1140 │ likely GENDER: Female│ 1210│ 18%│
1141 │ Total │ 2032│ 30%│
1142 │ ╶──────────────────────────┼─────┼──────┤
1143 │ Somewhat S3a. Male │ 446│ 7%│
1144 │ unlikely GENDER: Female│ 548│ 8%│
1146 │ ╶──────────────────────────┼─────┼──────┤
1147 │ Very S3a. Male │ 268│ 4%│
1148 │ unlikely GENDER: Female│ 354│ 5%│
1150 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1151 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1152 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1153 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1154 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1155 │ Very S3a. Male │ 805│ 12%│
1156 │ likely GENDER: Female│ 1029│ 15%│
1157 │ Total │ 1834│ 27%│
1158 │ ╶──────────────────────────┼─────┼──────┤
1159 │ Somewhat S3a. Male │ 975│ 14%│
1160 │ likely GENDER: Female│ 1332│ 19%│
1161 │ Total │ 2307│ 34%│
1162 │ ╶──────────────────────────┼─────┼──────┤
1163 │ Somewhat S3a. Male │ 535│ 8%│
1164 │ unlikely GENDER: Female│ 560│ 8%│
1165 │ Total │ 1095│ 16%│
1166 │ ╶──────────────────────────┼─────┼──────┤
1167 │ Very S3a. Male │ 270│ 4%│
1168 │ unlikely GENDER: Female│ 279│ 4%│
1170 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1173 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1174 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1175 │ │ certain│likely│ likely │ unlikely│unlikely│
1176 │ ├────────┼──────┼─────────┼─────────┼────────┤
1178 │ │ Table %│ % │ Table % │ Table % │ Table %│
1179 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1180 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1181 │GENDER: is it that drivers│ │ │ │ │ │
1182 │ who have had too │ │ │ │ │ │
1183 │ much to drink to │ │ │ │ │ │
1184 │ drive safely will │ │ │ │ │ │
1185 │ A. Get stopped by │ │ │ │ │ │
1186 │ the police? │ │ │ │ │ │
1187 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1188 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1189 │ is it that drivers│ │ │ │ │ │
1190 │ who have had too │ │ │ │ │ │
1191 │ much to drink to │ │ │ │ │ │
1192 │ drive safely will │ │ │ │ │ │
1193 │ A. Get stopped by │ │ │ │ │ │
1194 │ the police? │ │ │ │ │ │
1195 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1196 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1197 │ is it that drivers│ │ │ │ │ │
1198 │ who have had too │ │ │ │ │ │
1199 │ much to drink to │ │ │ │ │ │
1200 │ drive safely will │ │ │ │ │ │
1201 │ A. Get stopped by │ │ │ │ │ │
1202 │ the police? │ │ │ │ │ │
1203 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1204 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1205 │GENDER: is it that drivers│ │ │ │ │ │
1206 │ who have had too │ │ │ │ │ │
1207 │ much to drink to │ │ │ │ │ │
1208 │ drive safely will │ │ │ │ │ │
1209 │ B. Have an │ │ │ │ │ │
1210 │ accident? │ │ │ │ │ │
1211 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1212 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1213 │ is it that drivers│ │ │ │ │ │
1214 │ who have had too │ │ │ │ │ │
1215 │ much to drink to │ │ │ │ │ │
1216 │ drive safely will │ │ │ │ │ │
1217 │ B. Have an │ │ │ │ │ │
1218 │ accident? │ │ │ │ │ │
1219 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1220 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1221 │ is it that drivers│ │ │ │ │ │
1222 │ who have had too │ │ │ │ │ │
1223 │ much to drink to │ │ │ │ │ │
1224 │ drive safely will │ │ │ │ │ │
1225 │ B. Have an │ │ │ │ │ │
1226 │ accident? │ │ │ │ │ │
1227 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1228 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1229 │GENDER: is it that drivers│ │ │ │ │ │
1230 │ who have had too │ │ │ │ │ │
1231 │ much to drink to │ │ │ │ │ │
1232 │ drive safely will │ │ │ │ │ │
1233 │ C. Be convicted │ │ │ │ │ │
1234 │ for drunk driving?│ │ │ │ │ │
1235 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1236 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1237 │ is it that drivers│ │ │ │ │ │
1238 │ who have had too │ │ │ │ │ │
1239 │ much to drink to │ │ │ │ │ │
1240 │ drive safely will │ │ │ │ │ │
1241 │ C. Be convicted │ │ │ │ │ │
1242 │ for drunk driving?│ │ │ │ │ │
1243 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1244 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1245 │ is it that drivers│ │ │ │ │ │
1246 │ who have had too │ │ │ │ │ │
1247 │ much to drink to │ │ │ │ │ │
1248 │ drive safely will │ │ │ │ │ │
1249 │ C. Be convicted │ │ │ │ │ │
1250 │ for drunk driving?│ │ │ │ │ │
1251 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1252 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1253 │GENDER: is it that drivers│ │ │ │ │ │
1254 │ who have had too │ │ │ │ │ │
1255 │ much to drink to │ │ │ │ │ │
1256 │ drive safely will │ │ │ │ │ │
1257 │ D. Be arrested for│ │ │ │ │ │
1258 │ drunk driving? │ │ │ │ │ │
1259 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1260 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1261 │ is it that drivers│ │ │ │ │ │
1262 │ who have had too │ │ │ │ │ │
1263 │ much to drink to │ │ │ │ │ │
1264 │ drive safely will │ │ │ │ │ │
1265 │ D. Be arrested for│ │ │ │ │ │
1266 │ drunk driving? │ │ │ │ │ │
1267 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1268 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1269 │ is it that drivers│ │ │ │ │ │
1270 │ who have had too │ │ │ │ │ │
1271 │ much to drink to │ │ │ │ │ │
1272 │ drive safely will │ │ │ │ │ │
1273 │ D. Be arrested for│ │ │ │ │ │
1274 │ drunk driving? │ │ │ │ │ │
1275 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1279 AT_SETUP([CTABLES nesting and scale variables])
1280 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1281 AT_DATA([ctables.sps],
1283 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1284 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1285 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1286 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1287 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1289 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1291 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1297 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1298 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1299 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1301 │ Once a week or │ 44│ 54│
1303 │ Only certain │ 34│ 41│
1304 │ times a year │ │ │
1306 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1309 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1310 │ │Minimum│Maximum│Mean│
1311 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1312 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1313 │What is GENDER: months, has there been a │ │ │ │
1314 │your time when you felt you │ │ │ │
1315 │age? should cut down on your No │ 16│ 86│ 46│
1317 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1318 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1319 │ months, has there been a │ │ │ │
1320 │ time when you felt you │ │ │ │
1321 │ should cut down on your No │ 16│ 86│ 48│
1323 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1324 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1325 │What is GENDER: months, has there been a │ │ │ │
1326 │your time when people criticized No │ 16│ 86│ 46│
1327 │age? your drinking? │ │ │ │
1328 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1329 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1330 │ months, has there been a │ │ │ │
1331 │ time when people criticized No │ 16│ 86│ 48│
1332 │ your drinking? │ │ │ │
1333 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1336 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1337 │ │S1. Including yourself, how many members of this│
1338 │ │ household are age 16 or older? │
1339 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1340 │ │ │ │ │ │ │ │ 6 or │
1341 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1342 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1343 │ │Column│Column│Column│Column│Column│Column│Column│
1344 │ │ % │ % │ % │ % │ % │ % │ % │
1345 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1346 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1347 │SAMPLE How certain │ │ │ │ │ │ │ │
1348 │SOURCE: likely │ │ │ │ │ │ │ │
1349 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1350 │ that likely │ │ │ │ │ │ │ │
1351 │ drivers │ │ │ │ │ │ │ │
1352 │ who have │ │ │ │ │ │ │ │
1353 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1354 │ much to likely │ │ │ │ │ │ │ │
1355 │ drink to │ │ │ │ │ │ │ │
1356 │ drive │ │ │ │ │ │ │ │
1357 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1358 │ will A. unlikely│ │ │ │ │ │ │ │
1359 │ Get │ │ │ │ │ │ │ │
1360 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1361 │ by the unlikely│ │ │ │ │ │ │ │
1362 │ police? │ │ │ │ │ │ │ │
1363 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1366 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1369 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1370 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1371 │group typical month did you have one or more │ │ │
1372 │ alcoholic beverages to drink? │ │ │
1373 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1374 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1375 │ typical month did you have one or more │ │ │
1376 │ alcoholic beverages to drink? │ │ │
1377 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1378 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1379 │ typical month did you have one or more │ │ │
1380 │ alcoholic beverages to drink? │ │ │
1381 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1382 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1383 │ typical month did you have one or more │ │ │
1384 │ alcoholic beverages to drink? │ │ │
1385 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1386 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1387 │ typical month did you have one or more │ │ │
1388 │ alcoholic beverages to drink? │ │ │
1389 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1390 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1391 │ older typical month did you have one or more │ │ │
1392 │ alcoholic beverages to drink? │ │ │
1393 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1398 AT_SETUP([CTABLES SLABELS])
1399 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1400 AT_DATA([ctables.sps],
1402 CTABLES /TABLE qn1 [COUNT COLPCT].
1403 CTABLES /TABLE qn1 [COUNT COLPCT]
1404 /SLABELS POSITION=ROW.
1405 CTABLES /TABLE qn1 [COUNT COLPCT]
1406 /SLABELS POSITION=ROW VISIBLE=NO.
1408 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1410 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1413 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1414 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1415 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1416 │ Once a week or less│ 361│ 5.2%│
1417 │ Only certain times │ 130│ 1.9%│
1419 │ Never │ 540│ 7.7%│
1420 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1423 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1424 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1425 │other motor vehicle? Column │66.9%│
1427 │ ╶───────────────────────────┼─────┤
1428 │ Several days a week Count │ 1274│
1431 │ ╶───────────────────────────┼─────┤
1432 │ Once a week or less Count │ 361│
1435 │ ╶───────────────────────────┼─────┤
1436 │ Only certain times Count │ 130│
1437 │ a year Column │ 1.9%│
1439 │ ╶───────────────────────────┼─────┤
1440 │ Never Count │ 540│
1443 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1446 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1447 │ 1. How often do you usually drive a car or other Every day │ 4667│
1448 │motor vehicle? │66.9%│
1449 │ Several days a week │ 1274│
1451 │ Once a week or less │ 361│
1453 │ Only certain times a │ 130│
1457 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1461 AT_SETUP([CTABLES simple totals])
1462 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1463 AT_DATA([ctables.sps],
1466 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1467 DESCRIPTIVES qn18/STATISTICS=MEAN.
1468 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1469 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1471 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1473 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1475 ├────────────────────────────────────────────────────────────────────────┼─────┤
1476 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1477 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1480 │ Wine coolers │ 137│
1481 │ Hard liquor or │ 888│
1483 │ Flavored malt │ 83│
1485 │ Number responding │ 4221│
1486 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1488 Descriptive Statistics
1489 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1491 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1492 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1493 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1494 │Valid N (listwise) │6999│ │
1495 │Missing N (listwise) │2781│ │
1496 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1499 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1500 │ │ │ │ Valid│Total│
1501 │ │Mean│Count│ N │ N │
1502 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1503 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1504 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1505 │ you usually drink per sitting? │ │ │ │ │
1506 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1507 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1508 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1509 │ you usually drink per sitting? │ │ │ │ │
1510 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1511 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1512 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1513 │ you usually drink per sitting? │ │ │ │ │
1514 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1515 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1516 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1517 │ you usually drink per sitting? │ │ │ │ │
1518 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1519 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1520 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1521 │ you usually drink per sitting? │ │ │ │ │
1522 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1526 AT_SETUP([CTABLES subtotals])
1527 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1528 AT_DATA([ctables.sps],
1530 CTABLES /TABLE=qn105ba BY qns1
1531 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1532 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1533 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1534 CTABLES /TABLE=qn105ba BY qns1
1535 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1536 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1538 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1540 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1541 │ │ S1. Including yourself, how many members of this household │
1542 │ │ are age 16 or older? │
1543 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1544 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1545 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1546 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1547 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1548 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1549 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1550 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1551 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1552 │ likely │ │ │ │ │ │ │ │
1553 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1554 │ unlikely │ │ │ │ │ │ │ │
1555 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1556 │ unlikely │ │ │ │ │ │ │ │
1557 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1560 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1561 │ │ S1. Including yourself, how many members of this household │
1562 │ │ are age 16 or older? │
1563 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1564 │ │ │ │ │ │ │ │ 6 or │
1565 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1566 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1567 │ │ │ │ │ │ Column│ │ │
1568 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1569 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1570 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1571 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1572 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1573 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1574 │ likely │ │ │ │ │ │ │ │
1575 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1576 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1577 │ unlikely │ │ │ │ │ │ │ │
1578 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1579 │ unlikely │ │ │ │ │ │ │ │
1580 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1581 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1584 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1585 │ │ S1. Including yourself, how many members of this household │
1586 │ │ are age 16 or older? │
1587 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1588 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1589 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1590 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1591 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1592 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1593 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1594 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1595 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1596 │ likely │ │ │ │ │ │ │ │
1597 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1598 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1599 │ unlikely │ │ │ │ │ │ │ │
1600 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1601 │ unlikely │ │ │ │ │ │ │ │
1602 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1603 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1607 AT_SETUP([CTABLES PCOMPUTE])
1608 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1609 AT_DATA([ctables.sps],
1612 /PCOMPUTE &x=EXPR([3] + [4])
1613 /PCOMPUTE &y=EXPR([4] + [5])
1614 /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
1615 /PPROPERTIES &y LABEL='4+5'
1616 /TABLE=qn105ba BY qns1
1617 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
1619 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1621 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1622 │ │ S1. Including yourself, how many members of this household │
1623 │ │ are age 16 or older? │
1624 │ ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
1625 │ │ 1 │ 2 │ Subtotal │ 5 │ 3+4 │ 4+5 │ Subtotal │
1626 │ ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1627 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1628 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
1629 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 11│ 81.00│ 30│ 92│
1630 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1631 │A. Get stopped by the police? Very likely│ 384│ 552│ 936│ 14│ 171.00│ 65│ 185│
1632 │ Somewhat │ 590│ 1249│ 1839│ 20│ 265.00│ 92│ 285│
1633 │ likely │ │ │ │ │ │ │ │
1634 │ Somewhat │ 278│ 647│ 925│ 6│ 116.00│ 38│ 122│
1635 │ unlikely │ │ │ │ │ │ │ │
1636 │ Very │ 141│ 290│ 431│ 4│ 59.00│ 22│ 63│
1637 │ unlikely │ │ │ │ │ │ │ │
1638 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
1642 AT_SETUP([CTABLES CLABELS])
1643 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1644 AT_DATA([ctables.sps],
1646 CTABLES /TABLE AgeGroup BY qns3a.
1647 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1648 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1649 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1650 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1653 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1655 ╭───────────────────────┬────────────╮
1661 ├───────────────────────┼─────┼──────┤
1662 │Age group 15 or younger│ 0│ 0│
1663 │ 16 to 25 │ 594│ 505│
1664 │ 26 to 35 │ 476│ 491│
1665 │ 36 to 45 │ 489│ 548│
1666 │ 46 to 55 │ 526│ 649│
1667 │ 56 to 65 │ 516│ 731│
1668 │ 66 or older │ 531│ 943│
1669 ╰───────────────────────┴─────┴──────╯
1672 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1674 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1676 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1677 │ │ 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 │
1678 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1679 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1680 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1681 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1682 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1683 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1684 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1687 ╭──────────────────────────────┬────────────╮
1691 ├──────────────────────────────┼────────────┤
1692 │Age group 15 or younger Male │ 0│
1694 │ ╶────────────────────┼────────────┤
1695 │ 16 to 25 Male │ 594│
1697 │ ╶────────────────────┼────────────┤
1698 │ 26 to 35 Male │ 476│
1700 │ ╶────────────────────┼────────────┤
1701 │ 36 to 45 Male │ 489│
1703 │ ╶────────────────────┼────────────┤
1704 │ 46 to 55 Male │ 526│
1706 │ ╶────────────────────┼────────────┤
1707 │ 56 to 65 Male │ 516│
1709 │ ╶────────────────────┼────────────┤
1710 │ 66 or older Male │ 531│
1712 ╰──────────────────────────────┴────────────╯
1716 ╭─────────┬────────────╮
1722 ├─────────┼─────┼──────┤
1724 ╰─────────┴─────┴──────╯
1728 ╭─────────┬────────────╮
1734 ├─────────┼─────┼──────┤
1735 │Age group│ 594│ 505│
1736 ╰─────────┴─────┴──────╯
1740 ╭─────────┬────────────╮
1746 ├─────────┼─────┼──────┤
1747 │Age group│ 476│ 491│
1748 ╰─────────┴─────┴──────╯
1752 ╭─────────┬────────────╮
1758 ├─────────┼─────┼──────┤
1759 │Age group│ 489│ 548│
1760 ╰─────────┴─────┴──────╯
1764 ╭─────────┬────────────╮
1770 ├─────────┼─────┼──────┤
1771 │Age group│ 526│ 649│
1772 ╰─────────┴─────┴──────╯
1776 ╭─────────┬────────────╮
1782 ├─────────┼─────┼──────┤
1783 │Age group│ 516│ 731│
1784 ╰─────────┴─────┴──────╯
1788 ╭─────────┬────────────╮
1794 ├─────────┼─────┼──────┤
1795 │Age group│ 531│ 943│
1796 ╰─────────┴─────┴──────╯
1800 ╭───────────────────────┬────────────╮
1804 ├───────────────────────┼────────────┤
1805 │Age group 15 or younger│ 0│
1811 │ 66 or older │ 531│
1812 ╰───────────────────────┴────────────╯
1816 ╭───────────────────────┬────────────╮
1820 ├───────────────────────┼────────────┤
1821 │Age group 15 or younger│ 0│
1827 │ 66 or older │ 943│
1828 ╰───────────────────────┴────────────╯
1832 AT_SETUP([CTABLES missing values])
1833 AT_DATA([ctables.sps],
1834 [[DATA LIST LIST NOTABLE/x y.
1873 MISSING VALUES x (1, 2) y (2, 3).
1874 VARIABLE LEVEL ALL (NOMINAL).
1876 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1877 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1878 /CATEGORIES VARIABLES=ALL TOTAL=YES.
1879 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
1880 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1881 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1882 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1883 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1884 /CATEGORIES VARIABLES=ALL TOTAL=YES
1885 /SLABELS POSITION=ROW.
1886 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1887 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1888 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1889 /SLABELS POSITION=ROW.
1890 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
1891 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1892 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
1893 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
1894 /SLABELS POSITION=ROW.
1896 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1898 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1899 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1900 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1901 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1902 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1903 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
1904 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1905 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1906 dnl Note that Column Total N % doesn't add up to 100 because missing
1907 dnl values are included in the total but not shown as a category and this
1908 dnl is expected behavior.
1911 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1912 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1913 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1914 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1915 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
1916 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1917 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1918 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
1919 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
1920 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1921 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1922 dnl values are included in the total but not shown as a category and this
1923 dnl is expected behavior.
1926 ╭────────────────────────┬───────────────────────────╮
1928 │ ├──────┬──────┬──────┬──────┤
1929 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
1930 ├────────────────────────┼──────┼──────┼──────┼──────┤
1931 │x 3.00 Count │ 1│ 1│ 1│ 3│
1932 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1933 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1934 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1935 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1936 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1937 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1938 │ Valid N │ │ │ │ 3│
1939 │ Total N │ │ │ │ 6│
1940 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1941 │ 4.00 Count │ 1│ 1│ 1│ 3│
1942 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1943 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1944 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1945 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1946 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1947 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1948 │ Valid N │ │ │ │ 3│
1949 │ Total N │ │ │ │ 6│
1950 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1951 │ 5.00 Count │ 1│ 1│ 1│ 3│
1952 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
1953 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
1954 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
1955 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1956 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
1957 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
1958 │ Valid N │ │ │ │ 3│
1959 │ Total N │ │ │ │ 6│
1960 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1961 │ Total Count │ 3│ 3│ 3│ 9│
1962 │ Column % │100.0%│100.0%│100.0%│ .│
1963 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
1964 │ Column Total N %│100.0%│100.0%│100.0%│ .│
1965 │ Row % │ .│ .│ .│ .│
1966 │ Row Valid N % │ .│ .│ .│ .│
1967 │ Row Total N % │ .│ .│ .│ .│
1968 │ Valid N │ 3│ 3│ 3│ 9│
1969 │ Total N │ 6│ 6│ 6│ 36│
1970 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1973 ╭────────────────────────┬─────────────────────────────────────────╮
1975 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
1976 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1977 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1978 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1979 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1980 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1981 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1982 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1983 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1984 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1985 │ Valid N │ │ │ │ │ │ 0│
1986 │ Total N │ │ │ │ │ │ 6│
1987 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1988 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1989 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
1990 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
1991 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
1992 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1993 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
1994 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1995 │ Valid N │ │ │ │ │ │ 0│
1996 │ Total N │ │ │ │ │ │ 6│
1997 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1998 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
1999 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2000 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2001 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2002 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2003 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2004 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2005 │ Valid N │ │ │ │ │ │ 3│
2006 │ Total N │ │ │ │ │ │ 6│
2007 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2008 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2009 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2010 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2011 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2012 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2013 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2014 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2015 │ Valid N │ │ │ │ │ │ 3│
2016 │ Total N │ │ │ │ │ │ 6│
2017 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2018 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2019 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2020 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2021 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2022 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2023 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2024 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2025 │ Valid N │ │ │ │ │ │ 3│
2026 │ Total N │ │ │ │ │ │ 6│
2027 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2028 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
2029 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2030 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
2031 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2032 │ Row % │ .│ .│ .│ .│ .│ .│
2033 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2034 │ Row Total N % │ .│ .│ .│ .│ .│ .│
2035 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
2036 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
2037 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2040 ╭────────────────────────┬──────────────────────────────────╮
2042 │ ├──────┬──────┬──────┬──────┬──────┤
2043 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2044 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2045 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
2046 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2047 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2048 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2049 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2050 │ Row Valid N % │ .│ .│ .│ .│ .│
2051 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2052 │ Valid N │ │ │ │ │ 0│
2053 │ Total N │ │ │ │ │ 6│
2054 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2055 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
2056 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2057 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2058 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2059 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2060 │ Row Valid N % │ .│ .│ .│ .│ .│
2061 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2062 │ Valid N │ │ │ │ │ 0│
2063 │ Total N │ │ │ │ │ 6│
2064 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2065 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
2066 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2067 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2068 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2069 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2070 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2071 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2072 │ Valid N │ │ │ │ │ 3│
2073 │ Total N │ │ │ │ │ 6│
2074 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2075 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
2076 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2077 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2078 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2079 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2080 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2081 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2082 │ Valid N │ │ │ │ │ 3│
2083 │ Total N │ │ │ │ │ 6│
2084 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2085 │ Total Count │ 4│ 4│ 4│ 4│ 16│
2086 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
2087 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
2088 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
2089 │ Row % │ .│ .│ .│ .│ .│
2090 │ Row Valid N % │ .│ .│ .│ .│ .│
2091 │ Row Total N % │ .│ .│ .│ .│ .│
2092 │ Valid N │ 2│ 0│ 2│ 2│ 6│
2093 │ Total N │ 5│ 5│ 5│ 5│ 30│
2094 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2098 AT_SETUP([CTABLES SMISSING=LISTWISE])
2099 AT_KEYWORDS([SMISSING LISTWISE])
2100 AT_DATA([ctables.sps],
2101 [[DATA LIST LIST NOTABLE/x y z.
2109 VARIABLE LEVEL x (NOMINAL).
2111 CTABLES /TABLE (y + z) > x.
2112 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2114 * The following doesn't come out as listwise because the tables are
2115 separate, not linked by an > operator.
2116 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2118 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2148 AT_SETUP([CTABLES VLABELS])
2149 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2150 AT_DATA([ctables.sps],
2152 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2153 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME /TABLE qnd5a BY qns3a.
2154 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL /TABLE qnd5a BY qns3a.
2155 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH /TABLE qnd5a BY qns3a.
2156 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a BY qns3a.
2158 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2160 ╭────────────────────────────────────────────────────────────────┬────────────╮
2166 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2167 │D5a. What would you say is your primary Cuban │ 13│ 7│
2168 │ethnic background? Mexican │ 175│ 136│
2170 │ South American │ 21│ 13│
2171 │ Central American │ 27│ 25│
2172 │ Puerto Rican, OR │ 37│ 41│
2173 │ Something else │ 35│ 33│
2174 │ Multiple - cannot │ 2│ 5│
2176 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2179 ╭──────────────────────────────────┬────────────╮
2185 ├──────────────────────────────────┼─────┼──────┤
2186 │QND5A Cuban │ 13│ 7│
2187 │ Mexican │ 175│ 136│
2189 │ South American │ 21│ 13│
2190 │ Central American │ 27│ 25│
2191 │ Puerto Rican, OR │ 37│ 41│
2192 │ Something else │ 35│ 33│
2193 │ Multiple - cannot choose one│ 2│ 5│
2194 ╰──────────────────────────────────┴─────┴──────╯
2197 ╭────────────────────────────────────────────────────────────────┬────────────╮
2203 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2204 │D5a. What would you say is your primary Cuban │ 13│ 7│
2205 │ethnic background? Mexican │ 175│ 136│
2207 │ South American │ 21│ 13│
2208 │ Central American │ 27│ 25│
2209 │ Puerto Rican, OR │ 37│ 41│
2210 │ Something else │ 35│ 33│
2211 │ Multiple - cannot │ 2│ 5│
2213 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2216 ╭────────────────────────────────────────────────────────────┬────────────────╮
2219 │ ├───────┬────────┤
2221 │ ├───────┼────────┤
2223 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2224 │QND5A D5a. What would you say is your Cuban │ 13│ 7│
2225 │primary ethnic background? Mexican │ 175│ 136│
2227 │ South American │ 21│ 13│
2228 │ Central American │ 27│ 25│
2229 │ Puerto Rican, OR │ 37│ 41│
2230 │ Something else │ 35│ 33│
2231 │ Multiple - cannot │ 2│ 5│
2233 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2236 ╭────────────────────────────┬─────┬──────╮
2240 ├────────────────────────────┼─────┼──────┤
2242 │Mexican │ 175│ 136│
2244 │South American │ 21│ 13│
2245 │Central American │ 27│ 25│
2246 │Puerto Rican, OR │ 37│ 41│
2247 │Something else │ 35│ 33│
2248 │Multiple - cannot choose one│ 2│ 5│
2249 ╰────────────────────────────┴─────┴──────╯
2253 AT_SETUP([CTABLES FORMAT EMPTY])
2254 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2255 AT_DATA([ctables.sps],
2257 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2258 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2259 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2261 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2263 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2264 │ │ D5. ETHNICITY: Are you of │
2265 │ │ Hispanic or Latino origin or │
2267 │ ├───────────────┬───────────────┤
2269 │ ├───────────────┼───────────────┤
2271 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2272 │D5a. What would you say is Cuban │ 20│ 0│
2273 │your primary ethnic Mexican │ 311│ 0│
2274 │background? Spanish │ 48│ 0│
2275 │ South American │ 34│ 0│
2276 │ Central American│ 52│ 0│
2277 │ Puerto Rican, OR│ 78│ 0│
2278 │ Something else │ 68│ 0│
2279 │ Multiple - │ 7│ 0│
2280 │ cannot choose │ │ │
2282 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2285 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2286 │ │ D5. ETHNICITY: Are you of │
2287 │ │ Hispanic or Latino origin or │
2289 │ ├───────────────┬───────────────┤
2291 │ ├───────────────┼───────────────┤
2293 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2294 │D5a. What would you say is Cuban │ 20│ │
2295 │your primary ethnic Mexican │ 311│ │
2296 │background? Spanish │ 48│ │
2297 │ South American │ 34│ │
2298 │ Central American│ 52│ │
2299 │ Puerto Rican, OR│ 78│ │
2300 │ Something else │ 68│ │
2302 │ cannot choose │ │ │
2304 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2307 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2308 │ │ D5. ETHNICITY: Are you of │
2309 │ │ Hispanic or Latino origin or │
2311 │ ├───────────────┬───────────────┤
2313 │ ├───────────────┼───────────────┤
2315 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2316 │D5a. What would you say is Cuban │ 20│n/a │
2317 │your primary ethnic Mexican │ 311│n/a │
2318 │background? Spanish │ 48│n/a │
2319 │ South American │ 34│n/a │
2320 │ Central American│ 52│n/a │
2321 │ Puerto Rican, OR│ 78│n/a │
2322 │ Something else │ 68│n/a │
2323 │ Multiple - │ 7│n/a │
2324 │ cannot choose │ │ │
2326 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2330 AT_SETUP([CTABLES FORMAT MISSING])
2331 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2332 AT_DATA([ctables.sps],
2334 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2336 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2338 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2339 │ │ D5. ETHNICITY: Are you of │
2340 │ │ Hispanic or Latino origin or │
2342 │ ├───────────────┬───────────────┤
2344 │ ├───────────────┼───────────────┤
2345 │ │ Column % │ Column % │
2346 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2347 │D5a. What would you say is Cuban │ 3.2%│(no data) │
2348 │your primary ethnic Mexican │ 50.3%│(no data) │
2349 │background? Spanish │ 7.8%│(no data) │
2350 │ South American │ 5.5%│(no data) │
2351 │ Central American│ 8.4%│(no data) │
2352 │ Puerto Rican, OR│ 12.6%│(no data) │
2353 │ Something else │ 11.0%│(no data) │
2354 │ Multiple - │ 1.1%│(no data) │
2355 │ cannot choose │ │ │
2357 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2361 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2362 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2363 AT_DATA([ctables.sps],
2365 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2366 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2367 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2369 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2371 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2373 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2374 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2375 │occasion? 1 │ 491│ 34.9%│
2395 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2398 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2400 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2401 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2402 │occasion? 1 │ 491│ 34.9%│
2422 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2425 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2427 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2428 │38. How many drinks did you have on that Less than one│<10 │ .5%│
2429 │occasion? 1 │ 491│ 34.9%│
2449 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2453 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2454 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2455 AT_DATA([ctables.sps],
2457 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2459 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2471 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2472 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2473 maximumColumnWidth="192"
2474 minimumColumnWidth="96"
2478 AT_SETUP([CTABLES special formats])
2479 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2480 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2481 AT_DATA([ctables.sps],
2483 COMPUTE x = qnd3 - 4.
2484 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].
2486 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2488 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2489 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2490 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2491 │x│(3.0) │N=-3.0 │(-3.0) │(-3.0%)│8.0 │N=8.0 │(8.0) │(8.0%) │
2492 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯