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
17 dnl - Summary functions:
18 dnl * U-prefix for unweighted summaries.
19 dnl * areaPCT.SUM and UareaPCT.SUM functions.
20 dnl - SPLIT FILE with SEPARATE splits
21 dnl - Definition of columns/rows when labels are rotated from one axis to another.
24 dnl - Multiple response sets
25 dnl - MRSETS subcommand.
26 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
29 dnl - Summary functions:
30 dnl * .LCL and .UCL suffixes.
33 dnl * Data-dependent sorting.
35 AT_SETUP([CTABLES parsing])
36 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
37 AT_DATA([ctables.sps],
40 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
41 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
42 /FORMAT UNITS=CM EMPTY="(-)"
43 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
44 /VLABELS VARIABLES=qn17 DISPLAY=NAME
45 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
46 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
47 /VLABELS VARIABLES=qn20 DISPLAY=NONE
48 /MRSETS COUNTDUPLICATES=NO
49 /MRSETS COUNTDUPLICATES=YES
52 /WEIGHT VARIABLE=qns3a
54 /HIDESMALLCOUNTS COUNT=10
56 /SLABELS POSITION=COLUMN VISIBLE=YES
57 /SLABELS VISIBLE=NO POSITION=ROW
58 /SLABELS POSITION=LAYER
60 /CLABELS ROWLABELS=OPPOSITE
62 /CATEGORIES VARIABLES=qn1 qn17
63 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
64 POSITION=BEFORE EMPTY=INCLUDE.
65 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
66 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
67 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
69 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
72 ╭───────────────────┬────┬────╮
74 ├───────────────────┼────┼────┤
75 │Sa1. SAMPLE SOURCE:│5392│1607│
76 ╰───────────────────┴────┴────╯
80 ╭───────────────────┬─────╮
82 ├───────────────────┼─────┤
83 │Sa1. SAMPLE SOURCE:│ 5392│
84 ╰───────────────────┴─────╯
87 ╭────────────────────────┬─────╮
89 ├────────────────────────┼─────┤
90 │Sa1. SAMPLE SOURCE: RDD │ 5392│
92 ╰────────────────────────┴─────╯
95 ╭────────────────────────┬─────╮
97 ├────────────────────────┼─────┤
98 │Sa1. SAMPLE SOURCE: RDD │ 5392│
100 ╰────────────────────────┴─────╯
104 AT_SETUP([CTABLES parsing - negative])
105 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
106 AT_DATA([ctables.sps],
109 CTABLES /FORMAT MINCOLWIDTH='foo'.
110 CTABLES /TABLE qn1 [**].
111 CTABLES /TABLE qn1 [NOTAFUNCTION].
114 CTABLES /TABLE NOTAVAR.
116 CTABLES /TABLE string[S].
117 CTABLES /TABLE qn1 [PTILE 101].
118 CTABLES /TABLE qn1 [MEAN F0.1].
119 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
120 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
121 CTABLES /TABLE qn1 [MEAN TOTALS].
122 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
123 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
124 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
127 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
128 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
129 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
130 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
131 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
132 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
133 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
134 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
135 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
136 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
137 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
138 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
139 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
140 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
141 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
142 CTABLES /PCOMPUTE &k=EXPR([LO **]).
143 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
144 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
145 CTABLES /PCOMPUTE &k=EXPR([1**]).
146 CTABLES /PCOMPUTE &k=EXPR((1x)).
147 CTABLES /PCOMPUTE **k.
148 CTABLES /PCOMPUTE &1.
149 CTABLES /PCOMPUTE &k**.
150 CTABLES /PCOMPUTE &k=**.
151 CTABLES /PCOMPUTE &k=EXPR**.
152 CTABLES /PCOMPUTE &k=EXPR(1x).
153 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
154 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
155 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
156 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
157 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
158 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
159 CTABLES /FORMAT EMPTY=**.
160 CTABLES /FORMAT MISSING=**.
162 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
164 CTABLES /VLABELS VARIABLES=NOTAVAR.
165 CTABLES /VLABELS VARIABLES=qn1 **.
166 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
168 CTABLES /MRSETS COUNTDUPLICATES=**.
169 CTABLES /SMISSING **.
171 CTABLES /WEIGHT VARIABLE=NOTAVAR.
172 CTABLES /HIDESMALLCOUNTS COUNT=1.
174 CTABLES /HIDESMALLCOUNTS COUNT=2.
175 CTABLES /TABLE qn1**.
176 CTABLES /TABLE qn1 /SLABELS POSITION=**.
177 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
178 CTABLES /TABLE qn1 /SLABELS **.
179 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
180 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
181 CTABLES /TABLE qn1 /CLABELS **.
182 CTABLES /TABLE qn1 /CRITERIA **.
183 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
184 CTABLES /TABLE qn1 /TITLES **.
185 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
186 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
187 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
188 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
189 CTABLES /TABLE qn1 /SIGTEST **.
190 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
191 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
192 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
193 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
194 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
195 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
196 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
197 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
198 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
199 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
200 CTABLES /TABLE qn1 /COMPARETEST **.
201 CTABLES /TABLE qn1 / **.
202 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
203 CTABLES /TABLE qn20 > qnd1.
204 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
205 NUMERIC datetime (DATETIME17.0).
206 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
208 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
209 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
211 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
212 negative number for MINCOLWIDTH.
214 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
217 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
218 summary function name.
220 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
222 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
225 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
227 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
229 10 | CTABLES /TABLE string[S].
232 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
233 between 0 and 100 for PTILE.
235 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
236 requires a width between 1 and 40.
238 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
239 format NEGPAREN requires width 2 or greater.
241 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
242 format NEGPAREN requires width greater than decimals.
244 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
246 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
249 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
250 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
253 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
255 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
257 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
260 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
261 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
264 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
266 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
268 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
270 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
272 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
274 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
276 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
279 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
280 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
283 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
284 between 0 and 100 for PTILE.
286 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
289 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
292 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
295 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
298 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
300 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
303 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
306 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
307 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
309 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
310 LABEL, POSITION, or EMPTY.
312 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
313 integer for SUBTOTAL.
315 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
317 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
319 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
321 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
323 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
325 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
327 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
329 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
331 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
333 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
335 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
337 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
339 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
340 the previous definition.
341 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
342 | ^~~~~~~~~~~~~~~~~~~
344 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
345 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
346 | ^~~~~~~~~~~~~~~~~~~
348 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
351 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
352 Expecting summary function name.
354 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
355 between 0 and 100 for PTILE.
357 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
359 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
362 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
363 FORMAT, or HIDESOURCECATS.
365 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
367 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
369 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
370 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
372 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
375 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
378 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
380 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
383 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
384 DEFAULT, NAME, LABEL, BOTH, or NONE.
386 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
389 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
392 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
393 VARIABLE or LISTWISE.
395 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
398 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
400 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
401 greater for HIDESMALLCOUNTS COUNT.
403 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
404 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
405 HIDESMALLCOUNTS, or TABLE.
407 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
410 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
412 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
415 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
418 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
421 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
424 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
427 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
428 ROWLABELS, or COLLABELS.
430 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
433 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
434 in @<:@0,100@:}@ for CILEVEL.
436 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
437 CAPTION, CORNER, or TITLE.
439 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
442 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
443 in @<:@0,1@:}@ for ALPHA.
445 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
448 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
449 ALLVISIBLE or SUBTOTALS.
451 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
452 ALPHA, INCLUDEMRSETS, or CATEGORIES.
454 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
457 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
460 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
463 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
464 BONFERRONI, BH, or NONE.
466 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
469 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
472 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
473 ALLVISIBLE or SUBTOTALS.
475 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
478 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
481 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
484 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
485 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
488 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
489 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
491 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
494 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
495 97 | CTABLES /TABLE qn20 > qnd1.
498 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
499 97 | CTABLES /TABLE qn20 > qnd1.
502 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
503 97 | CTABLES /TABLE qn20 > qnd1.
506 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
507 categorical variables at the innermost nesting level.
508 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
509 | ^~~~~~~~~~~~~~~~~~~~
511 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
513 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
516 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
517 specification as format DATETIME: Day (123) must be between 1 and 31..
518 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
523 AT_SETUP([CTABLES parsing - more negative])
524 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
525 AT_DATA([ctables.sps],
527 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
528 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
529 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
532 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
533 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
535 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
537 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
538 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
539 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
540 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
542 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
543 CTABLES /PCOMPUTE &x=EXPR([**]).
544 CTABLES /PCOMPUTE &x=EXPR(**).
548 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
550 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
551 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
552 category not included in the category list.
553 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
558 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
559 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
563 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
564 list of categories here.
565 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
570 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
571 category not included in the category list.
572 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
577 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
578 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
582 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
583 variable's CATEGORIES specification.
585 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
586 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
587 subtotals by position, e.g. SUBTOTAL[1].
588 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
589 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
591 ^~~~~~~~~~~~~~~~~~~~~~~~
593 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
595 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
596 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
599 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
600 applied only to string variables, but this subcommand tries to apply it to
601 numeric variable QN1.
602 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
605 ctables.sps:8.53: error: CTABLES: This category specification may be applied
606 only to numeric variables, but this subcommand tries to apply it to string
608 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
611 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
612 based on a summary function.
614 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
615 moved to be categorical, but qnd1 is a scale variable.
617 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
618 moved to have the same width, but QN1 has width 0 and string has width 8.
620 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
621 moved to have the same value labels, but QN1 and QNSA1 have different value
624 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
625 moved to have the same category specifications, but QN105BA and QN105BB have
626 different category specifications.
628 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
629 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
630 this warning, insert parentheses.
631 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
634 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
637 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
639 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
641 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
642 variable must be specified.
644 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
646 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
648 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
651 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
653 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
656 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
658 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
661 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
662 has a summary even if the syntax does not explicitly specify one.
663 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
668 AT_SETUP([CTABLES one categorical variable])
669 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
670 AT_DATA([ctables.sps],
673 CTABLES /TABLE BY qn1.
674 CTABLES /TABLE BY BY qn1.
676 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
678 ╭────────────────────────────────────────────────────────────────────────┬─────╮
680 ├────────────────────────────────────────────────────────────────────────┼─────┤
681 │ 1. How often do you usually drive a car or other Every day │ 4667│
682 │motor vehicle? Several days a week │ 1274│
683 │ Once a week or less │ 361│
684 │ Only certain times a │ 130│
687 ╰────────────────────────────────────────────────────────────────────────┴─────╯
690 ╭──────────────────────────────────────────────────────────────────────────────╮
691 │ 1. How often do you usually drive a car or other motor vehicle? │
692 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
693 │ │ Several days a │ Once a week or │ Only certain times a │ │
694 │Every day│ week │ less │ year │Never│
695 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
696 │ Count │ Count │ Count │ Count │Count│
697 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
698 │ 4667│ 1274│ 361│ 130│ 540│
699 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
711 AT_SETUP([CTABLES one string variable])
712 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
713 AT_DATA([ctables.sps],
716 MISSING VALUES licensed('DontKnow', 'Refused').
717 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
718 CTABLES /TABLE licensed.
719 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
720 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
721 * Notice that the string matching is case-sensitive.
722 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
723 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
725 /PCOMPUTE ¬yes=EXPR(['No']+['DontKnow']+['Refused'])
726 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
728 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'No', 'DontKnow', 'Refused'].
730 /PCOMPUTE ¬yes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
731 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
733 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'DontKnow' THRU 'No', 'Refused'].
735 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
745 ╭─────────────────┬─────┬───────╮
747 ├─────────────────┼─────┼───────┤
748 │licensed DontKnow│ 4│ │
752 │ Total │ 6999│ 6951│
753 ╰─────────────────┴─────┴───────╯
756 ╭──────────────┬─────╮
758 ├──────────────┼─────┤
759 │licensed Yes │ 6379│
762 ╰──────────────┴─────╯
765 ╭──────────────┬─────╮
767 ├──────────────┼─────┤
768 │licensed Yes │ 6379│
771 ╰──────────────┴─────╯
774 ╭────────────────┬─────╮
776 ├────────────────┼─────┤
781 ╰────────────────┴─────╯
784 ╭────────────────┬─────╮
786 ├────────────────┼─────┤
787 │licensed Yes │ 6379│
789 ╰────────────────┴─────╯
792 ╭────────────────┬─────╮
794 ├────────────────┼─────┤
795 │licensed Yes │ 6379│
797 ╰────────────────┴─────╯
801 AT_SETUP([CTABLES one scale variable])
802 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
803 AT_DATA([ctables.sps],
805 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
806 CTABLES /TABLE BY qnd1.
807 CTABLES /TABLE BY BY qnd1.
809 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
811 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
812 │ │ │ │ │ │ Std │ │ │
813 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
814 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
815 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
816 │age? │ │ │ │ │ │ │ │
817 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
820 ╭──────────────────────────╮
821 │D1. AGE: What is your age?│
822 ├──────────────────────────┤
824 ├──────────────────────────┤
826 ╰──────────────────────────╯
829 D1. AGE: What is your age?
838 AT_SETUP([CTABLES simple stacking])
839 AT_KEYWORDS([stack stacked])
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_KEYWORDS([nest nested])
1077 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1078 AT_DATA([ctables.sps],
1080 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1081 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1082 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1083 /CATEGORIES VARIABLES=qns3a TOTAL=YES
1084 /CLABELS ROW=OPPOSITE.
1086 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1088 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1091 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1092 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
1093 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
1094 │drive safely will A. Get stopped by Total │ 700│ 10%│
1095 │the police? ╶──────────────────────────┼─────┼──────┤
1096 │ Very S3a. Male │ 660│ 10%│
1097 │ likely GENDER: Female│ 842│ 12%│
1098 │ Total │ 1502│ 22%│
1099 │ ╶──────────────────────────┼─────┼──────┤
1100 │ Somewhat S3a. Male │ 1174│ 17%│
1101 │ likely GENDER: Female│ 1589│ 23%│
1102 │ Total │ 2763│ 40%│
1103 │ ╶──────────────────────────┼─────┼──────┤
1104 │ Somewhat S3a. Male │ 640│ 9%│
1105 │ unlikely GENDER: Female│ 667│ 10%│
1106 │ Total │ 1307│ 19%│
1107 │ ╶──────────────────────────┼─────┼──────┤
1108 │ Very S3a. Male │ 311│ 5%│
1109 │ unlikely GENDER: Female│ 298│ 4%│
1111 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1112 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
1113 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
1114 │drive safely will B. Have an accident? Total │ 1100│ 16%│
1115 │ ╶──────────────────────────┼─────┼──────┤
1116 │ Very S3a. Male │ 1104│ 16%│
1117 │ likely GENDER: Female│ 1715│ 25%│
1118 │ Total │ 2819│ 41%│
1119 │ ╶──────────────────────────┼─────┼──────┤
1120 │ Somewhat S3a. Male │ 1203│ 17%│
1121 │ likely GENDER: Female│ 1214│ 18%│
1122 │ Total │ 2417│ 35%│
1123 │ ╶──────────────────────────┼─────┼──────┤
1124 │ Somewhat S3a. Male │ 262│ 4%│
1125 │ unlikely GENDER: Female│ 168│ 2%│
1127 │ ╶──────────────────────────┼─────┼──────┤
1128 │ Very S3a. Male │ 81│ 1%│
1129 │ unlikely GENDER: Female│ 59│ 1%│
1131 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1132 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
1133 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
1134 │drive safely will C. Be convicted for Total │ 1149│ 17%│
1135 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1136 │ Very S3a. Male │ 988│ 14%│
1137 │ likely GENDER: Female│ 1049│ 15%│
1138 │ Total │ 2037│ 30%│
1139 │ ╶──────────────────────────┼─────┼──────┤
1140 │ Somewhat S3a. Male │ 822│ 12%│
1141 │ likely GENDER: Female│ 1210│ 18%│
1142 │ Total │ 2032│ 30%│
1143 │ ╶──────────────────────────┼─────┼──────┤
1144 │ Somewhat S3a. Male │ 446│ 7%│
1145 │ unlikely GENDER: Female│ 548│ 8%│
1147 │ ╶──────────────────────────┼─────┼──────┤
1148 │ Very S3a. Male │ 268│ 4%│
1149 │ unlikely GENDER: Female│ 354│ 5%│
1151 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1152 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1153 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1154 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1155 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1156 │ Very S3a. Male │ 805│ 12%│
1157 │ likely GENDER: Female│ 1029│ 15%│
1158 │ Total │ 1834│ 27%│
1159 │ ╶──────────────────────────┼─────┼──────┤
1160 │ Somewhat S3a. Male │ 975│ 14%│
1161 │ likely GENDER: Female│ 1332│ 19%│
1162 │ Total │ 2307│ 34%│
1163 │ ╶──────────────────────────┼─────┼──────┤
1164 │ Somewhat S3a. Male │ 535│ 8%│
1165 │ unlikely GENDER: Female│ 560│ 8%│
1166 │ Total │ 1095│ 16%│
1167 │ ╶──────────────────────────┼─────┼──────┤
1168 │ Very S3a. Male │ 270│ 4%│
1169 │ unlikely GENDER: Female│ 279│ 4%│
1171 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1174 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1175 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1176 │ │ certain│likely│ likely │ unlikely│unlikely│
1177 │ ├────────┼──────┼─────────┼─────────┼────────┤
1179 │ │ Table %│ % │ Table % │ Table % │ Table %│
1180 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1181 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1182 │GENDER: is it that drivers│ │ │ │ │ │
1183 │ who have had too │ │ │ │ │ │
1184 │ much to drink to │ │ │ │ │ │
1185 │ drive safely will │ │ │ │ │ │
1186 │ A. Get stopped by │ │ │ │ │ │
1187 │ the police? │ │ │ │ │ │
1188 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1189 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1190 │ is it that drivers│ │ │ │ │ │
1191 │ who have had too │ │ │ │ │ │
1192 │ much to drink to │ │ │ │ │ │
1193 │ drive safely will │ │ │ │ │ │
1194 │ A. Get stopped by │ │ │ │ │ │
1195 │ the police? │ │ │ │ │ │
1196 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1197 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1198 │ is it that drivers│ │ │ │ │ │
1199 │ who have had too │ │ │ │ │ │
1200 │ much to drink to │ │ │ │ │ │
1201 │ drive safely will │ │ │ │ │ │
1202 │ A. Get stopped by │ │ │ │ │ │
1203 │ the police? │ │ │ │ │ │
1204 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1205 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1206 │GENDER: is it that drivers│ │ │ │ │ │
1207 │ who have had too │ │ │ │ │ │
1208 │ much to drink to │ │ │ │ │ │
1209 │ drive safely will │ │ │ │ │ │
1210 │ B. Have an │ │ │ │ │ │
1211 │ accident? │ │ │ │ │ │
1212 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1213 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1214 │ is it that drivers│ │ │ │ │ │
1215 │ who have had too │ │ │ │ │ │
1216 │ much to drink to │ │ │ │ │ │
1217 │ drive safely will │ │ │ │ │ │
1218 │ B. Have an │ │ │ │ │ │
1219 │ accident? │ │ │ │ │ │
1220 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1221 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1222 │ is it that drivers│ │ │ │ │ │
1223 │ who have had too │ │ │ │ │ │
1224 │ much to drink to │ │ │ │ │ │
1225 │ drive safely will │ │ │ │ │ │
1226 │ B. Have an │ │ │ │ │ │
1227 │ accident? │ │ │ │ │ │
1228 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1229 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1230 │GENDER: is it that drivers│ │ │ │ │ │
1231 │ who have had too │ │ │ │ │ │
1232 │ much to drink to │ │ │ │ │ │
1233 │ drive safely will │ │ │ │ │ │
1234 │ C. Be convicted │ │ │ │ │ │
1235 │ for drunk driving?│ │ │ │ │ │
1236 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1237 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1238 │ is it that drivers│ │ │ │ │ │
1239 │ who have had too │ │ │ │ │ │
1240 │ much to drink to │ │ │ │ │ │
1241 │ drive safely will │ │ │ │ │ │
1242 │ C. Be convicted │ │ │ │ │ │
1243 │ for drunk driving?│ │ │ │ │ │
1244 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1245 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1246 │ is it that drivers│ │ │ │ │ │
1247 │ who have had too │ │ │ │ │ │
1248 │ much to drink to │ │ │ │ │ │
1249 │ drive safely will │ │ │ │ │ │
1250 │ C. Be convicted │ │ │ │ │ │
1251 │ for drunk driving?│ │ │ │ │ │
1252 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1253 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1254 │GENDER: is it that drivers│ │ │ │ │ │
1255 │ who have had too │ │ │ │ │ │
1256 │ much to drink to │ │ │ │ │ │
1257 │ drive safely will │ │ │ │ │ │
1258 │ D. Be arrested for│ │ │ │ │ │
1259 │ drunk driving? │ │ │ │ │ │
1260 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1261 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1262 │ is it that drivers│ │ │ │ │ │
1263 │ who have had too │ │ │ │ │ │
1264 │ much to drink to │ │ │ │ │ │
1265 │ drive safely will │ │ │ │ │ │
1266 │ D. Be arrested for│ │ │ │ │ │
1267 │ drunk driving? │ │ │ │ │ │
1268 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1269 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1270 │ is it that drivers│ │ │ │ │ │
1271 │ who have had too │ │ │ │ │ │
1272 │ much to drink to │ │ │ │ │ │
1273 │ drive safely will │ │ │ │ │ │
1274 │ D. Be arrested for│ │ │ │ │ │
1275 │ drunk driving? │ │ │ │ │ │
1276 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1280 AT_SETUP([CTABLES nesting and scale variables])
1281 AT_KEYWORDS([nest nested])
1282 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1283 AT_DATA([ctables.sps],
1285 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1286 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1287 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1288 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1289 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1291 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1293 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1299 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1300 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1301 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1303 │ Once a week or │ 44│ 54│
1305 │ Only certain │ 34│ 41│
1306 │ times a year │ │ │
1308 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1311 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1312 │ │Minimum│Maximum│Mean│
1313 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1314 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1315 │What is GENDER: months, has there been a │ │ │ │
1316 │your time when you felt you │ │ │ │
1317 │age? should cut down on your No │ 16│ 86│ 46│
1319 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1320 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1321 │ months, has there been a │ │ │ │
1322 │ time when you felt you │ │ │ │
1323 │ should cut down on your No │ 16│ 86│ 48│
1325 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1326 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1327 │What is GENDER: months, has there been a │ │ │ │
1328 │your time when people criticized No │ 16│ 86│ 46│
1329 │age? your drinking? │ │ │ │
1330 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1331 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1332 │ months, has there been a │ │ │ │
1333 │ time when people criticized No │ 16│ 86│ 48│
1334 │ your drinking? │ │ │ │
1335 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1338 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1339 │ │S1. Including yourself, how many members of this│
1340 │ │ household are age 16 or older? │
1341 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1342 │ │ │ │ │ │ │ │ 6 or │
1343 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1344 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1345 │ │Column│Column│Column│Column│Column│Column│Column│
1346 │ │ % │ % │ % │ % │ % │ % │ % │
1347 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1348 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1349 │SAMPLE How certain │ │ │ │ │ │ │ │
1350 │SOURCE: likely │ │ │ │ │ │ │ │
1351 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1352 │ that likely │ │ │ │ │ │ │ │
1353 │ drivers │ │ │ │ │ │ │ │
1354 │ who have │ │ │ │ │ │ │ │
1355 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1356 │ much to likely │ │ │ │ │ │ │ │
1357 │ drink to │ │ │ │ │ │ │ │
1358 │ drive │ │ │ │ │ │ │ │
1359 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1360 │ will A. unlikely│ │ │ │ │ │ │ │
1361 │ Get │ │ │ │ │ │ │ │
1362 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1363 │ by the unlikely│ │ │ │ │ │ │ │
1364 │ police? │ │ │ │ │ │ │ │
1365 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1368 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1371 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1372 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1373 │group typical month did you have one or more │ │ │
1374 │ alcoholic beverages to drink? │ │ │
1375 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1376 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1377 │ typical month did you have one or more │ │ │
1378 │ alcoholic beverages to drink? │ │ │
1379 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1380 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1381 │ typical month did you have one or more │ │ │
1382 │ alcoholic beverages to drink? │ │ │
1383 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1384 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1385 │ typical month did you have one or more │ │ │
1386 │ alcoholic beverages to drink? │ │ │
1387 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1388 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1389 │ typical month did you have one or more │ │ │
1390 │ alcoholic beverages to drink? │ │ │
1391 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1392 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1393 │ older typical month did you have one or more │ │ │
1394 │ alcoholic beverages to drink? │ │ │
1395 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1400 AT_SETUP([CTABLES SLABELS])
1401 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1402 AT_DATA([ctables.sps],
1404 CTABLES /TABLE qn1 [COUNT COLPCT].
1405 CTABLES /TABLE qn1 [COUNT COLPCT]
1406 /SLABELS POSITION=ROW.
1407 CTABLES /TABLE qn1 [COUNT COLPCT]
1408 /SLABELS POSITION=ROW VISIBLE=NO.
1410 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1412 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1415 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1416 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1417 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1418 │ Once a week or less│ 361│ 5.2%│
1419 │ Only certain times │ 130│ 1.9%│
1421 │ Never │ 540│ 7.7%│
1422 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1425 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1426 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1427 │other motor vehicle? Column │66.9%│
1429 │ ╶───────────────────────────┼─────┤
1430 │ Several days a week Count │ 1274│
1433 │ ╶───────────────────────────┼─────┤
1434 │ Once a week or less Count │ 361│
1437 │ ╶───────────────────────────┼─────┤
1438 │ Only certain times Count │ 130│
1439 │ a year Column │ 1.9%│
1441 │ ╶───────────────────────────┼─────┤
1442 │ Never Count │ 540│
1445 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1448 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1449 │ 1. How often do you usually drive a car or other Every day │ 4667│
1450 │motor vehicle? │66.9%│
1451 │ Several days a week │ 1274│
1453 │ Once a week or less │ 361│
1455 │ Only certain times a │ 130│
1459 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1463 AT_SETUP([CTABLES simple totals])
1464 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1465 AT_DATA([ctables.sps],
1468 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1469 DESCRIPTIVES qn18/STATISTICS=MEAN.
1470 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1471 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1473 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1475 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1477 ├────────────────────────────────────────────────────────────────────────┼─────┤
1478 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1479 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1482 │ Wine coolers │ 137│
1483 │ Hard liquor or │ 888│
1485 │ Flavored malt │ 83│
1487 │ Number responding │ 4221│
1488 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1490 Descriptive Statistics
1491 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1493 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1494 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1495 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1496 │Valid N (listwise) │6999│ │
1497 │Missing N (listwise) │2781│ │
1498 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1501 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1502 │ │ │ │ Valid│Total│
1503 │ │Mean│Count│ N │ N │
1504 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1505 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1506 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1507 │ you usually drink per sitting? │ │ │ │ │
1508 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1509 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1510 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1511 │ you usually drink per sitting? │ │ │ │ │
1512 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1513 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1514 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1515 │ you usually drink per sitting? │ │ │ │ │
1516 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1517 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1518 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1519 │ you usually drink per sitting? │ │ │ │ │
1520 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1521 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1522 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1523 │ you usually drink per sitting? │ │ │ │ │
1524 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1528 AT_SETUP([CTABLES subtotals])
1529 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1530 AT_DATA([ctables.sps],
1532 CTABLES /TABLE=qn105ba BY qns1
1533 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1534 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1535 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1536 CTABLES /TABLE=qn105ba BY qns1
1537 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1538 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1540 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1542 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1543 │ │ S1. Including yourself, how many members of this household │
1544 │ │ are age 16 or older? │
1545 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1546 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1547 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1548 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1549 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1550 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1551 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1552 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1553 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1554 │ likely │ │ │ │ │ │ │ │
1555 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1556 │ unlikely │ │ │ │ │ │ │ │
1557 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1558 │ unlikely │ │ │ │ │ │ │ │
1559 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1562 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1563 │ │ S1. Including yourself, how many members of this household │
1564 │ │ are age 16 or older? │
1565 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1566 │ │ │ │ │ │ │ │ 6 or │
1567 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1568 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1569 │ │ │ │ │ │ Column│ │ │
1570 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1571 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1572 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1573 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1574 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1575 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1576 │ likely │ │ │ │ │ │ │ │
1577 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1578 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1579 │ unlikely │ │ │ │ │ │ │ │
1580 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1581 │ unlikely │ │ │ │ │ │ │ │
1582 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1583 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1586 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1587 │ │ S1. Including yourself, how many members of this household │
1588 │ │ are age 16 or older? │
1589 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1590 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1591 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1592 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1593 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1594 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1595 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1596 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1597 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1598 │ likely │ │ │ │ │ │ │ │
1599 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1600 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1601 │ unlikely │ │ │ │ │ │ │ │
1602 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1603 │ unlikely │ │ │ │ │ │ │ │
1604 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1605 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1609 AT_SETUP([CTABLES PCOMPUTE])
1610 AT_KEYWORDS([postcompute])
1611 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1612 AT_DATA([ctables.sps],
1615 /PCOMPUTE &x=EXPR([3] + [4])
1616 /PCOMPUTE &y=EXPR([4] + [5])
1617 /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1618 /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1619 /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1620 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1622 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1624 /PCOMPUTE &x=EXPR([3] + [4])
1625 /PCOMPUTE &y=EXPR([4] + [5])
1626 /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1627 /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1628 /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1629 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1631 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1633 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1634 │ │ S1. Including yourself, how many members of this household are age 16 or older? │
1635 │ ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1636 │ │ 1 │ 2 │ Subtotal │ 3 │ 4 │ 5 │ 3+4 │ 4+5 │ Subtotal │ Total │
1637 │ ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1638 │ │ │ │ │ │ │ │ │ │ │ Row│ │ Row│ │ │ │ Row│ │ │ │ │
1639 │ │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│ % │Count│ % │ Count│Row %│Count│ % │Count│Row %│Count│ Row %│
1640 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1641 │105b. How Almost │ 147│30.3%│ 246│50.7%│ 393│81.0%│ 62│12.8%│ 19│3.9%│ 11│2.3%│ 81.00│16.7%│ 30│6.2%│ 92│19.0%│ 485│100.0%│
1642 │likely is certain │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1643 │it that │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1644 │drivers Very │ 384│34.3%│ 552│49.2%│ 936│83.5%│ 120│10.7%│ 51│4.5%│ 14│1.2%│171.00│15.3%│ 65│5.8%│ 185│16.5%│ 1121│100.0%│
1645 │who have likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1646 │had too │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1647 │much to Somewhat│ 590│27.8%│ 1249│58.8%│ 1839│86.6%│ 193│ 9.1%│ 72│3.4%│ 20│ .9%│265.00│12.5%│ 92│4.3%│ 285│13.4%│ 2124│100.0%│
1648 │drink to likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1649 │drive │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1650 │safely Somewhat│ 278│26.6%│ 647│61.8%│ 925│88.3%│ 84│ 8.0%│ 32│3.1%│ 6│ .6%│116.00│11.1%│ 38│3.6%│ 122│11.7%│ 1047│100.0%│
1651 │will A. unlikely│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1652 │Get │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1653 │stopped by Very │ 141│28.5%│ 290│58.7%│ 431│87.2%│ 41│ 8.3%│ 18│3.6%│ 4│ .8%│ 59.00│11.9%│ 22│4.5%│ 63│12.8%│ 494│100.0%│
1654 │the unlikely│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1655 │police? │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1656 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1659 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1660 │ │ S1. Including yourself, how many members of this household are age 16 or older? │
1661 │ ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1662 │ │ 1 │ 2 │ Subtotal │ 3 │ 3+4 │ 4+5 │ Subtotal │ Total │
1663 │ ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1664 │ │ │ │ │ │ │ │ │ │ │ │ │ Row│ │ │ │ │
1665 │ │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│ % │Count│Row %│Count│ Row %│
1666 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1667 │105b. How likely is it that Almost │ 147│30.3%│ 246│50.7%│ 393│81.0%│ 62│12.8%│ 81.00│16.7%│ 30│6.2%│ 92│19.0%│ 485│100.0%│
1668 │drivers who have had too much certain │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1669 │to drink to drive safely will Very │ 384│34.3%│ 552│49.2%│ 936│83.5%│ 120│10.7%│171.00│15.3%│ 65│5.8%│ 185│16.5%│ 1121│100.0%│
1670 │A. Get stopped by the police? likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1671 │ Somewhat │ 590│27.8%│ 1249│58.8%│ 1839│86.6%│ 193│ 9.1%│265.00│12.5%│ 92│4.3%│ 285│13.4%│ 2124│100.0%│
1672 │ likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1673 │ Somewhat │ 278│26.6%│ 647│61.8%│ 925│88.3%│ 84│ 8.0%│116.00│11.1%│ 38│3.6%│ 122│11.7%│ 1047│100.0%│
1674 │ unlikely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1675 │ Very │ 141│28.5%│ 290│58.7%│ 431│87.2%│ 41│ 8.3%│ 59.00│11.9%│ 22│4.5%│ 63│12.8%│ 494│100.0%│
1676 │ unlikely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1677 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1681 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1682 AT_KEYWORDS([postcompute])
1683 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1684 AT_DATA([ctables.sps],
1687 /PCOMPUTE &x=EXPR(OTHERNM)
1688 /PCOMPUTE &y=EXPR(MISSING)
1689 /PPROPERTIES &x LABEL='Drivers'
1690 /PPROPERTIES &y LABEL='Missing Values 2'
1692 /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1694 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1696 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1702 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1703 │ 1. How often do you usually drive a car or other motor vehicle? Every day │ 2305│ 2362│
1704 │ Several days a week │ 440│ 834│
1705 │ Once a week or less │ 125│ 236│
1706 │ Only certain times a year│ 58│ 72│
1708 │ Drivers │ 2928│ 3504│
1709 │ Valid Values │ 3120│ 3852│
1710 │ Don't know │ 3│ 5│
1712 │ Missing Values │ 12│ 15│
1713 │ Missing Values 2 │ 12│ 15│
1714 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1718 AT_SETUP([CTABLES PCOMPUTE - THRU])
1719 AT_KEYWORDS([postcompute])
1720 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1721 AT_DATA([ctables.sps],
1724 /PCOMPUTE &x=EXPR([1 THRU 2])
1725 /PCOMPUTE &y=EXPR([3 THRU 4])
1726 /PCOMPUTE &z=EXPR([5] + MISSING)
1727 /PPROPERTIES &x LABEL='Frequent Drivers'
1728 /PPROPERTIES &y LABEL='Infrequent Drivers'
1729 /PPROPERTIES &z LABEL='Not Drivers or Missing'
1731 /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1733 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1735 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1741 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1742 │ 1. How often do you usually drive a car or other motor vehicle? Every day │ 2305│ 2362│
1743 │ Several days a week │ 440│ 834│
1744 │ Frequent Drivers │ 2745│ 3196│
1745 │ Once a week or less │ 125│ 236│
1746 │ Only certain times a year│ 58│ 72│
1747 │ Infrequent Drivers │ 183│ 308│
1748 │ Drivers │ 2928│ 3504│
1750 │ Don't know │ 3│ 5│
1752 │ Not Drivers or Missing │ 204│ 363│
1753 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1757 dnl I'm not sure that this is the correct behavior (see
1758 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1759 dnl but at least this test will notify us if the behavior changes.
1760 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1761 AT_KEYWORDS([PCOMPUTE postcompute])
1762 AT_DATA([ctables.sps],
1763 [[DATA LIST LIST NOTABLE/x y z.
1766 VARIABLE LEVEL x y (NOMINAL).
1780 /PCOMPUTE &a = EXPR([1] + [2])
1781 /PCOMPUTE &b = EXPR([2] + [3])
1782 /PCOMPUTE &c = EXPR([4] * [5])
1783 /PCOMPUTE &d = EXPR([5] * [6])
1785 /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1786 /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1788 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1790 ╭───────────┬─────────────────────────────────────╮
1792 │ ├─────┬─────────┬─────┬─────────┬─────┤
1793 │ │ 4 │[4] * [5]│ 5 │[5] * [6]│ 6 │
1794 │ ├─────┼─────────┼─────┼─────────┼─────┤
1795 │ │Count│ Count │Count│ Count │Count│
1796 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1797 │x 1 │ 5│ 10│ 2│ 18│ 9│
1798 │ [1] + [2]│ 7│ .│ 5│ .│ 13│
1799 │ 2 │ 2│ 6│ 3│ 12│ 4│
1800 │ [2] + [3]│ 3│ .│ 9│ .│ 5│
1801 │ 3 │ 1│ 6│ 6│ 6│ 1│
1802 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1806 AT_SETUP([CTABLES CLABELS])
1807 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1808 AT_DATA([ctables.sps],
1810 CTABLES /TABLE AgeGroup BY qns3a.
1811 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1812 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1813 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1814 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1816 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1818 ╭───────────────────────┬────────────╮
1824 ├───────────────────────┼─────┼──────┤
1825 │Age group 15 or younger│ 0│ 0│
1826 │ 16 to 25 │ 594│ 505│
1827 │ 26 to 35 │ 476│ 491│
1828 │ 36 to 45 │ 489│ 548│
1829 │ 46 to 55 │ 526│ 649│
1830 │ 56 to 65 │ 516│ 731│
1831 │ 66 or older │ 531│ 943│
1832 ╰───────────────────────┴─────┴──────╯
1835 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1837 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1839 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1840 │ │ 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 │
1841 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1842 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1843 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1844 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1845 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1846 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1847 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1850 ╭──────────────────────────────┬────────────╮
1854 ├──────────────────────────────┼────────────┤
1855 │Age group 15 or younger Male │ 0│
1857 │ ╶────────────────────┼────────────┤
1858 │ 16 to 25 Male │ 594│
1860 │ ╶────────────────────┼────────────┤
1861 │ 26 to 35 Male │ 476│
1863 │ ╶────────────────────┼────────────┤
1864 │ 36 to 45 Male │ 489│
1866 │ ╶────────────────────┼────────────┤
1867 │ 46 to 55 Male │ 526│
1869 │ ╶────────────────────┼────────────┤
1870 │ 56 to 65 Male │ 516│
1872 │ ╶────────────────────┼────────────┤
1873 │ 66 or older Male │ 531│
1875 ╰──────────────────────────────┴────────────╯
1879 ╭─────────┬────────────╮
1885 ├─────────┼─────┼──────┤
1887 ╰─────────┴─────┴──────╯
1891 ╭─────────┬────────────╮
1897 ├─────────┼─────┼──────┤
1898 │Age group│ 594│ 505│
1899 ╰─────────┴─────┴──────╯
1903 ╭─────────┬────────────╮
1909 ├─────────┼─────┼──────┤
1910 │Age group│ 476│ 491│
1911 ╰─────────┴─────┴──────╯
1915 ╭─────────┬────────────╮
1921 ├─────────┼─────┼──────┤
1922 │Age group│ 489│ 548│
1923 ╰─────────┴─────┴──────╯
1927 ╭─────────┬────────────╮
1933 ├─────────┼─────┼──────┤
1934 │Age group│ 526│ 649│
1935 ╰─────────┴─────┴──────╯
1939 ╭─────────┬────────────╮
1945 ├─────────┼─────┼──────┤
1946 │Age group│ 516│ 731│
1947 ╰─────────┴─────┴──────╯
1951 ╭─────────┬────────────╮
1957 ├─────────┼─────┼──────┤
1958 │Age group│ 531│ 943│
1959 ╰─────────┴─────┴──────╯
1963 ╭───────────────────────┬────────────╮
1967 ├───────────────────────┼────────────┤
1968 │Age group 15 or younger│ 0│
1974 │ 66 or older │ 531│
1975 ╰───────────────────────┴────────────╯
1979 ╭───────────────────────┬────────────╮
1983 ├───────────────────────┼────────────┤
1984 │Age group 15 or younger│ 0│
1990 │ 66 or older │ 943│
1991 ╰───────────────────────┴────────────╯
1995 AT_SETUP([CTABLES missing values])
1996 AT_DATA([ctables.sps],
1997 [[DATA LIST LIST NOTABLE/x y.
2036 MISSING VALUES x (1, 2) y (2, 3).
2037 VARIABLE LEVEL ALL (NOMINAL).
2039 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2040 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2041 /CATEGORIES VARIABLES=ALL TOTAL=YES.
2042 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2043 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2044 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2045 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2046 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2047 /CATEGORIES VARIABLES=ALL TOTAL=YES
2048 /SLABELS POSITION=ROW.
2049 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2050 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2051 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2052 /SLABELS POSITION=ROW.
2053 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2054 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2055 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
2056 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
2057 /SLABELS POSITION=ROW.
2059 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2061 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2062 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2063 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2064 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2065 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2066 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2067 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
2068 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2069 dnl Note that Column Total N % doesn't add up to 100 because missing
2070 dnl values are included in the total but not shown as a category and this
2071 dnl is expected behavior.
2074 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2075 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2076 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2077 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
2078 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
2079 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2080 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2081 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2082 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
2083 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2084 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2085 dnl values are included in the total but not shown as a category and this
2086 dnl is expected behavior.
2089 ╭────────────────────────┬───────────────────────────╮
2091 │ ├──────┬──────┬──────┬──────┤
2092 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
2093 ├────────────────────────┼──────┼──────┼──────┼──────┤
2094 │x 3.00 Count │ 1│ 1│ 1│ 3│
2095 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2096 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2097 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2098 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2099 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2100 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2101 │ Valid N │ │ │ │ 3│
2102 │ Total N │ │ │ │ 6│
2103 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2104 │ 4.00 Count │ 1│ 1│ 1│ 3│
2105 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2106 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2107 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2108 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2109 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2110 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2111 │ Valid N │ │ │ │ 3│
2112 │ Total N │ │ │ │ 6│
2113 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2114 │ 5.00 Count │ 1│ 1│ 1│ 3│
2115 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2116 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2117 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2118 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2119 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2120 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2121 │ Valid N │ │ │ │ 3│
2122 │ Total N │ │ │ │ 6│
2123 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2124 │ Total Count │ 3│ 3│ 3│ 9│
2125 │ Column % │100.0%│100.0%│100.0%│ .│
2126 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
2127 │ Column Total N %│100.0%│100.0%│100.0%│ .│
2128 │ Row % │ .│ .│ .│ .│
2129 │ Row Valid N % │ .│ .│ .│ .│
2130 │ Row Total N % │ .│ .│ .│ .│
2131 │ Valid N │ 3│ 3│ 3│ 9│
2132 │ Total N │ 6│ 6│ 6│ 36│
2133 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2136 ╭────────────────────────┬─────────────────────────────────────────╮
2138 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
2139 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2140 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2141 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2142 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2143 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
2144 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2145 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2146 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2147 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2148 │ Valid N │ │ │ │ │ │ 0│
2149 │ Total N │ │ │ │ │ │ 6│
2150 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2151 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2152 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2153 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
2154 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2155 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2156 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2157 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2158 │ Valid N │ │ │ │ │ │ 0│
2159 │ Total N │ │ │ │ │ │ 6│
2160 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2161 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2162 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2163 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2164 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2165 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2166 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2167 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2168 │ Valid N │ │ │ │ │ │ 3│
2169 │ Total N │ │ │ │ │ │ 6│
2170 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2171 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2172 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2173 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2174 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2175 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2176 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2177 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2178 │ Valid N │ │ │ │ │ │ 3│
2179 │ Total N │ │ │ │ │ │ 6│
2180 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2181 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2182 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2183 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2184 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2185 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2186 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2187 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2188 │ Valid N │ │ │ │ │ │ 3│
2189 │ Total N │ │ │ │ │ │ 6│
2190 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2191 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
2192 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2193 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
2194 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2195 │ Row % │ .│ .│ .│ .│ .│ .│
2196 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2197 │ Row Total N % │ .│ .│ .│ .│ .│ .│
2198 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
2199 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
2200 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2203 ╭────────────────────────┬──────────────────────────────────╮
2205 │ ├──────┬──────┬──────┬──────┬──────┤
2206 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2207 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2208 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
2209 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2210 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2211 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2212 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2213 │ Row Valid N % │ .│ .│ .│ .│ .│
2214 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2215 │ Valid N │ │ │ │ │ 0│
2216 │ Total N │ │ │ │ │ 6│
2217 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2218 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
2219 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2220 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2221 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2222 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2223 │ Row Valid N % │ .│ .│ .│ .│ .│
2224 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2225 │ Valid N │ │ │ │ │ 0│
2226 │ Total N │ │ │ │ │ 6│
2227 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2228 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
2229 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2230 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2231 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2232 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2233 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2234 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2235 │ Valid N │ │ │ │ │ 3│
2236 │ Total N │ │ │ │ │ 6│
2237 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2238 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
2239 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2240 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2241 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2242 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2243 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2244 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2245 │ Valid N │ │ │ │ │ 3│
2246 │ Total N │ │ │ │ │ 6│
2247 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2248 │ Total Count │ 4│ 4│ 4│ 4│ 16│
2249 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
2250 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
2251 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
2252 │ Row % │ .│ .│ .│ .│ .│
2253 │ Row Valid N % │ .│ .│ .│ .│ .│
2254 │ Row Total N % │ .│ .│ .│ .│ .│
2255 │ Valid N │ 2│ 0│ 2│ 2│ 6│
2256 │ Total N │ 5│ 5│ 5│ 5│ 30│
2257 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2261 AT_SETUP([CTABLES SMISSING=LISTWISE])
2262 AT_KEYWORDS([SMISSING LISTWISE])
2263 AT_DATA([ctables.sps],
2264 [[DATA LIST LIST NOTABLE/x y z.
2272 VARIABLE LEVEL x (NOMINAL).
2274 CTABLES /TABLE (y + z) > x.
2275 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2277 * The following doesn't come out as listwise because the tables are
2278 separate, not linked by an > operator.
2279 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2281 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2311 AT_SETUP([CTABLES VLABELS - variables on different axes])
2312 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2313 AT_DATA([ctables.sps],
2315 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2316 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME /TABLE qnd5a BY qns3a.
2317 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL /TABLE qnd5a BY qns3a.
2318 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH /TABLE qnd5a BY qns3a.
2319 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a BY qns3a.
2321 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2323 ╭────────────────────────────────────────────────────────────────┬────────────╮
2329 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2330 │D5a. What would you say is your primary Cuban │ 13│ 7│
2331 │ethnic background? Mexican │ 175│ 136│
2333 │ South American │ 21│ 13│
2334 │ Central American │ 27│ 25│
2335 │ Puerto Rican, OR │ 37│ 41│
2336 │ Something else │ 35│ 33│
2337 │ Multiple - cannot │ 2│ 5│
2339 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2342 ╭──────────────────────────────────┬────────────╮
2348 ├──────────────────────────────────┼─────┼──────┤
2349 │QND5A Cuban │ 13│ 7│
2350 │ Mexican │ 175│ 136│
2352 │ South American │ 21│ 13│
2353 │ Central American │ 27│ 25│
2354 │ Puerto Rican, OR │ 37│ 41│
2355 │ Something else │ 35│ 33│
2356 │ Multiple - cannot choose one│ 2│ 5│
2357 ╰──────────────────────────────────┴─────┴──────╯
2360 ╭────────────────────────────────────────────────────────────────┬────────────╮
2366 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2367 │D5a. What would you say is your primary Cuban │ 13│ 7│
2368 │ethnic background? Mexican │ 175│ 136│
2370 │ South American │ 21│ 13│
2371 │ Central American │ 27│ 25│
2372 │ Puerto Rican, OR │ 37│ 41│
2373 │ Something else │ 35│ 33│
2374 │ Multiple - cannot │ 2│ 5│
2376 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2379 ╭────────────────────────────────────────────────────────────┬────────────────╮
2382 │ ├───────┬────────┤
2384 │ ├───────┼────────┤
2386 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2387 │QND5A D5a. What would you say is your Cuban │ 13│ 7│
2388 │primary ethnic background? Mexican │ 175│ 136│
2390 │ South American │ 21│ 13│
2391 │ Central American │ 27│ 25│
2392 │ Puerto Rican, OR │ 37│ 41│
2393 │ Something else │ 35│ 33│
2394 │ Multiple - cannot │ 2│ 5│
2396 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2399 ╭────────────────────────────┬─────┬──────╮
2403 ├────────────────────────────┼─────┼──────┤
2405 │Mexican │ 175│ 136│
2407 │South American │ 21│ 13│
2408 │Central American │ 27│ 25│
2409 │Puerto Rican, OR │ 37│ 41│
2410 │Something else │ 35│ 33│
2411 │Multiple - cannot choose one│ 2│ 5│
2412 ╰────────────────────────────┴─────┴──────╯
2416 AT_SETUP([CTABLES VLABELS - stacked variables])
2417 AT_KEYWORDS([stack stacking])
2418 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2419 AT_DATA([ctables.sps],
2421 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2422 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2423 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2424 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2425 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2427 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2429 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2431 ├───────────────────────────────────────────────────────────────────────┼─────┤
2432 │D5a. What would you say is your primary ethnic Cuban │ 20│
2433 │background? Mexican │ 311│
2435 │ South American │ 34│
2436 │ Central American │ 52│
2437 │ Puerto Rican, OR │ 78│
2438 │ Something else │ 68│
2439 │ Multiple - cannot │ 7│
2441 ├───────────────────────────────────────────────────────────────────────┼─────┤
2444 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2447 ╭─────────────────────────────────────────┬─────╮
2449 ├─────────────────────────────────────────┼─────┤
2453 │ South American │ 34│
2454 │ Central American │ 52│
2455 │ Puerto Rican, OR │ 78│
2456 │ Something else │ 68│
2457 │ Multiple - cannot choose one│ 7│
2458 ├─────────────────────────────────────────┼─────┤
2459 │S3a. GENDER: Male │ 3132│
2461 ╰─────────────────────────────────────────┴─────╯
2464 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2466 ├───────────────────────────────────────────────────────────────────────┼─────┤
2467 │D5a. What would you say is your primary ethnic Cuban │ 20│
2468 │background? Mexican │ 311│
2470 │ South American │ 34│
2471 │ Central American │ 52│
2472 │ Puerto Rican, OR │ 78│
2473 │ Something else │ 68│
2474 │ Multiple - cannot │ 7│
2476 ├───────────────────────────────────────────────────────────────────────┼─────┤
2478 ├───────────────────────────────────────────────────────────────────────┼─────┤
2480 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2483 ╭─────────────────────────────┬─────╮
2485 ├─────────────────────────────┼─────┤
2487 ├─────────────────────────────┼─────┤
2489 ├─────────────────────────────┼─────┤
2491 ├─────────────────────────────┼─────┤
2492 │South American │ 34│
2493 ├─────────────────────────────┼─────┤
2494 │Central American │ 52│
2495 ├─────────────────────────────┼─────┤
2496 │Puerto Rican, OR │ 78│
2497 ├─────────────────────────────┼─────┤
2498 │Something else │ 68│
2499 ├─────────────────────────────┼─────┤
2500 │Multiple - cannot choose one │ 7│
2501 ├─────────────────────────────┼─────┤
2502 │S3a. GENDER: Male │ 3132│
2504 ╰─────────────────────────────┴─────╯
2507 ╭────────────────────────────┬─────╮
2509 ├────────────────────────────┼─────┤
2513 │South American │ 34│
2514 │Central American │ 52│
2515 │Puerto Rican, OR │ 78│
2516 │Something else │ 68│
2517 │Multiple - cannot choose one│ 7│
2520 ╰────────────────────────────┴─────╯
2524 AT_SETUP([CTABLES VLABELS - nested variables])
2525 AT_KEYWORDS([nest nesting])
2526 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2527 AT_DATA([ctables.sps],
2529 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2530 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2531 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2532 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2533 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2535 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2537 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2539 ├───────────────────────────────────────────────────────────────────────┼─────┤
2540 │D5a. What would you say is your Cuban QNS3A Male │ 13│
2541 │primary ethnic background? Female│ 7│
2542 │ ╶─────────────────────────────────┼─────┤
2543 │ Mexican QNS3A Male │ 175│
2545 │ ╶─────────────────────────────────┼─────┤
2546 │ Spanish QNS3A Male │ 20│
2548 │ ╶─────────────────────────────────┼─────┤
2549 │ South American QNS3A Male │ 21│
2551 │ ╶─────────────────────────────────┼─────┤
2552 │ Central American QNS3A Male │ 27│
2554 │ ╶─────────────────────────────────┼─────┤
2555 │ Puerto Rican, OR QNS3A Male │ 37│
2557 │ ╶─────────────────────────────────┼─────┤
2558 │ Something else QNS3A Male │ 35│
2560 │ ╶─────────────────────────────────┼─────┤
2561 │ Multiple - cannot QNS3A Male │ 2│
2562 │ choose one Female│ 5│
2563 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2566 ╭──────────────────────────────────────────────────────┬─────╮
2568 ├──────────────────────────────────────────────────────┼─────┤
2569 │QND5A Cuban S3a. GENDER: Male │ 13│
2571 │ ╶────────────────────────────────────────────────┼─────┤
2572 │ Mexican S3a. GENDER: Male │ 175│
2574 │ ╶────────────────────────────────────────────────┼─────┤
2575 │ Spanish S3a. GENDER: Male │ 20│
2577 │ ╶────────────────────────────────────────────────┼─────┤
2578 │ South American S3a. GENDER: Male │ 21│
2580 │ ╶────────────────────────────────────────────────┼─────┤
2581 │ Central American S3a. GENDER: Male │ 27│
2583 │ ╶────────────────────────────────────────────────┼─────┤
2584 │ Puerto Rican, OR S3a. GENDER: Male │ 37│
2586 │ ╶────────────────────────────────────────────────┼─────┤
2587 │ Something else S3a. GENDER: Male │ 35│
2589 │ ╶────────────────────────────────────────────────┼─────┤
2590 │ Multiple - cannot choose one S3a. GENDER: Male │ 2│
2592 ╰──────────────────────────────────────────────────────┴─────╯
2595 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2597 ├───────────────────────────────────────────────────────────────────────┼─────┤
2598 │D5a. What would you say is your primary Cuban Male │ 13│
2599 │ethnic background? Female│ 7│
2600 │ ╶────────────────────────────┼─────┤
2601 │ Mexican Male │ 175│
2603 │ ╶────────────────────────────┼─────┤
2604 │ Spanish Male │ 20│
2606 │ ╶────────────────────────────┼─────┤
2607 │ South American Male │ 21│
2609 │ ╶────────────────────────────┼─────┤
2610 │ Central American Male │ 27│
2612 │ ╶────────────────────────────┼─────┤
2613 │ Puerto Rican, OR Male │ 37│
2615 │ ╶────────────────────────────┼─────┤
2616 │ Something else Male │ 35│
2618 │ ╶────────────────────────────┼─────┤
2619 │ Multiple - cannot Male │ 2│
2620 │ choose one Female│ 5│
2621 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2624 ╭────────────────────────────────────────────────┬─────╮
2626 ├────────────────────────────────────────────────┼─────┤
2627 │Cuban S3a. GENDER: Male │ 13│
2629 ├────────────────────────────────────────────────┼─────┤
2630 │Mexican S3a. GENDER: Male │ 175│
2632 ├────────────────────────────────────────────────┼─────┤
2633 │Spanish S3a. GENDER: Male │ 20│
2635 ├────────────────────────────────────────────────┼─────┤
2636 │South American S3a. GENDER: Male │ 21│
2638 ├────────────────────────────────────────────────┼─────┤
2639 │Central American S3a. GENDER: Male │ 27│
2641 ├────────────────────────────────────────────────┼─────┤
2642 │Puerto Rican, OR S3a. GENDER: Male │ 37│
2644 ├────────────────────────────────────────────────┼─────┤
2645 │Something else S3a. GENDER: Male │ 35│
2647 ├────────────────────────────────────────────────┼─────┤
2648 │Multiple - cannot choose one S3a. GENDER: Male │ 2│
2650 ╰────────────────────────────────────────────────┴─────╯
2653 ╭───────────────────────────────────┬─────╮
2655 ├───────────────────────────────────┼─────┤
2658 ├───────────────────────────────────┼─────┤
2659 │Mexican Male │ 175│
2661 ├───────────────────────────────────┼─────┤
2664 ├───────────────────────────────────┼─────┤
2665 │South American Male │ 21│
2667 ├───────────────────────────────────┼─────┤
2668 │Central American Male │ 27│
2670 ├───────────────────────────────────┼─────┤
2671 │Puerto Rican, OR Male │ 37│
2673 ├───────────────────────────────────┼─────┤
2674 │Something else Male │ 35│
2676 ├───────────────────────────────────┼─────┤
2677 │Multiple - cannot choose one Male │ 2│
2679 ╰───────────────────────────────────┴─────╯
2683 AT_SETUP([CTABLES FORMAT EMPTY])
2684 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2685 AT_DATA([ctables.sps],
2687 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2688 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2689 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2691 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2693 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2694 │ │ D5. ETHNICITY: Are you of │
2695 │ │ Hispanic or Latino origin or │
2697 │ ├───────────────┬───────────────┤
2699 │ ├───────────────┼───────────────┤
2701 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2702 │D5a. What would you say is Cuban │ 20│ 0│
2703 │your primary ethnic Mexican │ 311│ 0│
2704 │background? Spanish │ 48│ 0│
2705 │ South American │ 34│ 0│
2706 │ Central American│ 52│ 0│
2707 │ Puerto Rican, OR│ 78│ 0│
2708 │ Something else │ 68│ 0│
2709 │ Multiple - │ 7│ 0│
2710 │ cannot choose │ │ │
2712 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2715 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2716 │ │ D5. ETHNICITY: Are you of │
2717 │ │ Hispanic or Latino origin or │
2719 │ ├───────────────┬───────────────┤
2721 │ ├───────────────┼───────────────┤
2723 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2724 │D5a. What would you say is Cuban │ 20│ │
2725 │your primary ethnic Mexican │ 311│ │
2726 │background? Spanish │ 48│ │
2727 │ South American │ 34│ │
2728 │ Central American│ 52│ │
2729 │ Puerto Rican, OR│ 78│ │
2730 │ Something else │ 68│ │
2732 │ cannot choose │ │ │
2734 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2737 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2738 │ │ D5. ETHNICITY: Are you of │
2739 │ │ Hispanic or Latino origin or │
2741 │ ├───────────────┬───────────────┤
2743 │ ├───────────────┼───────────────┤
2745 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2746 │D5a. What would you say is Cuban │ 20│n/a │
2747 │your primary ethnic Mexican │ 311│n/a │
2748 │background? Spanish │ 48│n/a │
2749 │ South American │ 34│n/a │
2750 │ Central American│ 52│n/a │
2751 │ Puerto Rican, OR│ 78│n/a │
2752 │ Something else │ 68│n/a │
2753 │ Multiple - │ 7│n/a │
2754 │ cannot choose │ │ │
2756 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2760 AT_SETUP([CTABLES FORMAT MISSING])
2761 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2762 AT_DATA([ctables.sps],
2764 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2766 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2768 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2769 │ │ D5. ETHNICITY: Are you of │
2770 │ │ Hispanic or Latino origin or │
2772 │ ├───────────────┬───────────────┤
2774 │ ├───────────────┼───────────────┤
2775 │ │ Column % │ Column % │
2776 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2777 │D5a. What would you say is Cuban │ 3.2%│(no data) │
2778 │your primary ethnic Mexican │ 50.3%│(no data) │
2779 │background? Spanish │ 7.8%│(no data) │
2780 │ South American │ 5.5%│(no data) │
2781 │ Central American│ 8.4%│(no data) │
2782 │ Puerto Rican, OR│ 12.6%│(no data) │
2783 │ Something else │ 11.0%│(no data) │
2784 │ Multiple - │ 1.1%│(no data) │
2785 │ cannot choose │ │ │
2787 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2791 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2792 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2793 AT_DATA([ctables.sps],
2795 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2796 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2797 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2799 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2801 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2803 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2804 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2805 │occasion? 1 │ 491│ 34.9%│
2825 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2828 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2830 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2831 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2832 │occasion? 1 │ 491│ 34.9%│
2852 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2855 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2857 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2858 │38. How many drinks did you have on that Less than one│<10 │ .5%│
2859 │occasion? 1 │ 491│ 34.9%│
2879 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2883 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2884 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2885 AT_DATA([ctables.sps],
2887 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2889 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2901 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2902 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2903 maximumColumnWidth="192"
2904 minimumColumnWidth="96"
2908 AT_SETUP([CTABLES special formats])
2909 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2910 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2911 AT_DATA([ctables.sps],
2913 COMPUTE x = qnd3 - 4.
2914 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].
2916 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2918 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2919 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2920 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2921 │x│(3.0) │N=-3.0 │(-3.0) │(-3.0%)│8.0 │N=8.0 │(8.0) │(8.0%) │
2922 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2926 AT_SETUP([CTABLES TITLES])
2927 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2928 AT_DATA([ctables.sps],
2931 /VLABELS VARIABLES=qn1 DISPLAY=NONE
2932 /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
2933 /TITLES TITLE='How often do you drive?'
2934 CAPTION='Generated )TIME on )DATE'
2937 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
2938 s&../../..&MM/DD/YY&'], [0], [dnl
2939 How often do you drive?
2940 ╭───────────────────────────────────┬─────────────────────────────────────────╮
2942 │ ├────────────────────┬────────────────────┤
2944 │ ├────────────────────┼────────────────────┤
2945 │ │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
2946 │ │ you of Hispanic or │ you of Hispanic or │
2947 │ │ Latino origin or │ Latino origin or │
2948 │( ( 1. How often do you usually │ descent? │ descent? │
2949 │drive a car or other motor ├─────────┬──────────┼─────────┬──────────┤
2950 │vehicle?) ) BY S3a. GENDER: > D5. │ Yes │ No │ Yes │ No │
2951 │ETHNICITY: Are you of Hispanic or ├─────────┼──────────┼─────────┼──────────┤
2952 │Latino origin or descent? │ Count │ Count │ Count │ Count │
2953 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
2954 │Every day │ 218│ 2066│ 166│ 2175│
2955 │Several days a week │ 44│ 391│ 45│ 782│
2956 │Once a week or less │ 16│ 109│ 12│ 223│
2957 │Only certain times a year │ 15│ 41│ 11│ 61│
2958 │Never │ 39│ 150│ 56│ 278│
2959 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
2960 Generated HH:MM:SS on MM/DD/YY
2964 AT_SETUP([CTABLES area definitions])
2965 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2966 AT_DATA([ctables.sps],
2969 /VLABELS VARIABLES=ALL DISPLAY=NAME
2970 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLE.ID, LAYER.ID, SUBTABLE.ID]
2971 /SLABELS POSITION=ROW
2972 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROW.ID, LAYERROW.ID]
2973 /SLABELS POSITION=ROW
2974 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COL.ID, LAYERCOL.ID]
2975 /SLABELS POSITION=ROW.
2977 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
2980 ╭─────────────────────────────┬─────────────┬──────╮
2982 │ ├──────┬──────┼───┬──┤
2984 │ ├──────┼──────┤ │ │
2985 │ │ QN86 │ QN86 │ │ │
2986 │ ├───┬──┼───┬──┤ │ │
2987 │ │Yes│No│Yes│No│Yes│No│
2988 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
2989 │QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
2990 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
2991 │ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
2992 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
2993 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
2994 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
2995 │ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
2996 │ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
2997 │ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
2998 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
2999 │ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
3000 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3001 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3002 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3003 │ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
3004 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3008 ╭─────────────────────────────┬─────────────┬──────╮
3010 │ ├──────┬──────┼───┬──┤
3012 │ ├──────┼──────┤ │ │
3013 │ │ QN86 │ QN86 │ │ │
3014 │ ├───┬──┼───┬──┤ │ │
3015 │ │Yes│No│Yes│No│Yes│No│
3016 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3017 │QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3018 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3019 │ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
3020 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3021 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3022 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3023 │ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
3024 │ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3025 │ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3026 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3027 │ Subtable ID│ 10│10│ 11│11│ 12│12│
3028 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3029 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3030 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3031 │ Subtable ID│ 10│10│ 11│11│ 12│12│
3032 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3036 ╭──────────────────────────────┬─────────────┬──────╮
3038 │ ├──────┬──────┼───┬──┤
3040 │ ├──────┼──────┤ │ │
3041 │ │ QN86 │ QN86 │ │ │
3042 │ ├───┬──┼───┬──┤ │ │
3043 │ │Yes│No│Yes│No│Yes│No│
3044 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3045 │QN61 Yes QN57 Yes Row ID │ 1│ 1│ 2│ 2│ 3│ 3│
3046 │ Layer Row ID│ 1│ 1│ 1│ 1│ 2│ 2│
3047 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3048 │ No Row ID │ 4│ 4│ 5│ 5│ 6│ 6│
3049 │ Layer Row ID│ 3│ 3│ 3│ 3│ 4│ 4│
3050 │ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3051 │ No QN57 Yes Row ID │ 7│ 7│ 8│ 8│ 9│ 9│
3052 │ Layer Row ID│ 5│ 5│ 5│ 5│ 6│ 6│
3053 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3054 │ No Row ID │ 10│10│ 11│11│ 12│12│
3055 │ Layer Row ID│ 7│ 7│ 7│ 7│ 8│ 8│
3056 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3060 ╭──────────────────────────────┬─────────────┬──────╮
3062 │ ├──────┬──────┼───┬──┤
3064 │ ├──────┼──────┤ │ │
3065 │ │ QN86 │ QN86 │ │ │
3066 │ ├───┬──┼───┬──┤ │ │
3067 │ │Yes│No│Yes│No│Yes│No│
3068 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3069 │QN61 Yes QN57 Yes Row ID │ 13│13│ 14│14│ 15│15│
3070 │ Layer Row ID│ 9│ 9│ 9│ 9│ 10│10│
3071 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3072 │ No Row ID │ 16│16│ 17│17│ 18│18│
3073 │ Layer Row ID│ 11│11│ 11│11│ 12│12│
3074 │ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3075 │ No QN57 Yes Row ID │ 19│19│ 20│20│ 21│21│
3076 │ Layer Row ID│ 13│13│ 13│13│ 14│14│
3077 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3078 │ No Row ID │ 22│22│ 23│23│ 24│24│
3079 │ Layer Row ID│ 15│15│ 15│15│ 16│16│
3080 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3084 ╭─────────────────────────────────┬─────────────┬──────╮
3086 │ ├──────┬──────┼───┬──┤
3088 │ ├──────┼──────┤ │ │
3089 │ │ QN86 │ QN86 │ │ │
3090 │ ├───┬──┼───┬──┤ │ │
3091 │ │Yes│No│Yes│No│Yes│No│
3092 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3093 │QN61 Yes QN57 Yes Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
3094 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3095 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3096 │ No Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
3097 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3098 │ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3099 │ No QN57 Yes Column ID │ 7│ 8│ 9│10│ 11│12│
3100 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3101 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3102 │ No Column ID │ 7│ 8│ 9│10│ 11│12│
3103 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3104 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3108 ╭─────────────────────────────────┬─────────────┬──────╮
3110 │ ├──────┬──────┼───┬──┤
3112 │ ├──────┼──────┤ │ │
3113 │ │ QN86 │ QN86 │ │ │
3114 │ ├───┬──┼───┬──┤ │ │
3115 │ │Yes│No│Yes│No│Yes│No│
3116 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3117 │QN61 Yes QN57 Yes Column ID │ 13│14│ 15│16│ 17│18│
3118 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3119 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3120 │ No Column ID │ 13│14│ 15│16│ 17│18│
3121 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3122 │ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3123 │ No QN57 Yes Column ID │ 19│20│ 21│22│ 23│24│
3124 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3125 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3126 │ No Column ID │ 19│20│ 21│22│ 23│24│
3127 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3128 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3132 AT_SETUP([CTABLES categorical summary functions])
3133 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3134 AT_DATA([ctables.sps],
3137 /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
3138 /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
3139 /SLABELS POSITION=ROW.
3141 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3143 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
3144 │ │ D5a. What would you say is your primary ethnic background? │
3145 │ ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
3146 │ │ │ │ │ │ │ │ │ Multiple - │ │ │ │
3147 │ │ │ │ │ South │ Central │ Puerto │ Something│ cannot choose│ Don't│ │ │
3148 │ │Cuban│Mexican│Spanish│ American │ American │Rican, OR│ else │ one │ know │Refused│Total│
3149 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3150 │Region NE Count │ 6│ 8│ 8│ 11│ 7│ 39│ 23│ 2│ 0│ 1│ 105│
3151 │ Row % │ 5.7%│ 7.6%│ 7.6%│ 10.5%│ 6.7%│ 37.1%│ 21.9%│ 1.9%│ .0%│ 1.0%│ │
3152 │ Row │ 5.8%│ 7.7%│ 7.7%│ 10.6%│ 6.7%│ 37.5%│ 22.1%│ 1.9%│ .0%│ .0%│ │
3153 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3154 │ % │ │ │ │ │ │ │ │ │ │ │ │
3155 │ Row │ .4%│ .6%│ .6%│ .8%│ .5%│ 2.8%│ 1.6%│ .1%│ .0%│ .1%│ │
3156 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3157 │ % │ │ │ │ │ │ │ │ │ │ │ │
3158 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 104│
3159 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1409│
3160 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3161 │ MW Count │ 3│ 24│ 1│ 4│ 5│ 9│ 6│ 0│ 0│ 1│ 53│
3162 │ Row % │ 5.7%│ 45.3%│ 1.9%│ 7.5%│ 9.4%│ 17.0%│ 11.3%│ .0%│ .0%│ 1.9%│ │
3163 │ Row │ 5.8%│ 46.2%│ 1.9%│ 7.7%│ 9.6%│ 17.3%│ 11.5%│ .0%│ .0%│ .0%│ │
3164 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3165 │ % │ │ │ │ │ │ │ │ │ │ │ │
3166 │ Row │ .2%│ 1.5%│ .1%│ .2%│ .3%│ .5%│ .4%│ .0%│ .0%│ .1%│ │
3167 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3168 │ % │ │ │ │ │ │ │ │ │ │ │ │
3169 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 52│
3170 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1654│
3171 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3172 │ S Count │ 10│ 113│ 11│ 14│ 25│ 23│ 20│ 2│ 3│ 2│ 223│
3173 │ Row % │ 4.5%│ 50.7%│ 4.9%│ 6.3%│ 11.2%│ 10.3%│ 9.0%│ .9%│ 1.3%│ .9%│ │
3174 │ Row │ 4.6%│ 51.8%│ 5.0%│ 6.4%│ 11.5%│ 10.6%│ 9.2%│ .9%│ .0%│ .0%│ │
3175 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3176 │ % │ │ │ │ │ │ │ │ │ │ │ │
3177 │ Row │ .4%│ 4.7%│ .5%│ .6%│ 1.0%│ 1.0%│ .8%│ .1%│ .1%│ .1%│ │
3178 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3179 │ % │ │ │ │ │ │ │ │ │ │ │ │
3180 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 218│
3181 │ Total N│ │ │ │ │ │ │ │ │ │ │ 2390│
3182 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3183 │ W Count │ 1│ 166│ 28│ 5│ 15│ 7│ 19│ 3│ 0│ 1│ 245│
3184 │ Row % │ .4%│ 67.8%│ 11.4%│ 2.0%│ 6.1%│ 2.9%│ 7.8%│ 1.2%│ .0%│ .4%│ │
3185 │ Row │ .4%│ 68.0%│ 11.5%│ 2.0%│ 6.1%│ 2.9%│ 7.8%│ 1.2%│ .0%│ .0%│ │
3186 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3187 │ % │ │ │ │ │ │ │ │ │ │ │ │
3188 │ Row │ .1%│ 10.7%│ 1.8%│ .3%│ 1.0%│ .5%│ 1.2%│ .2%│ .0%│ .1%│ │
3189 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3190 │ % │ │ │ │ │ │ │ │ │ │ │ │
3191 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 244│
3192 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1546│
3193 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
3198 AT_SETUP([CTABLES scale summary functions])
3199 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3200 AT_DATA([ctables.sps],
3204 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
3205 CTABLES later, to make the results easier to verify.
3206 SPLIT FILE BY REGION.
3209 /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
3210 /FORMAT NOTABLE /MISSING=INCLUDE.
3214 /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
3215 /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, COLPCT.SUM]
3216 /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
3217 /SLABELS POSITION=ROW.
3219 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3221 ╭────────────────┬────────╮
3223 ├────────────────┼────────┤
3226 │ ╶─────────┼────────┤
3228 │ ╶─────────┼────────┤
3230 │ ╶─────────┼────────┤
3232 │ ╶─────────┼────────┤
3234 │ ╶─────────┼────────┤
3236 │ ╶─────────┼────────┤
3238 │ ╶─────────┼────────┤
3240 │ ╶─────────┼────────┤
3242 │ ╶─────────┼────────┤
3244 │ ╶─────────┼────────┤
3246 ├────────────────┼────────┤
3249 │ ╶─────────┼────────┤
3251 │ ╶─────────┼────────┤
3253 │ ╶─────────┼────────┤
3255 │ ╶─────────┼────────┤
3257 │ ╶─────────┼────────┤
3259 │ ╶─────────┼────────┤
3261 │ ╶─────────┼────────┤
3263 │ ╶─────────┼────────┤
3265 │ ╶─────────┼────────┤
3267 │ ╶─────────┼────────┤
3269 ├────────────────┼────────┤
3272 │ ╶─────────┼────────┤
3274 │ ╶─────────┼────────┤
3276 │ ╶─────────┼────────┤
3278 │ ╶─────────┼────────┤
3280 │ ╶─────────┼────────┤
3282 │ ╶─────────┼────────┤
3284 │ ╶─────────┼────────┤
3286 │ ╶─────────┼────────┤
3288 │ ╶─────────┼────────┤
3290 │ ╶─────────┼────────┤
3292 ├────────────────┼────────┤
3295 │ ╶─────────┼────────┤
3297 │ ╶─────────┼────────┤
3299 │ ╶─────────┼────────┤
3301 │ ╶─────────┼────────┤
3303 │ ╶─────────┼────────┤
3305 │ ╶─────────┼────────┤
3307 │ ╶─────────┼────────┤
3309 │ ╶─────────┼────────┤
3311 │ ╶─────────┼────────┤
3313 │ ╶─────────┼────────┤
3315 ╰────────────────┴────────╯
3318 ╭───────────────────────────┬────────╮
3320 ├───────────────────────────┼────────┤
3321 │REGION NE Valid N │ 936│
3324 │ Std Error of Mean│ .14│
3327 │ Std Deviation │ 4.41│
3335 │ Column Sum % │ 21.8%│
3336 │ ╶────────────────────┼────────┤
3337 │ MW Valid N │ 1019│
3340 │ Std Error of Mean│ .16│
3343 │ Std Deviation │ 5.15│
3351 │ Column Sum % │ 24.3%│
3352 │ ╶────────────────────┼────────┤
3354 │ Missing │ 1114.00│
3356 │ Std Error of Mean│ .18│
3359 │ Std Deviation │ 6.44│
3367 │ Column Sum % │ 31.2%│
3368 │ ╶────────────────────┼────────┤
3372 │ Std Error of Mean│ .17│
3375 │ Std Deviation │ 5.25│
3383 │ Column Sum % │ 22.7%│
3384 ╰───────────────────────────┴────────╯
3389 AT_SETUP([CTABLES hidden scale VLABELS])
3390 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3391 AT_DATA([ctables.sps],
3394 /TABLE region BY qn19a + qn35
3395 /SLABELS POSITION=ROW.
3397 /VLABELS VARIABLE=qn19a DISPLAY=NONE
3398 /TABLE region BY qn19a + qn35
3399 /SLABELS POSITION=ROW.
3401 /VLABELS VARIABLE=qn35 DISPLAY=NONE
3402 /TABLE region BY qn19a + qn35
3403 /SLABELS POSITION=ROW.
3405 * This one in particular caused a crash because no categories were
3406 created on the column axis, so passing in 0 for the index was still
3407 too big for that number of categories. It was fixed by creating a
3408 name-only category for each variable despite the "NONE" request,
3409 then hiding the entire dimension's labels if all its labels were
3412 /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
3413 /TABLE region BY qn19a + qn35
3414 /SLABELS POSITION=ROW.
3416 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3418 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
3419 │ │ 19a. About how old were you│ 35. In the past thirty days, how│
3420 │ │ when you first starting │ many times have you driven a │
3421 │ │ drinking alcohol, not │ motor vehicle WITHIN TWO HOURS │
3422 │ │ counting small tastes or │ AFTER drinking alcoholic │
3423 │ │ sips of alcohol. │ beverages? │
3424 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
3425 │Region NE Mean│ 19.33│ 2│
3426 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3427 │ MW Mean│ 19.83│ 2│
3428 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3430 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3432 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
3435 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
3436 │ │ │ 35. In the past thirty days, how many times have you │
3437 │ │ │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
3438 │ │QN19A│ alcoholic beverages? │
3439 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
3440 │Region NE Mean│19.33│ 2│
3441 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3443 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3445 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3447 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
3450 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
3451 │ │ 19a. About how old were you when you first starting │ │
3452 │ │ drinking alcohol, not counting small tastes or sips of │ │
3454 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
3455 │Region NE Mean│ 19.33│ 2│
3456 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3457 │ MW Mean│ 19.83│ 2│
3458 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3460 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3462 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
3465 ╭──────────────┬───────╮
3466 │Region NE Mean│19.33 2│
3473 ╰──────────────┴───────╯