Re-implement MEANS.
[pspp] / tests / language / stats / means.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017, 2019 Free Software Foundation, Inc.
3 dnl
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl
17 AT_BANNER([MEANS procedure])
18
19 AT_SETUP([MEANS simple])
20 AT_KEYWORDS([categorical categoricals])
21
22 AT_DATA([means-simple.sps], [dnl
23 data list notable list /hand * score * w *.
24 begin data.
25 1 17 4
26 1 16 5
27 2 21 1
28 2 22 1
29 2 20 8
30 end data.
31
32 weight by w.
33
34 means tables = score by hand
35  /cells = mean count.
36 ])
37
38 AT_CHECK([pspp -O format=csv means-simple.sps], [0], [dnl
39 Table: Case Processing Summary
40 ,Cases,,,,,
41 ,Included,,Excluded,,Total,
42 ,N,Percent,N,Percent,N,Percent
43 score * hand,19,100.0%,0,.0%,19,100.0%
44
45 Table: Report
46 hand,Mean,N
47 1.00,16.44,9
48 2.00,20.30,10
49 Total,18.47,19
50 ])
51
52 AT_CLEANUP
53
54 AT_SETUP([MEANS very simple])
55 AT_KEYWORDS([categorical categoricals])
56
57 AT_DATA([very-simple.sps], [dnl
58 data list notable list /score *.
59 begin data.
60 17
61 17
62 17
63 16
64 17
65 16
66 16
67 16
68 16
69 21
70 22
71 20
72 20
73 20
74 20
75 20
76 20
77 20
78 20
79 end data.
80
81 means tables = score
82  /cells = mean count.
83 ])
84
85 AT_CHECK([pspp -O format=csv very-simple.sps], [0], [dnl
86 Table: Case Processing Summary
87 ,Cases,,,,,
88 ,Included,,Excluded,,Total,
89 ,N,Percent,N,Percent,N,Percent
90 score,19,100.0%,0,.0%,19,100.0%
91
92 Table: Report
93 Mean,N
94 18.47,19
95 ])
96
97 AT_CLEANUP
98
99
100 AT_SETUP([MEANS empty factor spec])
101 AT_KEYWORDS([categorical categoricals])
102
103 AT_DATA([means-bad.sps], [dnl
104 data list list /outcome *.
105 begin data.
106 1
107 2
108 3
109 end data.
110
111 MEANS TABLES =  outcome
112         BY.
113 ])
114
115 AT_CHECK([pspp -O format=csv means-bad.sps], [1], [ignore])
116
117 AT_CLEANUP
118
119
120
121 AT_SETUP([MEANS parser bug])
122 AT_KEYWORDS([categorical categoricals])
123
124 dnl This bug caused an infinite loop
125 AT_DATA([means-bad.sps], [dnl
126 DATA LIST notable LIST /a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 fylo *.
127 begin data.
128 1 2 3 4 5 6 7 8 9 0 11
129 end data.
130
131 MEANS TABLES = a1 a2 a3 a4 a5 a6 a7 a8 a9 a10a BY fylo.
132 ])
133
134 AT_CHECK([pspp -O format=csv means-bad.sps], [1], [ignore])
135
136 AT_CLEANUP
137
138
139 dnl This example is based upon info from https://libguides.library.kent.edu/SPSS/CompareMeans
140 AT_SETUP([MEANS default missing behaviour])
141 AT_KEYWORDS([categorical categoricals])
142
143 AT_DATA([means-missing.sps], [dnl
144 data list notable list /w * score * a * b *.
145 begin data
146      12      . 0 0
147      13      . 0 1
148      11      . 1 0
149       7      . 1 1
150       5      1 0 .
151      91      1 0 0
152     130      1 0 1
153       4      1 1 .
154      90      1 1 0
155      72      1 1 1
156 end data.
157
158 weight by w.
159
160 MEANS tables=score
161         /cells = count.
162
163 MEANS tables=score by a
164         /cells = count.
165
166 MEANS tables=score by a by b
167       /cells = count.
168 ])
169
170 AT_CHECK([pspp -O format=csv means-missing.sps], [0], [dnl
171 Table: Case Processing Summary
172 ,Cases,,,,,
173 ,Included,,Excluded,,Total,
174 ,N,Percent,N,Percent,N,Percent
175 score,392,90.1%,43,9.9%,435,100.0%
176
177 Table: Report
178 N
179 392
180
181 Table: Case Processing Summary
182 ,Cases,,,,,
183 ,Included,,Excluded,,Total,
184 ,N,Percent,N,Percent,N,Percent
185 score * a,392,90.1%,43,9.9%,435,100.0%
186
187 Table: Report
188 a,N
189 .00,226
190 1.00,166
191 Total,392
192
193 Table: Case Processing Summary
194 ,Cases,,,,,
195 ,Included,,Excluded,,Total,
196 ,N,Percent,N,Percent,N,Percent
197 score * a * b,383,88.0%,52,12.0%,435,100.0%
198
199 Table: Report
200 a,b,N
201 .00,.00,91
202 ,1.00,130
203 ,Total,221
204 1.00,.00,90
205 ,1.00,72
206 ,Total,162
207 Total,.00,181
208 ,1.00,202
209 ,Total,383
210 ])
211
212 AT_CLEANUP
213
214
215 dnl This example from https://www.spss-tutorials.com/spss-means-command/
216 AT_SETUP([MEANS two way])
217 AT_KEYWORDS([categorical categoricals])
218
219 AT_DATA([means-freelancer.sps], [dnl
220 data list notable list /income_2010 * gender  sector_2010.
221 begin data
222 6072.40 0 5
223 12706.65 1 4
224 14912.82 0 2
225 16338.36 1 5
226 22606.99 0 .
227 23544.95 1 1
228 24985.21 0 2
229 26586.48 0 1
230 29076.24 1 3
231 31010.18 0 2
232 33190.63 1 1
233 35570.67 1 4
234 36202.60 1 4
235 36205.85 1 2
236 36262.56 1 .
237 38283.56 0 1
238 38569.91 1 5
239 39057.56 1 4
240 39594.68 1 5
241 42087.38 0 1
242 42370.92 0 2
243 42931.32 1 2
244 45907.58 0 4
245 45911.32 1 .
246 47227.09 1 3
247 50440.71 1 5
248 57440.17 1 3
249 58918.86 0 5
250 59430.07 1 2
251 61135.95 0 4
252 64193.85 0 4
253 64857.02 0 3
254 65903.42 0 4
255 66592.38 1 3
256 70986.10 0 3
257 71229.94 0 4
258 74663.05 1 4
259 76676.14 1 4
260 79260.80 0 4
261 80311.71 0 4
262 end data.
263
264 means income_2010 by gender by sector_2010
265         /cells count min mean stddev.
266 ])
267
268 AT_CHECK([pspp -O format=csv means-freelancer.sps], [0], [dnl
269 Table: Case Processing Summary
270 ,Cases,,,,,
271 ,Included,,Excluded,,Total,
272 ,N,Percent,N,Percent,N,Percent
273 income_2010 * gender * sector_2010,37,92.5%,3,7.5%,40,100.0%
274
275 Table: Report
276 gender,sector_2010,N,Minimum,Mean,Std. Deviation
277 .00,1.00,3,26586.48,35652.47,8078.46
278 ,2.00,4,14912.82,28319.78,11482.43
279 ,3.00,2,64857.02,67921.56,4333.91
280 ,4.00,7,45907.58,66849.04,11787.11
281 ,5.00,2,6072.40,32495.63,37368.09
282 ,Total,18,6072.40,49389.68,22371.48
283 1.00,1.00,2,23544.95,28367.79,6820.53
284 ,2.00,3,36205.85,46189.08,11949.93
285 ,3.00,4,29076.24,50083.97,16084.44
286 ,4.00,6,12706.65,45812.78,24995.16
287 ,5.00,4,16338.36,36235.92,14311.04
288 ,Total,19,12706.65,42918.90,17851.64
289 Total,1.00,5,23544.95,32738.60,7757.62
290 ,2.00,7,14912.82,35978.05,14309.27
291 ,3.00,6,29076.24,56029.83,15615.06
292 ,4.00,13,12706.65,57139.99,21187.85
293 ,5.00,6,6072.40,34989.15,20146.69
294 ,Total,37,6072.40,46066.84,20160.12
295 ])
296
297 AT_CLEANUP
298
299
300 dnl Check that rows are suppressed and that things generally work ok
301 dnl when there are a 2 way instance contains an unbalanced set of
302 dnl categorical values.
303 AT_SETUP([MEANS unbalanced])
304 AT_KEYWORDS([categorical categoricals])
305
306 AT_DATA([means-unbalanced.sps], [dnl
307 data list notable list /b c x *.
308 begin data.
309 4 1 123
310 3 1 123
311 5 0 246
312 4 0 246
313 3 0 246
314 end data.
315
316 * The data above lack a 5 1 case.
317
318 means
319         table=x by b by c
320         /cells = mean count
321         .
322 ])
323
324 AT_CHECK([pspp -O format=csv means-unbalanced.sps], [0], [dnl
325 Table: Case Processing Summary
326 ,Cases,,,,,
327 ,Included,,Excluded,,Total,
328 ,N,Percent,N,Percent,N,Percent
329 x * b * c,5,100.0%,0,.0%,5,100.0%
330
331 Table: Report
332 b,c,Mean,N
333 3.00,.00,246.00,1
334 ,1.00,123.00,1
335 ,Total,184.50,2
336 4.00,.00,246.00,1
337 ,1.00,123.00,1
338 ,Total,184.50,2
339 5.00,.00,246.00,1
340 ,Total,246.00,1
341 Total,.00,246.00,3
342 ,1.00,123.00,2
343 ,Total,196.80,5
344 ])
345
346 AT_CLEANUP
347
348 dnl This example kindly provided by Dana Williams
349 AT_SETUP([MEANS three way])
350 AT_KEYWORDS([categorical categoricals])
351
352 AT_DATA([means-threeway.sps], [dnl
353 data list notable list /score a b c.
354 begin data.
355 3  0 0 0
356 4  0 0 1
357 41 0 0 2
358 5  0 1 0
359 6  0 1 1
360 7  1 0 0
361 8  1 0 1
362 9  1 1 0
363 10 1 1 1
364 end data.
365
366 means score by a by b by c.
367 ])
368
369 AT_CHECK([pspp -O format=csv means-threeway.sps], [0], [dnl
370 Table: Case Processing Summary
371 ,Cases,,,,,
372 ,Included,,Excluded,,Total,
373 ,N,Percent,N,Percent,N,Percent
374 score * a * b * c,9,100.0%,0,.0%,9,100.0%
375
376 Table: Report
377 a,b,c,Mean,N,Std. Deviation
378 .00,.00,.00,3.00,1,NaN
379 ,,1.00,4.00,1,NaN
380 ,,2.00,41.00,1,NaN
381 ,,Total,16.00,3,21.66
382 ,1.00,.00,5.00,1,NaN
383 ,,1.00,6.00,1,NaN
384 ,,Total,5.50,2,.71
385 ,Total,.00,4.00,2,1.41
386 ,,1.00,5.00,2,1.41
387 ,,2.00,41.00,1,NaN
388 ,,Total,11.80,5,16.36
389 1.00,.00,.00,7.00,1,NaN
390 ,,1.00,8.00,1,NaN
391 ,,Total,7.50,2,.71
392 ,1.00,.00,9.00,1,NaN
393 ,,1.00,10.00,1,NaN
394 ,,Total,9.50,2,.71
395 ,Total,.00,8.00,2,1.41
396 ,,1.00,9.00,2,1.41
397 ,,Total,8.50,4,1.29
398 Total,.00,.00,5.00,2,2.83
399 ,,1.00,6.00,2,2.83
400 ,,2.00,41.00,1,NaN
401 ,,Total,12.60,5,16.01
402 ,1.00,.00,7.00,2,2.83
403 ,,1.00,8.00,2,2.83
404 ,,Total,7.50,4,2.38
405 ,Total,.00,6.00,4,2.58
406 ,,1.00,7.00,4,2.58
407 ,,2.00,41.00,1,NaN
408 ,,Total,10.33,9,11.73
409 ])
410
411 AT_CLEANUP
412
413 dnl The above example again, but with string variables for
414 dnl the control vars.
415 AT_SETUP([MEANS three way string])
416 AT_KEYWORDS([categorical categoricals])
417
418 AT_DATA([means-threeway-string.sps], [dnl
419 data list notable list /score (f22.2) a (a24) b (a16) c (a8).
420 begin data.
421 3  fooberrycrumblexzaQ  fosilationwereqd  zero
422 4  fooberrycrumblexzaQ  fosilationwereqd  one
423 41 fooberrycrumblexzaQ  fosilationwereqd  two
424 5  fooberrycrumblexzaQ  onlyonekonboys    zero
425 6  fooberrycrumblexzaQ  onlyonekonboys    one
426 7  wontledingbatsXASDF  fosilationwereqd  zero
427 8  wontledingbatsXASDF  fosilationwereqd  one
428 9  wontledingbatsXASDF  onlyonekonboys    zero
429 10 wontledingbatsXASDF  onlyonekonboys    one
430 end data.
431
432 means score by a by b by c.
433 ])
434
435 AT_CHECK([pspp -O format=csv means-threeway-string.sps], [0], [dnl
436 Table: Case Processing Summary
437 ,Cases,,,,,
438 ,Included,,Excluded,,Total,
439 ,N,Percent,N,Percent,N,Percent
440 score * a * b * c,9,100.0%,0,.0%,9,100.0%
441
442 Table: Report
443 a,b,c,Mean,N,Std. Deviation
444 fooberrycrumblexzaQ     ,fosilationwereqd,one     ,4.00,1,NaN
445 ,,two     ,41.00,1,NaN
446 ,,zero    ,3.00,1,NaN
447 ,,Total,16.00,3,21.66
448 ,onlyonekonboys  ,one     ,6.00,1,NaN
449 ,,zero    ,5.00,1,NaN
450 ,,Total,5.50,2,.71
451 ,Total,one     ,5.00,2,1.41
452 ,,two     ,41.00,1,NaN
453 ,,zero    ,4.00,2,1.41
454 ,,Total,11.80,5,16.36
455 wontledingbatsXASDF     ,fosilationwereqd,one     ,8.00,1,NaN
456 ,,zero    ,7.00,1,NaN
457 ,,Total,7.50,2,.71
458 ,onlyonekonboys  ,one     ,10.00,1,NaN
459 ,,zero    ,9.00,1,NaN
460 ,,Total,9.50,2,.71
461 ,Total,one     ,9.00,2,1.41
462 ,,zero    ,8.00,2,1.41
463 ,,Total,8.50,4,1.29
464 Total,fosilationwereqd,one     ,6.00,2,2.83
465 ,,two     ,41.00,1,NaN
466 ,,zero    ,5.00,2,2.83
467 ,,Total,12.60,5,16.01
468 ,onlyonekonboys  ,one     ,8.00,2,2.83
469 ,,zero    ,7.00,2,2.83
470 ,,Total,7.50,4,2.38
471 ,Total,one     ,7.00,4,2.58
472 ,,two     ,41.00,1,NaN
473 ,,zero    ,6.00,4,2.58
474 ,,Total,10.33,9,11.73
475 ])
476
477 AT_CLEANUP
478
479
480
481 dnl An example with multiple tables
482 AT_SETUP([MEANS multiple tables])
483 AT_KEYWORDS([categorical categoricals])
484
485 AT_DATA([means-multi-table.sps], [dnl
486 data list notable list /a * b * c * x * y *.
487 begin data.
488 6 3 0 123 456
489 6 3 1 123 456
490 6 4 0 123 456
491 6 4 1 123 456
492 6 5 0 123 456
493 6 5 1 123 456
494 7 3 0 123 456
495 7 3 1 123 456
496 7 4 0 123 456
497 7 4 1 123 456
498 7 5 0 123 456
499 7 5 1 123 456
500 8 3 0 123 456
501 8 3 1 123 456
502 8 4 0 123 456
503 8 4 1 123 456
504 8 5 0 123 456
505 8 5 1 123 456
506 9 3 0 123 456
507 9 3 1 123 456
508 9 4 0 123 456
509 9 4 1 123 456
510 9 5 0 123 456
511 9 5 1 123 456
512 end data.
513
514
515 means table = x by b by c
516         /x by b
517         /y by a by b
518   cells = min count  .
519 ])
520
521 AT_CHECK([pspp -O format=csv means-multi-table.sps], [0], [dnl
522 Table: Case Processing Summary
523 ,Cases,,,,,
524 ,Included,,Excluded,,Total,
525 ,N,Percent,N,Percent,N,Percent
526 x * b * c,24,100.0%,0,.0%,24,100.0%
527
528 Table: Report
529 b,c,Minimum,N
530 3.00,.00,123.00,4
531 ,1.00,123.00,4
532 ,Total,123.00,8
533 4.00,.00,123.00,4
534 ,1.00,123.00,4
535 ,Total,123.00,8
536 5.00,.00,123.00,4
537 ,1.00,123.00,4
538 ,Total,123.00,8
539 Total,.00,123.00,12
540 ,1.00,123.00,12
541 ,Total,123.00,24
542
543 Table: Case Processing Summary
544 ,Cases,,,,,
545 ,Included,,Excluded,,Total,
546 ,N,Percent,N,Percent,N,Percent
547 x * b,24,100.0%,0,.0%,24,100.0%
548
549 Table: Report
550 b,Minimum,N
551 3.00,123.00,8
552 4.00,123.00,8
553 5.00,123.00,8
554 Total,123.00,24
555
556 Table: Case Processing Summary
557 ,Cases,,,,,
558 ,Included,,Excluded,,Total,
559 ,N,Percent,N,Percent,N,Percent
560 y * a * b,24,100.0%,0,.0%,24,100.0%
561
562 Table: Report
563 a,b,Minimum,N
564 6.00,3.00,456.00,2
565 ,4.00,456.00,2
566 ,5.00,456.00,2
567 ,Total,456.00,6
568 7.00,3.00,456.00,2
569 ,4.00,456.00,2
570 ,5.00,456.00,2
571 ,Total,456.00,6
572 8.00,3.00,456.00,2
573 ,4.00,456.00,2
574 ,5.00,456.00,2
575 ,Total,456.00,6
576 9.00,3.00,456.00,2
577 ,4.00,456.00,2
578 ,5.00,456.00,2
579 ,Total,456.00,6
580 Total,3.00,456.00,8
581 ,4.00,456.00,8
582 ,5.00,456.00,8
583 ,Total,456.00,24
584 ])
585
586 AT_CLEANUP
587
588
589
590 dnl An example with more than one dependent variable.
591 dnl This case uses a somewhat different table layout.
592 AT_SETUP([MEANS multi variable])
593 AT_KEYWORDS([categorical categoricals])
594
595 AT_DATA([means-multi-variable.sps], [dnl
596 data list notable list /b c x y.
597 begin data.
598 5 1 123 55
599 5 1 123 55
600 5 1 123 55
601 5 1 123 55
602 4 1 456 44
603 4 1 456 44
604 4 1 456 44
605 4 1 456 44
606 3 1 789 55
607 3 1 789 55
608 3 1 789 55
609 3 1 789 55
610 5 0 246 99
611 5 0 246 99
612 5 0 246 99
613 5 0 246 .
614 4 0 987 99
615 4 0 987 99
616 4 0 987 99
617 4 0 987 99
618 3 0 654 11
619 3 0 654 11
620 3 0 654 11
621 3 0 654 11
622 end data.
623
624 means
625         table = x y by b by c
626         .
627 ])
628
629 AT_CHECK([pspp -O format=csv means-multi-variable.sps], [0], [dnl
630 Table: Case Processing Summary
631 ,Cases,,,,,
632 ,Included,,Excluded,,Total,
633 ,N,Percent,N,Percent,N,Percent
634 x * b * c,24,100.0%,0,.0%,24,100.0%
635 y * b * c,23,95.8%,1,4.2%,24,100.0%
636
637 Table: x * y * b * c
638 b,c,,x,y
639 3.00,.00,Mean,654.00,11.00
640 ,,N,4,4
641 ,,Std. Deviation,.00,.00
642 ,1.00,Mean,789.00,55.00
643 ,,N,4,4
644 ,,Std. Deviation,.00,.00
645 ,Total,Mean,721.50,33.00
646 ,,N,8,8
647 ,,Std. Deviation,72.16,23.52
648 4.00,.00,Mean,987.00,99.00
649 ,,N,4,4
650 ,,Std. Deviation,.00,.00
651 ,1.00,Mean,456.00,44.00
652 ,,N,4,4
653 ,,Std. Deviation,.00,.00
654 ,Total,Mean,721.50,71.50
655 ,,N,8,8
656 ,,Std. Deviation,283.83,29.40
657 5.00,.00,Mean,246.00,99.00
658 ,,N,4,3
659 ,,Std. Deviation,.00,.00
660 ,1.00,Mean,123.00,55.00
661 ,,N,4,4
662 ,,Std. Deviation,.00,.00
663 ,Total,Mean,184.50,73.86
664 ,,N,8,7
665 ,,Std. Deviation,65.75,23.52
666 Total,.00,Mean,629.00,67.00
667 ,,N,12,11
668 ,,Std. Deviation,316.50,44.40
669 ,1.00,Mean,456.00,51.33
670 ,,N,12,12
671 ,,Std. Deviation,283.98,5.42
672 ,Total,Mean,542.50,58.83
673 ,,N,24,23
674 ,,Std. Deviation,307.06,31.22
675 ])
676
677
678 AT_CLEANUP
679
680
681 dnl This example is based upon one kindly provided by Dana Williams
682 dnl It exercises the most complex case where there are multiple
683 dnl dependent variables AND multiple control variables in each layer.
684 AT_SETUP([MEANS multi combination])
685 AT_KEYWORDS([categorical categoricals])
686
687 AT_DATA([means-multi-combination.sps], [dnl
688 data list notable list /one two three four five six.
689 begin data
690 1 1 1 1 1 1
691 2 1 1 1 1 1
692 1 2 1 1 1 1
693 2 2 1 1 1 1
694 1 1 2 1 1 1
695 2 1 2 1 1 1
696 1 2 2 1 1 1
697 2 2 2 1 1 1
698 1 1 1 2 1 1
699 2 1 1 2 1 1
700 1 2 1 2 1 1
701 2 2 1 2 1 1
702 1 1 2 2 1 1
703 2 1 2 2 1 1
704 1 2 2 2 1 1
705 2 2 2 2 1 1
706 1 1 1 1 2 1
707 2 1 1 1 2 1
708 1 2 1 1 2 1
709 2 2 1 1 2 1
710 1 1 2 1 2 1
711 2 1 2 1 2 1
712 1 2 2 1 2 1
713 2 2 2 1 2 1
714 1 1 1 2 2 1
715 2 1 1 2 2 1
716 1 2 1 2 2 1
717 2 2 1 2 2 1
718 1 1 2 2 2 1
719 2 1 2 2 2 1
720 1 2 2 2 2 1
721 2 2 2 2 2 1
722 1 1 1 1 1 2
723 2 1 1 1 1 2
724 1 2 1 1 1 2
725 2 2 1 1 1 2
726 1 1 2 1 1 2
727 2 1 2 1 1 2
728 1 2 2 1 1 2
729 2 2 2 1 1 2
730 1 1 1 2 1 2
731 2 1 1 2 1 2
732 1 2 1 2 1 2
733 2 2 1 2 1 2
734 1 1 2 2 1 2
735 2 1 2 2 1 2
736 1 2 2 2 1 2
737 2 2 2 2 1 2
738 1 1 1 1 2 2
739 2 1 1 1 2 2
740 1 2 1 1 2 2
741 2 2 1 1 2 2
742 1 1 2 1 2 2
743 2 1 2 1 2 2
744 1 2 2 1 2 2
745 2 2 2 1 2 2
746 1 1 1 2 2 2
747 2 1 1 2 2 2
748 1 2 1 2 2 2
749 2 2 1 2 2 2
750 1 1 2 2 2 2
751 2 1 2 2 2 2
752 1 2 2 2 2 2
753 2 2 2 2 2 2
754 end data.
755
756 recode six  (2 = 62) (1 = 61).
757 recode five (2 = 52) (1 = 51).
758 recode four (2 = 42) (1 = 41).
759 recode three (2 = 32) (1 = 31).
760
761 set format F22.5.
762
763 means tables = one two BY three four BY five six.
764 ])
765
766 AT_CHECK([pspp -O format=csv means-multi-combination.sps], [0], [dnl
767 Table: Case Processing Summary
768 ,Cases,,,,,
769 ,Included,,Excluded,,Total,
770 ,N,Percent,N,Percent,N,Percent
771 one * three * five,64,100.0%,0,.0%,64,100.0%
772 two * three * five,64,100.0%,0,.0%,64,100.0%
773 one * three * six,64,100.0%,0,.0%,64,100.0%
774 two * three * six,64,100.0%,0,.0%,64,100.0%
775 one * four * five,64,100.0%,0,.0%,64,100.0%
776 two * four * five,64,100.0%,0,.0%,64,100.0%
777 one * four * six,64,100.0%,0,.0%,64,100.0%
778 two * four * six,64,100.0%,0,.0%,64,100.0%
779
780 Table: one * two * three * five
781 three,five,,one,two
782 31.00,51.00,Mean,1.50000,1.50000
783 ,,N,16,16
784 ,,Std. Deviation,.51640,.51640
785 ,52.00,Mean,1.50000,1.50000
786 ,,N,16,16
787 ,,Std. Deviation,.51640,.51640
788 ,Total,Mean,1.50000,1.50000
789 ,,N,32,32
790 ,,Std. Deviation,.50800,.50800
791 32.00,51.00,Mean,1.50000,1.50000
792 ,,N,16,16
793 ,,Std. Deviation,.51640,.51640
794 ,52.00,Mean,1.50000,1.50000
795 ,,N,16,16
796 ,,Std. Deviation,.51640,.51640
797 ,Total,Mean,1.50000,1.50000
798 ,,N,32,32
799 ,,Std. Deviation,.50800,.50800
800 Total,51.00,Mean,1.50000,1.50000
801 ,,N,32,32
802 ,,Std. Deviation,.50800,.50800
803 ,52.00,Mean,1.50000,1.50000
804 ,,N,32,32
805 ,,Std. Deviation,.50800,.50800
806 ,Total,Mean,1.50000,1.50000
807 ,,N,64,64
808 ,,Std. Deviation,.50395,.50395
809
810 Table: one * two * three * six
811 three,six,,one,two
812 31.00,61.00,Mean,1.50000,1.50000
813 ,,N,16,16
814 ,,Std. Deviation,.51640,.51640
815 ,62.00,Mean,1.50000,1.50000
816 ,,N,16,16
817 ,,Std. Deviation,.51640,.51640
818 ,Total,Mean,1.50000,1.50000
819 ,,N,32,32
820 ,,Std. Deviation,.50800,.50800
821 32.00,61.00,Mean,1.50000,1.50000
822 ,,N,16,16
823 ,,Std. Deviation,.51640,.51640
824 ,62.00,Mean,1.50000,1.50000
825 ,,N,16,16
826 ,,Std. Deviation,.51640,.51640
827 ,Total,Mean,1.50000,1.50000
828 ,,N,32,32
829 ,,Std. Deviation,.50800,.50800
830 Total,61.00,Mean,1.50000,1.50000
831 ,,N,32,32
832 ,,Std. Deviation,.50800,.50800
833 ,62.00,Mean,1.50000,1.50000
834 ,,N,32,32
835 ,,Std. Deviation,.50800,.50800
836 ,Total,Mean,1.50000,1.50000
837 ,,N,64,64
838 ,,Std. Deviation,.50395,.50395
839
840 Table: one * two * four * five
841 four,five,,one,two
842 41.00,51.00,Mean,1.50000,1.50000
843 ,,N,16,16
844 ,,Std. Deviation,.51640,.51640
845 ,52.00,Mean,1.50000,1.50000
846 ,,N,16,16
847 ,,Std. Deviation,.51640,.51640
848 ,Total,Mean,1.50000,1.50000
849 ,,N,32,32
850 ,,Std. Deviation,.50800,.50800
851 42.00,51.00,Mean,1.50000,1.50000
852 ,,N,16,16
853 ,,Std. Deviation,.51640,.51640
854 ,52.00,Mean,1.50000,1.50000
855 ,,N,16,16
856 ,,Std. Deviation,.51640,.51640
857 ,Total,Mean,1.50000,1.50000
858 ,,N,32,32
859 ,,Std. Deviation,.50800,.50800
860 Total,51.00,Mean,1.50000,1.50000
861 ,,N,32,32
862 ,,Std. Deviation,.50800,.50800
863 ,52.00,Mean,1.50000,1.50000
864 ,,N,32,32
865 ,,Std. Deviation,.50800,.50800
866 ,Total,Mean,1.50000,1.50000
867 ,,N,64,64
868 ,,Std. Deviation,.50395,.50395
869
870 Table: one * two * four * six
871 four,six,,one,two
872 41.00,61.00,Mean,1.50000,1.50000
873 ,,N,16,16
874 ,,Std. Deviation,.51640,.51640
875 ,62.00,Mean,1.50000,1.50000
876 ,,N,16,16
877 ,,Std. Deviation,.51640,.51640
878 ,Total,Mean,1.50000,1.50000
879 ,,N,32,32
880 ,,Std. Deviation,.50800,.50800
881 42.00,61.00,Mean,1.50000,1.50000
882 ,,N,16,16
883 ,,Std. Deviation,.51640,.51640
884 ,62.00,Mean,1.50000,1.50000
885 ,,N,16,16
886 ,,Std. Deviation,.51640,.51640
887 ,Total,Mean,1.50000,1.50000
888 ,,N,32,32
889 ,,Std. Deviation,.50800,.50800
890 Total,61.00,Mean,1.50000,1.50000
891 ,,N,32,32
892 ,,Std. Deviation,.50800,.50800
893 ,62.00,Mean,1.50000,1.50000
894 ,,N,32,32
895 ,,Std. Deviation,.50800,.50800
896 ,Total,Mean,1.50000,1.50000
897 ,,N,64,64
898 ,,Std. Deviation,.50395,.50395
899 ])
900
901 AT_CLEANUP
902
903
904 dnl This example was observed to cause a crash in the
905 dnl destructor.  Found by zzuf.
906 AT_SETUP([MEANS clean up])
907 AT_KEYWORDS([categorical categoricals])
908
909 AT_DATA([means-bad.sps], [dnl
910 data list notable list /one two three four five six.
911 begin data
912 1 1 1 1 1 1
913 2 1 1 1 1 !
914 1 2 2 2 2 2
915 2 2 2 2 2 2
916 end data.
917
918 means tables = one two BY thsee four BY five six.
919 ])
920
921 AT_CHECK([pspp -O format=csv means-bad.sps], [1], [ignore])
922
923 AT_CLEANUP
924
925
926 dnl Another example which caused a crash.
927 dnl Found by zzuf.
928 AT_SETUP([MEANS control all missing])
929 AT_KEYWORDS([categorical categoricals])
930
931 AT_DATA([means-bad.sps], [dnl
932 data list notable list /a * b *  y * uu *.
933 begin data.
934 6 3 . 5
935 6 3 . 5
936 6 4 . 5
937 end data.
938
939 means table = b by a by y by uu
940   .
941 ])
942
943 AT_CHECK([pspp -O format=csv means-bad.sps], [0], [dnl
944 Table: Case Processing Summary
945 ,Cases,,,,,
946 ,Included,,Excluded,,Total,
947 ,N,Percent,N,Percent,N,Percent
948 b * a * y * uu,0,.0%,3,100.0%,3,100.0%
949
950 "warning: The table ""a * y * uu"" has no non-empty control variables.  No result for this table will be displayed."
951 ])
952
953 AT_CLEANUP
954
955
956 dnl Do some tests on the MISSING keyword.
957 AT_SETUP([MEANS missing classes])
958 AT_KEYWORDS([categorical categoricals])
959
960 AT_DATA([means-missing-classes.sps], [dnl
961 data list notable list /hand * score *.
962 begin data.
963 1 17
964 1 17
965 1 17
966 1 16
967 1 17
968 1 16
969 1 16
970 1 .
971 1 99
972 2 21
973 2 22
974 2 20
975 2 20
976 2 20
977 2 20
978 2 20
979 2 20
980 2 20
981 2 20
982 9 55
983 end data.
984
985 missing values score (99).
986 missing values hand (9).
987
988 means tables=score  by hand
989         /cells = count max
990         /missing = dependent
991         .
992
993 means tables=score  by hand
994         /cells = count max
995         /missing = include
996         .
997
998 means tables=score  by hand
999         /cells = count max
1000         .
1001
1002 ])
1003
1004 AT_CHECK([pspp -O format=csv means-missing-classes.sps], [0], [dnl
1005 Table: Case Processing Summary
1006 ,Cases,,,,,
1007 ,Included,,Excluded,,Total,
1008 ,N,Percent,N,Percent,N,Percent
1009 score * hand,18,90.0%,2,10.0%,20,100.0%
1010
1011 Table: Report
1012 hand,N,Maximum
1013 1.00,7,17.00
1014 2.00,10,22.00
1015 9.00,1,55.00
1016 Total,18,55.00
1017
1018 Table: Case Processing Summary
1019 ,Cases,,,,,
1020 ,Included,,Excluded,,Total,
1021 ,N,Percent,N,Percent,N,Percent
1022 score * hand,19,95.0%,1,5.0%,20,100.0%
1023
1024 Table: Report
1025 hand,N,Maximum
1026 1.00,8,99.00
1027 2.00,10,22.00
1028 9.00,1,55.00
1029 Total,19,99.00
1030
1031 Table: Case Processing Summary
1032 ,Cases,,,,,
1033 ,Included,,Excluded,,Total,
1034 ,N,Percent,N,Percent,N,Percent
1035 score * hand,17,85.0%,3,15.0%,20,100.0%
1036
1037 Table: Report
1038 hand,N,Maximum
1039 1.00,7,17.00
1040 2.00,10,22.00
1041 Total,17,22.00
1042 ])
1043
1044 AT_CLEANUP
1045
1046
1047