start writing tests
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl Features not yet tested:
4 dnl - Preprocessing to distinguish categorical from scale.
5 dnl - Parsing (positive and negative)
6 dnl - String variables and values
7 dnl - Testing details of missing value handling in summaries.
8 dnl - test CLABELS ROWLABELS=LAYER.
9 dnl - Test VLABELS.
10 dnl - Test WEIGHT and adjustment weights.
11 dnl - EMPTY=INCLUDE For string ranges.
12 dnl - Summary functions:
13 dnl   * Separate summary functions for totals and subtotals.
14 dnl   * )CILEVEL in summary label specification
15 dnl Category sorting:
16 dnl   * VALUE
17 dnl   * LABEL
18 dnl   * ascending/descending
19 dnl - CATEGORIES:
20 dnl   * String values
21 dnl   * Date values
22 dnl   * THRU (numeric ranges)
23 dnl   * THRU (string ranges)
24 dnl   * OTHERNM
25 dnl - FORMAT:
26 dnl   * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
27 dnl   * EMPTY.
28 dnl   * MISSING.
29 dnl - HIDESMALLCOUNTS.
30 dnl - Date/time variables and values
31 dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
32 dnl - TITLES: )DATE, )TIME, )TABLE.
33 dnl - Test PCOMPUTE:
34 dnl   * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
35 dnl   * MISSING, OTHERNM
36 dnl   * strings and string ranges
37 dnl   * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
38 dnl   * dates
39 dnl - PPROPERTIES:
40 dnl   * )LABEL[N].
41 dnl - Summary functions:
42 dnl   * U-prefix for unweighted summaries.
43 dnl   * areaPCT.SUM and UareaPCT.SUM functions.
44 dnl - SPLIT FILE with SEPARATE splits
45 dnl - Definition of columns/rows when labels are rotated from one axis to another.
46 dnl
47 dnl Not for v1:
48 dnl - Multiple response sets
49 dnl - MRSETS subcommand.
50 dnl - CATEGORIES: Special case for explicit category specifications and multiple dichotomy sets.
51 dnl - SIGTEST
52 dnl - COMPARETEST
53 dnl - Summary functions:
54 dnl   * .LCL and .UCL suffixes.
55 dnl   * .SE suffixes.
56 dnl - CATEGORIES:
57 dnl   * Data-dependent sorting.
58 dnl
59 dnl
60 dnl Bug:
61 dnl     CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a.
62 dnl produces a bad median:
63 dnl                     Custom Tables
64 dnl +--------------------------+-----------------------+
65 dnl |                          |      S3a. GENDER:     |
66 dnl |                          +-----------+-----------+
67 dnl |                          |    Male   |   Female  |
68 dnl |                          +----+------+----+------+
69 dnl |                          |Mean|Median|Mean|Median|
70 dnl +--------------------------+----+------+----+------+
71 dnl |D1. AGE: What is your age?|  46|   999|  50|   999|
72 dnl +--------------------------+----+------+----+------+
73
74
75
76 AT_SETUP([CTABLES parsing])
77 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
78 AT_DATA([ctables.sps],
79 [[GET 'nhtsa.sav'.
80 CTABLES
81     /FORMAT MINCOLWIDTH=10 MAXCOLWIDTH=20 UNITS=POINTS EMPTY=ZERO MISSING="x"
82     /FORMAT MINCOLWIDTH=DEFAULT MAXCOLWIDTH=DEFAULT UNITS=INCHES EMPTY=BLANK MISSING="."
83     /FORMAT UNITS=CM EMPTY="(-)"
84     /VLABELS VARIABLES=qn1 DISPLAY=DEFAULT
85     /VLABELS VARIABLES=qn17 DISPLAY=NAME
86     /VLABELS VARIABLES=qns3a DISPLAY=LABEL
87     /VLABELS VARIABLES=qnd1 DISPLAY=BOTH
88     /VLABELS VARIABLES=qn20 DISPLAY=NONE
89     /MRSETS COUNTDUPLICATES=NO
90     /MRSETS COUNTDUPLICATES=YES
91     /SMISSING VARIABLE
92     /SMISSING LISTWISE
93     /WEIGHT VARIABLE=qns3a
94     /HIDESMALLCOUNTS
95     /HIDESMALLCOUNTS COUNT=10
96     /TABLE qnd1
97     /SLABELS POSITION=COLUMN VISIBLE=YES
98     /SLABELS VISIBLE=NO POSITION=ROW
99     /SLABELS POSITION=LAYER
100     /CLABELS AUTO
101     /CLABELS ROWLABELS=OPPOSITE
102     /CLABELS ROWLABELS=LAYER
103     /CLABELS COLLABELS=OPPOSITE
104     /CLABELS COLLABELS=LAYER
105     /CRITERIA CILEVEL=50
106     /CATEGORIES VARIABLES=qn1 qn17
107                 ORDER=A KEY=VALUE MISSING=INCLUDE TOTAL=YES LABEL="xyzzy"
108                 POSITION=BEFORE EMPTY=INCLUDE.
109 ]])
110 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
111             Custom Tables
112 Mean
113 ╭───────────────────────────────┬──╮
114 │qnd1 D1. AGE: What is your age?│49│
115 ╰───────────────────────────────┴──╯
116 ])
117 AT_CLEANUP
118
119 AT_SETUP([CTABLES one categorical variable])
120 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
121 AT_DATA([ctables.sps],
122 [[GET 'nhtsa.sav'.
123 CTABLES /TABLE qn1.
124 CTABLES /TABLE BY qn1.
125 CTABLES /TABLE BY BY qn1.
126 ]])
127 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
128                                   Custom Tables
129 ╭────────────────────────────────────────────────────────────────────────┬─────╮
130 │                                                                        │Count│
131 ├────────────────────────────────────────────────────────────────────────┼─────┤
132 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
133 │motor vehicle?                                     Several days a week  │ 1274│
134 │                                                   Once a week or less  │  361│
135 │                                                   Only certain times a │  130│
136 │                                                   year                 │     │
137 │                                                   Never                │  540│
138 ╰────────────────────────────────────────────────────────────────────────┴─────╯
139
140                                   Custom Tables
141 ╭──────────────────────────────────────────────────────────────────────────────╮
142 │        1. How often do you usually drive a car or other motor vehicle?       │
143 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
144 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
145 │Every day│       week       │       less       │          year          │Never│
146 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
147 │  Count  │       Count      │       Count      │          Count         │Count│
148 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
149 │     4667│              1274│               361│                     130│  540│
150 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
151
152 Custom Tables
153 Every day
154 ╭─────╮
155 │Count│
156 ├─────┤
157 │ 4667│
158 ╰─────╯
159 ])
160 AT_CLEANUP
161
162 AT_SETUP([CTABLES one scale variable])
163 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
164 AT_DATA([ctables.sps],
165 [[GET 'nhtsa.sav'.
166 CTABLES /TABLE qnd1[COUNT, VALIDN, TOTALN, MEAN, STDDEV, MINIMUM, MAXIMUM].
167 CTABLES /TABLE BY qnd1.
168 CTABLES /TABLE BY BY qnd1.
169 ]])
170 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
171                                   Custom Tables
172 ╭──────────────────────┬─────┬───────┬───────┬────┬────────────┬───────┬───────╮
173 │                      │     │       │       │    │     Std    │       │       │
174 │                      │Count│Valid N│Total N│Mean│  Deviation │Minimum│Maximum│
175 ├──────────────────────┼─────┼───────┼───────┼────┼────────────┼───────┼───────┤
176 │D1. AGE: What is your │ 6999│   6930│   6999│  48│          19│     16│     86│
177 │age?                  │     │       │       │    │            │       │       │
178 ╰──────────────────────┴─────┴───────┴───────┴────┴────────────┴───────┴───────╯
179
180         Custom Tables
181 ╭──────────────────────────╮
182 │D1. AGE: What is your age?│
183 ├──────────────────────────┤
184 │           Mean           │
185 ├──────────────────────────┤
186 │                        48│
187 ╰──────────────────────────╯
188
189 Custom Tables
190 D1. AGE: What is your age?
191 ╭────╮
192 │Mean│
193 ├────┤
194 │  48│
195 ╰────╯
196 ])
197 AT_CLEANUP
198
199 AT_SETUP([CTABLES simple stacking])
200 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
201 AT_DATA([ctables.sps],
202 [[GET 'nhtsa.sav'.
203 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
204 ]])
205 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
206                                   Custom Tables
207 ╭───────────────────────────────────────────────────────────────┬──────────────╮
208 │                                                               │ S3a. GENDER: │
209 │                                                               ├──────┬───────┤
210 │                                                               │ Male │ Female│
211 │                                                               ├──────┼───────┤
212 │                                                               │Column│ Column│
213 │                                                               │   %  │   %   │
214 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
215 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
216 │too much to drink to drive safely will A. Get      certain     │      │       │
217 │stopped by the police?                             Very likely │   21%│    22%│
218 │                                                   Somewhat    │   38%│    42%│
219 │                                                   likely      │      │       │
220 │                                                   Somewhat    │   21%│    18%│
221 │                                                   unlikely    │      │       │
222 │                                                   Very        │   10%│     8%│
223 │                                                   unlikely    │      │       │
224 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
225 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
226 │too much to drink to drive safely will B. Have an  certain     │      │       │
227 │accident?                                          Very likely │   36%│    45%│
228 │                                                   Somewhat    │   39%│    32%│
229 │                                                   likely      │      │       │
230 │                                                   Somewhat    │    9%│     4%│
231 │                                                   unlikely    │      │       │
232 │                                                   Very        │    3%│     2%│
233 │                                                   unlikely    │      │       │
234 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
235 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
236 │too much to drink to drive safely will C. Be       certain     │      │       │
237 │convicted for drunk driving?                       Very likely │   32%│    28%│
238 │                                                   Somewhat    │   27%│    32%│
239 │                                                   likely      │      │       │
240 │                                                   Somewhat    │   15%│    15%│
241 │                                                   unlikely    │      │       │
242 │                                                   Very        │    9%│     9%│
243 │                                                   unlikely    │      │       │
244 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
245 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
246 │too much to drink to drive safely will D. Be       certain     │      │       │
247 │arrested for drunk driving?                        Very likely │   26%│    27%│
248 │                                                   Somewhat    │   32%│    35%│
249 │                                                   likely      │      │       │
250 │                                                   Somewhat    │   17%│    15%│
251 │                                                   unlikely    │      │       │
252 │                                                   Very        │    9%│     7%│
253 │                                                   unlikely    │      │       │
254 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
255 ])
256 AT_CLEANUP
257
258 AT_SETUP([CTABLES show or hide empty categories])
259 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
260 AT_DATA([ctables.sps],
261 [[GET 'nhtsa.sav'.
262 IF (qn105ba = 2) qn105ba = 1.
263 IF (qns3a = 1) qns3a = 2.
264 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
265 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
266     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
267 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
268     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
269 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
270     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
271 ]])
272 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
273                                   Custom Tables
274 ╭──────────────────────────────────────────────────────────────┬───────────────╮
275 │                                                              │  S3a. GENDER: │
276 │                                                              ├───────┬───────┤
277 │                                                              │  Male │ Female│
278 │                                                              ├───────┼───────┤
279 │                                                              │ Column│ Column│
280 │                                                              │   %   │   %   │
281 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
282 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
283 │too much to drink to drive safely will A. Get      certain    │       │       │
284 │stopped by the police?                             Very likely│      .│     0%│
285 │                                                   Somewhat   │      .│    40%│
286 │                                                   likely     │       │       │
287 │                                                   Somewhat   │      .│    19%│
288 │                                                   unlikely   │       │       │
289 │                                                   Very       │      .│     9%│
290 │                                                   unlikely   │       │       │
291 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
292
293                                   Custom Tables
294 ╭──────────────────────────────────────────────────────────────┬───────────────╮
295 │                                                              │  S3a. GENDER: │
296 │                                                              ├───────┬───────┤
297 │                                                              │  Male │ Female│
298 │                                                              ├───────┼───────┤
299 │                                                              │ Column│ Column│
300 │                                                              │   %   │   %   │
301 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
302 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
303 │too much to drink to drive safely will A. Get      certain    │       │       │
304 │stopped by the police?                             Somewhat   │      .│    40%│
305 │                                                   likely     │       │       │
306 │                                                   Somewhat   │      .│    19%│
307 │                                                   unlikely   │       │       │
308 │                                                   Very       │      .│     9%│
309 │                                                   unlikely   │       │       │
310 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
311
312                                   Custom Tables
313 ╭────────────────────────────────────────────────────────────────────┬─────────╮
314 │                                                                    │   S3a.  │
315 │                                                                    │ GENDER: │
316 │                                                                    ├─────────┤
317 │                                                                    │  Female │
318 │                                                                    ├─────────┤
319 │                                                                    │ Column %│
320 ├────────────────────────────────────────────────────────────────────┼─────────┤
321 │105b. How likely is it that drivers who have had too    Almost      │      32%│
322 │much to drink to drive safely will A. Get stopped by    certain     │         │
323 │the police?                                             Very likely │       0%│
324 │                                                        Somewhat    │      40%│
325 │                                                        likely      │         │
326 │                                                        Somewhat    │      19%│
327 │                                                        unlikely    │         │
328 │                                                        Very        │       9%│
329 │                                                        unlikely    │         │
330 ╰────────────────────────────────────────────────────────────────────┴─────────╯
331
332                                   Custom Tables
333 ╭────────────────────────────────────────────────────────────────────┬─────────╮
334 │                                                                    │   S3a.  │
335 │                                                                    │ GENDER: │
336 │                                                                    ├─────────┤
337 │                                                                    │  Female │
338 │                                                                    ├─────────┤
339 │                                                                    │ Column %│
340 ├────────────────────────────────────────────────────────────────────┼─────────┤
341 │105b. How likely is it that drivers who have had too    Almost      │      32%│
342 │much to drink to drive safely will A. Get stopped by    certain     │         │
343 │the police?                                             Somewhat    │      40%│
344 │                                                        likely      │         │
345 │                                                        Somewhat    │      19%│
346 │                                                        unlikely    │         │
347 │                                                        Very        │       9%│
348 │                                                        unlikely    │         │
349 ╰────────────────────────────────────────────────────────────────────┴─────────╯
350 ])
351 AT_CLEANUP
352
353 AT_SETUP([CTABLES simple nesting])
354 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
355 AT_DATA([ctables.sps],
356 [[GET 'nhtsa.sav'.
357 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
358   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
359 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
360   /CATEGORIES VARIABLES=qns3a TOTAL=YES
361   /CLABELS ROW=OPPOSITE.
362 ]])
363 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
364                                   Custom Tables
365 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
366 │                                                                 │     │ Table│
367 │                                                                 │Count│   %  │
368 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
369 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
370 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
371 │drive safely will A. Get stopped by                        Total │  700│   10%│
372 │the police?                           ╶──────────────────────────┼─────┼──────┤
373 │                                       Very       S3a.     Male  │  660│   10%│
374 │                                       likely     GENDER:  Female│  842│   12%│
375 │                                                           Total │ 1502│   22%│
376 │                                      ╶──────────────────────────┼─────┼──────┤
377 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
378 │                                       likely     GENDER:  Female│ 1589│   23%│
379 │                                                           Total │ 2763│   40%│
380 │                                      ╶──────────────────────────┼─────┼──────┤
381 │                                       Somewhat   S3a.     Male  │  640│    9%│
382 │                                       unlikely   GENDER:  Female│  667│   10%│
383 │                                                           Total │ 1307│   19%│
384 │                                      ╶──────────────────────────┼─────┼──────┤
385 │                                       Very       S3a.     Male  │  311│    5%│
386 │                                       unlikely   GENDER:  Female│  298│    4%│
387 │                                                           Total │  609│    9%│
388 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
389 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
390 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
391 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
392 │                                      ╶──────────────────────────┼─────┼──────┤
393 │                                       Very       S3a.     Male  │ 1104│   16%│
394 │                                       likely     GENDER:  Female│ 1715│   25%│
395 │                                                           Total │ 2819│   41%│
396 │                                      ╶──────────────────────────┼─────┼──────┤
397 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
398 │                                       likely     GENDER:  Female│ 1214│   18%│
399 │                                                           Total │ 2417│   35%│
400 │                                      ╶──────────────────────────┼─────┼──────┤
401 │                                       Somewhat   S3a.     Male  │  262│    4%│
402 │                                       unlikely   GENDER:  Female│  168│    2%│
403 │                                                           Total │  430│    6%│
404 │                                      ╶──────────────────────────┼─────┼──────┤
405 │                                       Very       S3a.     Male  │   81│    1%│
406 │                                       unlikely   GENDER:  Female│   59│    1%│
407 │                                                           Total │  140│    2%│
408 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
409 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
410 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
411 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
412 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
413 │                                       Very       S3a.     Male  │  988│   14%│
414 │                                       likely     GENDER:  Female│ 1049│   15%│
415 │                                                           Total │ 2037│   30%│
416 │                                      ╶──────────────────────────┼─────┼──────┤
417 │                                       Somewhat   S3a.     Male  │  822│   12%│
418 │                                       likely     GENDER:  Female│ 1210│   18%│
419 │                                                           Total │ 2032│   30%│
420 │                                      ╶──────────────────────────┼─────┼──────┤
421 │                                       Somewhat   S3a.     Male  │  446│    7%│
422 │                                       unlikely   GENDER:  Female│  548│    8%│
423 │                                                           Total │  994│   15%│
424 │                                      ╶──────────────────────────┼─────┼──────┤
425 │                                       Very       S3a.     Male  │  268│    4%│
426 │                                       unlikely   GENDER:  Female│  354│    5%│
427 │                                                           Total │  622│    9%│
428 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
429 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
430 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
431 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
432 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
433 │                                       Very       S3a.     Male  │  805│   12%│
434 │                                       likely     GENDER:  Female│ 1029│   15%│
435 │                                                           Total │ 1834│   27%│
436 │                                      ╶──────────────────────────┼─────┼──────┤
437 │                                       Somewhat   S3a.     Male  │  975│   14%│
438 │                                       likely     GENDER:  Female│ 1332│   19%│
439 │                                                           Total │ 2307│   34%│
440 │                                      ╶──────────────────────────┼─────┼──────┤
441 │                                       Somewhat   S3a.     Male  │  535│    8%│
442 │                                       unlikely   GENDER:  Female│  560│    8%│
443 │                                                           Total │ 1095│   16%│
444 │                                      ╶──────────────────────────┼─────┼──────┤
445 │                                       Very       S3a.     Male  │  270│    4%│
446 │                                       unlikely   GENDER:  Female│  279│    4%│
447 │                                                           Total │  549│    8%│
448 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
449
450                                   Custom Tables
451 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
452 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
453 │                                 │ certain│likely│  likely │ unlikely│unlikely│
454 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
455 │                                 │        │ Table│         │         │        │
456 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
457 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
458 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
459 │GENDER:        is it that drivers│        │      │         │         │        │
460 │               who have had too  │        │      │         │         │        │
461 │               much to drink to  │        │      │         │         │        │
462 │               drive safely will │        │      │         │         │        │
463 │               A. Get stopped by │        │      │         │         │        │
464 │               the police?       │        │      │         │         │        │
465 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
466 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
467 │               is it that drivers│        │      │         │         │        │
468 │               who have had too  │        │      │         │         │        │
469 │               much to drink to  │        │      │         │         │        │
470 │               drive safely will │        │      │         │         │        │
471 │               A. Get stopped by │        │      │         │         │        │
472 │               the police?       │        │      │         │         │        │
473 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
474 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
475 │               is it that drivers│        │      │         │         │        │
476 │               who have had too  │        │      │         │         │        │
477 │               much to drink to  │        │      │         │         │        │
478 │               drive safely will │        │      │         │         │        │
479 │               A. Get stopped by │        │      │         │         │        │
480 │               the police?       │        │      │         │         │        │
481 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
482 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
483 │GENDER:        is it that drivers│        │      │         │         │        │
484 │               who have had too  │        │      │         │         │        │
485 │               much to drink to  │        │      │         │         │        │
486 │               drive safely will │        │      │         │         │        │
487 │               B. Have an        │        │      │         │         │        │
488 │               accident?         │        │      │         │         │        │
489 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
490 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
491 │               is it that drivers│        │      │         │         │        │
492 │               who have had too  │        │      │         │         │        │
493 │               much to drink to  │        │      │         │         │        │
494 │               drive safely will │        │      │         │         │        │
495 │               B. Have an        │        │      │         │         │        │
496 │               accident?         │        │      │         │         │        │
497 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
498 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
499 │               is it that drivers│        │      │         │         │        │
500 │               who have had too  │        │      │         │         │        │
501 │               much to drink to  │        │      │         │         │        │
502 │               drive safely will │        │      │         │         │        │
503 │               B. Have an        │        │      │         │         │        │
504 │               accident?         │        │      │         │         │        │
505 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
506 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
507 │GENDER:        is it that drivers│        │      │         │         │        │
508 │               who have had too  │        │      │         │         │        │
509 │               much to drink to  │        │      │         │         │        │
510 │               drive safely will │        │      │         │         │        │
511 │               C. Be convicted   │        │      │         │         │        │
512 │               for drunk driving?│        │      │         │         │        │
513 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
514 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
515 │               is it that drivers│        │      │         │         │        │
516 │               who have had too  │        │      │         │         │        │
517 │               much to drink to  │        │      │         │         │        │
518 │               drive safely will │        │      │         │         │        │
519 │               C. Be convicted   │        │      │         │         │        │
520 │               for drunk driving?│        │      │         │         │        │
521 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
522 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
523 │               is it that drivers│        │      │         │         │        │
524 │               who have had too  │        │      │         │         │        │
525 │               much to drink to  │        │      │         │         │        │
526 │               drive safely will │        │      │         │         │        │
527 │               C. Be convicted   │        │      │         │         │        │
528 │               for drunk driving?│        │      │         │         │        │
529 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
530 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
531 │GENDER:        is it that drivers│        │      │         │         │        │
532 │               who have had too  │        │      │         │         │        │
533 │               much to drink to  │        │      │         │         │        │
534 │               drive safely will │        │      │         │         │        │
535 │               D. Be arrested for│        │      │         │         │        │
536 │               drunk driving?    │        │      │         │         │        │
537 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
538 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
539 │               is it that drivers│        │      │         │         │        │
540 │               who have had too  │        │      │         │         │        │
541 │               much to drink to  │        │      │         │         │        │
542 │               drive safely will │        │      │         │         │        │
543 │               D. Be arrested for│        │      │         │         │        │
544 │               drunk driving?    │        │      │         │         │        │
545 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
546 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
547 │               is it that drivers│        │      │         │         │        │
548 │               who have had too  │        │      │         │         │        │
549 │               much to drink to  │        │      │         │         │        │
550 │               drive safely will │        │      │         │         │        │
551 │               D. Be arrested for│        │      │         │         │        │
552 │               drunk driving?    │        │      │         │         │        │
553 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
554 ])
555 AT_CLEANUP
556
557 AT_SETUP([CTABLES nesting and scale variables])
558 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
559 AT_DATA([ctables.sps],
560 [[GET 'nhtsa.sav'.
561 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
562 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
563 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
564   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
565 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
566 ]])
567 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
568                                   Custom Tables
569 ╭─────────────────────────────────────────────────────────────────┬────────────╮
570 │                                                                 │S3a. GENDER:│
571 │                                                                 ├─────┬──────┤
572 │                                                                 │ Male│Female│
573 │                                                                 ├─────┼──────┤
574 │                                                                 │ Mean│ Mean │
575 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
576 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
577 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
578 │                                                  week           │     │      │
579 │                                                  Once a week or │   44│    54│
580 │                                                  less           │     │      │
581 │                                                  Only certain   │   34│    41│
582 │                                                  times a year   │     │      │
583 │                                                  Never          │   39│    55│
584 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
585
586                                   Custom Tables
587 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
588 │                                                         │Minimum│Maximum│Mean│
589 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
590 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
591 │What is  GENDER:         months, has there been a        │       │       │    │
592 │your                     time when you felt you          │       │       │    │
593 │age?                     should cut down on your      No │     16│     86│  46│
594 │                         drinking?                       │       │       │    │
595 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
596 │                  Female 26. During the last 12       Yes│     16│     86│  43│
597 │                         months, has there been a        │       │       │    │
598 │                         time when you felt you          │       │       │    │
599 │                         should cut down on your      No │     16│     86│  48│
600 │                         drinking?                       │       │       │    │
601 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
602 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
603 │What is  GENDER:         months, has there been a        │       │       │    │
604 │your                     time when people criticized  No │     16│     86│  46│
605 │age?                     your drinking?                  │       │       │    │
606 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
607 │                  Female 27. During the last 12       Yes│     17│     69│  37│
608 │                         months, has there been a        │       │       │    │
609 │                         time when people criticized  No │     16│     86│  48│
610 │                         your drinking?                  │       │       │    │
611 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
612
613                                   Custom Tables
614 ╭─────────────────────────────┬────────────────────────────────────────────────╮
615 │                             │S1. Including yourself, how many members of this│
616 │                             │         household are age 16 or older?         │
617 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
618 │                             │      │      │      │      │      │      │ 6 or │
619 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
620 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
621 │                             │Column│Column│Column│Column│Column│Column│Column│
622 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
623 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
624 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
625 │SAMPLE      How      certain │      │      │      │      │      │      │      │
626 │SOURCE:     likely           │      │      │      │      │      │      │      │
627 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
628 │            that     likely  │      │      │      │      │      │      │      │
629 │            drivers          │      │      │      │      │      │      │      │
630 │            who have         │      │      │      │      │      │      │      │
631 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
632 │            much to  likely  │      │      │      │      │      │      │      │
633 │            drink to         │      │      │      │      │      │      │      │
634 │            drive            │      │      │      │      │      │      │      │
635 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
636 │            will A.  unlikely│      │      │      │      │      │      │      │
637 │            Get              │      │      │      │      │      │      │      │
638 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
639 │            by the   unlikely│      │      │      │      │      │      │      │
640 │            police?          │      │      │      │      │      │      │      │
641 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
642
643                                   Custom Tables
644 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
645 │                                                              │    │    Std   │
646 │                                                              │Mean│ Deviation│
647 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
648 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
649 │group           typical month did you have one or more        │    │          │
650 │                alcoholic beverages to drink?                 │    │          │
651 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
652 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
653 │                typical month did you have one or more        │    │          │
654 │                alcoholic beverages to drink?                 │    │          │
655 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
656 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
657 │                typical month did you have one or more        │    │          │
658 │                alcoholic beverages to drink?                 │    │          │
659 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
660 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
661 │                typical month did you have one or more        │    │          │
662 │                alcoholic beverages to drink?                 │    │          │
663 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
664 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
665 │                typical month did you have one or more        │    │          │
666 │                alcoholic beverages to drink?                 │    │          │
667 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
668 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
669 │       older    typical month did you have one or more        │    │          │
670 │                alcoholic beverages to drink?                 │    │          │
671 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
672 ])
673 AT_CLEANUP
674
675
676 AT_SETUP([CTABLES SLABELS])
677 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
678 AT_DATA([ctables.sps],
679 [[GET 'nhtsa.sav'.
680 CTABLES /TABLE qn1 [COUNT COLPCT].
681 CTABLES /TABLE qn1 [COUNT COLPCT]
682     /SLABELS POSITION=ROW.
683 CTABLES /TABLE qn1 [COUNT COLPCT]
684     /SLABELS POSITION=ROW VISIBLE=NO.
685 ]])
686 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
687                                   Custom Tables
688 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
689 │                                                                │     │ Column│
690 │                                                                │Count│   %   │
691 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
692 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
693 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
694 │                                             Once a week or less│  361│   5.2%│
695 │                                             Only certain times │  130│   1.9%│
696 │                                             a year             │     │       │
697 │                                             Never              │  540│   7.7%│
698 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
699
700                                   Custom Tables
701 ╭────────────────────────────────────────────────────────────────────────┬─────╮
702 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
703 │other motor vehicle?                                             Column │66.9%│
704 │                                                                 %      │     │
705 │                                            ╶───────────────────────────┼─────┤
706 │                                             Several days a week Count  │ 1274│
707 │                                                                 Column │18.3%│
708 │                                                                 %      │     │
709 │                                            ╶───────────────────────────┼─────┤
710 │                                             Once a week or less Count  │  361│
711 │                                                                 Column │ 5.2%│
712 │                                                                 %      │     │
713 │                                            ╶───────────────────────────┼─────┤
714 │                                             Only certain times  Count  │  130│
715 │                                             a year              Column │ 1.9%│
716 │                                                                 %      │     │
717 │                                            ╶───────────────────────────┼─────┤
718 │                                             Never               Count  │  540│
719 │                                                                 Column │ 7.7%│
720 │                                                                 %      │     │
721 ╰────────────────────────────────────────────────────────────────────────┴─────╯
722
723                                   Custom Tables
724 ╭────────────────────────────────────────────────────────────────────────┬─────╮
725 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
726 │motor vehicle?                                                          │66.9%│
727 │                                                   Several days a week  │ 1274│
728 │                                                                        │18.3%│
729 │                                                   Once a week or less  │  361│
730 │                                                                        │ 5.2%│
731 │                                                   Only certain times a │  130│
732 │                                                   year                 │ 1.9%│
733 │                                                   Never                │  540│
734 │                                                                        │ 7.7%│
735 ╰────────────────────────────────────────────────────────────────────────┴─────╯
736 ])
737 AT_CLEANUP
738
739 AT_SETUP([CTABLES simple totals])
740 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
741 AT_DATA([ctables.sps],
742 [[GET 'nhtsa.sav'.
743 CTABLES /TABLE=qn17
744     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
745 DESCRIPTIVES qn18/STATISTICS=MEAN.
746 CTABLES /TABLE=region > qn18 [MEAN, COUNT, VALIDN, TOTALN]
747     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
748 ]])
749 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
750                                   Custom Tables
751 ╭────────────────────────────────────────────────────────────────────────┬─────╮
752 │                                                                        │Count│
753 ├────────────────────────────────────────────────────────────────────────┼─────┤
754 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
755 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
756 │                                                      Light beer        │  620│
757 │                                                      Wine              │ 1418│
758 │                                                      Wine coolers      │  137│
759 │                                                      Hard liquor or    │  888│
760 │                                                      mixed drinks      │     │
761 │                                                      Flavored malt     │   83│
762 │                                                      drinks            │     │
763 │                                                      Number responding │ 4221│
764 ╰────────────────────────────────────────────────────────────────────────┴─────╯
765
766                              Descriptive Statistics
767 ╭────────────────────────────────────────────────────────────────────┬────┬────╮
768 │                                                                    │  N │Mean│
769 ├────────────────────────────────────────────────────────────────────┼────┼────┤
770 │18. When you drink ANSWERFROM(QN17R1), about how many               │4218│4.62│
771 │ANSWERFROM(QN17R2) do you usually drink per sitting?                │    │    │
772 │Valid N (listwise)                                                  │6999│    │
773 │Missing N (listwise)                                                │2781│    │
774 ╰────────────────────────────────────────────────────────────────────┴────┴────╯
775
776                                   Custom Tables
777 ╭──────────────────────────────────────────────────────┬────┬─────┬──────┬─────╮
778 │                                                      │    │     │ Valid│Total│
779 │                                                      │Mean│Count│   N  │  N  │
780 ├──────────────────────────────────────────────────────┼────┼─────┼──────┼─────┤
781 │Region NE       18. When you drink ANSWERFROM(QN17R1),│4.36│ 1409│   949│ 1409│
782 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
783 │                you usually drink per sitting?        │    │     │      │     │
784 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
785 │       MW       18. When you drink ANSWERFROM(QN17R1),│4.67│ 1654│  1027│ 1654│
786 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
787 │                you usually drink per sitting?        │    │     │      │     │
788 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
789 │       S        18. When you drink ANSWERFROM(QN17R1),│4.71│ 2390│  1287│ 2390│
790 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
791 │                you usually drink per sitting?        │    │     │      │     │
792 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
793 │       W        18. When you drink ANSWERFROM(QN17R1),│4.69│ 1546│   955│ 1546│
794 │                about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
795 │                you usually drink per sitting?        │    │     │      │     │
796 │      ╶───────────────────────────────────────────────┼────┼─────┼──────┼─────┤
797 │       All      18. When you drink ANSWERFROM(QN17R1),│4.62│ 6999│  4218│ 6999│
798 │       regions  about how many ANSWERFROM(QN17R2) do  │    │     │      │     │
799 │                you usually drink per sitting?        │    │     │      │     │
800 ╰──────────────────────────────────────────────────────┴────┴─────┴──────┴─────╯
801 ])
802 AT_CLEANUP
803
804 AT_SETUP([CTABLES subtotals])
805 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
806 AT_DATA([ctables.sps],
807 [[GET 'nhtsa.sav'.
808 CTABLES /TABLE=qn105ba BY qns1
809     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
810 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
811     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
812 CTABLES /TABLE=qn105ba BY qns1
813     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
814     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
815 ]])
816 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
817                                                       Custom Tables
818 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
819 │                                                         │ S1. Including yourself, how many members of this household │
820 │                                                         │                    are age 16 or older?                    │
821 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
822 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
823 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
824 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
825 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
826 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
827 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
828 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
829 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
830 │                                              likely     │       │       │         │       │        │      │          │
831 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
832 │                                              unlikely   │       │       │         │       │        │      │          │
833 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
834 │                                              unlikely   │       │       │         │       │        │      │          │
835 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
836
837                                                       Custom Tables
838 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
839 │                                                        │  S1. Including yourself, how many members of this household │
840 │                                                        │                     are age 16 or older?                    │
841 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
842 │                                                        │        │        │        │        │       │        │  6 or  │
843 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
844 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
845 │                                                        │        │        │        │        │ Column│        │        │
846 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
847 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
848 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
849 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
850 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
851 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
852 │                                             likely     │        │        │        │        │       │        │        │
853 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
854 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
855 │                                             unlikely   │        │        │        │        │       │        │        │
856 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
857 │                                             unlikely   │        │        │        │        │       │        │        │
858 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
859 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
860
861                                                       Custom Tables
862 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
863 │                                                         │ S1. Including yourself, how many members of this household │
864 │                                                         │                    are age 16 or older?                    │
865 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
866 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
867 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
868 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
869 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
870 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
871 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
872 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
873 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
874 │                                              likely     │       │       │         │       │        │      │          │
875 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
876 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
877 │                                              unlikely   │       │       │         │       │        │      │          │
878 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
879 │                                              unlikely   │       │       │         │       │        │      │          │
880 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
881 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
882 ])
883 AT_CLEANUP
884
885 AT_SETUP([CTABLES PCOMPUTE])
886 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
887 AT_DATA([ctables.sps],
888 [[GET 'nhtsa.sav'.
889 CTABLES
890     /PCOMPUTE &x=EXPR([3] + [4])
891     /PCOMPUTE &y=EXPR([4] + [5])
892     /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES FORMAT=COUNT F8.2
893     /PPROPERTIES &y LABEL='4+5'
894     /TABLE=qn105ba BY qns1
895     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
896 ]])
897 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
898                                                       Custom Tables
899 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
900 │                                                        │  S1. Including yourself, how many members of this household │
901 │                                                        │                     are age 16 or older?                    │
902 │                                                        ├───────┬───────┬──────────┬───────┬────────┬──────┬──────────┤
903 │                                                        │   1   │   2   │ Subtotal │   5   │   3+4  │  4+5 │ Subtotal │
904 │                                                        ├───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
905 │                                                        │ Count │ Count │   Count  │ Count │  Count │ Count│   Count  │
906 ├────────────────────────────────────────────────────────┼───────┼───────┼──────────┼───────┼────────┼──────┼──────────┤
907 │105b. How likely is it that drivers who have Almost     │    147│    246│       393│     11│   81.00│    30│        92│
908 │had too much to drink to drive safely will   certain    │       │       │          │       │        │      │          │
909 │A. Get stopped by the police?                Very likely│    384│    552│       936│     14│  171.00│    65│       185│
910 │                                             Somewhat   │    590│   1249│      1839│     20│  265.00│    92│       285│
911 │                                             likely     │       │       │          │       │        │      │          │
912 │                                             Somewhat   │    278│    647│       925│      6│  116.00│    38│       122│
913 │                                             unlikely   │       │       │          │       │        │      │          │
914 │                                             Very       │    141│    290│       431│      4│   59.00│    22│        63│
915 │                                             unlikely   │       │       │          │       │        │      │          │
916 ╰────────────────────────────────────────────────────────┴───────┴───────┴──────────┴───────┴────────┴──────┴──────────╯
917 ])
918 AT_CLEANUP
919
920 AT_SETUP([CTABLES CLABELS])
921 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
922 AT_DATA([ctables.sps],
923 [[GET 'nhtsa.sav'.
924 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
925 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
926 ]])
927 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
928                                                       Custom Tables
929 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
930 │       │                                                 S3a. GENDER:                                                 │
931 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
932 │       │                         Male                         │                         Female                        │
933 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
934 │       │  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 │
935 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
936 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
937 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
938 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
939 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
940 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
941 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
942
943                 Custom Tables
944 ╭──────────────────────────────┬────────────╮
945 │                              │S3a. GENDER:│
946 │                              ├────────────┤
947 │                              │    Count   │
948 ├──────────────────────────────┼────────────┤
949 │Age group 15 or younger Male  │           0│
950 │                        Female│           0│
951 │         ╶────────────────────┼────────────┤
952 │          16 to 25      Male  │         594│
953 │                        Female│         505│
954 │         ╶────────────────────┼────────────┤
955 │          26 to 35      Male  │         476│
956 │                        Female│         491│
957 │         ╶────────────────────┼────────────┤
958 │          36 to 45      Male  │         489│
959 │                        Female│         548│
960 │         ╶────────────────────┼────────────┤
961 │          46 to 55      Male  │         526│
962 │                        Female│         649│
963 │         ╶────────────────────┼────────────┤
964 │          56 to 65      Male  │         516│
965 │                        Female│         731│
966 │         ╶────────────────────┼────────────┤
967 │          66 or older   Male  │         531│
968 │                        Female│         943│
969 ╰──────────────────────────────┴────────────╯
970 ])
971 AT_CLEANUP
972
973 AT_SETUP([CTABLES missing values])
974 AT_DATA([ctables.sps],
975 [[DATA LIST LIST NOTABLE/x y.
976 BEGIN DATA.
977 1 1
978 1 2
979 1 3
980 1 4
981 1 5
982 1 .
983 2 1
984 2 2
985 2 3
986 2 4
987 2 5
988 2 .
989 3 1
990 3 2
991 3 3
992 3 4
993 3 5
994 3 .
995 4 1
996 4 2
997 4 3
998 4 4
999 4 5
1000 4 .
1001 5 1
1002 5 2
1003 5 3
1004 5 4
1005 5 5
1006 5 .
1007 . 1
1008 . 2
1009 . 3
1010 . 4
1011 . 5
1012 . .
1013 END DATA.
1014 MISSING VALUES x (1, 2) y (2, 3).
1015 VARIABLE LEVEL ALL (NOMINAL).
1016
1017 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1018     /CATEGORIES VARIABLES=ALL TOTAL=YES.
1019 CTABLES /TABLE x[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, VALIDN, TOTALN]]
1020     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE.
1021 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1022     /CATEGORIES VARIABLES=ALL TOTAL=YES
1023     /SLABELS POSITION=ROW.
1024 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1025     /CATEGORIES VARIABLES=ALL TOTAL=YES MISSING=INCLUDE
1026     /SLABELS POSITION=ROW.
1027 CTABLES /TABLE x BY y[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, TOTALS[COUNT, COLPCT, COLPCT.VALIDN, COLPCT.TOTALN, ROWPCT, ROWPCT.VALIDN, ROWPCT.TOTALN, VALIDN, TOTALN]]
1028     /CATEGORIES VARIABLES=x [1, 2, 3, 4] TOTAL=YES 
1029     /CATEGORIES VARIABLES=y [1, 3, 4, 5] TOTAL=YES 
1030     /SLABELS POSITION=ROW.
1031 ]])
1032 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1033                                Custom Tables
1034 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1035 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1036 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1037 │x 3.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1038 │  4.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1039 │  5.00 │    6│   33.3%│           33.3%│           16.7%│       │       │
1040 │  Total│   18│  100.0%│          100.0%│          100.0%│     18│     36│
1041 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1042 dnl Note that Column Total N % doesn't add up to 100 because missing
1043 dnl values are included in the total but not shown as a category and this
1044 dnl is expected behavior.
1045
1046                                Custom Tables
1047 ╭───────┬─────┬────────┬────────────────┬────────────────┬───────┬───────╮
1048 │       │Count│Column %│Column Valid N %│Column Total N %│Valid N│Total N│
1049 ├───────┼─────┼────────┼────────────────┼────────────────┼───────┼───────┤
1050 │x 1.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1051 │  2.00 │    6│   20.0%│             .0%│           16.7%│       │       │
1052 │  3.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1053 │  4.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1054 │  5.00 │    6│   20.0%│           33.3%│           16.7%│       │       │
1055 │  Total│   30│  100.0%│          100.0%│          100.0%│     18│     36│
1056 ╰───────┴─────┴────────┴────────────────┴────────────────┴───────┴───────╯
1057 dnl Note that Column Total N % doesn't add up to 100 because system-missing
1058 dnl values are included in the total but not shown as a category and this
1059 dnl is expected behavior.
1060
1061                      Custom Tables
1062 ╭────────────────────────┬───────────────────────────╮
1063 │                        │             y             │
1064 │                        ├──────┬──────┬──────┬──────┤
1065 │                        │ 1.00 │ 4.00 │ 5.00 │ Total│
1066 ├────────────────────────┼──────┼──────┼──────┼──────┤
1067 │x 3.00  Count           │     1│     1│     1│     3│
1068 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1069 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1070 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1071 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1072 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1073 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1074 │        Valid N         │      │      │      │     3│
1075 │        Total N         │      │      │      │     6│
1076 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1077 │  4.00  Count           │     1│     1│     1│     3│
1078 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1079 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1080 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1081 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1082 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1083 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1084 │        Valid N         │      │      │      │     3│
1085 │        Total N         │      │      │      │     6│
1086 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1087 │  5.00  Count           │     1│     1│     1│     3│
1088 │        Column %        │ 33.3%│ 33.3%│ 33.3%│     .│
1089 │        Column Valid N %│ 33.3%│ 33.3%│ 33.3%│     .│
1090 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│     .│
1091 │        Row %           │ 33.3%│ 33.3%│ 33.3%│100.0%│
1092 │        Row Valid N %   │ 33.3%│ 33.3%│ 33.3%│100.0%│
1093 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│100.0%│
1094 │        Valid N         │      │      │      │     3│
1095 │        Total N         │      │      │      │     6│
1096 │ ╶──────────────────────┼──────┼──────┼──────┼──────┤
1097 │  Total Count           │     3│     3│     3│     9│
1098 │        Column %        │100.0%│100.0%│100.0%│     .│
1099 │        Column Valid N %│100.0%│100.0%│100.0%│     .│
1100 │        Column Total N %│100.0%│100.0%│100.0%│     .│
1101 │        Row %           │     .│     .│     .│     .│
1102 │        Row Valid N %   │     .│     .│     .│     .│
1103 │        Row Total N %   │     .│     .│     .│     .│
1104 │        Valid N         │     3│     3│     3│     9│
1105 │        Total N         │     6│     6│     6│    36│
1106 ╰────────────────────────┴──────┴──────┴──────┴──────╯
1107
1108                             Custom Tables
1109 ╭────────────────────────┬─────────────────────────────────────────╮
1110 │                        │                    y                    │
1111 │                        ├──────┬──────┬──────┬──────┬──────┬──────┤
1112 │                        │ 1.00 │ 2.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1113 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1114 │x 1.00  Count           │     1│     1│     1│     1│     1│     5│
1115 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1116 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
1117 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1118 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1119 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1120 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1121 │        Valid N         │      │      │      │      │      │     0│
1122 │        Total N         │      │      │      │      │      │     6│
1123 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1124 │  2.00  Count           │     1│     1│     1│     1│     1│     5│
1125 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1126 │        Column Valid N %│   .0%│     .│     .│   .0%│   .0%│     .│
1127 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1128 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1129 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1130 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1131 │        Valid N         │      │      │      │      │      │     0│
1132 │        Total N         │      │      │      │      │      │     6│
1133 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1134 │  3.00  Count           │     1│     1│     1│     1│     1│     5│
1135 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1136 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1137 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1138 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1139 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1140 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1141 │        Valid N         │      │      │      │      │      │     3│
1142 │        Total N         │      │      │      │      │      │     6│
1143 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1144 │  4.00  Count           │     1│     1│     1│     1│     1│     5│
1145 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1146 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1147 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1148 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1149 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1150 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1151 │        Valid N         │      │      │      │      │      │     3│
1152 │        Total N         │      │      │      │      │      │     6│
1153 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1154 │  5.00  Count           │     1│     1│     1│     1│     1│     5│
1155 │        Column %        │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1156 │        Column Valid N %│ 33.3%│     .│     .│ 33.3%│ 33.3%│     .│
1157 │        Column Total N %│ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│     .│
1158 │        Row %           │ 20.0%│ 20.0%│ 20.0%│ 20.0%│ 20.0%│100.0%│
1159 │        Row Valid N %   │ 33.3%│   .0%│   .0%│ 33.3%│ 33.3%│100.0%│
1160 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1161 │        Valid N         │      │      │      │      │      │     3│
1162 │        Total N         │      │      │      │      │      │     6│
1163 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┤
1164 │  Total Count           │     5│     5│     5│     5│     5│    25│
1165 │        Column %        │100.0%│100.0%│100.0%│100.0%│100.0%│     .│
1166 │        Column Valid N %│100.0%│     .│     .│100.0%│100.0%│     .│
1167 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│100.0%│     .│
1168 │        Row %           │     .│     .│     .│     .│     .│     .│
1169 │        Row Valid N %   │     .│     .│     .│     .│     .│     .│
1170 │        Row Total N %   │     .│     .│     .│     .│     .│     .│
1171 │        Valid N         │     3│     0│     0│     3│     3│     9│
1172 │        Total N         │     6│     6│     6│     6│     6│    36│
1173 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────╯
1174
1175                         Custom Tables
1176 ╭────────────────────────┬──────────────────────────────────╮
1177 │                        │                 y                │
1178 │                        ├──────┬──────┬──────┬──────┬──────┤
1179 │                        │ 1.00 │ 3.00 │ 4.00 │ 5.00 │ Total│
1180 ├────────────────────────┼──────┼──────┼──────┼──────┼──────┤
1181 │x 1.00  Count           │     1│     1│     1│     1│     4│
1182 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1183 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
1184 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1185 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1186 │        Row Valid N %   │     .│     .│     .│     .│     .│
1187 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1188 │        Valid N         │      │      │      │      │     0│
1189 │        Total N         │      │      │      │      │     6│
1190 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1191 │  2.00  Count           │     1│     1│     1│     1│     4│
1192 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1193 │        Column Valid N %│   .0%│     .│   .0%│   .0%│     .│
1194 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1195 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1196 │        Row Valid N %   │     .│     .│     .│     .│     .│
1197 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1198 │        Valid N         │      │      │      │      │     0│
1199 │        Total N         │      │      │      │      │     6│
1200 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1201 │  3.00  Count           │     1│     1│     1│     1│     4│
1202 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1203 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
1204 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1205 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1206 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
1207 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1208 │        Valid N         │      │      │      │      │     3│
1209 │        Total N         │      │      │      │      │     6│
1210 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1211 │  4.00  Count           │     1│     1│     1│     1│     4│
1212 │        Column %        │ 25.0%│ 25.0%│ 25.0%│ 25.0%│     .│
1213 │        Column Valid N %│ 50.0%│     .│ 50.0%│ 50.0%│     .│
1214 │        Column Total N %│ 20.0%│ 20.0%│ 20.0%│ 20.0%│     .│
1215 │        Row %           │ 25.0%│ 25.0%│ 25.0%│ 25.0%│100.0%│
1216 │        Row Valid N %   │ 33.3%│   .0%│ 33.3%│ 33.3%│100.0%│
1217 │        Row Total N %   │ 16.7%│ 16.7%│ 16.7%│ 16.7%│100.0%│
1218 │        Valid N         │      │      │      │      │     3│
1219 │        Total N         │      │      │      │      │     6│
1220 │ ╶──────────────────────┼──────┼──────┼──────┼──────┼──────┤
1221 │  Total Count           │     4│     4│     4│     4│    16│
1222 │        Column %        │100.0%│100.0%│100.0%│100.0%│     .│
1223 │        Column Valid N %│100.0%│     .│100.0%│100.0%│     .│
1224 │        Column Total N %│100.0%│100.0%│100.0%│100.0%│     .│
1225 │        Row %           │     .│     .│     .│     .│     .│
1226 │        Row Valid N %   │     .│     .│     .│     .│     .│
1227 │        Row Total N %   │     .│     .│     .│     .│     .│
1228 │        Valid N         │     2│     0│     2│     2│     6│
1229 │        Total N         │     5│     5│     5│     5│    30│
1230 ╰────────────────────────┴──────┴──────┴──────┴──────┴──────╯
1231 ])
1232 AT_CLEANUP
1233
1234 AT_SETUP([CTABLES SMISSING=LISTWISE])
1235 AT_KEYWORDS([SMISSING LISTWISE])
1236 AT_DATA([ctables.sps],
1237 [[DATA LIST LIST NOTABLE/x y z.
1238 BEGIN DATA.
1239 1  . 40
1240 1 10 50
1241 1 20 60
1242 1  .  .
1243 1 30  .
1244 END DATA.
1245 VARIABLE LEVEL x (NOMINAL).
1246
1247 CTABLES /TABLE (y + z) > x.
1248 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
1249
1250 * The following doesn't come out as listwise because the tables are
1251 separate, not linked by an > operator.
1252 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
1253 ]])
1254 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
1255   Custom Tables
1256 ╭────────┬─────╮
1257 │        │ Mean│
1258 ├────────┼─────┤
1259 │y x 1.00│20.00│
1260 ├────────┼─────┤
1261 │z x 1.00│50.00│
1262 ╰────────┴─────╯
1263
1264   Custom Tables
1265 ╭────────┬─────╮
1266 │        │ Mean│
1267 ├────────┼─────┤
1268 │y x 1.00│15.00│
1269 ├────────┼─────┤
1270 │z x 1.00│55.00│
1271 ╰────────┴─────╯
1272
1273   Custom Tables
1274 ╭────────┬─────╮
1275 │        │ Mean│
1276 ├────────┼─────┤
1277 │y x 1.00│20.00│
1278 ├────────┼─────┤
1279 │z x 1.00│50.00│
1280 ╰────────┴─────╯
1281 ])
1282 AT_CLEANUP