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