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