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