3 dnl Features not yet tested:
4 dnl - Preprocessing to distinguish categorical from scale.
5 dnl - Testing details of missing value handling in summaries.
6 dnl - Test WEIGHT and adjustment weights.
7 dnl - Summary functions:
8 dnl * Separate summary functions for totals and subtotals.
9 dnl * )CILEVEL in summary label specification
10 dnl - Summary functions:
11 dnl * U-prefix for unweighted summaries.
12 dnl * areaPCT.SUM and UareaPCT.SUM functions.
13 dnl - SPLIT FILE with SEPARATE splits
14 dnl - Definition of columns/rows when labels are rotated from one axis to another.
17 dnl - Multiple response sets
18 dnl - MRSETS subcommand.
19 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
22 dnl - Summary functions:
23 dnl * .LCL and .UCL suffixes.
26 dnl * Data-dependent sorting.
28 AT_SETUP([CTABLES parsing])
29 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
30 AT_DATA([ctables.sps],
33 /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
34 /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
35 /FORMAT UNITS=CM EMPTY="(-)"
36 /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
37 /VLABELS VARIABLES=qn17 DISPLAY=NAME
38 /VLABELS VARIABLES=qns3a DISPLAY=LABEL
39 /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
40 /VLABELS VARIABLES=qn20 DISPLAY=NONE
41 /MRSETS COUNTDUPLICATES=NO
42 /MRSETS COUNTDUPLICATES=YES
45 /WEIGHT VARIABLE=qns3a
47 /HIDESMALLCOUNTS COUNT=10
49 /SLABELS POSITION=COLUMN VISIBLE=YES
50 /SLABELS VISIBLE=NO POSITION=ROW
51 /SLABELS POSITION=LAYER
53 /CLABELS ROWLABELS=OPPOSITE
55 /CATEGORIES VARIABLES=qn1 qn17
56 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
57 POSITION=BEFORE EMPTY=INCLUDE.
58 CTABLES /TABLE qnsa1 /CLABELS ROWLABELS=LAYER.
59 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=OPPOSITE.
60 CTABLES /TABLE qnsa1 /CLABELS COLLABELS=LAYER.
62 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
65 ╭───────────────────┬────┬────╮
67 ├───────────────────┼────┼────┤
68 │Sa1. SAMPLE SOURCE:│5392│1607│
69 ╰───────────────────┴────┴────╯
73 ╭───────────────────┬─────╮
75 ├───────────────────┼─────┤
76 │Sa1. SAMPLE SOURCE:│ 5392│
77 ╰───────────────────┴─────╯
80 ╭────────────────────────┬─────╮
82 ├────────────────────────┼─────┤
83 │Sa1. SAMPLE SOURCE: RDD │ 5392│
85 ╰────────────────────────┴─────╯
88 ╭────────────────────────┬─────╮
90 ├────────────────────────┼─────┤
91 │Sa1. SAMPLE SOURCE: RDD │ 5392│
93 ╰────────────────────────┴─────╯
97 AT_SETUP([CTABLES parsing - negative])
98 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
99 AT_DATA([ctables.sps],
102 CTABLES /FORMAT MINCOLWIDTH='foo'.
103 CTABLES /TABLE qn1 [**].
104 CTABLES /TABLE qn1 [NOTAFUNCTION].
107 CTABLES /TABLE NOTAVAR.
109 CTABLES /TABLE string[S].
110 CTABLES /TABLE qn1 [PTILE 101].
111 CTABLES /TABLE qn1 [MEAN F0.1].
112 CTABLES /TABLE qn1 [MEAN NEGPAREN1.2].
113 CTABLES /TABLE qn1 [MEAN NEGPAREN3.4].
114 CTABLES /TABLE qn1 [MEAN TOTALS].
115 CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
116 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
117 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO **].
118 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [LO THRU x].
119 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1 THRU **].
120 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['x' THRU **].
121 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&**].
122 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
123 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=PTILE(qn1, 101).
124 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1.
125 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 KEY=MEAN.
126 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 MISSING=**.
127 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 TOTAL=**.
128 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 LABEL=**.
129 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 POSITION=**.
130 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 EMPTY=**.
131 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 **.
132 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [1,2,3] **.
133 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[0]).
134 CTABLES /PCOMPUTE &k=EXPR(SUBTOTAL[1**]).
135 CTABLES /PCOMPUTE &k=EXPR([LO **]).
136 CTABLES /PCOMPUTE &k=EXPR([LO THRU **]).
137 CTABLES /PCOMPUTE &k=EXPR([1 THRU **]).
138 CTABLES /PCOMPUTE &k=EXPR([1**]).
139 CTABLES /PCOMPUTE &k=EXPR((1x)).
140 CTABLES /PCOMPUTE **k.
141 CTABLES /PCOMPUTE &1.
142 CTABLES /PCOMPUTE &k**.
143 CTABLES /PCOMPUTE &k=**.
144 CTABLES /PCOMPUTE &k=EXPR**.
145 CTABLES /PCOMPUTE &k=EXPR(1x).
146 CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
147 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=NOTAFUNCTION.
148 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k FORMAT=PTILE **.
149 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k LABEL=**.
150 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k HIDESOURCECATS=**.
151 CTABLES /PCOMPUTE &k=EXPR(1) /PPROPERTIES &k **.
152 CTABLES /FORMAT EMPTY=**.
153 CTABLES /FORMAT MISSING=**.
155 CTABLES /FORMAT MINCOLWIDTH=20 MAXCOLWIDTH=10/.
157 CTABLES /VLABELS VARIABLES=NOTAVAR.
158 CTABLES /VLABELS VARIABLES=qn1 **.
159 CTABLES /VLABELS VARIABLES=qn1 DISPLAY=**.
161 CTABLES /MRSETS COUNTDUPLICATES=**.
162 CTABLES /SMISSING **.
164 CTABLES /WEIGHT VARIABLE=NOTAVAR.
165 CTABLES /HIDESMALLCOUNTS COUNT=1.
167 CTABLES /HIDESMALLCOUNTS COUNT=2.
168 CTABLES /TABLE qn1**.
169 CTABLES /TABLE qn1 /SLABELS POSITION=**.
170 CTABLES /TABLE qn1 /SLABELS VISIBLE=**.
171 CTABLES /TABLE qn1 /SLABELS **.
172 CTABLES /TABLE qn1 /CLABELS ROWLABELS=**.
173 CTABLES /TABLE qn1 /CLABELS COLLABELS=**.
174 CTABLES /TABLE qn1 /CLABELS **.
175 CTABLES /TABLE qn1 /CRITERIA **.
176 CTABLES /TABLE qn1 /CRITERIA CILEVEL=101.
177 CTABLES /TABLE qn1 /TITLES **.
178 CTABLES /TABLE qn1 /SIGTEST TYPE=**.
179 CTABLES /TABLE qn1 /SIGTEST ALPHA=**.
180 CTABLES /TABLE qn1 /SIGTEST INCLUDEMRSETS=**.
181 CTABLES /TABLE qn1 /SIGTEST CATEGORIES=**.
182 CTABLES /TABLE qn1 /SIGTEST **.
183 CTABLES /TABLE qn1 /COMPARETEST TYPE=**.
184 CTABLES /TABLE qn1 /COMPARETEST ALPHA=**.
185 CTABLES /TABLE qn1 /COMPARETEST ALPHA=0,5.
186 CTABLES /TABLE qn1 /COMPARETEST ADJUST=**.
187 CTABLES /TABLE qn1 /COMPARETEST INCLUDEMRSETS=**.
188 CTABLES /TABLE qn1 /COMPARETEST MEANSVARIANCE=**.
189 CTABLES /TABLE qn1 /COMPARETEST CATEGORIES=**.
190 CTABLES /TABLE qn1 /COMPARETEST MERGE=**.
191 CTABLES /TABLE qn1 /COMPARETEST STYLE=**.
192 CTABLES /TABLE qn1 /COMPARETEST SHOWSIG=**.
193 CTABLES /TABLE qn1 /COMPARETEST **.
194 CTABLES /TABLE qn1 / **.
195 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CLABELS COLLABELS=OPPOSITE.
196 CTABLES /TABLE qn20 > qnd1.
197 CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
198 NUMERIC datetime (DATETIME17.0).
199 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
201 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
202 [[ctables.sps:2.8: error: CTABLES: Syntax error at end of command: expecting `/'.
204 ctables.sps:3.29-3.33: error: CTABLES: Syntax error at `'foo'': Expected non-
205 negative number for MINCOLWIDTH.
207 ctables.sps:4.21-4.22: error: CTABLES: Syntax error at `**': expecting
210 ctables.sps:5.21-5.32: error: CTABLES: Syntax error at `NOTAFUNCTION': Expecting
211 summary function name.
213 ctables.sps:6.20: error: CTABLES: Syntax error at end of command: expecting `@:}@'.
215 ctables.sps:7.16-7.17: error: CTABLES: Syntax error at `**': expecting
218 ctables.sps:8: error: CTABLES: NOTAVAR is not a variable name.
220 ctables.sps:10.16-10.24: error: CTABLES: Cannot use string variable string as a
222 10 | CTABLES /TABLE string[S].
225 ctables.sps:11.27-11.29: error: CTABLES: Syntax error at `101': Expected number
226 between 0 and 100 for PTILE.
228 ctables.sps:12: error: CTABLES: Output format F0.1 specifies width 0, but F
229 requires a width between 1 and 40.
231 ctables.sps:13.26-13.36: error: CTABLES: Syntax error at `NEGPAREN1.2': Output
232 format NEGPAREN requires width 2 or greater.
234 ctables.sps:14.26-14.36: error: CTABLES: Syntax error at `NEGPAREN3.4': Output
235 format NEGPAREN requires width greater than decimals.
237 ctables.sps:15.21-15.24: error: CTABLES: Summary function MEAN applies only to
239 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
242 ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
243 15 | CTABLES /TABLE qn1 [MEAN TOTALS].
246 ctables.sps:15.32: error: CTABLES: Syntax error at `@:>@': expecting `@<:@'.
248 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
250 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
253 ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
254 16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
257 ctables.sps:16.40: error: CTABLES: Syntax error at `%': expecting `@:>@'.
259 ctables.sps:17.56: error: CTABLES: Syntax error at `x': expecting string.
261 ctables.sps:18.50-18.51: error: CTABLES: Syntax error at `**': expecting THRU.
263 ctables.sps:19.55: error: CTABLES: Syntax error at `x': expecting number.
265 ctables.sps:20.54-20.55: error: CTABLES: Syntax error at `**': expecting number.
267 ctables.sps:21.56-21.57: error: CTABLES: Syntax error at `**': expecting string.
269 ctables.sps:22.48-22.49: error: CTABLES: Syntax error at `**': expecting
272 ctables.sps:23.47-23.48: error: CTABLES: Unknown postcompute &x.
273 23 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&x].
276 ctables.sps:24.61-24.63: error: CTABLES: Syntax error at `101': Expected number
277 between 0 and 100 for PTILE.
279 ctables.sps:25.58: error: CTABLES: Syntax error at end of command: expecting
282 ctables.sps:26.54: error: CTABLES: Syntax error at end of command: expecting
285 ctables.sps:27.54-27.55: error: CTABLES: Syntax error at `**': expecting INCLUDE
288 ctables.sps:28.52-28.53: error: CTABLES: Syntax error at `**': expecting YES or
291 ctables.sps:29.52-29.53: error: CTABLES: Syntax error at `**': expecting string.
293 ctables.sps:30.55-30.56: error: CTABLES: Syntax error at `**': expecting BEFORE
296 ctables.sps:31.52-31.53: error: CTABLES: Syntax error at `**': expecting INCLUDE
299 ctables.sps:32.46-32.47: error: CTABLES: Syntax error at `**': expecting ORDER,
300 KEY, MISSING, TOTAL, LABEL, POSITION, or EMPTY.
302 ctables.sps:33.54-33.55: error: CTABLES: Syntax error at `**': expecting TOTAL,
303 LABEL, POSITION, or EMPTY.
305 ctables.sps:34.36: error: CTABLES: Syntax error at `0': Expected positive
306 integer for SUBTOTAL.
308 ctables.sps:35.37-35.38: error: CTABLES: Syntax error at `**': expecting `@:>@'.
310 ctables.sps:36.31-36.32: error: CTABLES: Syntax error at `**': expecting THRU.
312 ctables.sps:37.36-37.37: error: CTABLES: Syntax error at `**': expecting number.
314 ctables.sps:38.35-38.36: error: CTABLES: Syntax error at `**': expecting number.
316 ctables.sps:39.29-39.30: error: CTABLES: Syntax error at `**': expecting `@:>@'.
318 ctables.sps:40.29: error: CTABLES: Syntax error at `x': expecting `@:}@'.
320 ctables.sps:41.19-41.20: error: CTABLES: Syntax error at `**': expecting &.
322 ctables.sps:42.20: error: CTABLES: Syntax error at `1': expecting identifier.
324 ctables.sps:43.21-43.22: error: CTABLES: Syntax error at `**': expecting `='.
326 ctables.sps:44.22-44.23: error: CTABLES: Syntax error at `**': expecting EXPR.
328 ctables.sps:45.26-45.27: error: CTABLES: Syntax error at `**': expecting `('.
330 ctables.sps:46.28: error: CTABLES: Syntax error at `x': expecting `)'.
332 ctables.sps:47.31-47.49: warning: CTABLES: New definition of &k will override
333 the previous definition.
334 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
335 | ^~~~~~~~~~~~~~~~~~~
337 ctables.sps:47.10-47.28: note: CTABLES: This is the previous definition.
338 47 | CTABLES /PCOMPUTE &k=EXPR(1) /PCOMPUTE &k=EXPR(2).
339 | ^~~~~~~~~~~~~~~~~~~
341 ctables.sps:47.50: error: CTABLES: Syntax error at end of command: expecting
344 ctables.sps:48.53-48.64: error: CTABLES: Syntax error at `NOTAFUNCTION':
345 Expecting summary function name.
347 ctables.sps:49.59-49.60: error: CTABLES: Syntax error at `**': Expected number
348 between 0 and 100 for PTILE.
350 ctables.sps:50.52-50.53: error: CTABLES: Syntax error at `**': expecting string.
352 ctables.sps:51.61-51.62: error: CTABLES: Syntax error at `**': expecting YES or
355 ctables.sps:52.46-52.47: error: CTABLES: Syntax error at `**': expecting LABEL,
356 FORMAT, or HIDESOURCECATS.
358 ctables.sps:53.23-53.24: error: CTABLES: Syntax error at `**': expecting string.
360 ctables.sps:54.25-54.26: error: CTABLES: Syntax error at `**': expecting string.
362 ctables.sps:55.17-55.18: error: CTABLES: Syntax error at `**': expecting
363 MINCOLWIDTH, MAXCOLWIDTH, UNITS, EMPTY, or MISSING.
365 ctables.sps:56: error: CTABLES: MINCOLWIDTH must not be greater than
368 ctables.sps:57.18-57.19: error: CTABLES: Syntax error at `**': expecting
371 ctables.sps:58: error: CTABLES: NOTAVAR is not a variable name.
373 ctables.sps:59.32-59.33: error: CTABLES: Syntax error at `**': expecting
376 ctables.sps:60.40-60.41: error: CTABLES: Syntax error at `**': expecting
377 DEFAULT, NAME, LABEL, BOTH, or NONE.
379 ctables.sps:61.17-61.18: error: CTABLES: Syntax error at `**': expecting
382 ctables.sps:62.33-62.34: error: CTABLES: Syntax error at `**': expecting YES or
385 ctables.sps:63.19-63.20: error: CTABLES: Syntax error at `**': expecting
386 VARIABLE or LISTWISE.
388 ctables.sps:64.17-64.18: error: CTABLES: Syntax error at `**': expecting
391 ctables.sps:65: error: CTABLES: NOTAVAR is not a variable name.
393 ctables.sps:66.32: error: CTABLES: Syntax error at `1': Expected integer 2 or
394 greater for HIDESMALLCOUNTS COUNT.
396 ctables.sps:67.10-67.13: error: CTABLES: Syntax error at `QUUX': expecting
397 FORMAT, VLABELS, MRSETS, SMISSING, PCOMPUTE, PPROPERTIES, WEIGHT,
398 HIDESMALLCOUNTS, or TABLE.
400 ctables.sps:68.33: error: CTABLES: Syntax error at end of command: expecting
403 ctables.sps:69.19-69.20: error: CTABLES: Syntax error at `**': expecting `/'.
405 ctables.sps:70.38-70.39: error: CTABLES: Syntax error at `**': expecting COLUMN,
408 ctables.sps:71.37-71.38: error: CTABLES: Syntax error at `**': expecting YES or
411 ctables.sps:72.29-72.30: error: CTABLES: Syntax error at `**': expecting
414 ctables.sps:73.39-73.40: error: CTABLES: Syntax error at `**': expecting
417 ctables.sps:74.39-74.40: error: CTABLES: Syntax error at `**': expecting
420 ctables.sps:75.29-75.30: error: CTABLES: Syntax error at `**': expecting AUTO,
421 ROWLABELS, or COLLABELS.
423 ctables.sps:76.30-76.31: error: CTABLES: Syntax error at `**': expecting
426 ctables.sps:77.38-77.40: error: CTABLES: Syntax error at `101': Expected number
427 in @<:@0,100@:}@ for CILEVEL.
429 ctables.sps:78.28-78.29: error: CTABLES: Syntax error at `**': expecting
430 CAPTION, CORNER, or TITLE.
432 ctables.sps:79.34-79.35: error: CTABLES: Syntax error at `**': expecting
435 ctables.sps:80.35-80.36: error: CTABLES: Syntax error at `**': Expected number
436 in @<:@0,1@:}@ for ALPHA.
438 ctables.sps:81.43-81.44: error: CTABLES: Syntax error at `**': expecting YES or
441 ctables.sps:82.40-82.41: error: CTABLES: Syntax error at `**': expecting
442 ALLVISIBLE or SUBTOTALS.
444 ctables.sps:83.29-83.30: error: CTABLES: Syntax error at `**': expecting TYPE,
445 ALPHA, INCLUDEMRSETS, or CATEGORIES.
447 ctables.sps:84.38-84.39: error: CTABLES: Syntax error at `**': expecting PROP or
450 ctables.sps:85.39-85.40: error: CTABLES: Syntax error at `**': Expected number
453 ctables.sps:86.39: error: CTABLES: Syntax error at `0': Expected number in (0,1)
456 ctables.sps:87.40-87.41: error: CTABLES: Syntax error at `**': expecting
457 BONFERRONI, BH, or NONE.
459 ctables.sps:88.47-88.48: error: CTABLES: Syntax error at `**': expecting YES or
462 ctables.sps:89.47-89.48: error: CTABLES: Syntax error at `**': expecting ALLCATS
465 ctables.sps:90.44-90.45: error: CTABLES: Syntax error at `**': expecting
466 ALLVISIBLE or SUBTOTALS.
468 ctables.sps:91.39-91.40: error: CTABLES: Syntax error at `**': expecting YES or
471 ctables.sps:92.39-92.40: error: CTABLES: Syntax error at `**': expecting APA or
474 ctables.sps:93.41-93.42: error: CTABLES: Syntax error at `**': expecting YES or
477 ctables.sps:94.33-94.34: error: CTABLES: Syntax error at `**': expecting TYPE,
478 ALPHA, ADJUST, INCLUDEMRSETS, MEANSVARIANCE, CATEGORIES, MERGE, STYLE, or
481 ctables.sps:95.22-95.23: error: CTABLES: Syntax error at `**': expecting TABLE,
482 SLABELS, CLABELS, CRITERIA, CATEGORIES, TITLES, SIGTEST, or COMPARETEST.
484 ctables.sps:96: error: CTABLES: ROWLABELS and COLLABELS may not both be
487 ctables.sps:97.16-97.26: error: CTABLES: Cannot nest scale variables.
488 97 | CTABLES /TABLE qn20 > qnd1.
491 ctables.sps:97.16-97.19: note: CTABLES: This is an outer scale variable.
492 97 | CTABLES /TABLE qn20 > qnd1.
495 ctables.sps:97.23-97.26: note: CTABLES: This is an inner scale variable.
496 97 | CTABLES /TABLE qn20 > qnd1.
499 ctables.sps:98.16-98.35: error: CTABLES: Summaries may only be requested for
500 categorical variables at the innermost nesting level.
501 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
502 | ^~~~~~~~~~~~~~~~~~~~
504 ctables.sps:98.16-98.18: note: CTABLES: This outer categorical variable has a
506 98 | CTABLES /TABLE qn1 [ROWPCT] > qnsa1.
509 ctables.sps:100.52-100.56: error: CTABLES: Failed to parse category
510 specification as format DATETIME: Day (123) must be between 1 and 31..
511 100 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=datetime ['123'].
516 AT_SETUP([CTABLES parsing - more negative])
517 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
518 AT_DATA([ctables.sps],
520 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
521 CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc].
522 CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
525 CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
526 CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
528 CTABLES /TABLE qn1 /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn1 KEY=MEAN(qn1).
530 CTABLES /TABLE qnd1 /CLABELS ROWLABELS=OPPOSITE.
531 CTABLES /TABLE qn1 + string /CLABELS ROWLABELS=OPPOSITE.
532 CTABLES /TABLE qn1 + qnsa1 /CLABELS ROWLABELS=OPPOSITE.
533 CTABLES /TABLE qn105ba + qn105bb /CLABELS ROWLABELS=OPPOSITE /CATEGORIES VARIABLES=qn105ba [1,2,3].
535 CTABLES /PCOMPUTE &x=EXPR(1**2**3).
536 CTABLES /PCOMPUTE &x=EXPR([**]).
537 CTABLES /PCOMPUTE &x=EXPR(**).
541 CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
543 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [1],
544 [[ctables.sps:2.76-2.78: error: CTABLES: Computed category &pc references a
545 category not included in the category list.
546 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
551 ctables.sps:2.28-2.35: note: CTABLES: This is the missing category.
552 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
556 ctables.sps:2.76-2.79: note: CTABLES: To fix the problem, add subtotals to the
557 list of categories here.
558 2 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
563 ctables.sps:3.73-3.75: error: CTABLES: Computed category &pc references a
564 category not included in the category list.
565 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
570 ctables.sps:3.28-3.32: note: CTABLES: This is the missing category.
571 3 | CTABLES /PCOMPUTE &pc=EXPR(TOTAL) /TABLE qn1 /CATEGORIES VARIABLES=qn1
575 ctables.sps:3: note: CTABLES: To fix the problem, add TOTAL=YES to the
576 variable's CATEGORIES specification.
578 ctables.sps:4.76-4.99: error: CTABLES: These categories include 2 instances of
579 SUBTOTAL or HSUBTOTAL, so references from computed categories must refer to
580 subtotals by position, e.g. SUBTOTAL[1].
581 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
582 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
584 ^~~~~~~~~~~~~~~~~~~~~~~~
586 ctables.sps:4.28-4.35: note: CTABLES: This is the reference that lacks a
588 4 | CTABLES /PCOMPUTE &pc=EXPR(SUBTOTAL) /TABLE qn1 /CATEGORIES
589 VARIABLES=qn1 [&pc, SUBTOTAL, SUBTOTAL].
592 ctables.sps:7.47-7.54: error: CTABLES: This category specification may be
593 applied only to string variables, but this subcommand tries to apply it to
594 numeric variable QN1.
595 7 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 ['string'].
598 ctables.sps:8.53: error: CTABLES: This category specification may be applied
599 only to numeric variables, but this subcommand tries to apply it to string
601 8 | CTABLES /TABLE string /CATEGORIES VARIABLES=string [1].
604 ctables.sps:10: error: CTABLES: ROWLABELS=OPPOSITE is not allowed with sorting
605 based on a summary function.
607 ctables.sps:12: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
608 moved to be categorical, but qnd1 is a scale variable.
610 ctables.sps:13: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
611 moved to have the same width, but QN1 has width 0 and string has width 8.
613 ctables.sps:14: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
614 moved to have the same value labels, but QN1 and QNSA1 have different value
617 ctables.sps:15: error: CTABLES: ROWLABELS=OPPOSITE requires the variables to be
618 moved to have the same category specifications, but QN105BA and QN105BB have
619 different category specifications.
621 ctables.sps:17.27-17.33: warning: CTABLES: The exponentiation operator (`**') is
622 left-associative: `a**b**c' equals `(a**b)**c', not `a**(b**c)'. To disable
623 this warning, insert parentheses.
624 17 | CTABLES /PCOMPUTE &x=EXPR(1**2**3).
627 ctables.sps:17.35: error: CTABLES: Syntax error at end of command: expecting
630 ctables.sps:18.28-18.29: error: CTABLES: Syntax error at `**'.
632 ctables.sps:19.27-19.28: error: CTABLES: Syntax error at `**'.
634 ctables.sps:21.15: error: CTABLES: Syntax error at end of command: At least one
635 variable must be specified.
637 ctables.sps:23: error: CTABLES: Summaries may appear only on one axis.
639 ctables.sps:23.50-23.54: note: CTABLES: This variable on the layers axis has a
641 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
644 ctables.sps:23.16-23.20: note: CTABLES: This variable on the rows axis has a
646 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
649 ctables.sps:23.33-23.37: note: CTABLES: This variable on the columns axis has a
651 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
654 ctables.sps:23.33-23.37: note: CTABLES: This is a scale variable, so it always
655 has a summary even if the syntax does not explicitly specify one.
656 23 | CTABLES /TABLE qn113 [COUNT] BY qn114 [COUNT] BY qn116 [COUNT].
661 AT_SETUP([CTABLES one categorical variable])
662 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
663 AT_DATA([ctables.sps],
666 CTABLES /TABLE BY qn1.
667 CTABLES /TABLE BY BY qn1.
669 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
671 ╭────────────────────────────────────────────────────────────────────────┬─────╮
673 ├────────────────────────────────────────────────────────────────────────┼─────┤
674 │ 1. How often do you usually drive a car or other Every day │ 4667│
675 │motor vehicle? Several days a week │ 1274│
676 │ Once a week or less │ 361│
677 │ Only certain times a │ 130│
680 ╰────────────────────────────────────────────────────────────────────────┴─────╯
683 ╭──────────────────────────────────────────────────────────────────────────────╮
684 │ 1. How often do you usually drive a car or other motor vehicle? │
685 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
686 │ │ Several days a │ Once a week or │ Only certain times a │ │
687 │Every day│ week │ less │ year │Never│
688 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
689 │ Count │ Count │ Count │ Count │Count│
690 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
691 │ 4667│ 1274│ 361│ 130│ 540│
692 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
704 AT_SETUP([CTABLES one string variable])
705 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
706 AT_DATA([ctables.sps],
709 MISSING VALUES licensed('DontKnow', 'Refused').
710 RECODE qnd7a(1='Yes')(2='No')(3='DontKnow')(4='Refused') INTO licensed.
711 CTABLES /TABLE licensed.
712 CTABLES /TABLE licensed [COUNT, TOTALS[COUNT, VALIDN]] /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
713 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'No'] TOTAL=YES.
714 * Notice that the string matching is case-sensitive.
715 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['Yes', 'no'] TOTAL=YES.
716 CTABLES /TABLE licensed /CATEGORIES VARIABLES=licensed ['No' THRU 'yes'] TOTAL=YES.
718 /PCOMPUTE ¬yes=EXPR(['No']+['DontKnow']+['Refused'])
719 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
721 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'No', 'DontKnow', 'Refused'].
723 /PCOMPUTE ¬yes=EXPR(['DontKnow' THRU 'No'] + ['Refused'])
724 /PPROPERTIES ¬yes LABEL='Not Yes' HIDESOURCECATS=YES
726 /CATEGORIES VARIABLES=licensed ['Yes', ¬yes, 'DontKnow' THRU 'No', 'Refused'].
728 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
738 ╭─────────────────┬─────┬───────╮
740 ├─────────────────┼─────┼───────┤
741 │licensed DontKnow│ 4│ │
745 │ Total │ 6999│ 6951│
746 ╰─────────────────┴─────┴───────╯
749 ╭──────────────┬─────╮
751 ├──────────────┼─────┤
752 │licensed Yes │ 6379│
755 ╰──────────────┴─────╯
758 ╭──────────────┬─────╮
760 ├──────────────┼─────┤
761 │licensed Yes │ 6379│
764 ╰──────────────┴─────╯
767 ╭────────────────┬─────╮
769 ├────────────────┼─────┤
774 ╰────────────────┴─────╯
777 ╭────────────────┬─────╮
779 ├────────────────┼─────┤
780 │licensed Yes │ 6379│
782 ╰────────────────┴─────╯
785 ╭────────────────┬─────╮
787 ├────────────────┼─────┤
788 │licensed Yes │ 6379│
790 ╰────────────────┴─────╯
794 AT_SETUP([CTABLES one scale variable])
795 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
796 AT_DATA([ctables.sps],
798 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
799 CTABLES /TABLE BY qnd1.
800 CTABLES /TABLE BY BY qnd1.
802 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
804 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
805 │ │ │ │ │ │ Std │ │ │
806 │ │Count│Valid N│Total N│Mean│ Deviation │Minimum│Maximum│
807 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
808 │D1. AGE: What is your │ 6999│ 6930│ 6999│ 48│ 19│ 16│ 86│
809 │age? │ │ │ │ │ │ │ │
810 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
813 ╭──────────────────────────╮
814 │D1. AGE: What is your age?│
815 ├──────────────────────────┤
817 ├──────────────────────────┤
819 ╰──────────────────────────╯
822 D1. AGE: What is your age?
831 AT_SETUP([CTABLES simple stacking])
832 AT_KEYWORDS([stack stacked])
833 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
834 AT_DATA([ctables.sps],
836 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
838 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
840 ╭───────────────────────────────────────────────────────────────┬──────────────╮
847 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
848 │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│
849 │too much to drink to drive safely will A. Get certain │ │ │
850 │stopped by the police? Very likely │ 21%│ 22%│
851 │ Somewhat │ 38%│ 42%│
853 │ Somewhat │ 21%│ 18%│
857 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
858 │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│
859 │too much to drink to drive safely will B. Have an certain │ │ │
860 │accident? Very likely │ 36%│ 45%│
861 │ Somewhat │ 39%│ 32%│
867 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
868 │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│
869 │too much to drink to drive safely will C. Be certain │ │ │
870 │convicted for drunk driving? Very likely │ 32%│ 28%│
871 │ Somewhat │ 27%│ 32%│
873 │ Somewhat │ 15%│ 15%│
877 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
878 │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│
879 │too much to drink to drive safely will D. Be certain │ │ │
880 │arrested for drunk driving? Very likely │ 26%│ 27%│
881 │ Somewhat │ 32%│ 35%│
883 │ Somewhat │ 17%│ 15%│
887 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
891 AT_SETUP([CTABLES show or hide empty categories])
892 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
893 AT_DATA([ctables.sps],
895 IF (qn105ba = 2) qn105ba = 1.
896 IF (qns3a = 1) qns3a = 2.
897 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
898 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
899 /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
900 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
901 /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
902 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
903 /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
905 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
907 ╭──────────────────────────────────────────────────────────────┬───────────────╮
914 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
915 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
916 │too much to drink to drive safely will A. Get certain │ │ │
917 │stopped by the police? Very likely│ .│ 0%│
924 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
927 ╭──────────────────────────────────────────────────────────────┬───────────────╮
934 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
935 │105b. How likely is it that drivers who have had Almost │ .│ 32%│
936 │too much to drink to drive safely will A. Get certain │ │ │
937 │stopped by the police? Somewhat │ .│ 40%│
943 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
946 ╭────────────────────────────────────────────────────────────────────┬─────────╮
953 ├────────────────────────────────────────────────────────────────────┼─────────┤
954 │105b. How likely is it that drivers who have had too Almost │ 32%│
955 │much to drink to drive safely will A. Get stopped by certain │ │
956 │the police? Very likely │ 0%│
963 ╰────────────────────────────────────────────────────────────────────┴─────────╯
966 ╭────────────────────────────────────────────────────────────────────┬─────────╮
973 ├────────────────────────────────────────────────────────────────────┼─────────┤
974 │105b. How likely is it that drivers who have had too Almost │ 32%│
975 │much to drink to drive safely will A. Get stopped by certain │ │
976 │the police? Somewhat │ 40%│
982 ╰────────────────────────────────────────────────────────────────────┴─────────╯
986 AT_SETUP([CTABLES sorting categories])
987 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
988 AT_DATA([ctables.sps],
990 IF (QND5A=6) QND5A=-1.
991 IF (QND5A=5) QND5A=-2.
992 CTABLES /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=A
993 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=VALUE ORDER=D
994 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=A
995 /TABLE qnd5a /CATEGORIES VARIABLES=qnd5a KEY=LABEL ORDER=D.
997 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
999 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1001 ├────────────────────────────────────────────────────────────────────────┼─────┤
1002 │D5a. What would you say is your primary ethnic -2.00 │ 52│
1003 │background? -1.00 │ 78│
1007 │ South American │ 34│
1008 │ Central American │ 0│
1009 │ Puerto Rican, OR │ 0│
1010 │ Something else │ 68│
1011 │ Multiple - cannot choose│ 7│
1013 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1016 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1018 ├────────────────────────────────────────────────────────────────────────┼─────┤
1019 │D5a. What would you say is your primary ethnic Multiple - cannot choose│ 7│
1020 │background? one │ │
1021 │ Something else │ 68│
1022 │ Puerto Rican, OR │ 0│
1023 │ Central American │ 0│
1024 │ South American │ 34│
1030 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1033 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1035 ├────────────────────────────────────────────────────────────────────────┼─────┤
1036 │D5a. What would you say is your primary ethnic Central American │ 0│
1037 │background? Cuban │ 20│
1039 │ Multiple - cannot choose│ 7│
1041 │ Puerto Rican, OR │ 0│
1042 │ Something else │ 68│
1043 │ South American │ 34│
1047 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1050 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1052 ├────────────────────────────────────────────────────────────────────────┼─────┤
1053 │D5a. What would you say is your primary ethnic Spanish │ 48│
1054 │background? South American │ 34│
1055 │ Something else │ 68│
1056 │ Puerto Rican, OR │ 0│
1057 │ Multiple - cannot choose│ 7│
1061 │ Central American │ 0│
1064 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1068 AT_SETUP([CTABLES simple nesting])
1069 AT_KEYWORDS([nest nested])
1070 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1071 AT_DATA([ctables.sps],
1073 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
1074 /CATEGORIES VARIABLES=qns3a TOTAL=YES.
1075 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
1076 /CATEGORIES VARIABLES=qns3a TOTAL=YES
1077 /CLABELS ROW=OPPOSITE.
1079 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1081 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
1084 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1085 │105b. How likely is it that drivers Almost S3a. Male │ 297│ 4%│
1086 │who have had too much to drink to certain GENDER: Female│ 403│ 6%│
1087 │drive safely will A. Get stopped by Total │ 700│ 10%│
1088 │the police? ╶──────────────────────────┼─────┼──────┤
1089 │ Very S3a. Male │ 660│ 10%│
1090 │ likely GENDER: Female│ 842│ 12%│
1091 │ Total │ 1502│ 22%│
1092 │ ╶──────────────────────────┼─────┼──────┤
1093 │ Somewhat S3a. Male │ 1174│ 17%│
1094 │ likely GENDER: Female│ 1589│ 23%│
1095 │ Total │ 2763│ 40%│
1096 │ ╶──────────────────────────┼─────┼──────┤
1097 │ Somewhat S3a. Male │ 640│ 9%│
1098 │ unlikely GENDER: Female│ 667│ 10%│
1099 │ Total │ 1307│ 19%│
1100 │ ╶──────────────────────────┼─────┼──────┤
1101 │ Very S3a. Male │ 311│ 5%│
1102 │ unlikely GENDER: Female│ 298│ 4%│
1104 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1105 │105b. How likely is it that drivers Almost S3a. Male │ 429│ 6%│
1106 │who have had too much to drink to certain GENDER: Female│ 671│ 10%│
1107 │drive safely will B. Have an accident? Total │ 1100│ 16%│
1108 │ ╶──────────────────────────┼─────┼──────┤
1109 │ Very S3a. Male │ 1104│ 16%│
1110 │ likely GENDER: Female│ 1715│ 25%│
1111 │ Total │ 2819│ 41%│
1112 │ ╶──────────────────────────┼─────┼──────┤
1113 │ Somewhat S3a. Male │ 1203│ 17%│
1114 │ likely GENDER: Female│ 1214│ 18%│
1115 │ Total │ 2417│ 35%│
1116 │ ╶──────────────────────────┼─────┼──────┤
1117 │ Somewhat S3a. Male │ 262│ 4%│
1118 │ unlikely GENDER: Female│ 168│ 2%│
1120 │ ╶──────────────────────────┼─────┼──────┤
1121 │ Very S3a. Male │ 81│ 1%│
1122 │ unlikely GENDER: Female│ 59│ 1%│
1124 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1125 │105b. How likely is it that drivers Almost S3a. Male │ 539│ 8%│
1126 │who have had too much to drink to certain GENDER: Female│ 610│ 9%│
1127 │drive safely will C. Be convicted for Total │ 1149│ 17%│
1128 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1129 │ Very S3a. Male │ 988│ 14%│
1130 │ likely GENDER: Female│ 1049│ 15%│
1131 │ Total │ 2037│ 30%│
1132 │ ╶──────────────────────────┼─────┼──────┤
1133 │ Somewhat S3a. Male │ 822│ 12%│
1134 │ likely GENDER: Female│ 1210│ 18%│
1135 │ Total │ 2032│ 30%│
1136 │ ╶──────────────────────────┼─────┼──────┤
1137 │ Somewhat S3a. Male │ 446│ 7%│
1138 │ unlikely GENDER: Female│ 548│ 8%│
1140 │ ╶──────────────────────────┼─────┼──────┤
1141 │ Very S3a. Male │ 268│ 4%│
1142 │ unlikely GENDER: Female│ 354│ 5%│
1144 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1145 │105b. How likely is it that drivers Almost S3a. Male │ 498│ 7%│
1146 │who have had too much to drink to certain GENDER: Female│ 603│ 9%│
1147 │drive safely will D. Be arrested for Total │ 1101│ 16%│
1148 │drunk driving? ╶──────────────────────────┼─────┼──────┤
1149 │ Very S3a. Male │ 805│ 12%│
1150 │ likely GENDER: Female│ 1029│ 15%│
1151 │ Total │ 1834│ 27%│
1152 │ ╶──────────────────────────┼─────┼──────┤
1153 │ Somewhat S3a. Male │ 975│ 14%│
1154 │ likely GENDER: Female│ 1332│ 19%│
1155 │ Total │ 2307│ 34%│
1156 │ ╶──────────────────────────┼─────┼──────┤
1157 │ Somewhat S3a. Male │ 535│ 8%│
1158 │ unlikely GENDER: Female│ 560│ 8%│
1159 │ Total │ 1095│ 16%│
1160 │ ╶──────────────────────────┼─────┼──────┤
1161 │ Very S3a. Male │ 270│ 4%│
1162 │ unlikely GENDER: Female│ 279│ 4%│
1164 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1167 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
1168 │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │
1169 │ │ certain│likely│ likely │ unlikely│unlikely│
1170 │ ├────────┼──────┼─────────┼─────────┼────────┤
1172 │ │ Table %│ % │ Table % │ Table % │ Table %│
1173 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1174 │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│
1175 │GENDER: is it that drivers│ │ │ │ │ │
1176 │ who have had too │ │ │ │ │ │
1177 │ much to drink to │ │ │ │ │ │
1178 │ drive safely will │ │ │ │ │ │
1179 │ A. Get stopped by │ │ │ │ │ │
1180 │ the police? │ │ │ │ │ │
1181 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1182 │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│
1183 │ is it that drivers│ │ │ │ │ │
1184 │ who have had too │ │ │ │ │ │
1185 │ much to drink to │ │ │ │ │ │
1186 │ drive safely will │ │ │ │ │ │
1187 │ A. Get stopped by │ │ │ │ │ │
1188 │ the police? │ │ │ │ │ │
1189 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1190 │ Total 105b. How likely │ 10%│ 22%│ 40%│ 19%│ 9%│
1191 │ is it that drivers│ │ │ │ │ │
1192 │ who have had too │ │ │ │ │ │
1193 │ much to drink to │ │ │ │ │ │
1194 │ drive safely will │ │ │ │ │ │
1195 │ A. Get stopped by │ │ │ │ │ │
1196 │ the police? │ │ │ │ │ │
1197 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1198 │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│
1199 │GENDER: is it that drivers│ │ │ │ │ │
1200 │ who have had too │ │ │ │ │ │
1201 │ much to drink to │ │ │ │ │ │
1202 │ drive safely will │ │ │ │ │ │
1203 │ B. Have an │ │ │ │ │ │
1204 │ accident? │ │ │ │ │ │
1205 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1206 │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│
1207 │ is it that drivers│ │ │ │ │ │
1208 │ who have had too │ │ │ │ │ │
1209 │ much to drink to │ │ │ │ │ │
1210 │ drive safely will │ │ │ │ │ │
1211 │ B. Have an │ │ │ │ │ │
1212 │ accident? │ │ │ │ │ │
1213 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1214 │ Total 105b. How likely │ 16%│ 41%│ 35%│ 6%│ 2%│
1215 │ is it that drivers│ │ │ │ │ │
1216 │ who have had too │ │ │ │ │ │
1217 │ much to drink to │ │ │ │ │ │
1218 │ drive safely will │ │ │ │ │ │
1219 │ B. Have an │ │ │ │ │ │
1220 │ accident? │ │ │ │ │ │
1221 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1222 │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│
1223 │GENDER: is it that drivers│ │ │ │ │ │
1224 │ who have had too │ │ │ │ │ │
1225 │ much to drink to │ │ │ │ │ │
1226 │ drive safely will │ │ │ │ │ │
1227 │ C. Be convicted │ │ │ │ │ │
1228 │ for drunk driving?│ │ │ │ │ │
1229 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1230 │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│
1231 │ is it that drivers│ │ │ │ │ │
1232 │ who have had too │ │ │ │ │ │
1233 │ much to drink to │ │ │ │ │ │
1234 │ drive safely will │ │ │ │ │ │
1235 │ C. Be convicted │ │ │ │ │ │
1236 │ for drunk driving?│ │ │ │ │ │
1237 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1238 │ Total 105b. How likely │ 17%│ 30%│ 30%│ 15%│ 9%│
1239 │ is it that drivers│ │ │ │ │ │
1240 │ who have had too │ │ │ │ │ │
1241 │ much to drink to │ │ │ │ │ │
1242 │ drive safely will │ │ │ │ │ │
1243 │ C. Be convicted │ │ │ │ │ │
1244 │ for drunk driving?│ │ │ │ │ │
1245 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1246 │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│
1247 │GENDER: is it that drivers│ │ │ │ │ │
1248 │ who have had too │ │ │ │ │ │
1249 │ much to drink to │ │ │ │ │ │
1250 │ drive safely will │ │ │ │ │ │
1251 │ D. Be arrested for│ │ │ │ │ │
1252 │ drunk driving? │ │ │ │ │ │
1253 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1254 │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│
1255 │ is it that drivers│ │ │ │ │ │
1256 │ who have had too │ │ │ │ │ │
1257 │ much to drink to │ │ │ │ │ │
1258 │ drive safely will │ │ │ │ │ │
1259 │ D. Be arrested for│ │ │ │ │ │
1260 │ drunk driving? │ │ │ │ │ │
1261 │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
1262 │ Total 105b. How likely │ 16%│ 27%│ 34%│ 16%│ 8%│
1263 │ is it that drivers│ │ │ │ │ │
1264 │ who have had too │ │ │ │ │ │
1265 │ much to drink to │ │ │ │ │ │
1266 │ drive safely will │ │ │ │ │ │
1267 │ D. Be arrested for│ │ │ │ │ │
1268 │ drunk driving? │ │ │ │ │ │
1269 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
1273 AT_SETUP([CTABLES nesting and scale variables])
1274 AT_KEYWORDS([nest nested])
1275 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1276 AT_DATA([ctables.sps],
1278 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
1279 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
1280 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
1281 /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
1282 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
1284 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1286 ╭─────────────────────────────────────────────────────────────────┬────────────╮
1292 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
1293 │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│
1294 │is your age? a car or other motor vehicle? Several days a │ 51│ 59│
1296 │ Once a week or │ 44│ 54│
1298 │ Only certain │ 34│ 41│
1299 │ times a year │ │ │
1301 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
1304 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
1305 │ │Minimum│Maximum│Mean│
1306 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1307 │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│
1308 │What is GENDER: months, has there been a │ │ │ │
1309 │your time when you felt you │ │ │ │
1310 │age? should cut down on your No │ 16│ 86│ 46│
1312 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1313 │ Female 26. During the last 12 Yes│ 16│ 86│ 43│
1314 │ months, has there been a │ │ │ │
1315 │ time when you felt you │ │ │ │
1316 │ should cut down on your No │ 16│ 86│ 48│
1318 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
1319 │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│
1320 │What is GENDER: months, has there been a │ │ │ │
1321 │your time when people criticized No │ 16│ 86│ 46│
1322 │age? your drinking? │ │ │ │
1323 │ ╶───────────────────────────────────────┼───────┼───────┼────┤
1324 │ Female 27. During the last 12 Yes│ 17│ 69│ 37│
1325 │ months, has there been a │ │ │ │
1326 │ time when people criticized No │ 16│ 86│ 48│
1327 │ your drinking? │ │ │ │
1328 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
1331 ╭─────────────────────────────┬────────────────────────────────────────────────╮
1332 │ │S1. Including yourself, how many members of this│
1333 │ │ household are age 16 or older? │
1334 │ ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
1335 │ │ │ │ │ │ │ │ 6 or │
1336 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1337 │ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1338 │ │Column│Column│Column│Column│Column│Column│Column│
1339 │ │ % │ % │ % │ % │ % │ % │ % │
1340 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
1341 │Sa1. RDD 105b. Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1342 │SAMPLE How certain │ │ │ │ │ │ │ │
1343 │SOURCE: likely │ │ │ │ │ │ │ │
1344 │ is it Very │ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1345 │ that likely │ │ │ │ │ │ │ │
1346 │ drivers │ │ │ │ │ │ │ │
1347 │ who have │ │ │ │ │ │ │ │
1348 │ had too Somewhat│ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1349 │ much to likely │ │ │ │ │ │ │ │
1350 │ drink to │ │ │ │ │ │ │ │
1351 │ drive │ │ │ │ │ │ │ │
1352 │ safely Somewhat│ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1353 │ will A. unlikely│ │ │ │ │ │ │ │
1354 │ Get │ │ │ │ │ │ │ │
1355 │ stopped Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1356 │ by the unlikely│ │ │ │ │ │ │ │
1357 │ police? │ │ │ │ │ │ │ │
1358 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
1361 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
1364 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
1365 │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│
1366 │group typical month did you have one or more │ │ │
1367 │ alcoholic beverages to drink? │ │ │
1368 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1369 │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│
1370 │ typical month did you have one or more │ │ │
1371 │ alcoholic beverages to drink? │ │ │
1372 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1373 │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│
1374 │ typical month did you have one or more │ │ │
1375 │ alcoholic beverages to drink? │ │ │
1376 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1377 │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│
1378 │ typical month did you have one or more │ │ │
1379 │ alcoholic beverages to drink? │ │ │
1380 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1381 │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│
1382 │ typical month did you have one or more │ │ │
1383 │ alcoholic beverages to drink? │ │ │
1384 │ ╶───────────────────────────────────────────────────────┼────┼──────────┤
1385 │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│
1386 │ older typical month did you have one or more │ │ │
1387 │ alcoholic beverages to drink? │ │ │
1388 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
1393 AT_SETUP([CTABLES SLABELS])
1394 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1395 AT_DATA([ctables.sps],
1397 CTABLES /TABLE qn1 [COUNT COLPCT].
1398 CTABLES /TABLE qn1 [COUNT COLPCT]
1399 /SLABELS POSITION=ROW.
1400 CTABLES /TABLE qn1 [COUNT COLPCT]
1401 /SLABELS POSITION=ROW VISIBLE=NO.
1403 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1405 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
1408 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
1409 │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│
1410 │other motor vehicle? Several days a week│ 1274│ 18.3%│
1411 │ Once a week or less│ 361│ 5.2%│
1412 │ Only certain times │ 130│ 1.9%│
1414 │ Never │ 540│ 7.7%│
1415 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
1418 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1419 │ 1. How often do you usually drive a car or Every day Count │ 4667│
1420 │other motor vehicle? Column │66.9%│
1422 │ ╶───────────────────────────┼─────┤
1423 │ Several days a week Count │ 1274│
1426 │ ╶───────────────────────────┼─────┤
1427 │ Once a week or less Count │ 361│
1430 │ ╶───────────────────────────┼─────┤
1431 │ Only certain times Count │ 130│
1432 │ a year Column │ 1.9%│
1434 │ ╶───────────────────────────┼─────┤
1435 │ Never Count │ 540│
1438 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1441 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1442 │ 1. How often do you usually drive a car or other Every day │ 4667│
1443 │motor vehicle? │66.9%│
1444 │ Several days a week │ 1274│
1446 │ Once a week or less │ 361│
1448 │ Only certain times a │ 130│
1452 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1456 AT_SETUP([CTABLES simple totals])
1457 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1458 AT_DATA([ctables.sps],
1461 /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
1462 DESCRIPTIVES qn18/STATISTICS=MEAN.
1463 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
1464 /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
1466 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
1468 ╭────────────────────────────────────────────────────────────────────────┬─────╮
1470 ├────────────────────────────────────────────────────────────────────────┼─────┤
1471 │17. When you drink alcoholic beverages, which ONE of OR, something else│ 2│
1472 │the following beverages do you drink MOST OFTEN? Beer │ 1073│
1475 │ Wine coolers │ 137│
1476 │ Hard liquor or │ 888│
1478 │ Flavored malt │ 83│
1480 │ Number responding │ 4221│
1481 ╰────────────────────────────────────────────────────────────────────────┴─────╯
1483 Descriptive Statistics
1484 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
1486 ├────────────────────────────────────────────────────────────────────┼────┼────┤
1487 │18. When you drink ANSWERFROM(QN17R1), about how many │4218│4.62│
1488 │ANSWERFROM(QN17R2) do you usually drink per sitting? │ │ │
1489 │Valid N (listwise) │6999│ │
1490 │Missing N (listwise) │2781│ │
1491 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
1494 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
1495 │ │ │ │ Valid│Total│
1496 │ │Mean│Count│ N │ N │
1497 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1498 │Region NE 18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│ 949│ 1409│
1499 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1500 │ you usually drink per sitting? │ │ │ │ │
1501 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1502 │ MW 18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│ 1027│ 1654│
1503 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1504 │ you usually drink per sitting? │ │ │ │ │
1505 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1506 │ S 18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│ 1287│ 2390│
1507 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1508 │ you usually drink per sitting? │ │ │ │ │
1509 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1510 │ W 18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│ 955│ 1546│
1511 │ about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1512 │ you usually drink per sitting? │ │ │ │ │
1513 │ ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
1514 │ All 18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│ 4218│ 6999│
1515 │ regions about how many ANSWERFROM(QN17R2) do │ │ │ │ │
1516 │ you usually drink per sitting? │ │ │ │ │
1517 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
1521 AT_SETUP([CTABLES subtotals])
1522 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1523 AT_DATA([ctables.sps],
1525 CTABLES /TABLE=qn105ba BY qns1
1526 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1527 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
1528 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
1529 CTABLES /TABLE=qn105ba BY qns1
1530 /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
1531 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
1533 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1535 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1536 │ │ S1. Including yourself, how many members of this household │
1537 │ │ are age 16 or older? │
1538 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1539 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1540 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1541 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1542 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1543 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1544 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1545 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1546 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1547 │ likely │ │ │ │ │ │ │ │
1548 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1549 │ unlikely │ │ │ │ │ │ │ │
1550 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1551 │ unlikely │ │ │ │ │ │ │ │
1552 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1555 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
1556 │ │ S1. Including yourself, how many members of this household │
1557 │ │ are age 16 or older? │
1558 │ ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
1559 │ │ │ │ │ │ │ │ 6 or │
1560 │ │ None │ 1 │ 2 │ 3 │ 4 │ 5 │ more │
1561 │ ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1562 │ │ │ │ │ │ Column│ │ │
1563 │ │Column %│Column %│Column %│Column %│ % │Column %│Column %│
1564 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
1565 │105b. How likely is it that drivers who have Almost │ .│ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│
1566 │had too much to drink to drive safely will certain │ │ │ │ │ │ │ │
1567 │A. Get stopped by the police? Very likely│ .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
1568 │ Somewhat │ .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
1569 │ likely │ │ │ │ │ │ │ │
1570 │ Subtotal │ │ 72.8%│ 68.6%│ 75.0%│ 74.0%│ 81.8%│ 81.0%│
1571 │ Somewhat │ .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│
1572 │ unlikely │ │ │ │ │ │ │ │
1573 │ Very │ .│ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│
1574 │ unlikely │ │ │ │ │ │ │ │
1575 │ Subtotal │ │ 27.2%│ 31.4%│ 25.0%│ 26.0%│ 18.2%│ 19.0%│
1576 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
1579 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
1580 │ │ S1. Including yourself, how many members of this household │
1581 │ │ are age 16 or older? │
1582 │ ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
1583 │ │ 1 │ 2 │ Subtotal│ 3 │ 4 │ 5 │ Subtotal │
1584 │ ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1585 │ │ Count │ Count │ Count │ Count │ Count │ Count│ Count │
1586 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
1587 │105b. How likely is it that drivers who have Almost │ 147│ 246│ 393│ 62│ 19│ 11│ 92│
1588 │had too much to drink to drive safely will A. certain │ │ │ │ │ │ │ │
1589 │Get stopped by the police? Very likely│ 384│ 552│ 936│ 120│ 51│ 14│ 185│
1590 │ Somewhat │ 590│ 1249│ 1839│ 193│ 72│ 20│ 285│
1591 │ likely │ │ │ │ │ │ │ │
1592 │ Subtotal │ 1121│ 2047│ 3168│ 375│ 142│ 45│ 562│
1593 │ Somewhat │ 278│ 647│ 925│ 84│ 32│ 6│ 122│
1594 │ unlikely │ │ │ │ │ │ │ │
1595 │ Very │ 141│ 290│ 431│ 41│ 18│ 4│ 63│
1596 │ unlikely │ │ │ │ │ │ │ │
1597 │ Subtotal │ 419│ 937│ 1356│ 125│ 50│ 10│ 185│
1598 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
1602 AT_SETUP([CTABLES PCOMPUTE])
1603 AT_KEYWORDS([postcompute])
1604 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1605 AT_DATA([ctables.sps],
1608 /PCOMPUTE &x=EXPR([3] + [4])
1609 /PCOMPUTE &y=EXPR([4] + [5])
1610 /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1611 /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]'
1612 /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1613 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1615 * Adding HIDESOURCECATS=YES for one PPROPERTIES.
1617 /PCOMPUTE &x=EXPR([3] + [4])
1618 /PCOMPUTE &y=EXPR([4] + [5])
1619 /PPROPERTIES &x LABEL='3+4' FORMAT=COUNT F8.2
1620 /PPROPERTIES &y LABEL=')LABEL[5]+)LABEL[6]' HIDESOURCECATS=YES
1621 /TABLE=qn105ba [COUNT, ROWPCT] BY qns1
1622 /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL] TOTAL=YES
1624 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1626 ╭───────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1627 │ │ S1. Including yourself, how many members of this household are age 16 or older? │
1628 │ ├───────────┬───────────┬───────────┬───────────┬──────────┬──────────┬────────────┬──────────┬───────────┬────────────┤
1629 │ │ 1 │ 2 │ Subtotal │ 3 │ 4 │ 5 │ 3+4 │ 4+5 │ Subtotal │ Total │
1630 │ ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼─────┬────┼─────┬────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1631 │ │ │ │ │ │ │ │ │ │ │ Row│ │ Row│ │ │ │ Row│ │ │ │ │
1632 │ │Count│Row %│Count│Row %│Count│Row %│Count│Row %│Count│ % │Count│ % │ Count│Row %│Count│ % │Count│Row %│Count│ Row %│
1633 ├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼────┼─────┼────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1634 │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%│
1635 │likely is certain │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1636 │it that │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1637 │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%│
1638 │who have likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1639 │had too │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1640 │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%│
1641 │drink to likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1642 │drive │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1643 │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%│
1644 │will A. unlikely│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1645 │Get │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1646 │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%│
1647 │the unlikely│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1648 │police? │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1649 ╰───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┴─────┴────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1652 ╭─────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
1653 │ │ S1. Including yourself, how many members of this household are age 16 or older? │
1654 │ ├───────────┬───────────┬───────────┬───────────┬────────────┬──────────┬───────────┬────────────┤
1655 │ │ 1 │ 2 │ Subtotal │ 3 │ 3+4 │ 4+5 │ Subtotal │ Total │
1656 │ ├─────┬─────┼─────┬─────┼─────┬─────┼─────┬─────┼──────┬─────┼─────┬────┼─────┬─────┼─────┬──────┤
1657 │ │ │ │ │ │ │ │ │ │ │ │ │ Row│ │ │ │ │
1658 │ │Count│Row %│Count│Row %│Count│Row %│Count│Row %│ Count│Row %│Count│ % │Count│Row %│Count│ Row %│
1659 ├─────────────────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼──────┼─────┼─────┼────┼─────┼─────┼─────┼──────┤
1660 │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%│
1661 │drivers who have had too much certain │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1662 │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%│
1663 │A. Get stopped by the police? likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1664 │ 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%│
1665 │ likely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1666 │ 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%│
1667 │ unlikely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1668 │ 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%│
1669 │ unlikely │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1670 ╰─────────────────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴──────┴─────┴─────┴────┴─────┴─────┴─────┴──────╯
1674 AT_SETUP([CTABLES PCOMPUTE - OTHERNM and MISSING])
1675 AT_KEYWORDS([postcompute])
1676 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1677 AT_DATA([ctables.sps],
1680 /PCOMPUTE &x=EXPR(OTHERNM)
1681 /PCOMPUTE &y=EXPR(MISSING)
1682 /PPROPERTIES &x LABEL='Drivers'
1683 /PPROPERTIES &y LABEL='Missing Values 2'
1685 /CATEGORIES VARIABLES=qn1 [OTHERNM, 5, &x, SUBTOTAL='Valid Values', MISSING, SUBTOTAL='Missing Values', &y]
1687 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1689 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1695 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1696 │ 1. How often do you usually drive a car or other motor vehicle? Every day │ 2305│ 2362│
1697 │ Several days a week │ 440│ 834│
1698 │ Once a week or less │ 125│ 236│
1699 │ Only certain times a year│ 58│ 72│
1701 │ Drivers │ 2928│ 3504│
1702 │ Valid Values │ 3120│ 3852│
1703 │ Don't know │ 3│ 5│
1705 │ Missing Values │ 12│ 15│
1706 │ Missing Values 2 │ 12│ 15│
1707 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1711 AT_SETUP([CTABLES PCOMPUTE - THRU])
1712 AT_KEYWORDS([postcompute])
1713 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1714 AT_DATA([ctables.sps],
1717 /PCOMPUTE &x=EXPR([1 THRU 2])
1718 /PCOMPUTE &y=EXPR([3 THRU 4])
1719 /PCOMPUTE &z=EXPR([5] + MISSING)
1720 /PPROPERTIES &x LABEL='Frequent Drivers'
1721 /PPROPERTIES &y LABEL='Infrequent Drivers'
1722 /PPROPERTIES &z LABEL='Not Drivers or Missing'
1724 /CATEGORIES VARIABLES=qn1 [1 THRU 2, &x, 3 THRU 4, &y, SUBTOTAL='Drivers', 5, MISSING, &z]
1726 AT_CHECK([pspp ctables.sps -O box=unicode -O width=140], [0], [dnl
1728 ╭──────────────────────────────────────────────────────────────────────────────────────────┬────────────╮
1734 ├──────────────────────────────────────────────────────────────────────────────────────────┼─────┼──────┤
1735 │ 1. How often do you usually drive a car or other motor vehicle? Every day │ 2305│ 2362│
1736 │ Several days a week │ 440│ 834│
1737 │ Frequent Drivers │ 2745│ 3196│
1738 │ Once a week or less │ 125│ 236│
1739 │ Only certain times a year│ 58│ 72│
1740 │ Infrequent Drivers │ 183│ 308│
1741 │ Drivers │ 2928│ 3504│
1743 │ Don't know │ 3│ 5│
1745 │ Not Drivers or Missing │ 204│ 363│
1746 ╰──────────────────────────────────────────────────────────────────────────────────────────┴─────┴──────╯
1750 dnl I'm not sure that this is the correct behavior (see
1751 dnl https://mail.gnu.org/archive/html/pspp-users/2022-07/msg00002.html)
1752 dnl but at least this test will notify us if the behavior changes.
1753 AT_SETUP([CTABLES intersecting PCOMPUTEs])
1754 AT_KEYWORDS([PCOMPUTE postcompute])
1755 AT_DATA([ctables.sps],
1756 [[DATA LIST LIST NOTABLE/x y z.
1759 VARIABLE LEVEL x y (NOMINAL).
1773 /PCOMPUTE &a = EXPR([1] + [2])
1774 /PCOMPUTE &b = EXPR([2] + [3])
1775 /PCOMPUTE &c = EXPR([4] * [5])
1776 /PCOMPUTE &d = EXPR([5] * [6])
1778 /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
1779 /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].
1781 AT_CHECK([pspp ctables.sps -O box=unicode], [0],
1783 ╭───────────┬─────────────────────────────────────╮
1785 │ ├─────┬─────────┬─────┬─────────┬─────┤
1786 │ │ 4 │[4] * [5]│ 5 │[5] * [6]│ 6 │
1787 │ ├─────┼─────────┼─────┼─────────┼─────┤
1788 │ │Count│ Count │Count│ Count │Count│
1789 ├───────────┼─────┼─────────┼─────┼─────────┼─────┤
1790 │x 1 │ 5│ 10│ 2│ 18│ 9│
1791 │ [1] + [2]│ 7│ .│ 5│ .│ 13│
1792 │ 2 │ 2│ 6│ 3│ 12│ 4│
1793 │ [2] + [3]│ 3│ .│ 9│ .│ 5│
1794 │ 3 │ 1│ 6│ 6│ 6│ 1│
1795 ╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
1799 AT_SETUP([CTABLES string and date and time])
1802 for gender in F M; do
1803 for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
1804 for wkday in Sun Mon Tue Wed Thu Fri Sat Sun; do
1805 printf "$weight $gender $month $wkday\n"
1806 weight=$(expr \( $weight + 3 \) % 7 + 2)
1811 AT_DATA([ctables.sps],
1812 [[DATA LIST LIST NOTABLE FILE='ctables.txt'
1813 /w (F5.0) gender (A1) fmon (MONTH3) fday (WKDAY3).
1815 VARIABLE LEVEL w (SCALE).
1816 VARIABLE LEVEL gender fmon fday (NOMINAL).
1819 fmon 'Favorite month'
1820 fday 'Favorite day of the week'.
1821 VALUE LABELS /gender 'M' 'Male' 'F' 'Female'.
1823 /PCOMPUTE &q2 = EXPR(['APR' THRU 'June'])
1824 /PPROPERTIES &q2 LABEL='Q2'
1825 /PCOMPUTE &weekend = EXPR(['sun'] + ['Sat'])
1826 /PPROPERTIES &weekend LABEL='Weekend'
1827 /TABLE fmon BY gender > fday
1828 /CATEGORIES VARIABLES=fmon ['JAN', 'FEB', 'Mar', SUBTOTAL="Q1",
1830 'JUL' THRU 'sep', SUBTOTAL="Q3",
1831 OTHERNM, SUBTOTAL='Q4']
1832 /CATEGORIES VARIABLES=gender ['M', 'F']
1833 /CATEGORIES VARIABLE=fday ['Sun', 2 THRU 6, 'Sat', &weekend] TOTAL=YES
1834 /SLABELS VISIBLE=NO.
1836 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1838 ╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────╮
1840 │ ├─────────────────────────────────────────┬─────────────────────────────────────────┤
1842 │ ├─────────────────────────────────────────┼─────────────────────────────────────────┤
1843 │ │ Favorite day of the week │ Favorite day of the week │
1844 │ ├───┬───┬───┬───┬───┬───┬───┬───────┬─────┼───┬───┬───┬───┬───┬───┬───┬───────┬─────┤
1845 │ │SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│SUN│MON│TUE│WED│THU│FRI│SAT│Weekend│Total│
1846 ├──────────────────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┼───┼───┼───┼───┼───┼───┼───┼───────┼─────┤
1847 │Favorite month JAN│ 10│ 3│ 8│ 6│ 4│ 2│ 7│ 17│ 40│ 9│ 6│ 4│ 2│ 7│ 5│ 3│ 12│ 36│
1848 │ FEB│ 6│ 8│ 6│ 4│ 2│ 7│ 5│ 11│ 38│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│
1849 │ MAR│ 16│ 6│ 4│ 2│ 7│ 5│ 3│ 19│ 43│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│
1850 │ Q1 │ 32│ 17│ 18│ 12│ 13│ 14│ 15│ │ │ 29│ 12│ 13│ 14│ 15│ 16│ 17│ │ │
1851 │ APR│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│ 4│ 7│ 5│ 3│ 8│ 6│ 4│ 8│ 37│
1852 │ MAY│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│ 14│ 5│ 3│ 8│ 6│ 4│ 2│ 16│ 42│
1853 │ JUN│ 4│ 7│ 5│ 3│ 8│ 6│ 4│ 8│ 37│ 10│ 3│ 8│ 6│ 4│ 2│ 7│ 17│ 40│
1854 │ Q2 │ 24│ 13│ 14│ 15│ 16│ 17│ 18│ .│ │ 28│ 15│ 16│ 17│ 18│ 12│ 13│ .│ │
1855 │ JUL│ 14│ 5│ 3│ 8│ 6│ 4│ 2│ 16│ 42│ 6│ 8│ 6│ 4│ 2│ 7│ 5│ 11│ 38│
1856 │ AUG│ 10│ 3│ 8│ 6│ 4│ 2│ 7│ 17│ 40│ 16│ 6│ 4│ 2│ 7│ 5│ 3│ 19│ 43│
1857 │ SEP│ 6│ 8│ 6│ 4│ 2│ 7│ 5│ 11│ 38│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│
1858 │ Q3 │ 54│ 29│ 31│ 33│ 28│ 30│ 32│ │ │ 62│ 33│ 28│ 30│ 32│ 27│ 29│ │ │
1859 │ OCT│ 16│ 6│ 4│ 2│ 7│ 5│ 3│ 19│ 43│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│
1860 │ NOV│ 12│ 4│ 2│ 7│ 5│ 3│ 8│ 20│ 41│ 4│ 7│ 5│ 3│ 8│ 6│ 4│ 8│ 37│
1861 │ DEC│ 8│ 2│ 7│ 5│ 3│ 8│ 6│ 14│ 39│ 14│ 5│ 3│ 8│ 6│ 4│ 2│ 16│ 42│
1862 │ Q4 │ 36│ 12│ 13│ 14│ 15│ 16│ 17│ │ │ 26│ 14│ 15│ 16│ 17│ 18│ 12│ │ │
1863 ╰──────────────────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────┴───┴───┴───┴───┴───┴───┴───┴───────┴─────╯
1867 AT_SETUP([CTABLES CLABELS])
1868 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
1869 AT_DATA([ctables.sps],
1871 CTABLES /TABLE AgeGroup BY qns3a.
1872 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1873 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1874 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=LAYER.
1875 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=LAYER.
1877 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=120], [0], [dnl
1879 ╭───────────────────────┬────────────╮
1885 ├───────────────────────┼─────┼──────┤
1886 │Age group 15 or younger│ 0│ 0│
1887 │ 16 to 25 │ 594│ 505│
1888 │ 26 to 35 │ 476│ 491│
1889 │ 36 to 45 │ 489│ 548│
1890 │ 46 to 55 │ 526│ 649│
1891 │ 56 to 65 │ 516│ 731│
1892 │ 66 or older │ 531│ 943│
1893 ╰───────────────────────┴─────┴──────╯
1896 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
1898 │ ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
1900 │ ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
1901 │ │ 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 │
1902 │ │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │ younger │ 25 │ 35 │ 45 │ 55 │ 65 │ older │
1903 │ ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1904 │ │ Count │ Count │ Count│ Count│ Count│ Count │ Count │ Count │ Count│ Count │ Count│ Count│ Count│ Count │
1905 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
1906 │Age │ 0│ 594│ 476│ 489│ 526│ 516│ 531│ 0│ 505│ 491│ 548│ 649│ 731│ 943│
1907 │group │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1908 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
1911 ╭──────────────────────────────┬────────────╮
1915 ├──────────────────────────────┼────────────┤
1916 │Age group 15 or younger Male │ 0│
1918 │ ╶────────────────────┼────────────┤
1919 │ 16 to 25 Male │ 594│
1921 │ ╶────────────────────┼────────────┤
1922 │ 26 to 35 Male │ 476│
1924 │ ╶────────────────────┼────────────┤
1925 │ 36 to 45 Male │ 489│
1927 │ ╶────────────────────┼────────────┤
1928 │ 46 to 55 Male │ 526│
1930 │ ╶────────────────────┼────────────┤
1931 │ 56 to 65 Male │ 516│
1933 │ ╶────────────────────┼────────────┤
1934 │ 66 or older Male │ 531│
1936 ╰──────────────────────────────┴────────────╯
1940 ╭─────────┬────────────╮
1946 ├─────────┼─────┼──────┤
1948 ╰─────────┴─────┴──────╯
1952 ╭─────────┬────────────╮
1958 ├─────────┼─────┼──────┤
1959 │Age group│ 594│ 505│
1960 ╰─────────┴─────┴──────╯
1964 ╭─────────┬────────────╮
1970 ├─────────┼─────┼──────┤
1971 │Age group│ 476│ 491│
1972 ╰─────────┴─────┴──────╯
1976 ╭─────────┬────────────╮
1982 ├─────────┼─────┼──────┤
1983 │Age group│ 489│ 548│
1984 ╰─────────┴─────┴──────╯
1988 ╭─────────┬────────────╮
1994 ├─────────┼─────┼──────┤
1995 │Age group│ 526│ 649│
1996 ╰─────────┴─────┴──────╯
2000 ╭─────────┬────────────╮
2006 ├─────────┼─────┼──────┤
2007 │Age group│ 516│ 731│
2008 ╰─────────┴─────┴──────╯
2012 ╭─────────┬────────────╮
2018 ├─────────┼─────┼──────┤
2019 │Age group│ 531│ 943│
2020 ╰─────────┴─────┴──────╯
2024 ╭───────────────────────┬────────────╮
2028 ├───────────────────────┼────────────┤
2029 │Age group 15 or younger│ 0│
2035 │ 66 or older │ 531│
2036 ╰───────────────────────┴────────────╯
2040 ╭───────────────────────┬────────────╮
2044 ├───────────────────────┼────────────┤
2045 │Age group 15 or younger│ 0│
2051 │ 66 or older │ 943│
2052 ╰───────────────────────┴────────────╯
2056 AT_SETUP([CTABLES missing values])
2057 AT_DATA([ctables.sps],
2058 [[DATA LIST LIST NOTABLE/x y.
2097 MISSING VALUES x (1, 2) y (2, 3).
2098 VARIABLE LEVEL ALL (NOMINAL).
2100 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2101 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2102 /CATEGORIES VARIABLES=ALL TOTAL=YES.
2103 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN,
2104 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
2105 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
2106 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2107 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2108 /CATEGORIES VARIABLES=ALL TOTAL=YES
2109 /SLABELS POSITION=ROW.
2110 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2111 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2112 /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
2113 /SLABELS POSITION=ROW.
2114 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN,
2115 TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
2116 /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES
2117 /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES
2118 /SLABELS POSITION=ROW.
2120 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2122 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2123 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2124 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2125 │x 3.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2126 │ 4.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2127 │ 5.00 │ 6│ 33.3%│ 33.3%│ 16.7%│ │ │
2128 │ Total│ 18│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
2129 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2130 dnl Note that Column Total N % doesn't add up to 100 because missing
2131 dnl values are included in the total but not shown as a category and this
2132 dnl is expected behavior.
2135 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
2136 │ │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
2137 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
2138 │x 1.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
2139 │ 2.00 │ 6│ 20.0%│ .0%│ 16.7%│ │ │
2140 │ 3.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2141 │ 4.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2142 │ 5.00 │ 6│ 20.0%│ 33.3%│ 16.7%│ │ │
2143 │ Total│ 30│ 100.0%│ 100.0%│ 100.0%│ 18│ 36│
2144 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
2145 dnl Note that Column Total N % doesn't add up to 100 because system-missing
2146 dnl values are included in the total but not shown as a category and this
2147 dnl is expected behavior.
2150 ╭────────────────────────┬───────────────────────────╮
2152 │ ├──────┬──────┬──────┬──────┤
2153 │ │ 1.00 │ 4.00 │ 5.00 │ Total│
2154 ├────────────────────────┼──────┼──────┼──────┼──────┤
2155 │x 3.00 Count │ 1│ 1│ 1│ 3│
2156 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2157 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2158 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2159 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2160 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2161 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2162 │ Valid N │ │ │ │ 3│
2163 │ Total N │ │ │ │ 6│
2164 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2165 │ 4.00 Count │ 1│ 1│ 1│ 3│
2166 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2167 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2168 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2169 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2170 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2171 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2172 │ Valid N │ │ │ │ 3│
2173 │ Total N │ │ │ │ 6│
2174 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2175 │ 5.00 Count │ 1│ 1│ 1│ 3│
2176 │ Column % │ 33.3%│ 33.3%│ 33.3%│ .│
2177 │ Column Valid N %│ 33.3%│ 33.3%│ 33.3%│ .│
2178 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ .│
2179 │ Row % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2180 │ Row Valid N % │ 33.3%│ 33.3%│ 33.3%│100.0%│
2181 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│100.0%│
2182 │ Valid N │ │ │ │ 3│
2183 │ Total N │ │ │ │ 6│
2184 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
2185 │ Total Count │ 3│ 3│ 3│ 9│
2186 │ Column % │100.0%│100.0%│100.0%│ .│
2187 │ Column Valid N %│100.0%│100.0%│100.0%│ .│
2188 │ Column Total N %│100.0%│100.0%│100.0%│ .│
2189 │ Row % │ .│ .│ .│ .│
2190 │ Row Valid N % │ .│ .│ .│ .│
2191 │ Row Total N % │ .│ .│ .│ .│
2192 │ Valid N │ 3│ 3│ 3│ 9│
2193 │ Total N │ 6│ 6│ 6│ 36│
2194 ╰────────────────────────┴──────┴──────┴──────┴──────╯
2197 ╭────────────────────────┬─────────────────────────────────────────╮
2199 │ ├──────┬──────┬──────┬──────┬──────┬──────┤
2200 │ │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2201 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2202 │x 1.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2203 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2204 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
2205 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2206 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2207 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2208 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2209 │ Valid N │ │ │ │ │ │ 0│
2210 │ Total N │ │ │ │ │ │ 6│
2211 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2212 │ 2.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2213 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2214 │ Column Valid N %│ .0%│ .│ .│ .0%│ .0%│ .│
2215 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2216 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2217 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2218 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2219 │ Valid N │ │ │ │ │ │ 0│
2220 │ Total N │ │ │ │ │ │ 6│
2221 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2222 │ 3.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2223 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2224 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2225 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2226 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2227 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2228 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2229 │ Valid N │ │ │ │ │ │ 3│
2230 │ Total N │ │ │ │ │ │ 6│
2231 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2232 │ 4.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2233 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2234 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2235 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2236 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2237 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2238 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2239 │ Valid N │ │ │ │ │ │ 3│
2240 │ Total N │ │ │ │ │ │ 6│
2241 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2242 │ 5.00 Count │ 1│ 1│ 1│ 1│ 1│ 5│
2243 │ Column % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2244 │ Column Valid N %│ 33.3%│ .│ .│ 33.3%│ 33.3%│ .│
2245 │ Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ .│
2246 │ Row % │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
2247 │ Row Valid N % │ 33.3%│ .0%│ .0%│ 33.3%│ 33.3%│100.0%│
2248 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2249 │ Valid N │ │ │ │ │ │ 3│
2250 │ Total N │ │ │ │ │ │ 6│
2251 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
2252 │ Total Count │ 5│ 5│ 5│ 5│ 5│ 25│
2253 │ Column % │100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2254 │ Column Valid N %│100.0%│ .│ .│100.0%│100.0%│ .│
2255 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│ .│
2256 │ Row % │ .│ .│ .│ .│ .│ .│
2257 │ Row Valid N % │ .│ .│ .│ .│ .│ .│
2258 │ Row Total N % │ .│ .│ .│ .│ .│ .│
2259 │ Valid N │ 3│ 0│ 0│ 3│ 3│ 9│
2260 │ Total N │ 6│ 6│ 6│ 6│ 6│ 36│
2261 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
2264 ╭────────────────────────┬──────────────────────────────────╮
2266 │ ├──────┬──────┬──────┬──────┬──────┤
2267 │ │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
2268 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
2269 │x 1.00 Count │ 1│ 1│ 1│ 1│ 4│
2270 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2271 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2272 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2273 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2274 │ Row Valid N % │ .│ .│ .│ .│ .│
2275 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2276 │ Valid N │ │ │ │ │ 0│
2277 │ Total N │ │ │ │ │ 6│
2278 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2279 │ 2.00 Count │ 1│ 1│ 1│ 1│ 4│
2280 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2281 │ Column Valid N %│ .0%│ .│ .0%│ .0%│ .│
2282 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2283 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2284 │ Row Valid N % │ .│ .│ .│ .│ .│
2285 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2286 │ Valid N │ │ │ │ │ 0│
2287 │ Total N │ │ │ │ │ 6│
2288 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2289 │ 3.00 Count │ 1│ 1│ 1│ 1│ 4│
2290 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2291 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2292 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2293 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2294 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2295 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2296 │ Valid N │ │ │ │ │ 3│
2297 │ Total N │ │ │ │ │ 6│
2298 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2299 │ 4.00 Count │ 1│ 1│ 1│ 1│ 4│
2300 │ Column % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│ .│
2301 │ Column Valid N %│ 50.0%│ .│ 50.0%│ 50.0%│ .│
2302 │ Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│ .│
2303 │ Row % │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
2304 │ Row Valid N % │ 33.3%│ .0%│ 33.3%│ 33.3%│100.0%│
2305 │ Row Total N % │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
2306 │ Valid N │ │ │ │ │ 3│
2307 │ Total N │ │ │ │ │ 6│
2308 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
2309 │ Total Count │ 4│ 4│ 4│ 4│ 16│
2310 │ Column % │100.0%│100.0%│100.0%│100.0%│ .│
2311 │ Column Valid N %│100.0%│ .│100.0%│100.0%│ .│
2312 │ Column Total N %│100.0%│100.0%│100.0%│100.0%│ .│
2313 │ Row % │ .│ .│ .│ .│ .│
2314 │ Row Valid N % │ .│ .│ .│ .│ .│
2315 │ Row Total N % │ .│ .│ .│ .│ .│
2316 │ Valid N │ 2│ 0│ 2│ 2│ 6│
2317 │ Total N │ 5│ 5│ 5│ 5│ 30│
2318 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
2322 AT_SETUP([CTABLES SMISSING=LISTWISE])
2323 AT_KEYWORDS([SMISSING LISTWISE])
2324 AT_DATA([ctables.sps],
2325 [[DATA LIST LIST NOTABLE/x y z.
2333 VARIABLE LEVEL x (NOMINAL).
2335 CTABLES /TABLE (y + z) > x.
2336 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
2338 * The following doesn't come out as listwise because the tables are
2339 separate, not linked by an > operator.
2340 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
2342 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
2372 AT_SETUP([CTABLES VLABELS - variables on different axes])
2373 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2374 AT_DATA([ctables.sps],
2376 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=DEFAULT /TABLE qnd5a BY qns3a.
2377 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NAME /TABLE qnd5a BY qns3a.
2378 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=LABEL /TABLE qnd5a BY qns3a.
2379 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=BOTH /TABLE qnd5a BY qns3a.
2380 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a BY qns3a.
2382 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2384 ╭────────────────────────────────────────────────────────────────┬────────────╮
2390 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2391 │D5a. What would you say is your primary Cuban │ 13│ 7│
2392 │ethnic background? Mexican │ 175│ 136│
2394 │ South American │ 21│ 13│
2395 │ Central American │ 27│ 25│
2396 │ Puerto Rican, OR │ 37│ 41│
2397 │ Something else │ 35│ 33│
2398 │ Multiple - cannot │ 2│ 5│
2400 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2403 ╭──────────────────────────────────┬────────────╮
2409 ├──────────────────────────────────┼─────┼──────┤
2410 │QND5A Cuban │ 13│ 7│
2411 │ Mexican │ 175│ 136│
2413 │ South American │ 21│ 13│
2414 │ Central American │ 27│ 25│
2415 │ Puerto Rican, OR │ 37│ 41│
2416 │ Something else │ 35│ 33│
2417 │ Multiple - cannot choose one│ 2│ 5│
2418 ╰──────────────────────────────────┴─────┴──────╯
2421 ╭────────────────────────────────────────────────────────────────┬────────────╮
2427 ├────────────────────────────────────────────────────────────────┼─────┼──────┤
2428 │D5a. What would you say is your primary Cuban │ 13│ 7│
2429 │ethnic background? Mexican │ 175│ 136│
2431 │ South American │ 21│ 13│
2432 │ Central American │ 27│ 25│
2433 │ Puerto Rican, OR │ 37│ 41│
2434 │ Something else │ 35│ 33│
2435 │ Multiple - cannot │ 2│ 5│
2437 ╰────────────────────────────────────────────────────────────────┴─────┴──────╯
2440 ╭────────────────────────────────────────────────────────────┬────────────────╮
2443 │ ├───────┬────────┤
2445 │ ├───────┼────────┤
2447 ├────────────────────────────────────────────────────────────┼───────┼────────┤
2448 │QND5A D5a. What would you say is your Cuban │ 13│ 7│
2449 │primary ethnic background? Mexican │ 175│ 136│
2451 │ South American │ 21│ 13│
2452 │ Central American │ 27│ 25│
2453 │ Puerto Rican, OR │ 37│ 41│
2454 │ Something else │ 35│ 33│
2455 │ Multiple - cannot │ 2│ 5│
2457 ╰────────────────────────────────────────────────────────────┴───────┴────────╯
2460 ╭────────────────────────────┬─────┬──────╮
2464 ├────────────────────────────┼─────┼──────┤
2466 │Mexican │ 175│ 136│
2468 │South American │ 21│ 13│
2469 │Central American │ 27│ 25│
2470 │Puerto Rican, OR │ 37│ 41│
2471 │Something else │ 35│ 33│
2472 │Multiple - cannot choose one│ 2│ 5│
2473 ╰────────────────────────────┴─────┴──────╯
2477 AT_SETUP([CTABLES VLABELS - stacked variables])
2478 AT_KEYWORDS([stack stacking])
2479 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2480 AT_DATA([ctables.sps],
2482 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a + qns3a.
2483 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a + qns3a.
2484 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a + qns3a.
2485 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2486 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a + qns3a.
2488 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2490 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2492 ├───────────────────────────────────────────────────────────────────────┼─────┤
2493 │D5a. What would you say is your primary ethnic Cuban │ 20│
2494 │background? Mexican │ 311│
2496 │ South American │ 34│
2497 │ Central American │ 52│
2498 │ Puerto Rican, OR │ 78│
2499 │ Something else │ 68│
2500 │ Multiple - cannot │ 7│
2502 ├───────────────────────────────────────────────────────────────────────┼─────┤
2505 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2508 ╭─────────────────────────────────────────┬─────╮
2510 ├─────────────────────────────────────────┼─────┤
2514 │ South American │ 34│
2515 │ Central American │ 52│
2516 │ Puerto Rican, OR │ 78│
2517 │ Something else │ 68│
2518 │ Multiple - cannot choose one│ 7│
2519 ├─────────────────────────────────────────┼─────┤
2520 │S3a. GENDER: Male │ 3132│
2522 ╰─────────────────────────────────────────┴─────╯
2525 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2527 ├───────────────────────────────────────────────────────────────────────┼─────┤
2528 │D5a. What would you say is your primary ethnic Cuban │ 20│
2529 │background? Mexican │ 311│
2531 │ South American │ 34│
2532 │ Central American │ 52│
2533 │ Puerto Rican, OR │ 78│
2534 │ Something else │ 68│
2535 │ Multiple - cannot │ 7│
2537 ├───────────────────────────────────────────────────────────────────────┼─────┤
2539 ├───────────────────────────────────────────────────────────────────────┼─────┤
2541 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2544 ╭─────────────────────────────┬─────╮
2546 ├─────────────────────────────┼─────┤
2548 ├─────────────────────────────┼─────┤
2550 ├─────────────────────────────┼─────┤
2552 ├─────────────────────────────┼─────┤
2553 │South American │ 34│
2554 ├─────────────────────────────┼─────┤
2555 │Central American │ 52│
2556 ├─────────────────────────────┼─────┤
2557 │Puerto Rican, OR │ 78│
2558 ├─────────────────────────────┼─────┤
2559 │Something else │ 68│
2560 ├─────────────────────────────┼─────┤
2561 │Multiple - cannot choose one │ 7│
2562 ├─────────────────────────────┼─────┤
2563 │S3a. GENDER: Male │ 3132│
2565 ╰─────────────────────────────┴─────╯
2568 ╭────────────────────────────┬─────╮
2570 ├────────────────────────────┼─────┤
2574 │South American │ 34│
2575 │Central American │ 52│
2576 │Puerto Rican, OR │ 78│
2577 │Something else │ 68│
2578 │Multiple - cannot choose one│ 7│
2581 ╰────────────────────────────┴─────╯
2585 AT_SETUP([CTABLES VLABELS - nested variables])
2586 AT_KEYWORDS([nest nesting])
2587 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2588 AT_DATA([ctables.sps],
2590 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NAME /TABLE qnd5a > qns3a.
2591 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NAME /TABLE qnd5a > qns3a.
2592 CTABLES /VLABELS VARIABLES=qns3a DISPLAY=NONE /TABLE qnd5a > qns3a.
2593 CTABLES /VLABELS VARIABLES=qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2594 CTABLES /VLABELS VARIABLES=qns3a qnd5a DISPLAY=NONE /TABLE qnd5a > qns3a.
2596 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2598 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2600 ├───────────────────────────────────────────────────────────────────────┼─────┤
2601 │D5a. What would you say is your Cuban QNS3A Male │ 13│
2602 │primary ethnic background? Female│ 7│
2603 │ ╶─────────────────────────────────┼─────┤
2604 │ Mexican QNS3A Male │ 175│
2606 │ ╶─────────────────────────────────┼─────┤
2607 │ Spanish QNS3A Male │ 20│
2609 │ ╶─────────────────────────────────┼─────┤
2610 │ South American QNS3A Male │ 21│
2612 │ ╶─────────────────────────────────┼─────┤
2613 │ Central American QNS3A Male │ 27│
2615 │ ╶─────────────────────────────────┼─────┤
2616 │ Puerto Rican, OR QNS3A Male │ 37│
2618 │ ╶─────────────────────────────────┼─────┤
2619 │ Something else QNS3A Male │ 35│
2621 │ ╶─────────────────────────────────┼─────┤
2622 │ Multiple - cannot QNS3A Male │ 2│
2623 │ choose one Female│ 5│
2624 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2627 ╭──────────────────────────────────────────────────────┬─────╮
2629 ├──────────────────────────────────────────────────────┼─────┤
2630 │QND5A Cuban S3a. GENDER: Male │ 13│
2632 │ ╶────────────────────────────────────────────────┼─────┤
2633 │ Mexican S3a. GENDER: Male │ 175│
2635 │ ╶────────────────────────────────────────────────┼─────┤
2636 │ Spanish S3a. GENDER: Male │ 20│
2638 │ ╶────────────────────────────────────────────────┼─────┤
2639 │ South American S3a. GENDER: Male │ 21│
2641 │ ╶────────────────────────────────────────────────┼─────┤
2642 │ Central American S3a. GENDER: Male │ 27│
2644 │ ╶────────────────────────────────────────────────┼─────┤
2645 │ Puerto Rican, OR S3a. GENDER: Male │ 37│
2647 │ ╶────────────────────────────────────────────────┼─────┤
2648 │ Something else S3a. GENDER: Male │ 35│
2650 │ ╶────────────────────────────────────────────────┼─────┤
2651 │ Multiple - cannot choose one S3a. GENDER: Male │ 2│
2653 ╰──────────────────────────────────────────────────────┴─────╯
2656 ╭───────────────────────────────────────────────────────────────────────┬─────╮
2658 ├───────────────────────────────────────────────────────────────────────┼─────┤
2659 │D5a. What would you say is your primary Cuban Male │ 13│
2660 │ethnic background? Female│ 7│
2661 │ ╶────────────────────────────┼─────┤
2662 │ Mexican Male │ 175│
2664 │ ╶────────────────────────────┼─────┤
2665 │ Spanish Male │ 20│
2667 │ ╶────────────────────────────┼─────┤
2668 │ South American Male │ 21│
2670 │ ╶────────────────────────────┼─────┤
2671 │ Central American Male │ 27│
2673 │ ╶────────────────────────────┼─────┤
2674 │ Puerto Rican, OR Male │ 37│
2676 │ ╶────────────────────────────┼─────┤
2677 │ Something else Male │ 35│
2679 │ ╶────────────────────────────┼─────┤
2680 │ Multiple - cannot Male │ 2│
2681 │ choose one Female│ 5│
2682 ╰───────────────────────────────────────────────────────────────────────┴─────╯
2685 ╭────────────────────────────────────────────────┬─────╮
2687 ├────────────────────────────────────────────────┼─────┤
2688 │Cuban S3a. GENDER: Male │ 13│
2690 ├────────────────────────────────────────────────┼─────┤
2691 │Mexican S3a. GENDER: Male │ 175│
2693 ├────────────────────────────────────────────────┼─────┤
2694 │Spanish S3a. GENDER: Male │ 20│
2696 ├────────────────────────────────────────────────┼─────┤
2697 │South American S3a. GENDER: Male │ 21│
2699 ├────────────────────────────────────────────────┼─────┤
2700 │Central American S3a. GENDER: Male │ 27│
2702 ├────────────────────────────────────────────────┼─────┤
2703 │Puerto Rican, OR S3a. GENDER: Male │ 37│
2705 ├────────────────────────────────────────────────┼─────┤
2706 │Something else S3a. GENDER: Male │ 35│
2708 ├────────────────────────────────────────────────┼─────┤
2709 │Multiple - cannot choose one S3a. GENDER: Male │ 2│
2711 ╰────────────────────────────────────────────────┴─────╯
2714 ╭───────────────────────────────────┬─────╮
2716 ├───────────────────────────────────┼─────┤
2719 ├───────────────────────────────────┼─────┤
2720 │Mexican Male │ 175│
2722 ├───────────────────────────────────┼─────┤
2725 ├───────────────────────────────────┼─────┤
2726 │South American Male │ 21│
2728 ├───────────────────────────────────┼─────┤
2729 │Central American Male │ 27│
2731 ├───────────────────────────────────┼─────┤
2732 │Puerto Rican, OR Male │ 37│
2734 ├───────────────────────────────────┼─────┤
2735 │Something else Male │ 35│
2737 ├───────────────────────────────────┼─────┤
2738 │Multiple - cannot choose one Male │ 2│
2740 ╰───────────────────────────────────┴─────╯
2744 AT_SETUP([CTABLES FORMAT EMPTY])
2745 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2746 AT_DATA([ctables.sps],
2748 CTABLES /FORMAT EMPTY=ZERO /TABLE qnd5a BY qnd5.
2749 CTABLES /FORMAT EMPTY=BLANK /TABLE qnd5a BY qnd5.
2750 CTABLES /FORMAT EMPTY='n/a' /TABLE qnd5a BY qnd5.
2752 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2754 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2755 │ │ D5. ETHNICITY: Are you of │
2756 │ │ Hispanic or Latino origin or │
2758 │ ├───────────────┬───────────────┤
2760 │ ├───────────────┼───────────────┤
2762 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2763 │D5a. What would you say is Cuban │ 20│ 0│
2764 │your primary ethnic Mexican │ 311│ 0│
2765 │background? Spanish │ 48│ 0│
2766 │ South American │ 34│ 0│
2767 │ Central American│ 52│ 0│
2768 │ Puerto Rican, OR│ 78│ 0│
2769 │ Something else │ 68│ 0│
2770 │ Multiple - │ 7│ 0│
2771 │ cannot choose │ │ │
2773 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2776 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2777 │ │ D5. ETHNICITY: Are you of │
2778 │ │ Hispanic or Latino origin or │
2780 │ ├───────────────┬───────────────┤
2782 │ ├───────────────┼───────────────┤
2784 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2785 │D5a. What would you say is Cuban │ 20│ │
2786 │your primary ethnic Mexican │ 311│ │
2787 │background? Spanish │ 48│ │
2788 │ South American │ 34│ │
2789 │ Central American│ 52│ │
2790 │ Puerto Rican, OR│ 78│ │
2791 │ Something else │ 68│ │
2793 │ cannot choose │ │ │
2795 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2798 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2799 │ │ D5. ETHNICITY: Are you of │
2800 │ │ Hispanic or Latino origin or │
2802 │ ├───────────────┬───────────────┤
2804 │ ├───────────────┼───────────────┤
2806 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2807 │D5a. What would you say is Cuban │ 20│n/a │
2808 │your primary ethnic Mexican │ 311│n/a │
2809 │background? Spanish │ 48│n/a │
2810 │ South American │ 34│n/a │
2811 │ Central American│ 52│n/a │
2812 │ Puerto Rican, OR│ 78│n/a │
2813 │ Something else │ 68│n/a │
2814 │ Multiple - │ 7│n/a │
2815 │ cannot choose │ │ │
2817 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2821 AT_SETUP([CTABLES FORMAT MISSING])
2822 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2823 AT_DATA([ctables.sps],
2825 CTABLES /FORMAT MISSING='(no data)' /TABLE qnd5a[COLPCT] BY qnd5.
2827 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2829 ╭─────────────────────────────────────────────┬───────────────────────────────╮
2830 │ │ D5. ETHNICITY: Are you of │
2831 │ │ Hispanic or Latino origin or │
2833 │ ├───────────────┬───────────────┤
2835 │ ├───────────────┼───────────────┤
2836 │ │ Column % │ Column % │
2837 ├─────────────────────────────────────────────┼───────────────┼───────────────┤
2838 │D5a. What would you say is Cuban │ 3.2%│(no data) │
2839 │your primary ethnic Mexican │ 50.3%│(no data) │
2840 │background? Spanish │ 7.8%│(no data) │
2841 │ South American │ 5.5%│(no data) │
2842 │ Central American│ 8.4%│(no data) │
2843 │ Puerto Rican, OR│ 12.6%│(no data) │
2844 │ Something else │ 11.0%│(no data) │
2845 │ Multiple - │ 1.1%│(no data) │
2846 │ cannot choose │ │ │
2848 ╰─────────────────────────────────────────────┴───────────────┴───────────────╯
2852 AT_SETUP([CTABLES HIDESMALLCOUNTS])
2853 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2854 AT_DATA([ctables.sps],
2856 CTABLES /TABLE qn38[c][COUNT, COLPCT].
2857 CTABLES /HIDESMALLCOUNTS /TABLE qn38[c][COUNT, COLPCT].
2858 CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE qn38[c][COUNT, COLPCT].
2860 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2862 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2864 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2865 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2866 │occasion? 1 │ 491│ 34.9%│
2886 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2889 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2891 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2892 │38. How many drinks did you have on that Less than one│ 7│ .5%│
2893 │occasion? 1 │ 491│ 34.9%│
2913 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2916 ╭──────────────────────────────────────────────────────────────┬─────┬────────╮
2918 ├──────────────────────────────────────────────────────────────┼─────┼────────┤
2919 │38. How many drinks did you have on that Less than one│<10 │ .5%│
2920 │occasion? 1 │ 491│ 34.9%│
2940 ╰──────────────────────────────────────────────────────────────┴─────┴────────╯
2944 AT_SETUP([CTABLES FORMAT MINCOLWIDTH MAXCOLWIDTH])
2945 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2946 AT_DATA([ctables.sps],
2948 CTABLES /FORMAT MINCOLWIDTH=1 MAXCOLWIDTH=2 UNITS=INCHES /TABLE BY qns3a.
2950 AT_CHECK([pspp ctables.sps -o - -O box=unicode -o pspp.spv], [0], [dnl
2962 AT_CHECK([pspp-output get-table-look pspp.spv pspp.stt])
2963 AT_CHECK([sed 's/ /\n/g' pspp.stt | grep ColumnWidth | sort], [0], [dnl
2964 maximumColumnWidth="192"
2965 minimumColumnWidth="96"
2969 AT_SETUP([CTABLES special formats])
2970 AT_KEYWORDS([NEGPAREN NEQUAL PAREN PCTPAREN])
2971 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2972 AT_DATA([ctables.sps],
2974 COMPUTE x = qnd3 - 4.
2975 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].
2977 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
2979 ╭─┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────╮
2980 │ │Minimum│Minimum│Minimum│Minimum│Maximum│Maximum│Maximum│Maximum│
2981 ├─┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
2982 │x│(3.0) │N=-3.0 │(-3.0) │(-3.0%)│8.0 │N=8.0 │(8.0) │(8.0%) │
2983 ╰─┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────╯
2987 AT_SETUP([CTABLES TITLES])
2988 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
2989 AT_DATA([ctables.sps],
2992 /VLABELS VARIABLES=qn1 DISPLAY=NONE
2993 /TABLE ((qn1[c][COUNT])) BY qns3a[c] > qnd5
2994 /TITLES TITLE='How often do you drive?'
2995 CAPTION='Generated )TIME on )DATE'
2998 AT_CHECK([pspp ctables.sps -O box=unicode | sed 's/..:..:../HH:MM:SS/
2999 s&../../..&MM/DD/YY&'], [0], [dnl
3000 How often do you drive?
3001 ╭───────────────────────────────────┬─────────────────────────────────────────╮
3003 │ ├────────────────────┬────────────────────┤
3005 │ ├────────────────────┼────────────────────┤
3006 │ │ D5. ETHNICITY: Are │ D5. ETHNICITY: Are │
3007 │ │ you of Hispanic or │ you of Hispanic or │
3008 │ │ Latino origin or │ Latino origin or │
3009 │( ( 1. How often do you usually │ descent? │ descent? │
3010 │drive a car or other motor ├─────────┬──────────┼─────────┬──────────┤
3011 │vehicle?) ) BY S3a. GENDER: > D5. │ Yes │ No │ Yes │ No │
3012 │ETHNICITY: Are you of Hispanic or ├─────────┼──────────┼─────────┼──────────┤
3013 │Latino origin or descent? │ Count │ Count │ Count │ Count │
3014 ├───────────────────────────────────┼─────────┼──────────┼─────────┼──────────┤
3015 │Every day │ 218│ 2066│ 166│ 2175│
3016 │Several days a week │ 44│ 391│ 45│ 782│
3017 │Once a week or less │ 16│ 109│ 12│ 223│
3018 │Only certain times a year │ 15│ 41│ 11│ 61│
3019 │Never │ 39│ 150│ 56│ 278│
3020 ╰───────────────────────────────────┴─────────┴──────────┴─────────┴──────────╯
3021 Generated HH:MM:SS on MM/DD/YY
3025 AT_SETUP([CTABLES area definitions])
3026 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3027 AT_DATA([ctables.sps],
3030 /VLABELS VARIABLES=ALL DISPLAY=NAME
3031 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[TABLE.ID, LAYER.ID, SUBTABLE.ID]
3032 /SLABELS POSITION=ROW
3033 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[ROW.ID, LAYERROW.ID]
3034 /SLABELS POSITION=ROW
3035 /TABLE qn61 > qn57 BY qnd7a > qn86 + qn64b BY qns3a[COL.ID, LAYERCOL.ID]
3036 /SLABELS POSITION=ROW.
3038 AT_CHECK([pspp ctables.sps --table-look="$builddir"/all-layers.stt -O box=unicode -O width=80], [0], [dnl
3041 ╭─────────────────────────────┬─────────────┬──────╮
3043 │ ├──────┬──────┼───┬──┤
3045 │ ├──────┼──────┤ │ │
3046 │ │ QN86 │ QN86 │ │ │
3047 │ ├───┬──┼───┬──┤ │ │
3048 │ │Yes│No│Yes│No│Yes│No│
3049 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3050 │QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3051 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3052 │ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
3053 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3054 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3055 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3056 │ Subtable ID│ 1│ 1│ 2│ 2│ 3│ 3│
3057 │ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3058 │ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3059 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3060 │ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
3061 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3062 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3063 │ Layer ID │ 1│ 1│ 1│ 1│ 2│ 2│
3064 │ Subtable ID│ 4│ 4│ 5│ 5│ 6│ 6│
3065 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3069 ╭─────────────────────────────┬─────────────┬──────╮
3071 │ ├──────┬──────┼───┬──┤
3073 │ ├──────┼──────┤ │ │
3074 │ │ QN86 │ QN86 │ │ │
3075 │ ├───┬──┼───┬──┤ │ │
3076 │ │Yes│No│Yes│No│Yes│No│
3077 ├─────────────────────────────┼───┼──┼───┼──┼───┼──┤
3078 │QN61 Yes QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3079 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3080 │ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
3081 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3082 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3083 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3084 │ Subtable ID│ 7│ 7│ 8│ 8│ 9│ 9│
3085 │ ╶────────────────────────┼───┼──┼───┼──┼───┼──┤
3086 │ No QN57 Yes Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3087 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3088 │ Subtable ID│ 10│10│ 11│11│ 12│12│
3089 │ ╶───────────────┼───┼──┼───┼──┼───┼──┤
3090 │ No Table ID │ 1│ 1│ 1│ 1│ 2│ 2│
3091 │ Layer ID │ 3│ 3│ 3│ 3│ 4│ 4│
3092 │ Subtable ID│ 10│10│ 11│11│ 12│12│
3093 ╰─────────────────────────────┴───┴──┴───┴──┴───┴──╯
3097 ╭──────────────────────────────┬─────────────┬──────╮
3099 │ ├──────┬──────┼───┬──┤
3101 │ ├──────┼──────┤ │ │
3102 │ │ QN86 │ QN86 │ │ │
3103 │ ├───┬──┼───┬──┤ │ │
3104 │ │Yes│No│Yes│No│Yes│No│
3105 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3106 │QN61 Yes QN57 Yes Row ID │ 1│ 1│ 2│ 2│ 3│ 3│
3107 │ Layer Row ID│ 1│ 1│ 1│ 1│ 2│ 2│
3108 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3109 │ No Row ID │ 4│ 4│ 5│ 5│ 6│ 6│
3110 │ Layer Row ID│ 3│ 3│ 3│ 3│ 4│ 4│
3111 │ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3112 │ No QN57 Yes Row ID │ 7│ 7│ 8│ 8│ 9│ 9│
3113 │ Layer Row ID│ 5│ 5│ 5│ 5│ 6│ 6│
3114 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3115 │ No Row ID │ 10│10│ 11│11│ 12│12│
3116 │ Layer Row ID│ 7│ 7│ 7│ 7│ 8│ 8│
3117 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3121 ╭──────────────────────────────┬─────────────┬──────╮
3123 │ ├──────┬──────┼───┬──┤
3125 │ ├──────┼──────┤ │ │
3126 │ │ QN86 │ QN86 │ │ │
3127 │ ├───┬──┼───┬──┤ │ │
3128 │ │Yes│No│Yes│No│Yes│No│
3129 ├──────────────────────────────┼───┼──┼───┼──┼───┼──┤
3130 │QN61 Yes QN57 Yes Row ID │ 13│13│ 14│14│ 15│15│
3131 │ Layer Row ID│ 9│ 9│ 9│ 9│ 10│10│
3132 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3133 │ No Row ID │ 16│16│ 17│17│ 18│18│
3134 │ Layer Row ID│ 11│11│ 11│11│ 12│12│
3135 │ ╶─────────────────────────┼───┼──┼───┼──┼───┼──┤
3136 │ No QN57 Yes Row ID │ 19│19│ 20│20│ 21│21│
3137 │ Layer Row ID│ 13│13│ 13│13│ 14│14│
3138 │ ╶────────────────┼───┼──┼───┼──┼───┼──┤
3139 │ No Row ID │ 22│22│ 23│23│ 24│24│
3140 │ Layer Row ID│ 15│15│ 15│15│ 16│16│
3141 ╰──────────────────────────────┴───┴──┴───┴──┴───┴──╯
3145 ╭─────────────────────────────────┬─────────────┬──────╮
3147 │ ├──────┬──────┼───┬──┤
3149 │ ├──────┼──────┤ │ │
3150 │ │ QN86 │ QN86 │ │ │
3151 │ ├───┬──┼───┬──┤ │ │
3152 │ │Yes│No│Yes│No│Yes│No│
3153 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3154 │QN61 Yes QN57 Yes Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
3155 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3156 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3157 │ No Column ID │ 1│ 2│ 3│ 4│ 5│ 6│
3158 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3159 │ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3160 │ No QN57 Yes Column ID │ 7│ 8│ 9│10│ 11│12│
3161 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3162 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3163 │ No Column ID │ 7│ 8│ 9│10│ 11│12│
3164 │ Layer Column ID│ 1│ 2│ 3│ 4│ 5│ 6│
3165 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3169 ╭─────────────────────────────────┬─────────────┬──────╮
3171 │ ├──────┬──────┼───┬──┤
3173 │ ├──────┼──────┤ │ │
3174 │ │ QN86 │ QN86 │ │ │
3175 │ ├───┬──┼───┬──┤ │ │
3176 │ │Yes│No│Yes│No│Yes│No│
3177 ├─────────────────────────────────┼───┼──┼───┼──┼───┼──┤
3178 │QN61 Yes QN57 Yes Column ID │ 13│14│ 15│16│ 17│18│
3179 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3180 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3181 │ No Column ID │ 13│14│ 15│16│ 17│18│
3182 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3183 │ ╶────────────────────────────┼───┼──┼───┼──┼───┼──┤
3184 │ No QN57 Yes Column ID │ 19│20│ 21│22│ 23│24│
3185 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3186 │ ╶───────────────────┼───┼──┼───┼──┼───┼──┤
3187 │ No Column ID │ 19│20│ 21│22│ 23│24│
3188 │ Layer Column ID│ 7│ 8│ 9│10│ 11│12│
3189 ╰─────────────────────────────────┴───┴──┴───┴──┴───┴──╯
3193 AT_SETUP([CTABLES categorical summary functions])
3194 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3195 AT_DATA([ctables.sps],
3198 /TABLE region BY qnd5a[COUNT, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTAL[COUNT, VALIDN, TOTALN]]
3199 /CATEGORIES VARIABLES=qnd5a TOTAL=YES MISSING=INCLUDE
3200 /SLABELS POSITION=ROW.
3202 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3204 ╭─────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────╮
3205 │ │ D5a. What would you say is your primary ethnic background? │
3206 │ ├─────┬───────┬───────┬──────────┬──────────┬─────────┬──────────┬──────────────┬──────┬───────┬─────┤
3207 │ │ │ │ │ │ │ │ │ Multiple - │ │ │ │
3208 │ │ │ │ │ South │ Central │ Puerto │ Something│ cannot choose│ Don't│ │ │
3209 │ │Cuban│Mexican│Spanish│ American │ American │Rican, OR│ else │ one │ know │Refused│Total│
3210 ├─────────────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3211 │Region NE Count │ 6│ 8│ 8│ 11│ 7│ 39│ 23│ 2│ 0│ 1│ 105│
3212 │ Row % │ 5.7%│ 7.6%│ 7.6%│ 10.5%│ 6.7%│ 37.1%│ 21.9%│ 1.9%│ .0%│ 1.0%│ │
3213 │ Row │ 5.8%│ 7.7%│ 7.7%│ 10.6%│ 6.7%│ 37.5%│ 22.1%│ 1.9%│ .0%│ .0%│ │
3214 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3215 │ % │ │ │ │ │ │ │ │ │ │ │ │
3216 │ Row │ .4%│ .6%│ .6%│ .8%│ .5%│ 2.8%│ 1.6%│ .1%│ .0%│ .1%│ │
3217 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3218 │ % │ │ │ │ │ │ │ │ │ │ │ │
3219 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 104│
3220 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1409│
3221 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3222 │ MW Count │ 3│ 24│ 1│ 4│ 5│ 9│ 6│ 0│ 0│ 1│ 53│
3223 │ Row % │ 5.7%│ 45.3%│ 1.9%│ 7.5%│ 9.4%│ 17.0%│ 11.3%│ .0%│ .0%│ 1.9%│ │
3224 │ Row │ 5.8%│ 46.2%│ 1.9%│ 7.7%│ 9.6%│ 17.3%│ 11.5%│ .0%│ .0%│ .0%│ │
3225 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3226 │ % │ │ │ │ │ │ │ │ │ │ │ │
3227 │ Row │ .2%│ 1.5%│ .1%│ .2%│ .3%│ .5%│ .4%│ .0%│ .0%│ .1%│ │
3228 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3229 │ % │ │ │ │ │ │ │ │ │ │ │ │
3230 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 52│
3231 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1654│
3232 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3233 │ S Count │ 10│ 113│ 11│ 14│ 25│ 23│ 20│ 2│ 3│ 2│ 223│
3234 │ Row % │ 4.5%│ 50.7%│ 4.9%│ 6.3%│ 11.2%│ 10.3%│ 9.0%│ .9%│ 1.3%│ .9%│ │
3235 │ Row │ 4.6%│ 51.8%│ 5.0%│ 6.4%│ 11.5%│ 10.6%│ 9.2%│ .9%│ .0%│ .0%│ │
3236 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3237 │ % │ │ │ │ │ │ │ │ │ │ │ │
3238 │ Row │ .4%│ 4.7%│ .5%│ .6%│ 1.0%│ 1.0%│ .8%│ .1%│ .1%│ .1%│ │
3239 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3240 │ % │ │ │ │ │ │ │ │ │ │ │ │
3241 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 218│
3242 │ Total N│ │ │ │ │ │ │ │ │ │ │ 2390│
3243 │ ╶──────────┼─────┼───────┼───────┼──────────┼──────────┼─────────┼──────────┼──────────────┼──────┼───────┼─────┤
3244 │ W Count │ 1│ 166│ 28│ 5│ 15│ 7│ 19│ 3│ 0│ 1│ 245│
3245 │ Row % │ .4%│ 67.8%│ 11.4%│ 2.0%│ 6.1%│ 2.9%│ 7.8%│ 1.2%│ .0%│ .4%│ │
3246 │ Row │ .4%│ 68.0%│ 11.5%│ 2.0%│ 6.1%│ 2.9%│ 7.8%│ 1.2%│ .0%│ .0%│ │
3247 │ Valid N│ │ │ │ │ │ │ │ │ │ │ │
3248 │ % │ │ │ │ │ │ │ │ │ │ │ │
3249 │ Row │ .1%│ 10.7%│ 1.8%│ .3%│ 1.0%│ .5%│ 1.2%│ .2%│ .0%│ .1%│ │
3250 │ Total N│ │ │ │ │ │ │ │ │ │ │ │
3251 │ % │ │ │ │ │ │ │ │ │ │ │ │
3252 │ Valid N│ │ │ │ │ │ │ │ │ │ │ 244│
3253 │ Total N│ │ │ │ │ │ │ │ │ │ │ 1546│
3254 ╰─────────────────┴─────┴───────┴───────┴──────────┴──────────┴─────────┴──────────┴──────────────┴──────┴───────┴─────╯
3259 AT_SETUP([CTABLES scale summary functions])
3260 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3261 AT_DATA([ctables.sps],
3265 * Use SPLIT FILE with FREQUENCIES to generate output equivalent to
3266 CTABLES later, to make the results easier to verify.
3267 SPLIT FILE BY REGION.
3270 /STATISTICS=MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE RANGE MINIMUM MAXIMUM SUM
3271 /FORMAT NOTABLE /MISSING=INCLUDE.
3275 /VLABELS VARIABLE=qn19a DISPLAY=NAME /*XXX NONE yields an assertion failure
3276 /TABLE region BY qn19a[VALIDN, MISSING, MEAN, SEMEAN, MEDIAN, MODE, STDDEV, VARIANCE, RANGE, MINIMUM, MAXIMUM, SUM, COUNT, TOTALN, COLPCT.SUM]
3277 /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE
3278 /SLABELS POSITION=ROW.
3280 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
3282 ╭────────────────┬────────╮
3284 ├────────────────┼────────┤
3287 │ ╶─────────┼────────┤
3289 │ ╶─────────┼────────┤
3291 │ ╶─────────┼────────┤
3293 │ ╶─────────┼────────┤
3295 │ ╶─────────┼────────┤
3297 │ ╶─────────┼────────┤
3299 │ ╶─────────┼────────┤
3301 │ ╶─────────┼────────┤
3303 │ ╶─────────┼────────┤
3305 │ ╶─────────┼────────┤
3307 ├────────────────┼────────┤
3310 │ ╶─────────┼────────┤
3312 │ ╶─────────┼────────┤
3314 │ ╶─────────┼────────┤
3316 │ ╶─────────┼────────┤
3318 │ ╶─────────┼────────┤
3320 │ ╶─────────┼────────┤
3322 │ ╶─────────┼────────┤
3324 │ ╶─────────┼────────┤
3326 │ ╶─────────┼────────┤
3328 │ ╶─────────┼────────┤
3330 ├────────────────┼────────┤
3333 │ ╶─────────┼────────┤
3335 │ ╶─────────┼────────┤
3337 │ ╶─────────┼────────┤
3339 │ ╶─────────┼────────┤
3341 │ ╶─────────┼────────┤
3343 │ ╶─────────┼────────┤
3345 │ ╶─────────┼────────┤
3347 │ ╶─────────┼────────┤
3349 │ ╶─────────┼────────┤
3351 │ ╶─────────┼────────┤
3353 ├────────────────┼────────┤
3356 │ ╶─────────┼────────┤
3358 │ ╶─────────┼────────┤
3360 │ ╶─────────┼────────┤
3362 │ ╶─────────┼────────┤
3364 │ ╶─────────┼────────┤
3366 │ ╶─────────┼────────┤
3368 │ ╶─────────┼────────┤
3370 │ ╶─────────┼────────┤
3372 │ ╶─────────┼────────┤
3374 │ ╶─────────┼────────┤
3376 ╰────────────────┴────────╯
3379 ╭───────────────────────────┬────────╮
3381 ├───────────────────────────┼────────┤
3382 │REGION NE Valid N │ 936│
3385 │ Std Error of Mean│ .14│
3388 │ Std Deviation │ 4.41│
3396 │ Column Sum % │ 21.8%│
3397 │ ╶────────────────────┼────────┤
3398 │ MW Valid N │ 1019│
3401 │ Std Error of Mean│ .16│
3404 │ Std Deviation │ 5.15│
3412 │ Column Sum % │ 24.3%│
3413 │ ╶────────────────────┼────────┤
3415 │ Missing │ 1114.00│
3417 │ Std Error of Mean│ .18│
3420 │ Std Deviation │ 6.44│
3428 │ Column Sum % │ 31.2%│
3429 │ ╶────────────────────┼────────┤
3433 │ Std Error of Mean│ .17│
3436 │ Std Deviation │ 5.25│
3444 │ Column Sum % │ 22.7%│
3445 ╰───────────────────────────┴────────╯
3450 AT_SETUP([CTABLES hidden scale VLABELS])
3451 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
3452 AT_DATA([ctables.sps],
3455 /TABLE region BY qn19a + qn35
3456 /SLABELS POSITION=ROW.
3458 /VLABELS VARIABLE=qn19a DISPLAY=NONE
3459 /TABLE region BY qn19a + qn35
3460 /SLABELS POSITION=ROW.
3462 /VLABELS VARIABLE=qn35 DISPLAY=NONE
3463 /TABLE region BY qn19a + qn35
3464 /SLABELS POSITION=ROW.
3466 * This one in particular caused a crash because no categories were
3467 created on the column axis, so passing in 0 for the index was still
3468 too big for that number of categories. It was fixed by creating a
3469 name-only category for each variable despite the "NONE" request,
3470 then hiding the entire dimension's labels if all its labels were
3473 /VLABELS VARIABLE=qn19a qn35 DISPLAY=NONE
3474 /TABLE region BY qn19a + qn35
3475 /SLABELS POSITION=ROW.
3477 AT_CHECK([pspp ctables.sps -O box=unicode], [0], [dnl
3479 ╭──────────────┬────────────────────────────┬─────────────────────────────────╮
3480 │ │ 19a. About how old were you│ 35. In the past thirty days, how│
3481 │ │ when you first starting │ many times have you driven a │
3482 │ │ drinking alcohol, not │ motor vehicle WITHIN TWO HOURS │
3483 │ │ counting small tastes or │ AFTER drinking alcoholic │
3484 │ │ sips of alcohol. │ beverages? │
3485 ├──────────────┼────────────────────────────┼─────────────────────────────────┤
3486 │Region NE Mean│ 19.33│ 2│
3487 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3488 │ MW Mean│ 19.83│ 2│
3489 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3491 │ ╶───────┼────────────────────────────┼─────────────────────────────────┤
3493 ╰──────────────┴────────────────────────────┴─────────────────────────────────╯
3496 ╭──────────────┬─────┬────────────────────────────────────────────────────────╮
3497 │ │ │ 35. In the past thirty days, how many times have you │
3498 │ │ │ driven a motor vehicle WITHIN TWO HOURS AFTER drinking │
3499 │ │QN19A│ alcoholic beverages? │
3500 ├──────────────┼─────┼────────────────────────────────────────────────────────┤
3501 │Region NE Mean│19.33│ 2│
3502 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3504 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3506 │ ╶───────┼─────┼────────────────────────────────────────────────────────┤
3508 ╰──────────────┴─────┴────────────────────────────────────────────────────────╯
3511 ╭──────────────┬─────────────────────────────────────────────────────────┬────╮
3512 │ │ 19a. About how old were you when you first starting │ │
3513 │ │ drinking alcohol, not counting small tastes or sips of │ │
3515 ├──────────────┼─────────────────────────────────────────────────────────┼────┤
3516 │Region NE Mean│ 19.33│ 2│
3517 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3518 │ MW Mean│ 19.83│ 2│
3519 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3521 │ ╶───────┼─────────────────────────────────────────────────────────┼────┤
3523 ╰──────────────┴─────────────────────────────────────────────────────────┴────╯
3526 ╭──────────────┬───────╮
3527 │Region NE Mean│19.33 2│
3534 ╰──────────────┴───────╯