3 dnl Features not yet tested:
4 dnl - Summary functions:
5 dnl * Separate summary functions for totals and subtotals.
6 dnl * U-prefix for unweighted summaries.
7 dnl * areaPCT.SUM and UareaPCT.SUM functions.
8 dnl * WEIGHT and adjustment weights.
9 dnl * details of missing value handling in summaries.
10 dnl - Definition of columns/rows when labels are rotated from one axis to another.
13 dnl - Multiple response sets
14 dnl - MRSETS subcommand.
15 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
18 dnl - Summary functions:
19 dnl * .LCL and .UCL suffixes.
21 dnl - Summary functions:
22 dnl * )CILEVEL in summary label specification
24 dnl * Data-dependent sorting.
26 AT_SETUP([CTABLES parsing])
27 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
28 AT_DATA([ctables.sps],
31 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
32 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
33 /FORMAT UNITS=CM EMPTY="(-)"
34 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
35 /VLABELS VARIABLES=qn17 DISPLAY=NAME
36 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
37 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
38 /VLABELS VARIABLES=qn20 DISPLAY=NONE
39 /MRSETS COUNTDUPLICATES=NO
40 /MRSETS COUNTDUPLICATES=YES
43 /WEIGHT VARIABLE=qns3a
45 /HIDESMALLCOUNTS COUNT=10
47 /SLABELS POSITION=COLUMN VISIBLE=YES
48 /SLABELS VISIBLE=NO POSITION=ROW
49 /SLABELS POSITION=LAYER
51 /CLABELS ROWLABELS=OPPOSITE
53 /CATEGORIES VARIABLES=qn1 qn17
54 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
55 POSITION=BEFORE EMPTY=INCLUDE.
56 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
57 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
58 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
60 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
63 ╭───────────────────┬────┬────╮
65 ├───────────────────┼────┼────┤
66 │Sa1. SAMPLE SOURCE:│5392│1607│
67 ╰───────────────────┴────┴────╯
71 ╭───────────────────┬─────╮
73 ├───────────────────┼─────┤
74 │Sa1. SAMPLE SOURCE:│ 5392│
75 ╰───────────────────┴─────╯
78 ╭────────────────────────┬─────╮
80 ├────────────────────────┼─────┤
81 │Sa1. SAMPLE SOURCE: RDD │ 5392│
83 ╰────────────────────────┴─────╯
86 ╭────────────────────────┬─────╮
88 ├────────────────────────┼─────┤
89 │Sa1. SAMPLE SOURCE: RDD │ 5392│
91 ╰────────────────────────┴─────╯
95 AT_SETUP([CTABLES parsing - negative])
96 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
97 AT_DATA([ctables.sps],
100 CTABLES /FORMAT MINCOLWIDTH='foo'.
101 CTABLES /TABLE qn1 [**].
102 CTABLES /TABLE qn1 [NOTAFUNCTION].
105 CTABLES /TABLE NOTAVAR.
107 CTABLES /TABLE string[S].
108 CTABLES /TABLE qn1 [PTILE 101].
109 CTABLES /TABLE qn1 [MEAN F0.1].
110 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
111 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
112 CTABLES /TABLE qn1 [MEAN TOTALS].
113 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
114 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
115 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
116 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
117 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
118 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
119 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
120 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
121 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
122 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
123 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
124 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
127 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
128 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
129 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
130 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
131 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
132 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
133 CTABLES /PCOMPUTE &k=EXPR([LO **]).
134 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
135 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
136 CTABLES /PCOMPUTE &k=EXPR([1**]).
137 CTABLES /PCOMPUTE &k=EXPR((1x)).
138 CTABLES /PCOMPUTE **k.
139 CTABLES /PCOMPUTE &1.
140 CTABLES /PCOMPUTE &k**.
141 CTABLES /PCOMPUTE &k=**.
142 CTABLES /PCOMPUTE &k=EXPR**.
143 CTABLES /PCOMPUTE &k=EXPR(1x).
144 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
145 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
146 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
147 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
148 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
149 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
150 CTABLES /FORMAT EMPTY=**.
151 CTABLES /FORMAT MISSING=**.
153 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
155 CTABLES /VLABELS VARIABLES=NOTAVAR.
156 CTABLES /VLABELS VARIABLES=qn1 **.
157 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
159 CTABLES /MRSETS COUNTDUPLICATES=**.
160 CTABLES /SMISSING **.
162 CTABLES /WEIGHT VARIABLE=NOTAVAR.
163 CTABLES /HIDESMALLCOUNTS COUNT=1.
165 CTABLES /HIDESMALLCOUNTS COUNT=2.
166 CTABLES /TABLE qn1**.
167 CTABLES /TABLE qn1 /SLABELS POSITION=**.
168 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
169 CTABLES /TABLE qn1 /SLABELS **.
170 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
171 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
172 CTABLES /TABLE qn1 /CLABELS **.
173 CTABLES /TABLE qn1 /CRITERIA **.
174 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
175 CTABLES /TABLE qn1 /TITLES **.
176 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
177 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
178 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
179 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
180 CTABLES /TABLE qn1 /SIGTEST **.
181 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
182 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
183 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
184 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
185 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
186 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
187 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
188 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
189 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
190 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
191 CTABLES /TABLE qn1 /COMPARETEST **.
192 CTABLES /TABLE qn1 / **.
193 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
194 CTABLES /TABLE qn20 > qnd1.
195 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
196 NUMERIC datetime (DATETIME17.0).
197 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
199 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
200 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
202 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
203 negative number for MINCOLWIDTH.
205 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
208 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
209 summary function name.
211 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
213 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
216 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
218 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
220 10 | CTABLES /TABLE string[S].
223 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
224 between 0 and 100 for PTILE.
226 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
227 requires a width between 1 and 40.
229 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
230 format NEGPAREN requires width 2 or greater.
232 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
233 format NEGPAREN requires width greater than decimals.
235 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
237 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
240 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
241 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
244 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
246 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
248 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
251 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
252 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
255 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
257 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
259 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
261 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
263 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
265 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
267 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
270 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
271 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
274 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
275 between 0 and 100 for PTILE.
277 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
280 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
283 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
286 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
289 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
291 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
294 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
297 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
298 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
300 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
301 LABEL, POSITION, or EMPTY.
303 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
304 integer for SUBTOTAL.
306 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
308 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
310 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
312 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
314 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
316 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
318 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
320 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
322 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
324 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
326 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
328 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
330 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
331 the previous definition.
332 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
333 | ^~~~~~~~~~~~~~~~~~~
335 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
336 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
337 | ^~~~~~~~~~~~~~~~~~~
339 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
342 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
343 Expecting summary function name.
345 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
346 between 0 and 100 for PTILE.
348 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
350 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
353 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
354 FORMAT, or HIDESOURCECATS.
356 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
358 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
360 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
361 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
363 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
366 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
369 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
371 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
374 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
375 DEFAULT, NAME, LABEL, BOTH, or NONE.
377 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
380 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
383 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
384 VARIABLE or LISTWISE.
386 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
389 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
391 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
392 greater for HIDESMALLCOUNTS COUNT.
394 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
395 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
396 HIDESMALLCOUNTS, or TABLE.
398 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
401 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
403 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
406 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
409 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
412 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
415 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
418 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
419 ROWLABELS, or COLLABELS.
421 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
424 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
425 in @<:@0,100@:}@ for CILEVEL.
427 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
428 CAPTION, CORNER, or TITLE.
430 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
433 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
434 in @<:@0,1@:}@ for ALPHA.
436 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
439 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
440 ALLVISIBLE or SUBTOTALS.
442 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
443 ALPHA, INCLUDEMRSETS, or CATEGORIES.
445 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
448 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
451 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
454 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
455 BONFERRONI, BH, or NONE.
457 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
460 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
463 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
464 ALLVISIBLE or SUBTOTALS.
466 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
469 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
472 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
475 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
476 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
479 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
480 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
482 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
485 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
486 97 | CTABLES /TABLE qn20 > qnd1.
489 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
490 97 | CTABLES /TABLE qn20 > qnd1.
493 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
494 97 | CTABLES /TABLE qn20 > qnd1.
497 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
498 categorical variables at the innermost nesting level.
499 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
500 | ^~~~~~~~~~~~~~~~~~~~
502 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
504 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
507 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
508 specification as format DATETIME: Day (123) must be between 1 and 31..
509 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
514 AT_SETUP([CTABLES parsing - more negative])
515 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
516 AT_DATA([ctables.sps],
518 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
519 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
520 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
523 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
524 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
526 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
528 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
529 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
530 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
531 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
533 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
534 CTABLES /PCOMPUTE &x=EXPR([**]).
535 CTABLES /PCOMPUTE &x=EXPR(**).
539 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
541 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
542 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
543 category not included in the category list.
544 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
549 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
550 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
554 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
555 list of categories here.
556 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
561 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
562 category not included in the category list.
563 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
568 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
569 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
573 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
574 variable's CATEGORIES specification.
576 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
577 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
578 subtotals by position, e.g. SUBTOTAL[1].
579 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
580 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
582 ^~~~~~~~~~~~~~~~~~~~~~~~
584 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
586 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
587 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
590 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
591 applied only to string variables, but this subcommand tries to apply it to
592 numeric variable QN1.
593 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
596 ctables.sps:8.53: error: CTABLES: This category specification may be applied
597 only to numeric variables, but this subcommand tries to apply it to string
599 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
602 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
603 based on a summary function.
605 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
606 moved to be categorical, but qnd1 is a scale variable.
608 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
609 moved to have the same width, but QN1 has width 0 and string has width 8.
611 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
612 moved to have the same value labels, but QN1 and QNSA1 have different value
615 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
616 moved to have the same category specifications, but QN105BA and QN105BB have
617 different category specifications.
619 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
620 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
621 this warning, insert parentheses.
622 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
625 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
628 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
630 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
632 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
633 variable must be specified.
635 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
637 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
639 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
642 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
644 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
647 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
649 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
652 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
653 has a summary even if the syntax does not explicitly specify one.
654 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
659 AT_SETUP([CTABLES one categorical variable])
660 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
661 AT_DATA([ctables.sps],
664 CTABLES /TABLE BY qn1.
665 CTABLES /TABLE BY BY qn1.
667 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
669 ╭────────────────────────────────────────────────────────────────────────┬─────╮
671 ├────────────────────────────────────────────────────────────────────────┼─────┤
672 │ 1. How often do you usually drive a car or other Every day │ 4667│
673 │motor vehicle? Several days a week │ 1274│
674 │ Once a week or less │ 361│
675 │ Only certain times a │ 130│
678 ╰────────────────────────────────────────────────────────────────────────┴─────╯
681 ╭──────────────────────────────────────────────────────────────────────────────╮
682 │ 1. How often do you usually drive a car or other motor vehicle? │
683 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
684 │ │ Several days a │ Once a week or │ Only certain times a │ │
685 │Every day│ week │ less │ year │Never│
686 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
687 │ Count │ Count │ Count │ Count │Count│
688 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
689 │ 4667│ 1274│ 361│ 130│ 540│
690 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
702 AT_SETUP([CTABLES one string variable])
703 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
704 AT_DATA([ctables.sps],
707 MISSING VALUES licensed('DontKnow', 'Refused').
708 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
709 CTABLES /TABLE licensed.
710 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
711 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
712 * Notice that the string matching is case-sensitive.
713 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
714 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
716 /PCOMPUTE ¬yes=EXPR(['No']+['DontKnow']+['Refused'])
717 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
719 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'No', 'DontKnow', 'Refused'].
721 /PCOMPUTE ¬yes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
722 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
724 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'DontKnow' THRU 'No', 'Refused'].
726 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
736 ╭─────────────────┬─────┬───────╮
738 ├─────────────────┼─────┼───────┤
739 │licensed DontKnow│ 4│ │
743 │ Total │ 6999│ 6951│
744 ╰─────────────────┴─────┴───────╯
747 ╭──────────────┬─────╮
749 ├──────────────┼─────┤
750 │licensed Yes │ 6379│
753 ╰──────────────┴─────╯
756 ╭──────────────┬─────╮
758 ├──────────────┼─────┤
759 │licensed Yes │ 6379│
762 ╰──────────────┴─────╯
765 ╭────────────────┬─────╮
767 ├────────────────┼─────┤
772 ╰────────────────┴─────╯
775 ╭────────────────┬─────╮
777 ├────────────────┼─────┤
778 │licensed Yes │ 6379│
780 ╰────────────────┴─────╯
783 ╭────────────────┬─────╮
785 ├────────────────┼─────┤
786 │licensed Yes │ 6379│
788 ╰────────────────┴─────╯
792 AT_SETUP([CTABLES one scale variable])
793 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
794 AT_DATA([ctables.sps],
796 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
797 CTABLES /TABLE BY qnd1.
798 CTABLES /TABLE BY BY qnd1.
800 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
802 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
803 │ │ │ │ │ │ Std │ │ │
804 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
805 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
806 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
807 │age? │ │ │ │ │ │ │ │
808 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
811 ╭──────────────────────────╮
812 │D1. AGE: What is your age?│
813 ├──────────────────────────┤
815 ├──────────────────────────┤
817 ╰──────────────────────────╯
820 D1. AGE: What is your age?
829 AT_SETUP([CTABLES simple stacking])
830 AT_KEYWORDS([stack stacked])
831 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
832 AT_DATA([ctables.sps],
834 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
836 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
838 ╭───────────────────────────────────────────────────────────────┬──────────────╮
845 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
846 │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│
847 │too much to drink to drive safely will A. Get certain │ │ │
848 │stopped by the police? Very likely │ 21%│ 22%│
849 │ Somewhat │ 38%│ 42%│
851 │ Somewhat │ 21%│ 18%│
855 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
856 │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│
857 │too much to drink to drive safely will B. Have an certain │ │ │
858 │accident? Very likely │ 36%│ 45%│
859 │ Somewhat │ 39%│ 32%│
865 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
866 │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│
867 │too much to drink to drive safely will C. Be certain │ │ │
868 │convicted for drunk driving? Very likely │ 32%│ 28%│
869 │ Somewhat │ 27%│ 32%│
871 │ Somewhat │ 15%│ 15%│
875 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
876 │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│
877 │too much to drink to drive safely will D. Be certain │ │ │
878 │arrested for drunk driving? Very likely │ 26%│ 27%│
879 │ Somewhat │ 32%│ 35%│
881 │ Somewhat │ 17%│ 15%│
885 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
889 AT_SETUP([CTABLES show or hide empty categories])
890 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
891 AT_DATA([ctables.sps],
893 IF (qn105ba = 2) qn105ba = 1.
894 IF (qns3a = 1) qns3a = 2.
895 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
896 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
897 /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
898 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
899 /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
900 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
901 /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
903 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
905 ╭──────────────────────────────────────────────────────────────┬───────────────╮
912 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
913 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
914 │too much to drink to drive safely will A. Get certain │ │ │
915 │stopped by the police? Very likely│ .│ 0%│
922 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
925 ╭──────────────────────────────────────────────────────────────┬───────────────╮
932 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
933 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
934 │too much to drink to drive safely will A. Get certain │ │ │
935 │stopped by the police? Somewhat │ .│ 40%│
941 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
944 ╭────────────────────────────────────────────────────────────────────┬─────────╮
951 ├────────────────────────────────────────────────────────────────────┼─────────┤
952 │105b. How likely is it that drivers who have had too Almost │ 32%│
953 │much to drink to drive safely will A. Get stopped by certain │ │
954 │the police? Very likely │ 0%│
961 ╰────────────────────────────────────────────────────────────────────┴─────────╯
964 ╭────────────────────────────────────────────────────────────────────┬─────────╮
971 ├────────────────────────────────────────────────────────────────────┼─────────┤
972 │105b. How likely is it that drivers who have had too Almost │ 32%│
973 │much to drink to drive safely will A. Get stopped by certain │ │
974 │the police? Somewhat │ 40%│
980 ╰────────────────────────────────────────────────────────────────────┴─────────╯
984 AT_SETUP([CTABLES sorting categories])
985 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
986 AT_DATA([ctables.sps],
988 IF (QND5A=6) QND5A=-1.
989 IF (QND5A=5) QND5A=-2.
990 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
991 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
992 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
993 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
995 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
997 ╭────────────────────────────────────────────────────────────────────────┬─────╮
999 ├────────────────────────────────────────────────────────────────────────┼─────┤
1000 │D5a. What would you say is your primary ethnic -2.00 │ 52│
1001 │background? -1.00 │ 78│
1005 │ South American │ 34│
1006 │ Central American │ 0│
1007 │ Puerto Rican, OR │ 0│
1008 │ Something else │ 68│
1009 │ Multiple - cannot choose│ 7│
1011 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1014 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1016 ├────────────────────────────────────────────────────────────────────────┼─────┤
1017 │D5a. What would you say is your primary ethnic Multiple - cannot choose│ 7│
1018 │background? one │ │
1019 │ Something else │ 68│
1020 │ Puerto Rican, OR │ 0│
1021 │ Central American │ 0│
1022 │ South American │ 34│
1028 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1031 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1033 ├────────────────────────────────────────────────────────────────────────┼─────┤
1034 │D5a. What would you say is your primary ethnic Central American │ 0│
1035 │background? Cuban │ 20│
1037 │ Multiple - cannot choose│ 7│
1039 │ Puerto Rican, OR │ 0│
1040 │ Something else │ 68│
1041 │ South American │ 34│
1045 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1048 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1050 ├────────────────────────────────────────────────────────────────────────┼─────┤
1051 │D5a. What would you say is your primary ethnic Spanish │ 48│
1052 │background? South American │ 34│
1053 │ Something else │ 68│
1054 │ Puerto Rican, OR │ 0│
1055 │ Multiple - cannot choose│ 7│
1059 │ Central American │ 0│
1062 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1066 AT_SETUP([CTABLES simple nesting])
1067 AT_KEYWORDS([nest nested])
1068 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1069 AT_DATA([ctables.sps],
1071 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1072 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1073 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1074 /CATEGORIES VARIABLES=qns3a TOTAL=YES
1075 /CLABELS ROW=OPPOSITE.
1077 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1079 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1082 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1083 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
1084 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
1085 │drive safely will A. Get stopped by Total │ 700│ 10%│
1086 │the police? ╶──────────────────────────┼─────┼──────┤
1087 │ Very S3a. Male │ 660│ 10%│
1088 │ likely GENDER: Female│ 842│ 12%│
1089 │ Total │ 1502│ 22%│
1090 │ ╶──────────────────────────┼─────┼──────┤
1091 │ Somewhat S3a. Male │ 1174│ 17%│
1092 │ likely GENDER: Female│ 1589│ 23%│
1093 │ Total │ 2763│ 40%│
1094 │ ╶──────────────────────────┼─────┼──────┤
1095 │ Somewhat S3a. Male │ 640│ 9%│
1096 │ unlikely GENDER: Female│ 667│ 10%│
1097 │ Total │ 1307│ 19%│
1098 │ ╶──────────────────────────┼─────┼──────┤
1099 │ Very S3a. Male │ 311│ 5%│
1100 │ unlikely GENDER: Female│ 298│ 4%│
1102 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1103 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
1104 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
1105 │drive safely will B. Have an accident? Total │ 1100│ 16%│
1106 │ ╶──────────────────────────┼─────┼──────┤
1107 │ Very S3a. Male │ 1104│ 16%│
1108 │ likely GENDER: Female│ 1715│ 25%│
1109 │ Total │ 2819│ 41%│
1110 │ ╶──────────────────────────┼─────┼──────┤
1111 │ Somewhat S3a. Male │ 1203│ 17%│
1112 │ likely GENDER: Female│ 1214│ 18%│
1113 │ Total │ 2417│ 35%│
1114 │ ╶──────────────────────────┼─────┼──────┤
1115 │ Somewhat S3a. Male │ 262│ 4%│
1116 │ unlikely GENDER: Female│ 168│ 2%│
1118 │ ╶──────────────────────────┼─────┼──────┤
1119 │ Very S3a. Male │ 81│ 1%│
1120 │ unlikely GENDER: Female│ 59│ 1%│
1122 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1123 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
1124 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
1125 │drive safely will C. Be convicted for Total │ 1149│ 17%│
1126 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1127 │ Very S3a. Male │ 988│ 14%│
1128 │ likely GENDER: Female│ 1049│ 15%│
1129 │ Total │ 2037│ 30%│
1130 │ ╶──────────────────────────┼─────┼──────┤
1131 │ Somewhat S3a. Male │ 822│ 12%│
1132 │ likely GENDER: Female│ 1210│ 18%│
1133 │ Total │ 2032│ 30%│
1134 │ ╶──────────────────────────┼─────┼──────┤
1135 │ Somewhat S3a. Male │ 446│ 7%│
1136 │ unlikely GENDER: Female│ 548│ 8%│
1138 │ ╶──────────────────────────┼─────┼──────┤
1139 │ Very S3a. Male │ 268│ 4%│
1140 │ unlikely GENDER: Female│ 354│ 5%│
1142 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1143 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1144 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1145 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1146 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1147 │ Very S3a. Male │ 805│ 12%│
1148 │ likely GENDER: Female│ 1029│ 15%│
1149 │ Total │ 1834│ 27%│
1150 │ ╶──────────────────────────┼─────┼──────┤
1151 │ Somewhat S3a. Male │ 975│ 14%│
1152 │ likely GENDER: Female│ 1332│ 19%│
1153 │ Total │ 2307│ 34%│
1154 │ ╶──────────────────────────┼─────┼──────┤
1155 │ Somewhat S3a. Male │ 535│ 8%│
1156 │ unlikely GENDER: Female│ 560│ 8%│
1157 │ Total │ 1095│ 16%│
1158 │ ╶──────────────────────────┼─────┼──────┤
1159 │ Very S3a. Male │ 270│ 4%│
1160 │ unlikely GENDER: Female│ 279│ 4%│
1162 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1165 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1166 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1167 │ │ certain│likely│ likely │ unlikely│unlikely│
1168 │ ├────────┼──────┼─────────┼─────────┼────────┤
1170 │ │ Table %│ % │ Table % │ Table % │ Table %│
1171 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1172 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1173 │GENDER: is it that drivers│ │ │ │ │ │
1174 │ who have had too │ │ │ │ │ │
1175 │ much to drink to │ │ │ │ │ │
1176 │ drive safely will │ │ │ │ │ │
1177 │ A. Get stopped by │ │ │ │ │ │
1178 │ the police? │ │ │ │ │ │
1179 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1180 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1181 │ is it that drivers│ │ │ │ │ │
1182 │ who have had too │ │ │ │ │ │
1183 │ much to drink to │ │ │ │ │ │
1184 │ drive safely will │ │ │ │ │ │
1185 │ A. Get stopped by │ │ │ │ │ │
1186 │ the police? │ │ │ │ │ │
1187 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1188 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1189 │ is it that drivers│ │ │ │ │ │
1190 │ who have had too │ │ │ │ │ │
1191 │ much to drink to │ │ │ │ │ │
1192 │ drive safely will │ │ │ │ │ │
1193 │ A. Get stopped by │ │ │ │ │ │
1194 │ the police? │ │ │ │ │ │
1195 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1196 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1197 │GENDER: is it that drivers│ │ │ │ │ │
1198 │ who have had too │ │ │ │ │ │
1199 │ much to drink to │ │ │ │ │ │
1200 │ drive safely will │ │ │ │ │ │
1201 │ B. Have an │ │ │ │ │ │
1202 │ accident? │ │ │ │ │ │
1203 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1204 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1205 │ is it that drivers│ │ │ │ │ │
1206 │ who have had too │ │ │ │ │ │
1207 │ much to drink to │ │ │ │ │ │
1208 │ drive safely will │ │ │ │ │ │
1209 │ B. Have an │ │ │ │ │ │
1210 │ accident? │ │ │ │ │ │
1211 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1212 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1213 │ is it that drivers│ │ │ │ │ │
1214 │ who have had too │ │ │ │ │ │
1215 │ much to drink to │ │ │ │ │ │
1216 │ drive safely will │ │ │ │ │ │
1217 │ B. Have an │ │ │ │ │ │
1218 │ accident? │ │ │ │ │ │
1219 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1220 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1221 │GENDER: is it that drivers│ │ │ │ │ │
1222 │ who have had too │ │ │ │ │ │
1223 │ much to drink to │ │ │ │ │ │
1224 │ drive safely will │ │ │ │ │ │
1225 │ C. Be convicted │ │ │ │ │ │
1226 │ for drunk driving?│ │ │ │ │ │
1227 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1228 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1229 │ is it that drivers│ │ │ │ │ │
1230 │ who have had too │ │ │ │ │ │
1231 │ much to drink to │ │ │ │ │ │
1232 │ drive safely will │ │ │ │ │ │
1233 │ C. Be convicted │ │ │ │ │ │
1234 │ for drunk driving?│ │ │ │ │ │
1235 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1236 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1237 │ is it that drivers│ │ │ │ │ │
1238 │ who have had too │ │ │ │ │ │
1239 │ much to drink to │ │ │ │ │ │
1240 │ drive safely will │ │ │ │ │ │
1241 │ C. Be convicted │ │ │ │ │ │
1242 │ for drunk driving?│ │ │ │ │ │
1243 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1244 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1245 │GENDER: is it that drivers│ │ │ │ │ │
1246 │ who have had too │ │ │ │ │ │
1247 │ much to drink to │ │ │ │ │ │
1248 │ drive safely will │ │ │ │ │ │
1249 │ D. Be arrested for│ │ │ │ │ │
1250 │ drunk driving? │ │ │ │ │ │
1251 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1252 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1253 │ is it that drivers│ │ │ │ │ │
1254 │ who have had too │ │ │ │ │ │
1255 │ much to drink to │ │ │ │ │ │
1256 │ drive safely will │ │ │ │ │ │
1257 │ D. Be arrested for│ │ │ │ │ │
1258 │ drunk driving? │ │ │ │ │ │
1259 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1260 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1261 │ is it that drivers│ │ │ │ │ │
1262 │ who have had too │ │ │ │ │ │
1263 │ much to drink to │ │ │ │ │ │
1264 │ drive safely will │ │ │ │ │ │
1265 │ D. Be arrested for│ │ │ │ │ │
1266 │ drunk driving? │ │ │ │ │ │
1267 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1271 AT_SETUP([CTABLES nesting and scale variables])
1272 AT_KEYWORDS([nest nested])
1273 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1274 AT_DATA([ctables.sps],
1276 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1277 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1278 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1279 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1280 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1282 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1284 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1290 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1291 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1292 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1294 │ Once a week or │ 44│ 54│
1296 │ Only certain │ 34│ 41│
1297 │ times a year │ │ │
1299 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1302 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1303 │ │Minimum│Maximum│Mean│
1304 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1305 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1306 │What is GENDER: months, has there been a │ │ │ │
1307 │your time when you felt you │ │ │ │
1308 │age? should cut down on your No │ 16│ 86│ 46│
1310 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1311 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1312 │ months, has there been a │ │ │ │
1313 │ time when you felt you │ │ │ │
1314 │ should cut down on your No │ 16│ 86│ 48│
1316 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1317 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1318 │What is GENDER: months, has there been a │ │ │ │
1319 │your time when people criticized No │ 16│ 86│ 46│
1320 │age? your drinking? │ │ │ │
1321 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1322 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1323 │ months, has there been a │ │ │ │
1324 │ time when people criticized No │ 16│ 86│ 48│
1325 │ your drinking? │ │ │ │
1326 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1329 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1330 │ │S1. Including yourself, how many members of this│
1331 │ │ household are age 16 or older? │
1332 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1333 │ │ │ │ │ │ │ │ 6 or │
1334 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1335 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1336 │ │Column│Column│Column│Column│Column│Column│Column│
1337 │ │ % │ % │ % │ % │ % │ % │ % │
1338 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1339 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1340 │SAMPLE How certain │ │ │ │ │ │ │ │
1341 │SOURCE: likely │ │ │ │ │ │ │ │
1342 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1343 │ that likely │ │ │ │ │ │ │ │
1344 │ drivers │ │ │ │ │ │ │ │
1345 │ who have │ │ │ │ │ │ │ │
1346 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1347 │ much to likely │ │ │ │ │ │ │ │
1348 │ drink to │ │ │ │ │ │ │ │
1349 │ drive │ │ │ │ │ │ │ │
1350 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1351 │ will A. unlikely│ │ │ │ │ │ │ │
1352 │ Get │ │ │ │ │ │ │ │
1353 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1354 │ by the unlikely│ │ │ │ │ │ │ │
1355 │ police? │ │ │ │ │ │ │ │
1356 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1359 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1362 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1363 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1364 │group typical month did you have one or more │ │ │
1365 │ alcoholic beverages to drink? │ │ │
1366 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1367 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1368 │ typical month did you have one or more │ │ │
1369 │ alcoholic beverages to drink? │ │ │
1370 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1371 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1372 │ typical month did you have one or more │ │ │
1373 │ alcoholic beverages to drink? │ │ │
1374 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1375 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1376 │ typical month did you have one or more │ │ │
1377 │ alcoholic beverages to drink? │ │ │
1378 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1379 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1380 │ typical month did you have one or more │ │ │
1381 │ alcoholic beverages to drink? │ │ │
1382 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1383 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1384 │ older typical month did you have one or more │ │ │
1385 │ alcoholic beverages to drink? │ │ │
1386 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1391 AT_SETUP([CTABLES SLABELS])
1392 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1393 AT_DATA([ctables.sps],
1395 CTABLES /TABLE qn1 [COUNT COLPCT].
1396 CTABLES /TABLE qn1 [COUNT COLPCT]
1397 /SLABELS POSITION=ROW.
1398 CTABLES /TABLE qn1 [COUNT COLPCT]
1399 /SLABELS POSITION=ROW VISIBLE=NO.
1401 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1403 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1406 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1407 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1408 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1409 │ Once a week or less│ 361│ 5.2%│
1410 │ Only certain times │ 130│ 1.9%│
1412 │ Never │ 540│ 7.7%│
1413 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1416 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1417 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1418 │other motor vehicle? Column │66.9%│
1420 │ ╶───────────────────────────┼─────┤
1421 │ Several days a week Count │ 1274│
1424 │ ╶───────────────────────────┼─────┤
1425 │ Once a week or less Count │ 361│
1428 │ ╶───────────────────────────┼─────┤
1429 │ Only certain times Count │ 130│
1430 │ a year Column │ 1.9%│
1432 │ ╶───────────────────────────┼─────┤
1433 │ Never Count │ 540│
1436 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1439 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1440 │ 1. How often do you usually drive a car or other Every day │ 4667│
1441 │motor vehicle? │66.9%│
1442 │ Several days a week │ 1274│
1444 │ Once a week or less │ 361│
1446 │ Only certain times a │ 130│
1450 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1454 AT_SETUP([CTABLES simple totals])
1455 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1456 AT_DATA([ctables.sps],
1459 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1460 DESCRIPTIVES qn18/STATISTICS=MEAN.
1461 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1462 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1464 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1466 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1468 ├────────────────────────────────────────────────────────────────────────┼─────┤
1469 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1470 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1473 │ Wine coolers │ 137│
1474 │ Hard liquor or │ 888│
1476 │ Flavored malt │ 83│
1478 │ Number responding │ 4221│
1479 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1481 Descriptive Statistics
1482 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1484 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1485 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1486 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1487 │Valid N (listwise) │6999│ │
1488 │Missing N (listwise) │2781│ │
1489 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1492 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1493 │ │ │ │ Valid│Total│
1494 │ │Mean│Count│ N │ N │
1495 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1496 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1497 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1498 │ you usually drink per sitting? │ │ │ │ │
1499 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1500 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1501 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1502 │ you usually drink per sitting? │ │ │ │ │
1503 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1504 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1505 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1506 │ you usually drink per sitting? │ │ │ │ │
1507 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1508 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1509 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1510 │ you usually drink per sitting? │ │ │ │ │
1511 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1512 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1513 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1514 │ you usually drink per sitting? │ │ │ │ │
1515 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1519 AT_SETUP([CTABLES subtotals])
1520 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1521 AT_DATA([ctables.sps],
1523 CTABLES /TABLE=qn105ba BY qns1
1524 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1525 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1526 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1527 CTABLES /TABLE=qn105ba BY qns1
1528 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1529 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1531 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1533 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1534 │ │ S1. Including yourself, how many members of this household │
1535 │ │ are age 16 or older? │
1536 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1537 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1538 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1539 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1540 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1541 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1542 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1543 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1544 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1545 │ likely │ │ │ │ │ │ │ │
1546 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1547 │ unlikely │ │ │ │ │ │ │ │
1548 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1549 │ unlikely │ │ │ │ │ │ │ │
1550 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1553 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1554 │ │ S1. Including yourself, how many members of this household │
1555 │ │ are age 16 or older? │
1556 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1557 │ │ │ │ │ │ │ │ 6 or │
1558 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1559 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1560 │ │ │ │ │ │ Column│ │ │
1561 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1562 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1563 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1564 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1565 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1566 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1567 │ likely │ │ │ │ │ │ │ │
1568 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1569 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1570 │ unlikely │ │ │ │ │ │ │ │
1571 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1572 │ unlikely │ │ │ │ │ │ │ │
1573 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1574 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1577 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1578 │ │ S1. Including yourself, how many members of this household │
1579 │ │ are age 16 or older? │
1580 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1581 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1582 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1583 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1584 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1585 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1586 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1587 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1588 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1589 │ likely │ │ │ │ │ │ │ │
1590 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1591 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1592 │ unlikely │ │ │ │ │ │ │ │
1593 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1594 │ unlikely │ │ │ │ │ │ │ │
1595 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1596 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1600 AT_SETUP([CTABLES PCOMPUTE])
1601 AT_KEYWORDS([postcompute])
1602 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1603 AT_DATA([ctables.sps],
1606 /PCOMPUTE &x=EXPR([3] + [4])
1607 /PCOMPUTE &y=EXPR([4] + [5])
1608 /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1609 /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1610 /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1611 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1613 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
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]' HIDESOURCECATS=YES
1619 /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1620 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1622 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1624 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1625 │ │ S1. Including yourself, how many members of this household are age 16 or older? │
1626 │ ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1627 │ │ 1 │ 2 │ Subtotal │ 3 │ 4 │ 5 │ 3+4 │ 4+5 │ Subtotal │ Total │
1628 │ ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1629 │ │ │ │ │ │ │ │ │ │ │ Row│ │ Row│ │ │ │ Row│ │ │ │ │
1630 │ │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│ % │Count│ % │ Count│Row %│Count│ % │Count│Row %│Count│ Row %│
1631 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1632 │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%│
1633 │likely is certain │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1634 │it that │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1635 │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%│
1636 │who have likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1637 │had too │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1638 │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%│
1639 │drink to likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1640 │drive │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1641 │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%│
1642 │will A. unlikely│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1643 │Get │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1644 │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%│
1645 │the unlikely│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1646 │police? │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1647 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1650 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1651 │ │ S1. Including yourself, how many members of this household are age 16 or older? │
1652 │ ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1653 │ │ 1 │ 2 │ Subtotal │ 3 │ 3+4 │ 4+5 │ Subtotal │ Total │
1654 │ ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1655 │ │ │ │ │ │ │ │ │ │ │ │ │ Row│ │ │ │ │
1656 │ │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│ % │Count│Row %│Count│ Row %│
1657 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1658 │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%│
1659 │drivers who have had too much certain │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1660 │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%│
1661 │A. Get stopped by the police? likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1662 │ 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%│
1663 │ likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1664 │ 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%│
1665 │ unlikely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1666 │ 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%│
1667 │ unlikely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1668 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1672 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1673 AT_KEYWORDS([postcompute])
1674 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1675 AT_DATA([ctables.sps],
1678 /PCOMPUTE &x=EXPR(OTHERNM)
1679 /PCOMPUTE &y=EXPR(MISSING)
1680 /PPROPERTIES &x LABEL='Drivers'
1681 /PPROPERTIES &y LABEL='Missing Values 2'
1683 /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1685 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1687 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1693 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1694 │ 1. How often do you usually drive a car or other motor vehicle? Every day │ 2305│ 2362│
1695 │ Several days a week │ 440│ 834│
1696 │ Once a week or less │ 125│ 236│
1697 │ Only certain times a year│ 58│ 72│
1699 │ Drivers │ 2928│ 3504│
1700 │ Valid Values │ 3120│ 3852│
1701 │ Don't know │ 3│ 5│
1703 │ Missing Values │ 12│ 15│
1704 │ Missing Values 2 │ 12│ 15│
1705 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1709 AT_SETUP([CTABLES PCOMPUTE - THRU])
1710 AT_KEYWORDS([postcompute])
1711 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1712 AT_DATA([ctables.sps],
1715 /PCOMPUTE &x=EXPR([1 THRU 2])
1716 /PCOMPUTE &y=EXPR([3 THRU 4])
1717 /PCOMPUTE &z=EXPR([5] + MISSING)
1718 /PPROPERTIES &x LABEL='Frequent Drivers'
1719 /PPROPERTIES &y LABEL='Infrequent Drivers'
1720 /PPROPERTIES &z LABEL='Not Drivers or Missing'
1722 /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1724 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1726 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1732 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1733 │ 1. How often do you usually drive a car or other motor vehicle? Every day │ 2305│ 2362│
1734 │ Several days a week │ 440│ 834│
1735 │ Frequent Drivers │ 2745│ 3196│
1736 │ Once a week or less │ 125│ 236│
1737 │ Only certain times a year│ 58│ 72│
1738 │ Infrequent Drivers │ 183│ 308│
1739 │ Drivers │ 2928│ 3504│
1741 │ Don't know │ 3│ 5│
1743 │ Not Drivers or Missing │ 204│ 363│
1744 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1748 dnl I'm not sure that this is the correct behavior (see
1749 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1750 dnl but at least this test will notify us if the behavior changes.
1751 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1752 AT_KEYWORDS([PCOMPUTE postcompute])
1753 AT_DATA([ctables.sps],
1754 [[DATA LIST LIST NOTABLE/x y z.
1757 VARIABLE LEVEL x y (NOMINAL).
1771 /PCOMPUTE &a = EXPR([1] + [2])
1772 /PCOMPUTE &b = EXPR([2] + [3])
1773 /PCOMPUTE &c = EXPR([4] * [5])
1774 /PCOMPUTE &d = EXPR([5] * [6])
1776 /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1777 /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1779 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1781 ╭───────────┬─────────────────────────────────────╮
1783 │ ├─────┬─────────┬─────┬─────────┬─────┤
1784 │ │ 4 │[4] * [5]│ 5 │[5] * [6]│ 6 │
1785 │ ├─────┼─────────┼─────┼─────────┼─────┤
1786 │ │Count│ Count │Count│ Count │Count│
1787 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1788 │x 1 │ 5│ 10│ 2│ 18│ 9│
1789 │ [1] + [2]│ 7│ .│ 5│ .│ 13│
1790 │ 2 │ 2│ 6│ 3│ 12│ 4│
1791 │ [2] + [3]│ 3│ .│ 9│ .│ 5│
1792 │ 3 │ 1│ 6│ 6│ 6│ 1│
1793 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1797 AT_SETUP([CTABLES string and date and time])
1800 for gender in F M; do
1801 for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1802 for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1803 printf "$weight $gender $month $wkday\n"
1804 weight=$(expr \( $weight + 3 \) % 7 + 2)
1809 AT_DATA([ctables.sps],
1810 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1811 /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1813 VARIABLE LEVEL w (SCALE).
1814 VARIABLE LEVEL gender fmon fday (NOMINAL).
1817 fmon 'Favorite month'
1818 fday 'Favorite day of the week'.
1819 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1821 /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1822 /PPROPERTIES &q2 LABEL='Q2'
1823 /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1824 /PPROPERTIES &weekend LABEL='Weekend'
1825 /TABLE fmon BY gender > fday
1826 /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1828 'JUL' THRU 'sep', SUBTOTAL="Q3",
1829 OTHERNM, SUBTOTAL='Q4']
1830 /CATEGORIES VARIABLES=gender ['M', 'F']
1831 /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1832 /SLABELS VISIBLE=NO.
1834 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1836 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1838 │ ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1840 │ ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1841 │ │ Favorite day of the week │ Favorite day of the week │
1842 │ ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1843 │ │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1844 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1845 │Favorite month JAN│ 10│ 3│ 8│ 6│ 4│ 2│ 7│ 17│ 40│ 9│ 6│ 4│ 2│ 7│ 5│ 3│ 12│ 36│
1846 │ FEB│ 6│ 8│ 6│ 4│ 2│ 7│ 5│ 11│ 38│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│
1847 │ MAR│ 16│ 6│ 4│ 2│ 7│ 5│ 3│ 19│ 43│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│
1848 │ Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│ │ │ 29│ 12│ 13│ 14│ 15│ 16│ 17│ │ │
1849 │ APR│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│ 4│ 7│ 5│ 3│ 8│ 6│ 4│ 8│ 37│
1850 │ MAY│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│ 14│ 5│ 3│ 8│ 6│ 4│ 2│ 16│ 42│
1851 │ JUN│ 4│ 7│ 5│ 3│ 8│ 6│ 4│ 8│ 37│ 10│ 3│ 8│ 6│ 4│ 2│ 7│ 17│ 40│
1852 │ Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│ .│ │ 28│ 15│ 16│ 17│ 18│ 12│ 13│ .│ │
1853 │ JUL│ 14│ 5│ 3│ 8│ 6│ 4│ 2│ 16│ 42│ 6│ 8│ 6│ 4│ 2│ 7│ 5│ 11│ 38│
1854 │ AUG│ 10│ 3│ 8│ 6│ 4│ 2│ 7│ 17│ 40│ 16│ 6│ 4│ 2│ 7│ 5│ 3│ 19│ 43│
1855 │ SEP│ 6│ 8│ 6│ 4│ 2│ 7│ 5│ 11│ 38│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│
1856 │ Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│ │ │ 62│ 33│ 28│ 30│ 32│ 27│ 29│ │ │
1857 │ OCT│ 16│ 6│ 4│ 2│ 7│ 5│ 3│ 19│ 43│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│
1858 │ NOV│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│ 4│ 7│ 5│ 3│ 8│ 6│ 4│ 8│ 37│
1859 │ DEC│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│ 14│ 5│ 3│ 8│ 6│ 4│ 2│ 16│ 42│
1860 │ Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│ │ │ 26│ 14│ 15│ 16│ 17│ 18│ 12│ │ │
1861 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1865 AT_SETUP([CTABLES CLABELS])
1866 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1867 AT_DATA([ctables.sps],
1869 CTABLES /TABLE AgeGroup BY qns3a.
1870 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1871 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1872 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1873 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1875 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1877 ╭───────────────────────┬────────────╮
1883 ├───────────────────────┼─────┼──────┤
1884 │Age group 15 or younger│ 0│ 0│
1885 │ 16 to 25 │ 594│ 505│
1886 │ 26 to 35 │ 476│ 491│
1887 │ 36 to 45 │ 489│ 548│
1888 │ 46 to 55 │ 526│ 649│
1889 │ 56 to 65 │ 516│ 731│
1890 │ 66 or older │ 531│ 943│
1891 ╰───────────────────────┴─────┴──────╯
1894 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1896 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1898 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1899 │ │ 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 │
1900 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1901 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1902 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1903 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1904 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1905 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1906 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1909 ╭──────────────────────────────┬────────────╮
1913 ├──────────────────────────────┼────────────┤
1914 │Age group 15 or younger Male │ 0│
1916 │ ╶────────────────────┼────────────┤
1917 │ 16 to 25 Male │ 594│
1919 │ ╶────────────────────┼────────────┤
1920 │ 26 to 35 Male │ 476│
1922 │ ╶────────────────────┼────────────┤
1923 │ 36 to 45 Male │ 489│
1925 │ ╶────────────────────┼────────────┤
1926 │ 46 to 55 Male │ 526│
1928 │ ╶────────────────────┼────────────┤
1929 │ 56 to 65 Male │ 516│
1931 │ ╶────────────────────┼────────────┤
1932 │ 66 or older Male │ 531│
1934 ╰──────────────────────────────┴────────────╯
1938 ╭─────────┬────────────╮
1944 ├─────────┼─────┼──────┤
1946 ╰─────────┴─────┴──────╯
1950 ╭─────────┬────────────╮
1956 ├─────────┼─────┼──────┤
1957 │Age group│ 594│ 505│
1958 ╰─────────┴─────┴──────╯
1962 ╭─────────┬────────────╮
1968 ├─────────┼─────┼──────┤
1969 │Age group│ 476│ 491│
1970 ╰─────────┴─────┴──────╯
1974 ╭─────────┬────────────╮
1980 ├─────────┼─────┼──────┤
1981 │Age group│ 489│ 548│
1982 ╰─────────┴─────┴──────╯
1986 ╭─────────┬────────────╮
1992 ├─────────┼─────┼──────┤
1993 │Age group│ 526│ 649│
1994 ╰─────────┴─────┴──────╯
1998 ╭─────────┬────────────╮
2004 ├─────────┼─────┼──────┤
2005 │Age group│ 516│ 731│
2006 ╰─────────┴─────┴──────╯
2010 ╭─────────┬────────────╮
2016 ├─────────┼─────┼──────┤
2017 │Age group│ 531│ 943│
2018 ╰─────────┴─────┴──────╯
2022 ╭───────────────────────┬────────────╮
2026 ├───────────────────────┼────────────┤
2027 │Age group 15 or younger│ 0│
2033 │ 66 or older │ 531│
2034 ╰───────────────────────┴────────────╯
2038 ╭───────────────────────┬────────────╮
2042 ├───────────────────────┼────────────┤
2043 │Age group 15 or younger│ 0│
2049 │ 66 or older │ 943│
2050 ╰───────────────────────┴────────────╯
2054 AT_SETUP([CTABLES CLABELS])
2055 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2056 AT_DATA([ctables.sps],
2058 CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [ROWPCT, COLPCT].
2059 CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [ROWPCT, COLPCT] /CLABELS ROWLABELS=OPPOSITE.
2060 CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [ROWPCT, COLPCT] /CLABELS ROWLABELS=OPPOSITE.
2061 CTABLES /TABLE qns3a > (qn26 + qn27 + qn28 + qn29) [ROWPCT, COLPCT] /CLABELS ROWLABELS=LAYER.
2063 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode], [0], [dnl
2067 AT_SETUP([CTABLES missing values])
2068 AT_DATA([ctables.sps],
2069 [[DATA LIST LIST NOTABLE/x y.
2108 MISSING VALUES x (1, 2) y (2, 3).
2109 VARIABLE LEVEL ALL (NOMINAL).
2111 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2112 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2113 /CATEGORIES VARIABLES=ALL TOTAL=YES.
2114 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2115 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2116 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2117 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2118 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2119 /CATEGORIES VARIABLES=ALL TOTAL=YES
2120 /SLABELS POSITION=ROW.
2121 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2122 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2123 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2124 /SLABELS POSITION=ROW.
2125 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2126 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2127 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
2128 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
2129 /SLABELS POSITION=ROW.
2131 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2133 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2134 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2135 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2136 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2137 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2138 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2139 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
2140 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2141 dnl Note that Column Total N % doesn't add up to 100 because missing
2142 dnl values are included in the total but not shown as a category and this
2143 dnl is expected behavior.
2146 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2147 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2148 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2149 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
2150 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
2151 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2152 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2153 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2154 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
2155 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2156 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2157 dnl values are included in the total but not shown as a category and this
2158 dnl is expected behavior.
2161 ╭────────────────────────┬───────────────────────────╮
2163 │ ├──────┬──────┬──────┬──────┤
2164 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
2165 ├────────────────────────┼──────┼──────┼──────┼──────┤
2166 │x 3.00 Count │ 1│ 1│ 1│ 3│
2167 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2168 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2169 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2170 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2171 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2172 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2173 │ Valid N │ │ │ │ 3│
2174 │ Total N │ │ │ │ 6│
2175 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2176 │ 4.00 Count │ 1│ 1│ 1│ 3│
2177 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2178 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2179 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2180 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2181 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2182 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2183 │ Valid N │ │ │ │ 3│
2184 │ Total N │ │ │ │ 6│
2185 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2186 │ 5.00 Count │ 1│ 1│ 1│ 3│
2187 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2188 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2189 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2190 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2191 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2192 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2193 │ Valid N │ │ │ │ 3│
2194 │ Total N │ │ │ │ 6│
2195 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2196 │ Total Count │ 3│ 3│ 3│ 9│
2197 │ Column % │100.0%│100.0%│100.0%│ .│
2198 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
2199 │ Column Total N %│100.0%│100.0%│100.0%│ .│
2200 │ Row % │ .│ .│ .│ .│
2201 │ Row Valid N % │ .│ .│ .│ .│
2202 │ Row Total N % │ .│ .│ .│ .│
2203 │ Valid N │ 3│ 3│ 3│ 9│
2204 │ Total N │ 6│ 6│ 6│ 36│
2205 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2208 ╭────────────────────────┬─────────────────────────────────────────╮
2210 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
2211 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2212 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2213 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2214 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2215 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
2216 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2217 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2218 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2219 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2220 │ Valid N │ │ │ │ │ │ 0│
2221 │ Total N │ │ │ │ │ │ 6│
2222 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2223 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2224 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2225 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
2226 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2227 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2228 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2229 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2230 │ Valid N │ │ │ │ │ │ 0│
2231 │ Total N │ │ │ │ │ │ 6│
2232 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2233 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2234 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2235 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2236 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2237 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2238 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2239 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2240 │ Valid N │ │ │ │ │ │ 3│
2241 │ Total N │ │ │ │ │ │ 6│
2242 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2243 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2244 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2245 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2246 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2247 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2248 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2249 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2250 │ Valid N │ │ │ │ │ │ 3│
2251 │ Total N │ │ │ │ │ │ 6│
2252 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2253 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2254 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2255 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2256 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2257 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2258 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2259 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2260 │ Valid N │ │ │ │ │ │ 3│
2261 │ Total N │ │ │ │ │ │ 6│
2262 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2263 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
2264 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2265 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
2266 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2267 │ Row % │ .│ .│ .│ .│ .│ .│
2268 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2269 │ Row Total N % │ .│ .│ .│ .│ .│ .│
2270 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
2271 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
2272 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2275 ╭────────────────────────┬──────────────────────────────────╮
2277 │ ├──────┬──────┬──────┬──────┬──────┤
2278 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2279 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2280 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
2281 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2282 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2283 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2284 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2285 │ Row Valid N % │ .│ .│ .│ .│ .│
2286 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2287 │ Valid N │ │ │ │ │ 0│
2288 │ Total N │ │ │ │ │ 6│
2289 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2290 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
2291 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2292 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2293 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2294 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2295 │ Row Valid N % │ .│ .│ .│ .│ .│
2296 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2297 │ Valid N │ │ │ │ │ 0│
2298 │ Total N │ │ │ │ │ 6│
2299 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2300 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
2301 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2302 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2303 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2304 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2305 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2306 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2307 │ Valid N │ │ │ │ │ 3│
2308 │ Total N │ │ │ │ │ 6│
2309 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2310 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
2311 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2312 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2313 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2314 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2315 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2316 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2317 │ Valid N │ │ │ │ │ 3│
2318 │ Total N │ │ │ │ │ 6│
2319 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2320 │ Total Count │ 4│ 4│ 4│ 4│ 16│
2321 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
2322 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
2323 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
2324 │ Row % │ .│ .│ .│ .│ .│
2325 │ Row Valid N % │ .│ .│ .│ .│ .│
2326 │ Row Total N % │ .│ .│ .│ .│ .│
2327 │ Valid N │ 2│ 0│ 2│ 2│ 6│
2328 │ Total N │ 5│ 5│ 5│ 5│ 30│
2329 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2333 AT_SETUP([CTABLES SMISSING=LISTWISE])
2334 AT_KEYWORDS([SMISSING LISTWISE])
2335 AT_DATA([ctables.sps],
2336 [[DATA LIST LIST NOTABLE/x y z.
2344 VARIABLE LEVEL x (NOMINAL).
2346 CTABLES /TABLE (y + z) > x.
2347 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2349 * The following doesn't come out as listwise because the tables are
2350 separate, not linked by an > operator.
2351 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2353 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2383 AT_SETUP([CTABLES VLABELS - variables on different axes])
2384 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2385 AT_DATA([ctables.sps],
2387 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2388 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME /TABLE qnd5a BY qns3a.
2389 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL /TABLE qnd5a BY qns3a.
2390 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH /TABLE qnd5a BY qns3a.
2391 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a BY qns3a.
2393 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2395 ╭────────────────────────────────────────────────────────────────┬────────────╮
2401 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2402 │D5a. What would you say is your primary Cuban │ 13│ 7│
2403 │ethnic background? Mexican │ 175│ 136│
2405 │ South American │ 21│ 13│
2406 │ Central American │ 27│ 25│
2407 │ Puerto Rican, OR │ 37│ 41│
2408 │ Something else │ 35│ 33│
2409 │ Multiple - cannot │ 2│ 5│
2411 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2414 ╭──────────────────────────────────┬────────────╮
2420 ├──────────────────────────────────┼─────┼──────┤
2421 │QND5A Cuban │ 13│ 7│
2422 │ Mexican │ 175│ 136│
2424 │ South American │ 21│ 13│
2425 │ Central American │ 27│ 25│
2426 │ Puerto Rican, OR │ 37│ 41│
2427 │ Something else │ 35│ 33│
2428 │ Multiple - cannot choose one│ 2│ 5│
2429 ╰──────────────────────────────────┴─────┴──────╯
2432 ╭────────────────────────────────────────────────────────────────┬────────────╮
2438 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2439 │D5a. What would you say is your primary Cuban │ 13│ 7│
2440 │ethnic background? Mexican │ 175│ 136│
2442 │ South American │ 21│ 13│
2443 │ Central American │ 27│ 25│
2444 │ Puerto Rican, OR │ 37│ 41│
2445 │ Something else │ 35│ 33│
2446 │ Multiple - cannot │ 2│ 5│
2448 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2451 ╭────────────────────────────────────────────────────────────┬────────────────╮
2454 │ ├───────┬────────┤
2456 │ ├───────┼────────┤
2458 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2459 │QND5A D5a. What would you say is your Cuban │ 13│ 7│
2460 │primary ethnic background? Mexican │ 175│ 136│
2462 │ South American │ 21│ 13│
2463 │ Central American │ 27│ 25│
2464 │ Puerto Rican, OR │ 37│ 41│
2465 │ Something else │ 35│ 33│
2466 │ Multiple - cannot │ 2│ 5│
2468 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2471 ╭────────────────────────────┬─────┬──────╮
2475 ├────────────────────────────┼─────┼──────┤
2477 │Mexican │ 175│ 136│
2479 │South American │ 21│ 13│
2480 │Central American │ 27│ 25│
2481 │Puerto Rican, OR │ 37│ 41│
2482 │Something else │ 35│ 33│
2483 │Multiple - cannot choose one│ 2│ 5│
2484 ╰────────────────────────────┴─────┴──────╯
2488 AT_SETUP([CTABLES VLABELS - stacked variables])
2489 AT_KEYWORDS([stack stacking])
2490 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2491 AT_DATA([ctables.sps],
2493 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2494 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2495 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2496 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2497 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2499 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2501 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2503 ├───────────────────────────────────────────────────────────────────────┼─────┤
2504 │D5a. What would you say is your primary ethnic Cuban │ 20│
2505 │background? Mexican │ 311│
2507 │ South American │ 34│
2508 │ Central American │ 52│
2509 │ Puerto Rican, OR │ 78│
2510 │ Something else │ 68│
2511 │ Multiple - cannot │ 7│
2513 ├───────────────────────────────────────────────────────────────────────┼─────┤
2516 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2519 ╭─────────────────────────────────────────┬─────╮
2521 ├─────────────────────────────────────────┼─────┤
2525 │ South American │ 34│
2526 │ Central American │ 52│
2527 │ Puerto Rican, OR │ 78│
2528 │ Something else │ 68│
2529 │ Multiple - cannot choose one│ 7│
2530 ├─────────────────────────────────────────┼─────┤
2531 │S3a. GENDER: Male │ 3132│
2533 ╰─────────────────────────────────────────┴─────╯
2536 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2538 ├───────────────────────────────────────────────────────────────────────┼─────┤
2539 │D5a. What would you say is your primary ethnic Cuban │ 20│
2540 │background? Mexican │ 311│
2542 │ South American │ 34│
2543 │ Central American │ 52│
2544 │ Puerto Rican, OR │ 78│
2545 │ Something else │ 68│
2546 │ Multiple - cannot │ 7│
2548 ├───────────────────────────────────────────────────────────────────────┼─────┤
2550 ├───────────────────────────────────────────────────────────────────────┼─────┤
2552 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2555 ╭─────────────────────────────┬─────╮
2557 ├─────────────────────────────┼─────┤
2559 ├─────────────────────────────┼─────┤
2561 ├─────────────────────────────┼─────┤
2563 ├─────────────────────────────┼─────┤
2564 │South American │ 34│
2565 ├─────────────────────────────┼─────┤
2566 │Central American │ 52│
2567 ├─────────────────────────────┼─────┤
2568 │Puerto Rican, OR │ 78│
2569 ├─────────────────────────────┼─────┤
2570 │Something else │ 68│
2571 ├─────────────────────────────┼─────┤
2572 │Multiple - cannot choose one │ 7│
2573 ├─────────────────────────────┼─────┤
2574 │S3a. GENDER: Male │ 3132│
2576 ╰─────────────────────────────┴─────╯
2579 ╭────────────────────────────┬─────╮
2581 ├────────────────────────────┼─────┤
2585 │South American │ 34│
2586 │Central American │ 52│
2587 │Puerto Rican, OR │ 78│
2588 │Something else │ 68│
2589 │Multiple - cannot choose one│ 7│
2592 ╰────────────────────────────┴─────╯
2596 AT_SETUP([CTABLES VLABELS - nested variables])
2597 AT_KEYWORDS([nest nesting])
2598 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2599 AT_DATA([ctables.sps],
2601 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2602 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2603 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2604 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2605 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2607 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2609 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2611 ├───────────────────────────────────────────────────────────────────────┼─────┤
2612 │D5a. What would you say is your Cuban QNS3A Male │ 13│
2613 │primary ethnic background? Female│ 7│
2614 │ ╶─────────────────────────────────┼─────┤
2615 │ Mexican QNS3A Male │ 175│
2617 │ ╶─────────────────────────────────┼─────┤
2618 │ Spanish QNS3A Male │ 20│
2620 │ ╶─────────────────────────────────┼─────┤
2621 │ South American QNS3A Male │ 21│
2623 │ ╶─────────────────────────────────┼─────┤
2624 │ Central American QNS3A Male │ 27│
2626 │ ╶─────────────────────────────────┼─────┤
2627 │ Puerto Rican, OR QNS3A Male │ 37│
2629 │ ╶─────────────────────────────────┼─────┤
2630 │ Something else QNS3A Male │ 35│
2632 │ ╶─────────────────────────────────┼─────┤
2633 │ Multiple - cannot QNS3A Male │ 2│
2634 │ choose one Female│ 5│
2635 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2638 ╭──────────────────────────────────────────────────────┬─────╮
2640 ├──────────────────────────────────────────────────────┼─────┤
2641 │QND5A Cuban S3a. GENDER: Male │ 13│
2643 │ ╶────────────────────────────────────────────────┼─────┤
2644 │ Mexican S3a. GENDER: Male │ 175│
2646 │ ╶────────────────────────────────────────────────┼─────┤
2647 │ Spanish S3a. GENDER: Male │ 20│
2649 │ ╶────────────────────────────────────────────────┼─────┤
2650 │ South American S3a. GENDER: Male │ 21│
2652 │ ╶────────────────────────────────────────────────┼─────┤
2653 │ Central American S3a. GENDER: Male │ 27│
2655 │ ╶────────────────────────────────────────────────┼─────┤
2656 │ Puerto Rican, OR S3a. GENDER: Male │ 37│
2658 │ ╶────────────────────────────────────────────────┼─────┤
2659 │ Something else S3a. GENDER: Male │ 35│
2661 │ ╶────────────────────────────────────────────────┼─────┤
2662 │ Multiple - cannot choose one S3a. GENDER: Male │ 2│
2664 ╰──────────────────────────────────────────────────────┴─────╯
2667 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2669 ├───────────────────────────────────────────────────────────────────────┼─────┤
2670 │D5a. What would you say is your primary Cuban Male │ 13│
2671 │ethnic background? Female│ 7│
2672 │ ╶────────────────────────────┼─────┤
2673 │ Mexican Male │ 175│
2675 │ ╶────────────────────────────┼─────┤
2676 │ Spanish Male │ 20│
2678 │ ╶────────────────────────────┼─────┤
2679 │ South American Male │ 21│
2681 │ ╶────────────────────────────┼─────┤
2682 │ Central American Male │ 27│
2684 │ ╶────────────────────────────┼─────┤
2685 │ Puerto Rican, OR Male │ 37│
2687 │ ╶────────────────────────────┼─────┤
2688 │ Something else Male │ 35│
2690 │ ╶────────────────────────────┼─────┤
2691 │ Multiple - cannot Male │ 2│
2692 │ choose one Female│ 5│
2693 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2696 ╭────────────────────────────────────────────────┬─────╮
2698 ├────────────────────────────────────────────────┼─────┤
2699 │Cuban S3a. GENDER: Male │ 13│
2701 ├────────────────────────────────────────────────┼─────┤
2702 │Mexican S3a. GENDER: Male │ 175│
2704 ├────────────────────────────────────────────────┼─────┤
2705 │Spanish S3a. GENDER: Male │ 20│
2707 ├────────────────────────────────────────────────┼─────┤
2708 │South American S3a. GENDER: Male │ 21│
2710 ├────────────────────────────────────────────────┼─────┤
2711 │Central American S3a. GENDER: Male │ 27│
2713 ├────────────────────────────────────────────────┼─────┤
2714 │Puerto Rican, OR S3a. GENDER: Male │ 37│
2716 ├────────────────────────────────────────────────┼─────┤
2717 │Something else S3a. GENDER: Male │ 35│
2719 ├────────────────────────────────────────────────┼─────┤
2720 │Multiple - cannot choose one S3a. GENDER: Male │ 2│
2722 ╰────────────────────────────────────────────────┴─────╯
2725 ╭───────────────────────────────────┬─────╮
2727 ├───────────────────────────────────┼─────┤
2730 ├───────────────────────────────────┼─────┤
2731 │Mexican Male │ 175│
2733 ├───────────────────────────────────┼─────┤
2736 ├───────────────────────────────────┼─────┤
2737 │South American Male │ 21│
2739 ├───────────────────────────────────┼─────┤
2740 │Central American Male │ 27│
2742 ├───────────────────────────────────┼─────┤
2743 │Puerto Rican, OR Male │ 37│
2745 ├───────────────────────────────────┼─────┤
2746 │Something else Male │ 35│
2748 ├───────────────────────────────────┼─────┤
2749 │Multiple - cannot choose one Male │ 2│
2751 ╰───────────────────────────────────┴─────╯
2755 AT_SETUP([CTABLES FORMAT EMPTY])
2756 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2757 AT_DATA([ctables.sps],
2759 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2760 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2761 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2763 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2765 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2766 │ │ D5. ETHNICITY: Are you of │
2767 │ │ Hispanic or Latino origin or │
2769 │ ├───────────────┬───────────────┤
2771 │ ├───────────────┼───────────────┤
2773 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2774 │D5a. What would you say is Cuban │ 20│ 0│
2775 │your primary ethnic Mexican │ 311│ 0│
2776 │background? Spanish │ 48│ 0│
2777 │ South American │ 34│ 0│
2778 │ Central American│ 52│ 0│
2779 │ Puerto Rican, OR│ 78│ 0│
2780 │ Something else │ 68│ 0│
2781 │ Multiple - │ 7│ 0│
2782 │ cannot choose │ │ │
2784 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2787 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2788 │ │ D5. ETHNICITY: Are you of │
2789 │ │ Hispanic or Latino origin or │
2791 │ ├───────────────┬───────────────┤
2793 │ ├───────────────┼───────────────┤
2795 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2796 │D5a. What would you say is Cuban │ 20│ │
2797 │your primary ethnic Mexican │ 311│ │
2798 │background? Spanish │ 48│ │
2799 │ South American │ 34│ │
2800 │ Central American│ 52│ │
2801 │ Puerto Rican, OR│ 78│ │
2802 │ Something else │ 68│ │
2804 │ cannot choose │ │ │
2806 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2809 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2810 │ │ D5. ETHNICITY: Are you of │
2811 │ │ Hispanic or Latino origin or │
2813 │ ├───────────────┬───────────────┤
2815 │ ├───────────────┼───────────────┤
2817 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2818 │D5a. What would you say is Cuban │ 20│n/a │
2819 │your primary ethnic Mexican │ 311│n/a │
2820 │background? Spanish │ 48│n/a │
2821 │ South American │ 34│n/a │
2822 │ Central American│ 52│n/a │
2823 │ Puerto Rican, OR│ 78│n/a │
2824 │ Something else │ 68│n/a │
2825 │ Multiple - │ 7│n/a │
2826 │ cannot choose │ │ │
2828 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2832 AT_SETUP([CTABLES FORMAT MISSING])
2833 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2834 AT_DATA([ctables.sps],
2836 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2838 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2840 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2841 │ │ D5. ETHNICITY: Are you of │
2842 │ │ Hispanic or Latino origin or │
2844 │ ├───────────────┬───────────────┤
2846 │ ├───────────────┼───────────────┤
2847 │ │ Column % │ Column % │
2848 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2849 │D5a. What would you say is Cuban │ 3.2%│(no data) │
2850 │your primary ethnic Mexican │ 50.3%│(no data) │
2851 │background? Spanish │ 7.8%│(no data) │
2852 │ South American │ 5.5%│(no data) │
2853 │ Central American│ 8.4%│(no data) │
2854 │ Puerto Rican, OR│ 12.6%│(no data) │
2855 │ Something else │ 11.0%│(no data) │
2856 │ Multiple - │ 1.1%│(no data) │
2857 │ cannot choose │ │ │
2859 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2863 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2864 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2865 AT_DATA([ctables.sps],
2867 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2868 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2869 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2871 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2873 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2875 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2876 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2877 │occasion? 1 │ 491│ 34.9%│
2897 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2900 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2902 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2903 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2904 │occasion? 1 │ 491│ 34.9%│
2924 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2927 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2929 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2930 │38. How many drinks did you have on that Less than one│<10 │ .5%│
2931 │occasion? 1 │ 491│ 34.9%│
2951 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2955 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2956 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2957 AT_DATA([ctables.sps],
2959 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2961 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2973 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2974 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2975 maximumColumnWidth="192"
2976 minimumColumnWidth="96"
2980 AT_SETUP([CTABLES special formats])
2981 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2982 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2983 AT_DATA([ctables.sps],
2985 COMPUTE x = qnd3 - 4.
2986 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].
2988 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2990 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2991 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2992 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2993 │x│(3.0) │N=-3.0 │(-3.0) │(-3.0%)│8.0 │N=8.0 │(8.0) │(8.0%) │
2994 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2998 AT_SETUP([CTABLES TITLES])
2999 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3000 AT_DATA([ctables.sps],
3003 /VLABELS VARIABLES=qn1 DISPLAY=NONE
3004 /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
3005 /TITLES TITLE='How often do you drive?'
3006 CAPTION='Generated )TIME on )DATE'
3009 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
3010 s&../../..&MM/DD/YY&'], [0], [dnl
3011 How often do you drive?
3012 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3014 │ ├────────────────────┬────────────────────┤
3016 │ ├────────────────────┼────────────────────┤
3017 │ │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3018 │ │ you of Hispanic or │ you of Hispanic or │
3019 │ │ Latino origin or │ Latino origin or │
3020 │( ( 1. How often do you usually │ descent? │ descent? │
3021 │drive a car or other motor ├─────────┬──────────┼─────────┬──────────┤
3022 │vehicle?) ) BY S3a. GENDER: > D5. │ Yes │ No │ Yes │ No │
3023 │ETHNICITY: Are you of Hispanic or ├─────────┼──────────┼─────────┼──────────┤
3024 │Latino origin or descent? │ Count │ Count │ Count │ Count │
3025 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3026 │Every day │ 218│ 2066│ 166│ 2175│
3027 │Several days a week │ 44│ 391│ 45│ 782│
3028 │Once a week or less │ 16│ 109│ 12│ 223│
3029 │Only certain times a year │ 15│ 41│ 11│ 61│
3030 │Never │ 39│ 150│ 56│ 278│
3031 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3032 Generated HH:MM:SS on MM/DD/YY
3036 AT_SETUP([CTABLES area definitions])
3037 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3038 AT_DATA([ctables.sps],
3041 /VLABELS VARIABLES=ALL DISPLAY=NAME
3042 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLEID, LAYERID, SUBTABLEID]
3043 /SLABELS POSITION=ROW
3044 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROWID, LAYERROWID]
3045 /SLABELS POSITION=ROW
3046 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COLID, LAYERCOLID]
3047 /SLABELS POSITION=ROW.
3049 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3052 ╭─────────────────────────────┬─────────────┬──────╮
3054 │ ├──────┬──────┼───┬──┤
3056 │ ├──────┼──────┤ │ │
3057 │ │ QN86 │ QN86 │ │ │
3058 │ ├───┬──┼───┬──┤ │ │
3059 │ │Yes│No│Yes│No│Yes│No│
3060 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3061 │QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3062 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3063 │ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
3064 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3065 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3066 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3067 │ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
3068 │ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3069 │ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3070 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3071 │ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
3072 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3073 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3074 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3075 │ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
3076 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3080 ╭─────────────────────────────┬─────────────┬──────╮
3082 │ ├──────┬──────┼───┬──┤
3084 │ ├──────┼──────┤ │ │
3085 │ │ QN86 │ QN86 │ │ │
3086 │ ├───┬──┼───┬──┤ │ │
3087 │ │Yes│No│Yes│No│Yes│No│
3088 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3089 │QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3090 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3091 │ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
3092 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3093 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3094 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3095 │ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
3096 │ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3097 │ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3098 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3099 │ Subtable ID│ 10│10│ 11│11│ 12│12│
3100 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3101 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3102 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3103 │ Subtable ID│ 10│10│ 11│11│ 12│12│
3104 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3108 ╭──────────────────────────────┬─────────────┬──────╮
3110 │ ├──────┬──────┼───┬──┤
3112 │ ├──────┼──────┤ │ │
3113 │ │ QN86 │ QN86 │ │ │
3114 │ ├───┬──┼───┬──┤ │ │
3115 │ │Yes│No│Yes│No│Yes│No│
3116 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3117 │QN61 Yes QN57 Yes Row ID │ 1│ 1│ 2│ 2│ 3│ 3│
3118 │ Layer Row ID│ 1│ 1│ 1│ 1│ 2│ 2│
3119 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3120 │ No Row ID │ 4│ 4│ 5│ 5│ 6│ 6│
3121 │ Layer Row ID│ 3│ 3│ 3│ 3│ 4│ 4│
3122 │ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3123 │ No QN57 Yes Row ID │ 7│ 7│ 8│ 8│ 9│ 9│
3124 │ Layer Row ID│ 5│ 5│ 5│ 5│ 6│ 6│
3125 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3126 │ No Row ID │ 10│10│ 11│11│ 12│12│
3127 │ Layer Row ID│ 7│ 7│ 7│ 7│ 8│ 8│
3128 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3132 ╭──────────────────────────────┬─────────────┬──────╮
3134 │ ├──────┬──────┼───┬──┤
3136 │ ├──────┼──────┤ │ │
3137 │ │ QN86 │ QN86 │ │ │
3138 │ ├───┬──┼───┬──┤ │ │
3139 │ │Yes│No│Yes│No│Yes│No│
3140 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3141 │QN61 Yes QN57 Yes Row ID │ 13│13│ 14│14│ 15│15│
3142 │ Layer Row ID│ 9│ 9│ 9│ 9│ 10│10│
3143 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3144 │ No Row ID │ 16│16│ 17│17│ 18│18│
3145 │ Layer Row ID│ 11│11│ 11│11│ 12│12│
3146 │ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3147 │ No QN57 Yes Row ID │ 19│19│ 20│20│ 21│21│
3148 │ Layer Row ID│ 13│13│ 13│13│ 14│14│
3149 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3150 │ No Row ID │ 22│22│ 23│23│ 24│24│
3151 │ Layer Row ID│ 15│15│ 15│15│ 16│16│
3152 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3156 ╭─────────────────────────────────┬─────────────┬──────╮
3158 │ ├──────┬──────┼───┬──┤
3160 │ ├──────┼──────┤ │ │
3161 │ │ QN86 │ QN86 │ │ │
3162 │ ├───┬──┼───┬──┤ │ │
3163 │ │Yes│No│Yes│No│Yes│No│
3164 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3165 │QN61 Yes QN57 Yes Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
3166 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3167 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3168 │ No Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
3169 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3170 │ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3171 │ No QN57 Yes Column ID │ 7│ 8│ 9│10│ 11│12│
3172 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3173 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3174 │ No Column ID │ 7│ 8│ 9│10│ 11│12│
3175 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3176 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3180 ╭─────────────────────────────────┬─────────────┬──────╮
3182 │ ├──────┬──────┼───┬──┤
3184 │ ├──────┼──────┤ │ │
3185 │ │ QN86 │ QN86 │ │ │
3186 │ ├───┬──┼───┬──┤ │ │
3187 │ │Yes│No│Yes│No│Yes│No│
3188 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3189 │QN61 Yes QN57 Yes Column ID │ 13│14│ 15│16│ 17│18│
3190 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3191 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3192 │ No Column ID │ 13│14│ 15│16│ 17│18│
3193 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3194 │ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3195 │ No QN57 Yes Column ID │ 19│20│ 21│22│ 23│24│
3196 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3197 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3198 │ No Column ID │ 19│20│ 21│22│ 23│24│
3199 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3200 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3204 AT_SETUP([CTABLES area definitions with CLABELS OPPOSITE])
3205 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3206 AT_DATA([ctables.sps],
3209 /VLABELS VARIABLES=ALL DISPLAY=NAME
3210 /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[TABLEID]
3211 /SLABELS POSITION=ROW
3212 /CLABELS ROWLABELS=OPPOSITE
3213 /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[SUBTABLEID]
3214 /SLABELS POSITION=ROW
3215 /CLABELS ROWLABELS=OPPOSITE
3216 /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[ROWID]
3217 /SLABELS POSITION=ROW
3218 /CLABELS ROWLABELS=OPPOSITE
3219 /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[COLID]
3220 /SLABELS POSITION=ROW
3221 /CLABELS ROWLABELS=OPPOSITE
3222 /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[LAYERROWID]
3223 /SLABELS POSITION=ROW
3224 /CLABELS ROWLABELS=OPPOSITE
3225 /TABLE qn26 > qn61 > qn57 BY qn27 > qnd7a > qn86 BY qns3a[LAYERCOLID]
3226 /SLABELS POSITION=ROW
3227 /CLABELS ROWLABELS=OPPOSITE
3229 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
3233 AT_SETUP([CTABLES categorical summary functions])
3234 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3235 AT_DATA([ctables.sps],
3238 /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
3239 /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
3240 /SLABELS POSITION=ROW.
3242 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3244 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
3245 │ │ D5a. What would you say is your primary ethnic background? │
3246 │ ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
3247 │ │ │ │ │ │ │ │ │ Multiple - │ │ │ │
3248 │ │ │ │ │ South │ Central │ Puerto │ Something│ cannot choose│ Don't│ │ │
3249 │ │Cuban│Mexican│Spanish│ American │ American │Rican, OR│ else │ one │ know │Refused│Total│
3250 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3251 │Region NE Count │ 6│ 8│ 8│ 11│ 7│ 39│ 23│ 2│ 0│ 1│ 105│
3252 │ Row % │ 5.7%│ 7.6%│ 7.6%│ 10.5%│ 6.7%│ 37.1%│ 21.9%│ 1.9%│ .0%│ 1.0%│ │
3253 │ Row │ 5.8%│ 7.7%│ 7.7%│ 10.6%│ 6.7%│ 37.5%│ 22.1%│ 1.9%│ .0%│ .0%│ │
3254 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3255 │ % │ │ │ │ │ │ │ │ │ │ │ │
3256 │ Row │ .4%│ .6%│ .6%│ .8%│ .5%│ 2.8%│ 1.6%│ .1%│ .0%│ .1%│ │
3257 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3258 │ % │ │ │ │ │ │ │ │ │ │ │ │
3259 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 104│
3260 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1409│
3261 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3262 │ MW Count │ 3│ 24│ 1│ 4│ 5│ 9│ 6│ 0│ 0│ 1│ 53│
3263 │ Row % │ 5.7%│ 45.3%│ 1.9%│ 7.5%│ 9.4%│ 17.0%│ 11.3%│ .0%│ .0%│ 1.9%│ │
3264 │ Row │ 5.8%│ 46.2%│ 1.9%│ 7.7%│ 9.6%│ 17.3%│ 11.5%│ .0%│ .0%│ .0%│ │
3265 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3266 │ % │ │ │ │ │ │ │ │ │ │ │ │
3267 │ Row │ .2%│ 1.5%│ .1%│ .2%│ .3%│ .5%│ .4%│ .0%│ .0%│ .1%│ │
3268 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3269 │ % │ │ │ │ │ │ │ │ │ │ │ │
3270 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 52│
3271 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1654│
3272 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3273 │ S Count │ 10│ 113│ 11│ 14│ 25│ 23│ 20│ 2│ 3│ 2│ 223│
3274 │ Row % │ 4.5%│ 50.7%│ 4.9%│ 6.3%│ 11.2%│ 10.3%│ 9.0%│ .9%│ 1.3%│ .9%│ │
3275 │ Row │ 4.6%│ 51.8%│ 5.0%│ 6.4%│ 11.5%│ 10.6%│ 9.2%│ .9%│ .0%│ .0%│ │
3276 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3277 │ % │ │ │ │ │ │ │ │ │ │ │ │
3278 │ Row │ .4%│ 4.7%│ .5%│ .6%│ 1.0%│ 1.0%│ .8%│ .1%│ .1%│ .1%│ │
3279 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3280 │ % │ │ │ │ │ │ │ │ │ │ │ │
3281 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 218│
3282 │ Total N│ │ │ │ │ │ │ │ │ │ │ 2390│
3283 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3284 │ W Count │ 1│ 166│ 28│ 5│ 15│ 7│ 19│ 3│ 0│ 1│ 245│
3285 │ Row % │ .4%│ 67.8%│ 11.4%│ 2.0%│ 6.1%│ 2.9%│ 7.8%│ 1.2%│ .0%│ .4%│ │
3286 │ Row │ .4%│ 68.0%│ 11.5%│ 2.0%│ 6.1%│ 2.9%│ 7.8%│ 1.2%│ .0%│ .0%│ │
3287 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3288 │ % │ │ │ │ │ │ │ │ │ │ │ │
3289 │ Row │ .1%│ 10.7%│ 1.8%│ .3%│ 1.0%│ .5%│ 1.2%│ .2%│ .0%│ .1%│ │
3290 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3291 │ % │ │ │ │ │ │ │ │ │ │ │ │
3292 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 244│
3293 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1546│
3294 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
3298 AT_SETUP([CTABLES scale summary functions])
3299 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3300 AT_DATA([ctables.sps],
3304 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
3305 CTABLES later, to make the results easier to verify.
3306 SPLIT FILE BY REGION.
3309 /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
3310 /FORMAT NOTABLE /MISSING=INCLUDE.
3314 /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
3315 /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, COLPCT.SUM]
3316 /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
3317 /SLABELS POSITION=ROW.
3319 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3321 ╭────────────────┬────────╮
3323 ├────────────────┼────────┤
3326 │ ╶─────────┼────────┤
3328 │ ╶─────────┼────────┤
3330 │ ╶─────────┼────────┤
3332 │ ╶─────────┼────────┤
3334 │ ╶─────────┼────────┤
3336 │ ╶─────────┼────────┤
3338 │ ╶─────────┼────────┤
3340 │ ╶─────────┼────────┤
3342 │ ╶─────────┼────────┤
3344 │ ╶─────────┼────────┤
3346 ├────────────────┼────────┤
3349 │ ╶─────────┼────────┤
3351 │ ╶─────────┼────────┤
3353 │ ╶─────────┼────────┤
3355 │ ╶─────────┼────────┤
3357 │ ╶─────────┼────────┤
3359 │ ╶─────────┼────────┤
3361 │ ╶─────────┼────────┤
3363 │ ╶─────────┼────────┤
3365 │ ╶─────────┼────────┤
3367 │ ╶─────────┼────────┤
3369 ├────────────────┼────────┤
3372 │ ╶─────────┼────────┤
3374 │ ╶─────────┼────────┤
3376 │ ╶─────────┼────────┤
3378 │ ╶─────────┼────────┤
3380 │ ╶─────────┼────────┤
3382 │ ╶─────────┼────────┤
3384 │ ╶─────────┼────────┤
3386 │ ╶─────────┼────────┤
3388 │ ╶─────────┼────────┤
3390 │ ╶─────────┼────────┤
3392 ├────────────────┼────────┤
3395 │ ╶─────────┼────────┤
3397 │ ╶─────────┼────────┤
3399 │ ╶─────────┼────────┤
3401 │ ╶─────────┼────────┤
3403 │ ╶─────────┼────────┤
3405 │ ╶─────────┼────────┤
3407 │ ╶─────────┼────────┤
3409 │ ╶─────────┼────────┤
3411 │ ╶─────────┼────────┤
3413 │ ╶─────────┼────────┤
3415 ╰────────────────┴────────╯
3418 ╭───────────────────────────┬────────╮
3420 ├───────────────────────────┼────────┤
3421 │REGION NE Valid N │ 936│
3424 │ Std Error of Mean│ .14│
3427 │ Std Deviation │ 4.41│
3435 │ Column Sum % │ 21.8%│
3436 │ ╶────────────────────┼────────┤
3437 │ MW Valid N │ 1019│
3440 │ Std Error of Mean│ .16│
3443 │ Std Deviation │ 5.15│
3451 │ Column Sum % │ 24.3%│
3452 │ ╶────────────────────┼────────┤
3454 │ Missing │ 1114.00│
3456 │ Std Error of Mean│ .18│
3459 │ Std Deviation │ 6.44│
3467 │ Column Sum % │ 31.2%│
3468 │ ╶────────────────────┼────────┤
3472 │ Std Error of Mean│ .17│
3475 │ Std Deviation │ 5.25│
3483 │ Column Sum % │ 22.7%│
3484 ╰───────────────────────────┴────────╯
3489 AT_SETUP([CTABLES hidden scale VLABELS])
3490 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3491 AT_DATA([ctables.sps],
3494 /TABLE region BY qn19a + qn35
3495 /SLABELS POSITION=ROW.
3497 /VLABELS VARIABLE=qn19a DISPLAY=NONE
3498 /TABLE region BY qn19a + qn35
3499 /SLABELS POSITION=ROW.
3501 /VLABELS VARIABLE=qn35 DISPLAY=NONE
3502 /TABLE region BY qn19a + qn35
3503 /SLABELS POSITION=ROW.
3505 * This one in particular caused a crash because no categories were
3506 created on the column axis, so passing in 0 for the index was still
3507 too big for that number of categories. It was fixed by creating a
3508 name-only category for each variable despite the "NONE" request,
3509 then hiding the entire dimension's labels if all its labels were
3512 /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
3513 /TABLE region BY qn19a + qn35
3514 /SLABELS POSITION=ROW.
3516 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3518 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
3519 │ │ 19a. About how old were you│ 35. In the past thirty days, how│
3520 │ │ when you first starting │ many times have you driven a │
3521 │ │ drinking alcohol, not │ motor vehicle WITHIN TWO HOURS │
3522 │ │ counting small tastes or │ AFTER drinking alcoholic │
3523 │ │ sips of alcohol. │ beverages? │
3524 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
3525 │Region NE Mean│ 19.33│ 2│
3526 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3527 │ MW Mean│ 19.83│ 2│
3528 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3530 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3532 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
3535 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
3536 │ │ │ 35. In the past thirty days, how many times have you │
3537 │ │ │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
3538 │ │QN19A│ alcoholic beverages? │
3539 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
3540 │Region NE Mean│19.33│ 2│
3541 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3543 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3545 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3547 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
3550 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
3551 │ │ 19a. About how old were you when you first starting │ │
3552 │ │ drinking alcohol, not counting small tastes or sips of │ │
3554 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
3555 │Region NE Mean│ 19.33│ 2│
3556 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3557 │ MW Mean│ 19.83│ 2│
3558 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3560 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3562 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
3565 ╭──────────────┬───────╮
3566 │Region NE Mean│19.33 2│
3573 ╰──────────────┴───────╯
3577 AT_SETUP([CTABLES with SPLIT FILE])
3578 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3579 AT_DATA([ctables.sps],
3582 SORT CASES BY qns3a.
3584 CTABLES /TABLE qn105ba.
3586 * Layered split has no effect on output.
3587 SPLIT FILE BY qns3a.
3588 CTABLES /TABLE qn105ba.
3590 * Add column variable qns3a to compare against separate splits.
3591 CTABLES /TABLE qn105ba BY qns3a.
3593 * Separate splits are truly output separately.
3594 SPLIT FILE SEPARATE BY qns3a.
3595 CTABLES /TABLE qn105ba.
3597 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
3599 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3601 ├────────────────────────────────────────────────────────────────────────┼─────┤
3602 │105b. How likely is it that drivers who have had too much Almost │ 700│
3603 │to drink to drive safely will A. Get stopped by the police? certain │ │
3604 │ Very likely │ 1502│
3611 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3614 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3616 ├────────────────────────────────────────────────────────────────────────┼─────┤
3617 │105b. How likely is it that drivers who have had too much Almost │ 700│
3618 │to drink to drive safely will A. Get stopped by the police? certain │ │
3619 │ Very likely │ 1502│
3626 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3629 ╭─────────────────────────────────────────────────────────────────┬────────────╮
3635 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
3636 │105b. How likely is it that drivers who have had too Almost │ 297│ 403│
3637 │much to drink to drive safely will A. Get stopped by certain │ │ │
3638 │the police? Very likely │ 660│ 842│
3639 │ Somewhat │ 1174│ 1589│
3641 │ Somewhat │ 640│ 667│
3645 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
3648 ╭────────────┬─────╮
3650 ├────────────┼─────┤
3651 │S3a. GENDER:│Male │
3652 ╰────────────┴─────╯
3655 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3657 ├────────────────────────────────────────────────────────────────────────┼─────┤
3658 │105b. How likely is it that drivers who have had too much Almost │ 297│
3659 │to drink to drive safely will A. Get stopped by the police? certain │ │
3660 │ Very likely │ 660│
3667 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3670 ╭────────────┬──────╮
3672 ├────────────┼──────┤
3673 │S3a. GENDER:│Female│
3674 ╰────────────┴──────╯
3677 ╭────────────────────────────────────────────────────────────────────────┬─────╮
3679 ├────────────────────────────────────────────────────────────────────────┼─────┤
3680 │105b. How likely is it that drivers who have had too much Almost │ 403│
3681 │to drink to drive safely will A. Get stopped by the police? certain │ │
3682 │ Very likely │ 842│
3689 ╰────────────────────────────────────────────────────────────────────────┴─────╯
3693 AT_SETUP([CTABLES variable level inference])
3694 AT_DATA([data.txt], [dnl
3695 dnl n1 has 10 unique small values -> nominal.
3696 dnl n2 has 23 unique small values -> nominal.
3697 dnl n3 is all missing -> nominal.
3698 dnl s1 has 24 unique small values -> scale.
3699 dnl s2 has one negative value -> scale.
3700 dnl s3 has one non-integer value -> scale.
3701 dnl s4 has no valid values less than 10 -> scale.
3702 dnl s5 has no valid values less than 10,000 -> scale.
3703 1 1 . 1 1 1 10 10001
3704 2 2 . 2 2 2 11 10002
3705 3 3 . 3 3 3 12 10003
3706 4 4 . 4 4 4 13 10004
3707 5 5 . 5 5 5 14 10005
3708 6 6 . 6 6 6 15 10006
3709 7 7 . 7 7 7 16 10007
3710 8 8 . 8 8 8 17 10008
3711 9 9 . 9 9 9 18 10009
3712 10 10 . 10 10 10.5 19 110000
3713 1 11 . 11 -1 1 11 10001
3714 2 12 . 12 2 2 12 10002
3715 3 13 . 13 3 3 13 10003
3716 4 14 . 14 4 4 14 10004
3717 5 15 . 15 5 5 15 10005
3718 6 16 . 16 6 6 16 10006
3719 7 17 . 17 7 7 17 10007
3720 8 18 . 18 8 8 18 10008
3721 9 19 . 19 9 9 19 10009
3722 1 20 . 20 1 1 20 10001
3723 2 21 . 21 2 2 21 10002
3724 3 22 . 22 3 3 22 10003
3725 4 23 . 23 4 4 23 10004
3726 5 23 . 24 5 5 24 10005
3727 6 23 . 24 6 6 25 10006
3730 AT_DATA([ctables.sps], [dnl
3731 DATA LIST LIST file='data.txt' NOTABLE /n1 to n3 s1 to s5.
3733 * Nominal formats (copied from data that will default to scale).
3736 FORMATS n4(WKDAY5) n5(MONTH5).
3738 * Scale formats (copied from data that will default to nominal).
3742 FORMATS s6(DOLLAR6.2) s7(CCA8.2) s8(DATETIME17).
3747 CTABLES /TABLE n1 + n2 + n3 + string + s1 + s2 + s3 + s4 + s5.
3751 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
3753 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
3754 │ │ │ Measurement │ │ │ │ │ │
3755 │Name │Position│ Level │ Role│Width│Alignment│Print Format│Write Format│
3756 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
3757 │n1 │ 1│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3758 │n2 │ 2│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3759 │n3 │ 3│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3760 │s1 │ 4│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3761 │s2 │ 5│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3762 │s3 │ 6│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3763 │s4 │ 7│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3764 │s5 │ 8│Unknown │Input│ 8│Right │F8.2 │F8.2 │
3765 │n4 │ 9│Unknown │Input│ 8│Right │WKDAY5 │WKDAY5 │
3766 │n5 │ 10│Unknown │Input│ 8│Right │MONTH5 │MONTH5 │
3767 │s6 │ 11│Unknown │Input│ 8│Right │DOLLAR6.2 │DOLLAR6.2 │
3768 │s7 │ 12│Unknown │Input│ 8│Right │CCA8.2 │CCA8.2 │
3769 │s8 │ 13│Unknown │Input│ 8│Right │DATETIME17.0│DATETIME17.0│
3770 │string│ 14│Nominal │Input│ 8│Left │A8 │A8 │
3771 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯
3774 ╭────────────┬─────┬────────╮
3776 ├────────────┼─────┼────────┤
3787 ├────────────┼─────┼────────┤
3811 ├────────────┼─────┼────────┤
3813 ├────────────┼─────┼────────┤
3815 ├────────────┼─────┼────────┤
3817 ├────────────┼─────┼────────┤
3819 ├────────────┼─────┼────────┤
3821 ├────────────┼─────┼────────┤
3823 ╰────────────┴─────┴────────╯
3826 ╭──────┬────────┬──────────────┬─────┬─────┬─────────┬────────────┬────────────╮
3827 │ │ │ Measurement │ │ │ │ │ │
3828 │Name │Position│ Level │ Role│Width│Alignment│Print Format│Write Format│
3829 ├──────┼────────┼──────────────┼─────┼─────┼─────────┼────────────┼────────────┤
3830 │n1 │ 1│Nominal │Input│ 8│Right │F8.2 │F8.2 │
3831 │n2 │ 2│Nominal │Input│ 8│Right │F8.2 │F8.2 │
3832 │n3 │ 3│Nominal │Input│ 8│Right │F8.2 │F8.2 │
3833 │s1 │ 4│Scale │Input│ 8│Right │F8.2 │F8.2 │
3834 │s2 │ 5│Scale │Input│ 8│Right │F8.2 │F8.2 │
3835 │s3 │ 6│Scale │Input│ 8│Right │F8.2 │F8.2 │
3836 │s4 │ 7│Scale │Input│ 8│Right │F8.2 │F8.2 │
3837 │s5 │ 8│Scale │Input│ 8│Right │F8.2 │F8.2 │
3838 │n4 │ 9│Nominal │Input│ 8│Right │WKDAY5 │WKDAY5 │
3839 │n5 │ 10│Nominal │Input│ 8│Right │MONTH5 │MONTH5 │
3840 │s6 │ 11│Scale │Input│ 8│Right │DOLLAR6.2 │DOLLAR6.2 │
3841 │s7 │ 12│Scale │Input│ 8│Right │CCA8.2 │CCA8.2 │
3842 │s8 │ 13│Scale │Input│ 8│Right │DATETIME17.0│DATETIME17.0│
3843 │string│ 14│Nominal │Input│ 8│Left │A8 │A8 │
3844 ╰──────┴────────┴──────────────┴─────┴─────┴─────────┴────────────┴────────────╯