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