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