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