docs
[pspp] / tests / language / stats / ctables.at
1 AT_BANNER([CTABLES])
2
3 dnl TODO:
4 dnl
5 dnl - Parsing (positive and negative)
6 dnl - String variables and values
7 dnl - Date/time variables and values
8 dnl - Multiple-response sets.
9 dnl   * MRSETS subcommand.
10 dnl - SPLIT FILE with SEPARATE splits
11 dnl - Definition of columns/rows when labels are rotated from one axis to another.
12 dnl - Preprocessing to distinguish categorical from scale.
13 dnl - )CILEVEL in summary specifications
14 dnl - Summary functions:
15 dnl   * Unimplemented ones.
16 dnl   * U-prefix for unweighted summaries.
17 dnl   * .LCL and .UCL suffixes.
18 dnl   * .SE suffixes.
19 dnl   * Separate summary functions for totals and subtotals.
20 dnl - Special formats for summary functions: NEGPAREN, NEQUAL, PAREN, PCTPAREN.
21 dnl - Testing details of missing value handling in summaries.
22 dnl - test CLABELS ROWLABELS=LAYER.
23 dnl - CATEGORIES:
24 dnl   * Special case for explicit category specifications and multiple dichotomy sets
25 dnl   * THRU
26 dnl   * OTHERNM
27 dnl   * String values
28 dnl   * Date values
29 dnl   * Data-dependent sorting.
30 dnl - TITLES: )DATE, )TIME, )TABLE.
31 dnl - SIGTEST
32 dnl - COMPARETEST
33 dnl - FORMAT:
34 dnl   * MINCOLWIDTH, MAXCOLWIDTH, UNITS.
35 dnl   * EMPTY.
36 dnl   * MISSING.
37 dnl - VLABELS.
38 dnl - SMISSING (see documentation).
39 dnl - Test WEIGHT and adjustment weights.
40 dnl - Test PCOMPUTE and PPROPERTIES.
41 dnl - PCOMPUTE:
42 dnl   * multi-dimensional
43 dnl   * MISSING, OTHERNM
44 dnl   * strings
45 dnl - HIDESMALLCOUNTS.
46 dnl - Are string ranges a thing?
47 dnl
48 dnl Bug:
49 dnl     CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a.
50 dnl produces a bad median:
51 dnl                     Custom Tables
52 dnl +--------------------------+-----------------------+
53 dnl |                          |      S3a. GENDER:     |
54 dnl |                          +-----------+-----------+
55 dnl |                          |    Male   |   Female  |
56 dnl |                          +----+------+----+------+
57 dnl |                          |Mean|Median|Mean|Median|
58 dnl +--------------------------+----+------+----+------+
59 dnl |D1. AGE: What is your age?|  46|   999|  50|   999|
60 dnl +--------------------------+----+------+----+------+
61
62
63
64 # AT_SETUP([CTABLES parsing])
65 # AT_DATA([ctables.sps],
66 # [[DATA LIST LIST NOTABLE /x y z.
67 # CTABLES /TABLE=(x + y) > z.
68 # CTABLES /TABLE=(x[c] + y[c]) > z.
69 # CTABLES /TABLE=(x + y) > z[c].
70 # CTABLES /TABLE=x BY y BY z.
71 # CTABLES /TABLE=x[c] [ROWPCT.COUNT] > y[c].
72 # CTABLES /TABLE=x[c] > y[c] [ROWPCT.COUNT].
73 # ]])
74 # AT_CHECK([pspp ctables.sps])
75 # AT_CLEANUP
76
77 AT_SETUP([CTABLES one categorical variable])
78 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
79 AT_DATA([ctables.sps],
80 [[GET 'nhtsa.sav'.
81 CTABLES /TABLE qn1.
82 CTABLES /TABLE BY qn1.
83 CTABLES /TABLE BY BY qn1.
84 ]])
85 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
86                                   Custom Tables
87 ╭────────────────────────────────────────────────────────────────────────┬─────╮
88 │                                                                        │Count│
89 ├────────────────────────────────────────────────────────────────────────┼─────┤
90 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
91 │motor vehicle?                                     Several days a week  │ 1274│
92 │                                                   Once a week or less  │  361│
93 │                                                   Only certain times a │  130│
94 │                                                   year                 │     │
95 │                                                   Never                │  540│
96 ╰────────────────────────────────────────────────────────────────────────┴─────╯
97
98                                   Custom Tables
99 ╭──────────────────────────────────────────────────────────────────────────────╮
100 │        1. How often do you usually drive a car or other motor vehicle?       │
101 ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤
102 │         │  Several days a  │  Once a week or  │  Only certain times a  │     │
103 │Every day│       week       │       less       │          year          │Never│
104 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
105 │  Count  │       Count      │       Count      │          Count         │Count│
106 ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤
107 │     4667│              1274│               361│                     130│  540│
108 ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯
109
110 Custom Tables
111 Every day
112 ╭─────╮
113 │Count│
114 ├─────┤
115 │ 4667│
116 ╰─────╯
117 ])
118 AT_CLEANUP
119
120 AT_SETUP([CTABLES one scale variable])
121 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
122 AT_DATA([ctables.sps],
123 [[GET 'nhtsa.sav'.
124 CTABLES /TABLE qnd1[COUNT, MEAN, STDDEV, MINIMUM, MAXIMUM].
125 CTABLES /TABLE BY qnd1.
126 CTABLES /TABLE BY BY qnd1.
127 ]])
128 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
129                             Custom Tables
130 ╭──────────────────────────┬─────┬────┬─────────────┬───────┬───────╮
131 │                          │Count│Mean│Std Deviation│Minimum│Maximum│
132 ├──────────────────────────┼─────┼────┼─────────────┼───────┼───────┤
133 │D1. AGE: What is your age?│ 6930│  48│           19│     16│     86│
134 ╰──────────────────────────┴─────┴────┴─────────────┴───────┴───────╯
135
136         Custom Tables
137 ╭──────────────────────────╮
138 │D1. AGE: What is your age?│
139 ├──────────────────────────┤
140 │           Mean           │
141 ├──────────────────────────┤
142 │                        48│
143 ╰──────────────────────────╯
144
145 Custom Tables
146 D1. AGE: What is your age?
147 ╭────╮
148 │Mean│
149 ├────┤
150 │  48│
151 ╰────╯
152 ])
153 AT_CLEANUP
154
155 AT_SETUP([CTABLES simple stacking])
156 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
157 AT_DATA([ctables.sps],
158 [[GET 'nhtsa.sav'.
159 CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0].
160 ]])
161 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
162                                   Custom Tables
163 ╭───────────────────────────────────────────────────────────────┬──────────────╮
164 │                                                               │ S3a. GENDER: │
165 │                                                               ├──────┬───────┤
166 │                                                               │ Male │ Female│
167 │                                                               ├──────┼───────┤
168 │                                                               │Column│ Column│
169 │                                                               │   %  │   %   │
170 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
171 │105b. How likely is it that drivers who have had   Almost      │   10%│    11%│
172 │too much to drink to drive safely will A. Get      certain     │      │       │
173 │stopped by the police?                             Very likely │   21%│    22%│
174 │                                                   Somewhat    │   38%│    42%│
175 │                                                   likely      │      │       │
176 │                                                   Somewhat    │   21%│    18%│
177 │                                                   unlikely    │      │       │
178 │                                                   Very        │   10%│     8%│
179 │                                                   unlikely    │      │       │
180 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
181 │105b. How likely is it that drivers who have had   Almost      │   14%│    18%│
182 │too much to drink to drive safely will B. Have an  certain     │      │       │
183 │accident?                                          Very likely │   36%│    45%│
184 │                                                   Somewhat    │   39%│    32%│
185 │                                                   likely      │      │       │
186 │                                                   Somewhat    │    9%│     4%│
187 │                                                   unlikely    │      │       │
188 │                                                   Very        │    3%│     2%│
189 │                                                   unlikely    │      │       │
190 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
191 │105b. How likely is it that drivers who have had   Almost      │   18%│    16%│
192 │too much to drink to drive safely will C. Be       certain     │      │       │
193 │convicted for drunk driving?                       Very likely │   32%│    28%│
194 │                                                   Somewhat    │   27%│    32%│
195 │                                                   likely      │      │       │
196 │                                                   Somewhat    │   15%│    15%│
197 │                                                   unlikely    │      │       │
198 │                                                   Very        │    9%│     9%│
199 │                                                   unlikely    │      │       │
200 ├───────────────────────────────────────────────────────────────┼──────┼───────┤
201 │105b. How likely is it that drivers who have had   Almost      │   16%│    16%│
202 │too much to drink to drive safely will D. Be       certain     │      │       │
203 │arrested for drunk driving?                        Very likely │   26%│    27%│
204 │                                                   Somewhat    │   32%│    35%│
205 │                                                   likely      │      │       │
206 │                                                   Somewhat    │   17%│    15%│
207 │                                                   unlikely    │      │       │
208 │                                                   Very        │    9%│     7%│
209 │                                                   unlikely    │      │       │
210 ╰───────────────────────────────────────────────────────────────┴──────┴───────╯
211 ])
212 AT_CLEANUP
213
214 AT_SETUP([CTABLES show or hide empty categories])
215 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
216 AT_DATA([ctables.sps],
217 [[GET 'nhtsa.sav'.
218 IF (qn105ba = 2) qn105ba = 1.
219 IF (qns3a = 1) qns3a = 2.
220 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0].
221 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
222     /CATEGORIES VAR=qn105ba EMPTY=EXCLUDE.
223 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
224     /CATEGORIES VAR=qns3a EMPTY=EXCLUDE.
225 CTABLES /TABLE qn105ba BY qns3a [COLPCT PCT8.0]
226     /CATEGORIES VAR=ALL EMPTY=EXCLUDE.
227 ]])
228 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
229                                   Custom Tables
230 ╭──────────────────────────────────────────────────────────────┬───────────────╮
231 │                                                              │  S3a. GENDER: │
232 │                                                              ├───────┬───────┤
233 │                                                              │  Male │ Female│
234 │                                                              ├───────┼───────┤
235 │                                                              │ Column│ Column│
236 │                                                              │   %   │   %   │
237 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
238 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
239 │too much to drink to drive safely will A. Get      certain    │       │       │
240 │stopped by the police?                             Very likely│      .│     0%│
241 │                                                   Somewhat   │      .│    40%│
242 │                                                   likely     │       │       │
243 │                                                   Somewhat   │      .│    19%│
244 │                                                   unlikely   │       │       │
245 │                                                   Very       │      .│     9%│
246 │                                                   unlikely   │       │       │
247 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
248
249                                   Custom Tables
250 ╭──────────────────────────────────────────────────────────────┬───────────────╮
251 │                                                              │  S3a. GENDER: │
252 │                                                              ├───────┬───────┤
253 │                                                              │  Male │ Female│
254 │                                                              ├───────┼───────┤
255 │                                                              │ Column│ Column│
256 │                                                              │   %   │   %   │
257 ├──────────────────────────────────────────────────────────────┼───────┼───────┤
258 │105b. How likely is it that drivers who have had   Almost     │      .│    32%│
259 │too much to drink to drive safely will A. Get      certain    │       │       │
260 │stopped by the police?                             Somewhat   │      .│    40%│
261 │                                                   likely     │       │       │
262 │                                                   Somewhat   │      .│    19%│
263 │                                                   unlikely   │       │       │
264 │                                                   Very       │      .│     9%│
265 │                                                   unlikely   │       │       │
266 ╰──────────────────────────────────────────────────────────────┴───────┴───────╯
267
268                                   Custom Tables
269 ╭────────────────────────────────────────────────────────────────────┬─────────╮
270 │                                                                    │   S3a.  │
271 │                                                                    │ GENDER: │
272 │                                                                    ├─────────┤
273 │                                                                    │  Female │
274 │                                                                    ├─────────┤
275 │                                                                    │ Column %│
276 ├────────────────────────────────────────────────────────────────────┼─────────┤
277 │105b. How likely is it that drivers who have had too    Almost      │      32%│
278 │much to drink to drive safely will A. Get stopped by    certain     │         │
279 │the police?                                             Very likely │       0%│
280 │                                                        Somewhat    │      40%│
281 │                                                        likely      │         │
282 │                                                        Somewhat    │      19%│
283 │                                                        unlikely    │         │
284 │                                                        Very        │       9%│
285 │                                                        unlikely    │         │
286 ╰────────────────────────────────────────────────────────────────────┴─────────╯
287
288                                   Custom Tables
289 ╭────────────────────────────────────────────────────────────────────┬─────────╮
290 │                                                                    │   S3a.  │
291 │                                                                    │ GENDER: │
292 │                                                                    ├─────────┤
293 │                                                                    │  Female │
294 │                                                                    ├─────────┤
295 │                                                                    │ Column %│
296 ├────────────────────────────────────────────────────────────────────┼─────────┤
297 │105b. How likely is it that drivers who have had too    Almost      │      32%│
298 │much to drink to drive safely will A. Get stopped by    certain     │         │
299 │the police?                                             Somewhat    │      40%│
300 │                                                        likely      │         │
301 │                                                        Somewhat    │      19%│
302 │                                                        unlikely    │         │
303 │                                                        Very        │       9%│
304 │                                                        unlikely    │         │
305 ╰────────────────────────────────────────────────────────────────────┴─────────╯
306 ])
307 AT_CLEANUP
308
309 AT_SETUP([CTABLES simple nesting])
310 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
311 AT_DATA([ctables.sps],
312 [[GET 'nhtsa.sav'.
313 CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [COUNT, TABLEPCT PCT8.0]
314   /CATEGORIES VARIABLES=qns3a TOTAL=YES.
315 CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0]
316   /CATEGORIES VARIABLES=qns3a TOTAL=YES
317   /CLABELS ROW=OPPOSITE.
318 ]])
319 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
320                                   Custom Tables
321 ╭─────────────────────────────────────────────────────────────────┬─────┬──────╮
322 │                                                                 │     │ Table│
323 │                                                                 │Count│   %  │
324 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
325 │105b. How likely is it that drivers    Almost     S3a.     Male  │  297│    4%│
326 │who have had too much to drink to      certain    GENDER:  Female│  403│    6%│
327 │drive safely will A. Get stopped by                        Total │  700│   10%│
328 │the police?                           ╶──────────────────────────┼─────┼──────┤
329 │                                       Very       S3a.     Male  │  660│   10%│
330 │                                       likely     GENDER:  Female│  842│   12%│
331 │                                                           Total │ 1502│   22%│
332 │                                      ╶──────────────────────────┼─────┼──────┤
333 │                                       Somewhat   S3a.     Male  │ 1174│   17%│
334 │                                       likely     GENDER:  Female│ 1589│   23%│
335 │                                                           Total │ 2763│   40%│
336 │                                      ╶──────────────────────────┼─────┼──────┤
337 │                                       Somewhat   S3a.     Male  │  640│    9%│
338 │                                       unlikely   GENDER:  Female│  667│   10%│
339 │                                                           Total │ 1307│   19%│
340 │                                      ╶──────────────────────────┼─────┼──────┤
341 │                                       Very       S3a.     Male  │  311│    5%│
342 │                                       unlikely   GENDER:  Female│  298│    4%│
343 │                                                           Total │  609│    9%│
344 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
345 │105b. How likely is it that drivers    Almost     S3a.     Male  │  429│    6%│
346 │who have had too much to drink to      certain    GENDER:  Female│  671│   10%│
347 │drive safely will B. Have an accident?                     Total │ 1100│   16%│
348 │                                      ╶──────────────────────────┼─────┼──────┤
349 │                                       Very       S3a.     Male  │ 1104│   16%│
350 │                                       likely     GENDER:  Female│ 1715│   25%│
351 │                                                           Total │ 2819│   41%│
352 │                                      ╶──────────────────────────┼─────┼──────┤
353 │                                       Somewhat   S3a.     Male  │ 1203│   17%│
354 │                                       likely     GENDER:  Female│ 1214│   18%│
355 │                                                           Total │ 2417│   35%│
356 │                                      ╶──────────────────────────┼─────┼──────┤
357 │                                       Somewhat   S3a.     Male  │  262│    4%│
358 │                                       unlikely   GENDER:  Female│  168│    2%│
359 │                                                           Total │  430│    6%│
360 │                                      ╶──────────────────────────┼─────┼──────┤
361 │                                       Very       S3a.     Male  │   81│    1%│
362 │                                       unlikely   GENDER:  Female│   59│    1%│
363 │                                                           Total │  140│    2%│
364 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
365 │105b. How likely is it that drivers    Almost     S3a.     Male  │  539│    8%│
366 │who have had too much to drink to      certain    GENDER:  Female│  610│    9%│
367 │drive safely will C. Be convicted for                      Total │ 1149│   17%│
368 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
369 │                                       Very       S3a.     Male  │  988│   14%│
370 │                                       likely     GENDER:  Female│ 1049│   15%│
371 │                                                           Total │ 2037│   30%│
372 │                                      ╶──────────────────────────┼─────┼──────┤
373 │                                       Somewhat   S3a.     Male  │  822│   12%│
374 │                                       likely     GENDER:  Female│ 1210│   18%│
375 │                                                           Total │ 2032│   30%│
376 │                                      ╶──────────────────────────┼─────┼──────┤
377 │                                       Somewhat   S3a.     Male  │  446│    7%│
378 │                                       unlikely   GENDER:  Female│  548│    8%│
379 │                                                           Total │  994│   15%│
380 │                                      ╶──────────────────────────┼─────┼──────┤
381 │                                       Very       S3a.     Male  │  268│    4%│
382 │                                       unlikely   GENDER:  Female│  354│    5%│
383 │                                                           Total │  622│    9%│
384 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
385 │105b. How likely is it that drivers    Almost     S3a.     Male  │  498│    7%│
386 │who have had too much to drink to      certain    GENDER:  Female│  603│    9%│
387 │drive safely will D. Be arrested for                       Total │ 1101│   16%│
388 │drunk driving?                        ╶──────────────────────────┼─────┼──────┤
389 │                                       Very       S3a.     Male  │  805│   12%│
390 │                                       likely     GENDER:  Female│ 1029│   15%│
391 │                                                           Total │ 1834│   27%│
392 │                                      ╶──────────────────────────┼─────┼──────┤
393 │                                       Somewhat   S3a.     Male  │  975│   14%│
394 │                                       likely     GENDER:  Female│ 1332│   19%│
395 │                                                           Total │ 2307│   34%│
396 │                                      ╶──────────────────────────┼─────┼──────┤
397 │                                       Somewhat   S3a.     Male  │  535│    8%│
398 │                                       unlikely   GENDER:  Female│  560│    8%│
399 │                                                           Total │ 1095│   16%│
400 │                                      ╶──────────────────────────┼─────┼──────┤
401 │                                       Very       S3a.     Male  │  270│    4%│
402 │                                       unlikely   GENDER:  Female│  279│    4%│
403 │                                                           Total │  549│    8%│
404 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
405
406                                   Custom Tables
407 ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮
408 │                                 │ Almost │ Very │ Somewhat│ Somewhat│  Very  │
409 │                                 │ certain│likely│  likely │ unlikely│unlikely│
410 │                                 ├────────┼──────┼─────────┼─────────┼────────┤
411 │                                 │        │ Table│         │         │        │
412 │                                 │ Table %│   %  │ Table % │ Table % │ Table %│
413 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
414 │S3a.    Male   105b. How likely  │      4%│   10%│      17%│       9%│      5%│
415 │GENDER:        is it that drivers│        │      │         │         │        │
416 │               who have had too  │        │      │         │         │        │
417 │               much to drink to  │        │      │         │         │        │
418 │               drive safely will │        │      │         │         │        │
419 │               A. Get stopped by │        │      │         │         │        │
420 │               the police?       │        │      │         │         │        │
421 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
422 │        Female 105b. How likely  │      6%│   12%│      23%│      10%│      4%│
423 │               is it that drivers│        │      │         │         │        │
424 │               who have had too  │        │      │         │         │        │
425 │               much to drink to  │        │      │         │         │        │
426 │               drive safely will │        │      │         │         │        │
427 │               A. Get stopped by │        │      │         │         │        │
428 │               the police?       │        │      │         │         │        │
429 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
430 │        Total  105b. How likely  │     10%│   22%│      40%│      19%│      9%│
431 │               is it that drivers│        │      │         │         │        │
432 │               who have had too  │        │      │         │         │        │
433 │               much to drink to  │        │      │         │         │        │
434 │               drive safely will │        │      │         │         │        │
435 │               A. Get stopped by │        │      │         │         │        │
436 │               the police?       │        │      │         │         │        │
437 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
438 │S3a.    Male   105b. How likely  │      6%│   16%│      17%│       4%│      1%│
439 │GENDER:        is it that drivers│        │      │         │         │        │
440 │               who have had too  │        │      │         │         │        │
441 │               much to drink to  │        │      │         │         │        │
442 │               drive safely will │        │      │         │         │        │
443 │               B. Have an        │        │      │         │         │        │
444 │               accident?         │        │      │         │         │        │
445 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
446 │        Female 105b. How likely  │     10%│   25%│      18%│       2%│      1%│
447 │               is it that drivers│        │      │         │         │        │
448 │               who have had too  │        │      │         │         │        │
449 │               much to drink to  │        │      │         │         │        │
450 │               drive safely will │        │      │         │         │        │
451 │               B. Have an        │        │      │         │         │        │
452 │               accident?         │        │      │         │         │        │
453 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
454 │        Total  105b. How likely  │     16%│   41%│      35%│       6%│      2%│
455 │               is it that drivers│        │      │         │         │        │
456 │               who have had too  │        │      │         │         │        │
457 │               much to drink to  │        │      │         │         │        │
458 │               drive safely will │        │      │         │         │        │
459 │               B. Have an        │        │      │         │         │        │
460 │               accident?         │        │      │         │         │        │
461 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
462 │S3a.    Male   105b. How likely  │      8%│   14%│      12%│       7%│      4%│
463 │GENDER:        is it that drivers│        │      │         │         │        │
464 │               who have had too  │        │      │         │         │        │
465 │               much to drink to  │        │      │         │         │        │
466 │               drive safely will │        │      │         │         │        │
467 │               C. Be convicted   │        │      │         │         │        │
468 │               for drunk driving?│        │      │         │         │        │
469 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
470 │        Female 105b. How likely  │      9%│   15%│      18%│       8%│      5%│
471 │               is it that drivers│        │      │         │         │        │
472 │               who have had too  │        │      │         │         │        │
473 │               much to drink to  │        │      │         │         │        │
474 │               drive safely will │        │      │         │         │        │
475 │               C. Be convicted   │        │      │         │         │        │
476 │               for drunk driving?│        │      │         │         │        │
477 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
478 │        Total  105b. How likely  │     17%│   30%│      30%│      15%│      9%│
479 │               is it that drivers│        │      │         │         │        │
480 │               who have had too  │        │      │         │         │        │
481 │               much to drink to  │        │      │         │         │        │
482 │               drive safely will │        │      │         │         │        │
483 │               C. Be convicted   │        │      │         │         │        │
484 │               for drunk driving?│        │      │         │         │        │
485 ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
486 │S3a.    Male   105b. How likely  │      7%│   12%│      14%│       8%│      4%│
487 │GENDER:        is it that drivers│        │      │         │         │        │
488 │               who have had too  │        │      │         │         │        │
489 │               much to drink to  │        │      │         │         │        │
490 │               drive safely will │        │      │         │         │        │
491 │               D. Be arrested for│        │      │         │         │        │
492 │               drunk driving?    │        │      │         │         │        │
493 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
494 │        Female 105b. How likely  │      9%│   15%│      19%│       8%│      4%│
495 │               is it that drivers│        │      │         │         │        │
496 │               who have had too  │        │      │         │         │        │
497 │               much to drink to  │        │      │         │         │        │
498 │               drive safely will │        │      │         │         │        │
499 │               D. Be arrested for│        │      │         │         │        │
500 │               drunk driving?    │        │      │         │         │        │
501 │       ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤
502 │        Total  105b. How likely  │     16%│   27%│      34%│      16%│      8%│
503 │               is it that drivers│        │      │         │         │        │
504 │               who have had too  │        │      │         │         │        │
505 │               much to drink to  │        │      │         │         │        │
506 │               drive safely will │        │      │         │         │        │
507 │               D. Be arrested for│        │      │         │         │        │
508 │               drunk driving?    │        │      │         │         │        │
509 ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯
510 ])
511 AT_CLEANUP
512
513 AT_SETUP([CTABLES nesting and scale variables])
514 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
515 AT_DATA([ctables.sps],
516 [[GET 'nhtsa.sav'.
517 CTABLES /TABLE=qnd1 > qn1 BY qns3a.
518 CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27).
519 CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1
520   /CATEGORIES VAR=qnsa1 EMPTY=EXCLUDE.
521 CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1].
522 ]])
523 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
524                                   Custom Tables
525 ╭─────────────────────────────────────────────────────────────────┬────────────╮
526 │                                                                 │S3a. GENDER:│
527 │                                                                 ├─────┬──────┤
528 │                                                                 │ Male│Female│
529 │                                                                 ├─────┼──────┤
530 │                                                                 │ Mean│ Mean │
531 ├─────────────────────────────────────────────────────────────────┼─────┼──────┤
532 │D1. AGE: What   1. How often do you usually drive Every day      │   46│    46│
533 │is your age?   a car or other motor vehicle?      Several days a │   51│    59│
534 │                                                  week           │     │      │
535 │                                                  Once a week or │   44│    54│
536 │                                                  less           │     │      │
537 │                                                  Only certain   │   34│    41│
538 │                                                  times a year   │     │      │
539 │                                                  Never          │   39│    55│
540 ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯
541
542                                   Custom Tables
543 ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮
544 │                                                         │Minimum│Maximum│Mean│
545 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
546 │D1. AGE: S3a.     Male   26. During the last 12       Yes│     16│     86│  42│
547 │What is  GENDER:         months, has there been a        │       │       │    │
548 │your                     time when you felt you          │       │       │    │
549 │age?                     should cut down on your      No │     16│     86│  46│
550 │                         drinking?                       │       │       │    │
551 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
552 │                  Female 26. During the last 12       Yes│     16│     86│  43│
553 │                         months, has there been a        │       │       │    │
554 │                         time when you felt you          │       │       │    │
555 │                         should cut down on your      No │     16│     86│  48│
556 │                         drinking?                       │       │       │    │
557 ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤
558 │D1. AGE: S3a.     Male   27. During the last 12       Yes│     16│     86│  38│
559 │What is  GENDER:         months, has there been a        │       │       │    │
560 │your                     time when people criticized  No │     16│     86│  46│
561 │age?                     your drinking?                  │       │       │    │
562 │                 ╶───────────────────────────────────────┼───────┼───────┼────┤
563 │                  Female 27. During the last 12       Yes│     17│     69│  37│
564 │                         months, has there been a        │       │       │    │
565 │                         time when people criticized  No │     16│     86│  48│
566 │                         your drinking?                  │       │       │    │
567 ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯
568
569                                   Custom Tables
570 ╭─────────────────────────────┬────────────────────────────────────────────────╮
571 │                             │S1. Including yourself, how many members of this│
572 │                             │         household are age 16 or older?         │
573 │                             ├──────┬──────┬──────┬──────┬──────┬──────┬──────┤
574 │                             │      │      │      │      │      │      │ 6 or │
575 │                             │ None │   1  │   2  │   3  │   4  │   5  │ more │
576 │                             ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
577 │                             │Column│Column│Column│Column│Column│Column│Column│
578 │                             │   %  │   %  │   %  │   %  │   %  │   %  │   %  │
579 ├─────────────────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
580 │Sa1.    RDD 105b.    Almost  │     .│  9.5%│  8.2%│ 12.4%│  9.9%│ 20.0%│ 23.8%│
581 │SAMPLE      How      certain │      │      │      │      │      │      │      │
582 │SOURCE:     likely           │      │      │      │      │      │      │      │
583 │            is it    Very    │     .│ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│
584 │            that     likely  │      │      │      │      │      │      │      │
585 │            drivers          │      │      │      │      │      │      │      │
586 │            who have         │      │      │      │      │      │      │      │
587 │            had too  Somewhat│     .│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│
588 │            much to  likely  │      │      │      │      │      │      │      │
589 │            drink to         │      │      │      │      │      │      │      │
590 │            drive            │      │      │      │      │      │      │      │
591 │            safely   Somewhat│     .│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│  9.5%│
592 │            will A.  unlikely│      │      │      │      │      │      │      │
593 │            Get              │      │      │      │      │      │      │      │
594 │            stopped  Very    │     .│  9.2%│  9.7%│  8.2%│  9.4%│  7.3%│  9.5%│
595 │            by the   unlikely│      │      │      │      │      │      │      │
596 │            police?          │      │      │      │      │      │      │      │
597 ╰─────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────╯
598
599                                   Custom Tables
600 ╭──────────────────────────────────────────────────────────────┬────┬──────────╮
601 │                                                              │    │    Std   │
602 │                                                              │Mean│ Deviation│
603 ├──────────────────────────────────────────────────────────────┼────┼──────────┤
604 │Age    16 to 25 20. On how many of the thirty days in this    │ 5.2│       6.0│
605 │group           typical month did you have one or more        │    │          │
606 │                alcoholic beverages to drink?                 │    │          │
607 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
608 │       26 to 35 20. On how many of the thirty days in this    │ 4.7│       5.9│
609 │                typical month did you have one or more        │    │          │
610 │                alcoholic beverages to drink?                 │    │          │
611 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
612 │       36 to 45 20. On how many of the thirty days in this    │ 5.5│       6.8│
613 │                typical month did you have one or more        │    │          │
614 │                alcoholic beverages to drink?                 │    │          │
615 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
616 │       46 to 55 20. On how many of the thirty days in this    │ 5.8│       7.7│
617 │                typical month did you have one or more        │    │          │
618 │                alcoholic beverages to drink?                 │    │          │
619 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
620 │       56 to 65 20. On how many of the thirty days in this    │ 6.3│       8.2│
621 │                typical month did you have one or more        │    │          │
622 │                alcoholic beverages to drink?                 │    │          │
623 │      ╶───────────────────────────────────────────────────────┼────┼──────────┤
624 │       66 or    20. On how many of the thirty days in this    │ 7.1│       9.2│
625 │       older    typical month did you have one or more        │    │          │
626 │                alcoholic beverages to drink?                 │    │          │
627 ╰──────────────────────────────────────────────────────────────┴────┴──────────╯
628 ])
629 AT_CLEANUP
630
631
632 AT_SETUP([CTABLES SLABELS])
633 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
634 AT_DATA([ctables.sps],
635 [[GET 'nhtsa.sav'.
636 CTABLES /TABLE qn1 [COUNT COLPCT].
637 CTABLES /TABLE qn1 [COUNT COLPCT]
638     /SLABELS POSITION=ROW.
639 CTABLES /TABLE qn1 [COUNT COLPCT]
640     /SLABELS POSITION=ROW VISIBLE=NO.
641 ]])
642 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
643                                   Custom Tables
644 ╭────────────────────────────────────────────────────────────────┬─────┬───────╮
645 │                                                                │     │ Column│
646 │                                                                │Count│   %   │
647 ├────────────────────────────────────────────────────────────────┼─────┼───────┤
648 │ 1. How often do you usually drive a car or  Every day          │ 4667│  66.9%│
649 │other motor vehicle?                         Several days a week│ 1274│  18.3%│
650 │                                             Once a week or less│  361│   5.2%│
651 │                                             Only certain times │  130│   1.9%│
652 │                                             a year             │     │       │
653 │                                             Never              │  540│   7.7%│
654 ╰────────────────────────────────────────────────────────────────┴─────┴───────╯
655
656                                   Custom Tables
657 ╭────────────────────────────────────────────────────────────────────────┬─────╮
658 │ 1. How often do you usually drive a car or  Every day           Count  │ 4667│
659 │other motor vehicle?                                             Column │66.9%│
660 │                                                                 %      │     │
661 │                                            ╶───────────────────────────┼─────┤
662 │                                             Several days a week Count  │ 1274│
663 │                                                                 Column │18.3%│
664 │                                                                 %      │     │
665 │                                            ╶───────────────────────────┼─────┤
666 │                                             Once a week or less Count  │  361│
667 │                                                                 Column │ 5.2%│
668 │                                                                 %      │     │
669 │                                            ╶───────────────────────────┼─────┤
670 │                                             Only certain times  Count  │  130│
671 │                                             a year              Column │ 1.9%│
672 │                                                                 %      │     │
673 │                                            ╶───────────────────────────┼─────┤
674 │                                             Never               Count  │  540│
675 │                                                                 Column │ 7.7%│
676 │                                                                 %      │     │
677 ╰────────────────────────────────────────────────────────────────────────┴─────╯
678
679                                   Custom Tables
680 ╭────────────────────────────────────────────────────────────────────────┬─────╮
681 │ 1. How often do you usually drive a car or other  Every day            │ 4667│
682 │motor vehicle?                                                          │66.9%│
683 │                                                   Several days a week  │ 1274│
684 │                                                                        │18.3%│
685 │                                                   Once a week or less  │  361│
686 │                                                                        │ 5.2%│
687 │                                                   Only certain times a │  130│
688 │                                                   year                 │ 1.9%│
689 │                                                   Never                │  540│
690 │                                                                        │ 7.7%│
691 ╰────────────────────────────────────────────────────────────────────────┴─────╯
692 ])
693 AT_CLEANUP
694
695 AT_SETUP([CTABLES simple totals])
696 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
697 AT_DATA([ctables.sps],
698 [[GET 'nhtsa.sav'.
699 CTABLES /TABLE=qn17
700     /CATEGORIES VARIABLES=qn17 TOTAL=YES LABEL='Number responding'.
701 CTABLES /TABLE=region > qn18 [MEAN, COUNT]
702     /CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
703 ]])
704 AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl
705                                   Custom Tables
706 ╭────────────────────────────────────────────────────────────────────────┬─────╮
707 │                                                                        │Count│
708 ├────────────────────────────────────────────────────────────────────────┼─────┤
709 │17. When you drink alcoholic beverages, which ONE of  OR, something else│    2│
710 │the following beverages do you drink MOST OFTEN?      Beer              │ 1073│
711 │                                                      Light beer        │  620│
712 │                                                      Wine              │ 1418│
713 │                                                      Wine coolers      │  137│
714 │                                                      Hard liquor or    │  888│
715 │                                                      mixed drinks      │     │
716 │                                                      Flavored malt     │   83│
717 │                                                      drinks            │     │
718 │                                                      Number responding │ 4221│
719 ╰────────────────────────────────────────────────────────────────────────┴─────╯
720
721                                   Custom Tables
722 ╭───────────────────────────────────────────────────────────────────┬────┬─────╮
723 │                                                                   │Mean│Count│
724 ├───────────────────────────────────────────────────────────────────┼────┼─────┤
725 │Region NE       18. When you drink ANSWERFROM(QN17R1), about how   │4.36│  949│
726 │                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
727 │                sitting?                                           │    │     │
728 │      ╶────────────────────────────────────────────────────────────┼────┼─────┤
729 │       MW       18. When you drink ANSWERFROM(QN17R1), about how   │4.67│ 1027│
730 │                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
731 │                sitting?                                           │    │     │
732 │      ╶────────────────────────────────────────────────────────────┼────┼─────┤
733 │       S        18. When you drink ANSWERFROM(QN17R1), about how   │4.71│ 1287│
734 │                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
735 │                sitting?                                           │    │     │
736 │      ╶────────────────────────────────────────────────────────────┼────┼─────┤
737 │       W        18. When you drink ANSWERFROM(QN17R1), about how   │4.69│  955│
738 │                many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
739 │                sitting?                                           │    │     │
740 │      ╶────────────────────────────────────────────────────────────┼────┼─────┤
741 │       All      18. When you drink ANSWERFROM(QN17R1), about how   │4.62│ 4218│
742 │       regions  many ANSWERFROM(QN17R2) do you usually drink per   │    │     │
743 │                sitting?                                           │    │     │
744 ╰───────────────────────────────────────────────────────────────────┴────┴─────╯
745 ])
746 AT_CLEANUP
747
748 AT_SETUP([CTABLES subtotals])
749 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
750 AT_DATA([ctables.sps],
751 [[GET 'nhtsa.sav'.
752 CTABLES /TABLE=qn105ba BY qns1
753     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
754 CTABLES /TABLE=qn105ba [COLPCT] BY qns1
755     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL].
756 CTABLES /TABLE=qn105ba BY qns1
757     /CATEGORIES VARIABLES=qn105ba [1, 2, 3, SUBTOTAL, 4, 5, SUBTOTAL]
758     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, SUBTOTAL].
759 ]])
760 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
761                                                       Custom Tables
762 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
763 │                                                         │ S1. Including yourself, how many members of this household │
764 │                                                         │                    are age 16 or older?                    │
765 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
766 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
767 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
768 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
769 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
770 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
771 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
772 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
773 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
774 │                                              likely     │       │       │         │       │        │      │          │
775 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
776 │                                              unlikely   │       │       │         │       │        │      │          │
777 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
778 │                                              unlikely   │       │       │         │       │        │      │          │
779 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
780
781                                                       Custom Tables
782 ╭────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────╮
783 │                                                        │  S1. Including yourself, how many members of this household │
784 │                                                        │                     are age 16 or older?                    │
785 │                                                        ├────────┬────────┬────────┬────────┬───────┬────────┬────────┤
786 │                                                        │        │        │        │        │       │        │  6 or  │
787 │                                                        │  None  │    1   │    2   │    3   │   4   │    5   │  more  │
788 │                                                        ├────────┼────────┼────────┼────────┼───────┼────────┼────────┤
789 │                                                        │        │        │        │        │ Column│        │        │
790 │                                                        │Column %│Column %│Column %│Column %│   %   │Column %│Column %│
791 ├────────────────────────────────────────────────────────┼────────┼────────┼────────┼────────┼───────┼────────┼────────┤
792 │105b. How likely is it that drivers who have Almost     │       .│    9.5%│    8.2%│   12.4%│   9.9%│   20.0%│   23.8%│
793 │had too much to drink to drive safely will   certain    │        │        │        │        │       │        │        │
794 │A. Get stopped by the police?                Very likely│       .│   24.9%│   18.5%│   24.0%│  26.6%│   25.5%│   33.3%│
795 │                                             Somewhat   │       .│   38.3%│   41.9%│   38.6%│  37.5%│   36.4%│   23.8%│
796 │                                             likely     │        │        │        │        │       │        │        │
797 │                                             Subtotal   │        │   72.8%│   68.6%│   75.0%│  74.0%│   81.8%│   81.0%│
798 │                                             Somewhat   │       .│   18.1%│   21.7%│   16.8%│  16.7%│   10.9%│    9.5%│
799 │                                             unlikely   │        │        │        │        │       │        │        │
800 │                                             Very       │       .│    9.2%│    9.7%│    8.2%│   9.4%│    7.3%│    9.5%│
801 │                                             unlikely   │        │        │        │        │       │        │        │
802 │                                             Subtotal   │        │   27.2%│   31.4%│   25.0%│  26.0%│   18.2%│   19.0%│
803 ╰────────────────────────────────────────────────────────┴────────┴────────┴────────┴────────┴───────┴────────┴────────╯
804
805                                                       Custom Tables
806 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
807 │                                                         │ S1. Including yourself, how many members of this household │
808 │                                                         │                    are age 16 or older?                    │
809 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
810 │                                                         │   1   │   2   │ Subtotal│   3   │    4   │   5  │ Subtotal │
811 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
812 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
813 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
814 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     62│      19│    11│        92│
815 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
816 │Get stopped by the police?                    Very likely│    384│    552│      936│    120│      51│    14│       185│
817 │                                              Somewhat   │    590│   1249│     1839│    193│      72│    20│       285│
818 │                                              likely     │       │       │         │       │        │      │          │
819 │                                              Subtotal   │   1121│   2047│     3168│    375│     142│    45│       562│
820 │                                              Somewhat   │    278│    647│      925│     84│      32│     6│       122│
821 │                                              unlikely   │       │       │         │       │        │      │          │
822 │                                              Very       │    141│    290│      431│     41│      18│     4│        63│
823 │                                              unlikely   │       │       │         │       │        │      │          │
824 │                                              Subtotal   │    419│    937│     1356│    125│      50│    10│       185│
825 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
826 ])
827 AT_CLEANUP
828
829 AT_SETUP([CTABLES PCOMPUTE])
830 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
831 AT_DATA([ctables.sps],
832 [[GET 'nhtsa.sav'.
833 CTABLES
834     /PCOMPUTE &x=EXPR([3] + [4])
835     /PCOMPUTE &y=EXPR([4] + [5])
836     /PPROPERTIES &x LABEL='3+4' HIDESOURCECATS=YES
837     /PPROPERTIES &y LABEL='4+5'
838     /TABLE=qn105ba BY qns1
839     /CATEGORIES VARIABLES=qns1 [1, 2, SUBTOTAL, 3, 4, 5, &x, &y, SUBTOTAL]
840 ]])
841 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
842                                                       Custom Tables
843 ╭─────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────╮
844 │                                                         │ S1. Including yourself, how many members of this household │
845 │                                                         │                    are age 16 or older?                    │
846 │                                                         ├───────┬───────┬─────────┬───────┬────────┬──────┬──────────┤
847 │                                                         │   1   │   2   │ Subtotal│   5   │   3+4  │  4+5 │ Subtotal │
848 │                                                         ├───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
849 │                                                         │ Count │ Count │  Count  │ Count │  Count │ Count│   Count  │
850 ├─────────────────────────────────────────────────────────┼───────┼───────┼─────────┼───────┼────────┼──────┼──────────┤
851 │105b. How likely is it that drivers who have  Almost     │    147│    246│      393│     11│      81│    30│        92│
852 │had too much to drink to drive safely will A. certain    │       │       │         │       │        │      │          │
853 │Get stopped by the police?                    Very likely│    384│    552│      936│     14│     171│    65│       185│
854 │                                              Somewhat   │    590│   1249│     1839│     20│     265│    92│       285│
855 │                                              likely     │       │       │         │       │        │      │          │
856 │                                              Somewhat   │    278│    647│      925│      6│     116│    38│       122│
857 │                                              unlikely   │       │       │         │       │        │      │          │
858 │                                              Very       │    141│    290│      431│      4│      59│    22│        63│
859 │                                              unlikely   │       │       │         │       │        │      │          │
860 ╰─────────────────────────────────────────────────────────┴───────┴───────┴─────────┴───────┴────────┴──────┴──────────╯
861 ])
862 AT_CLEANUP
863
864 AT_SETUP([CTABLES CLABELS])
865 AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .])
866 AT_DATA([ctables.sps],
867 [[GET 'nhtsa.sav'.
868 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
869 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
870 ]])
871 AT_CHECK([pspp ctables.sps -O box=unicode -O width=120], [0], [dnl
872                                                       Custom Tables
873 ╭───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
874 │       │                                                 S3a. GENDER:                                                 │
875 │       ├──────────────────────────────────────────────────────┬───────────────────────────────────────────────────────┤
876 │       │                         Male                         │                         Female                        │
877 │       ├─────────┬───────┬──────┬──────┬──────┬───────┬───────┼──────────┬──────┬───────┬──────┬──────┬──────┬────────┤
878 │       │  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 │
879 │       │ younger │   25  │  35  │  45  │  55  │   65  │ older │  younger │  25  │   35  │  45  │  55  │  65  │  older │
880 │       ├─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
881 │       │  Count  │ Count │ Count│ Count│ Count│ Count │ Count │   Count  │ Count│ Count │ Count│ Count│ Count│  Count │
882 ├───────┼─────────┼───────┼──────┼──────┼──────┼───────┼───────┼──────────┼──────┼───────┼──────┼──────┼──────┼────────┤
883 │Age    │        0│    594│   476│   489│   526│    516│    531│         0│   505│    491│   548│   649│   731│     943│
884 │group  │         │       │      │      │      │       │       │          │      │       │      │      │      │        │
885 ╰───────┴─────────┴───────┴──────┴──────┴──────┴───────┴───────┴──────────┴──────┴───────┴──────┴──────┴──────┴────────╯
886
887                 Custom Tables
888 ╭──────────────────────────────┬────────────╮
889 │                              │S3a. GENDER:│
890 │                              ├────────────┤
891 │                              │    Count   │
892 ├──────────────────────────────┼────────────┤
893 │Age group 15 or younger Male  │           0│
894 │                        Female│           0│
895 │         ╶────────────────────┼────────────┤
896 │          16 to 25      Male  │         594│
897 │                        Female│         505│
898 │         ╶────────────────────┼────────────┤
899 │          26 to 35      Male  │         476│
900 │                        Female│         491│
901 │         ╶────────────────────┼────────────┤
902 │          36 to 45      Male  │         489│
903 │                        Female│         548│
904 │         ╶────────────────────┼────────────┤
905 │          46 to 55      Male  │         526│
906 │                        Female│         649│
907 │         ╶────────────────────┼────────────┤
908 │          56 to 65      Male  │         516│
909 │                        Female│         731│
910 │         ╶────────────────────┼────────────┤
911 │          66 or older   Male  │         531│
912 │                        Female│         943│
913 ╰──────────────────────────────┴────────────╯
914 ])
915 AT_CLEANUP