29dab48ff2690f6095b0b9280fc14772d43c2a20
[pspp] / tests / language / stats / examine.at
1 AT_BANNER([EXAMINE])
2
3 AT_SETUP([EXAMINE])
4 AT_DATA([examine.sps], [
5 DATA LIST LIST /QUALITY * W * BRAND * .
6 BEGIN DATA
7 3  1  1
8 2  2  1
9 1  2  1
10 1  1  1
11 4  1  1
12 4  1  1
13 5  1  2
14 2  1  2
15 4  4  2
16 2  1  2
17 3  1  2
18 7  1  3
19 4  2  3
20 5  3  3
21 3  1  3
22 6  1  3
23 END DATA
24
25 WEIGHT BY w.
26
27 VARIABLE LABELS brand   'Manufacturer'.
28 VARIABLE LABELS quality 'Breaking Strain'.
29
30 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
31
32 LIST /FORMAT=NUMBERED.
33
34 EXAMINE
35         quality BY brand
36         /STATISTICS descriptives extreme(3)
37         .
38 ])
39
40
41 dnl In the following data, only the extreme values have been checked.
42 dnl The descriptives have been blindly pasted.
43 AT_CHECK([pspp -O format=csv examine.sps], [0], [dnl
44 Table: Reading free-form data from INLINE.
45 Variable,Format
46 QUALITY,F8.0
47 W,F8.0
48 BRAND,F8.0
49
50 Table: Data List
51 Case Number,QUALITY,W,BRAND
52 1,3.00,1.00,1.00
53 2,2.00,2.00,1.00
54 3,1.00,2.00,1.00
55 4,1.00,1.00,1.00
56 5,4.00,1.00,1.00
57 6,4.00,1.00,1.00
58 7,5.00,1.00,2.00
59 8,2.00,1.00,2.00
60 9,4.00,4.00,2.00
61 10,2.00,1.00,2.00
62 11,3.00,1.00,2.00
63 12,7.00,1.00,3.00
64 13,4.00,2.00,3.00
65 14,5.00,3.00,3.00
66 15,3.00,1.00,3.00
67 16,6.00,1.00,3.00
68
69 Table: Case Processing Summary
70 ,Cases,,,,,
71 ,Valid,,Missing,,Total,
72 ,N,Percent,N,Percent,N,Percent
73 Breaking Strain,24.00,100%,.00,0%,24.00,100%
74
75 Table: Extreme Values
76 ,,,Case Number,Value
77 Breaking Strain,Highest,1,12,7.00
78 ,,2,16,6.00
79 ,,3,14,5.00
80 ,Lowest,1,3,1.00
81 ,,2,4,1.00
82 ,,3,2,2.00
83
84 Table: Descriptives
85 ,,,Statistic,Std. Error
86 Breaking Strain,Mean,,3.54,.32
87 ,95% Confidence Interval for Mean,Lower Bound,2.87,
88 ,,Upper Bound,4.21,
89 ,5% Trimmed Mean,,3.50,
90 ,Median,,4.00,
91 ,Variance,,2.52,
92 ,Std. Deviation,,1.59,
93 ,Minimum,,1.00,
94 ,Maximum,,7.00,
95 ,Range,,6.00,
96 ,Interquartile Range,,2.75,
97 ,Skewness,,.06,.47
98 ,Kurtosis,,-.36,.92
99
100 Table: Case Processing Summary
101 ,,Cases,,,,,
102 ,,Valid,,Missing,,Total,
103 ,Manufacturer,N,Percent,N,Percent,N,Percent
104 Breaking Strain,Aspeger,8.00,100%,.00,0%,8.00,100%
105 ,Bloggs,8.00,100%,.00,0%,8.00,100%
106 ,Charlies,8.00,100%,.00,0%,8.00,100%
107
108 Table: Extreme Values
109 ,Manufacturer,,,Case Number,Value
110 Breaking Strain,Aspeger,Highest,1,6,4.00
111 ,,,2,5,4.00
112 ,,,3,1,3.00
113 ,,Lowest,1,3,1.00
114 ,,,2,4,1.00
115 ,,,3,2,2.00
116 ,Bloggs,Highest,1,7,5.00
117 ,,,2,9,4.00
118 ,,,3,11,3.00
119 ,,Lowest,1,8,2.00
120 ,,,2,10,2.00
121 ,,,3,11,3.00
122 ,Charlies,Highest,1,12,7.00
123 ,,,2,16,6.00
124 ,,,3,14,5.00
125 ,,Lowest,1,15,3.00
126 ,,,2,13,4.00
127 ,,,3,14,5.00
128
129 Table: Descriptives
130 ,Manufacturer,,,Statistic,Std. Error
131 Breaking Strain,Aspeger,Mean,,2.25,.45
132 ,,95% Confidence Interval for Mean,Lower Bound,1.18,
133 ,,,Upper Bound,3.32,
134 ,,5% Trimmed Mean,,2.22,
135 ,,Median,,2.00,
136 ,,Variance,,1.64,
137 ,,Std. Deviation,,1.28,
138 ,,Minimum,,1.00,
139 ,,Maximum,,4.00,
140 ,,Range,,3.00,
141 ,,Interquartile Range,,2.75,
142 ,,Skewness,,.47,.75
143 ,,Kurtosis,,-1.55,1.48
144 ,Bloggs,Mean,,3.50,.38
145 ,,95% Confidence Interval for Mean,Lower Bound,2.61,
146 ,,,Upper Bound,4.39,
147 ,,5% Trimmed Mean,,3.50,
148 ,,Median,,4.00,
149 ,,Variance,,1.14,
150 ,,Std. Deviation,,1.07,
151 ,,Minimum,,2.00,
152 ,,Maximum,,5.00,
153 ,,Range,,3.00,
154 ,,Interquartile Range,,1.75,
155 ,,Skewness,,-.47,.75
156 ,,Kurtosis,,-.83,1.48
157 ,Charlies,Mean,,4.88,.44
158 ,,95% Confidence Interval for Mean,Lower Bound,3.83,
159 ,,,Upper Bound,5.92,
160 ,,5% Trimmed Mean,,4.86,
161 ,,Median,,5.00,
162 ,,Variance,,1.55,
163 ,,Std. Deviation,,1.25,
164 ,,Minimum,,3.00,
165 ,,Maximum,,7.00,
166 ,,Range,,4.00,
167 ,,Interquartile Range,,1.75,
168 ,,Skewness,,.30,.75
169 ,,Kurtosis,,.15,1.48
170 ])
171
172 AT_CLEANUP
173
174 AT_SETUP([EXAMINE -- extremes])
175 AT_DATA([examine.sps], [dnl
176 data list free /V1 W
177 begin data.
178 1  1
179 2  1
180 3  2
181 3  1
182 4  1
183 5  1
184 6  1
185 7  1
186 8  1
187 9  1
188 10 1
189 11 1
190 12 1
191 13 1
192 14 1
193 15 1
194 16 1
195 17 1
196 18 2
197 19 1
198 20 1
199 end data.
200
201 weight by w.
202
203 examine v1 
204  /statistics=extreme(6)
205  .
206 ])
207
208 AT_CHECK([pspp -O format=csv examine.sps], [0],[dnl
209 Table: Case Processing Summary
210 ,Cases,,,,,
211 ,Valid,,Missing,,Total,
212 ,N,Percent,N,Percent,N,Percent
213 V1,23.00,100%,.00,0%,23.00,100%
214
215 Table: Extreme Values
216 ,,,Case Number,Value
217 V1,Highest,1,21,20.00
218 ,,2,20,19.00
219 ,,3,19,18.00
220 ,,4,18,17.00
221 ,,5,17,16.00
222 ,,6,16,15.00
223 ,Lowest,1,1,1.00
224 ,,2,2,2.00
225 ,,3,3,3.00
226 ,,4,4,3.00
227 ,,5,5,4.00
228 ,,6,6,5.00
229 ])
230
231 AT_CLEANUP
232
233
234
235 AT_SETUP([EXAMINE -- extremes with fractional weights])
236 AT_DATA([extreme.sps], [dnl
237 set format=F20.3.
238 data list notable list /w * x *.
239 begin data.
240  0.88  300000
241  0.86  320000
242  0.98  480000
243  0.93  960000
244  1.35  960000
245  1.31  960000
246  0.88  960000
247  0.88  1080000
248  0.88  1080000
249  0.95  1200000
250  1.47  1200000
251  0.93  1200000
252  0.98  1320000
253  1.31  1380000
254  0.93  1440000
255  0.88  1560000
256  1.56  1560000
257  1.47  1560000
258 end data.
259
260 weight by w.
261
262
263 EXAMINE
264         x
265         /STATISTICS = DESCRIPTIVES EXTREME (5)
266         .
267 ])
268
269 AT_CHECK([pspp -O format=csv  extreme.sps], [0], [dnl
270 Table: Case Processing Summary
271 ,Cases,,,,,
272 ,Valid,,Missing,,Total,
273 ,N,Percent,N,Percent,N,Percent
274 x,19.430,100%,.000,0%,19.430,100%
275
276 Table: Extreme Values
277 ,,,Case Number,Value
278 x,Highest,1,18,1560000.000
279 ,,2,17,1560000.000
280 ,,3,16,1560000.000
281 ,,4,15,1440000.000
282 ,,5,14,1380000.000
283 ,Lowest,1,1,300000.000
284 ,,2,2,320000.000
285 ,,3,3,480000.000
286 ,,4,4,960000.000
287 ,,5,5,960000.000
288
289 Table: Descriptives
290 ,,,Statistic,Std. Error
291 x,Mean,,1120010.293,86222.178
292 ,95% Confidence Interval for Mean,Lower Bound,939166.693,
293 ,,Upper Bound,1300853.894,
294 ,5% Trimmed Mean,,1141017.899,
295 ,Median,,1200000.000,
296 ,Variance,,144447748124.869,
297 ,Std. Deviation,,380062.821,
298 ,Minimum,,300000.000,
299 ,Maximum,,1560000.000,
300 ,Range,,1260000.000,
301 ,Interquartile Range,,467258.065,
302 ,Skewness,,-.887,.519
303 ,Kurtosis,,.340,1.005
304 ])
305
306 AT_CLEANUP
307
308 dnl Test the PERCENTILES subcommand of the EXAMINE command.
309 dnl In particular test that it behaves properly when there are only 
310 dnl a few cases.
311 AT_SETUP([EXAMINE -- percentiles])
312 AT_DATA([examine.sps], [dnl
313 DATA LIST LIST /X *.
314 BEGIN DATA.
315 2.00 
316 8.00 
317 5.00 
318 END DATA.
319
320 EXAMINE /x
321         /PERCENTILES=HAVERAGE.
322
323 EXAMINE /x
324         /PERCENTILES=WAVERAGE.
325
326 EXAMINE /x
327         /PERCENTILES=ROUND.
328
329 EXAMINE /x
330         /PERCENTILES=EMPIRICAL.
331
332 EXAMINE /x
333         /PERCENTILES=AEMPIRICAL.
334 ])
335 AT_CHECK([pspp -o pspp.csv examine.sps])
336 AT_CHECK([cat pspp.csv], [0], [dnl
337 Table: Reading free-form data from INLINE.
338 Variable,Format
339 X,F8.0
340
341 Table: Case Processing Summary
342 ,Cases,,,,,
343 ,Valid,,Missing,,Total,
344 ,N,Percent,N,Percent,N,Percent
345 X,3,100%,0,0%,3,100%
346
347 Table: Percentiles
348 ,,Percentiles,,,,,,
349 ,,5,10,25,50,75,90,95
350 X,HAverage,.40,.80,2.00,5.00,8.00,8.00,8.00
351 ,Tukey's Hinges,,,3.50,5.00,6.50,,
352
353 Table: Case Processing Summary
354 ,Cases,,,,,
355 ,Valid,,Missing,,Total,
356 ,N,Percent,N,Percent,N,Percent
357 X,3,100%,0,0%,3,100%
358
359 Table: Percentiles
360 ,,Percentiles,,,,,,
361 ,,5,10,25,50,75,90,95
362 X,Weighted Average,.30,.60,1.50,3.50,5.75,7.10,7.55
363 ,Tukey's Hinges,,,3.50,5.00,6.50,,
364
365 Table: Case Processing Summary
366 ,Cases,,,,,
367 ,Valid,,Missing,,Total,
368 ,N,Percent,N,Percent,N,Percent
369 X,3,100%,0,0%,3,100%
370
371 Table: Percentiles
372 ,,Percentiles,,,,,,
373 ,,5,10,25,50,75,90,95
374 X,Rounded,.00,.00,2.00,5.00,5.00,8.00,8.00
375 ,Tukey's Hinges,,,3.50,5.00,6.50,,
376
377 Table: Case Processing Summary
378 ,Cases,,,,,
379 ,Valid,,Missing,,Total,
380 ,N,Percent,N,Percent,N,Percent
381 X,3,100%,0,0%,3,100%
382
383 Table: Percentiles
384 ,,Percentiles,,,,,,
385 ,,5,10,25,50,75,90,95
386 X,Empirical,2.00,2.00,2.00,5.00,8.00,8.00,8.00
387 ,Tukey's Hinges,,,3.50,5.00,6.50,,
388
389 Table: Case Processing Summary
390 ,Cases,,,,,
391 ,Valid,,Missing,,Total,
392 ,N,Percent,N,Percent,N,Percent
393 X,3,100%,0,0%,3,100%
394
395 Table: Percentiles
396 ,,Percentiles,,,,,,
397 ,,5,10,25,50,75,90,95
398 X,Empirical with averaging,2.00,2.00,2.00,5.00,8.00,8.00,8.00
399 ,Tukey's Hinges,,,3.50,5.00,6.50,,
400 ])
401 AT_CLEANUP
402
403 AT_SETUP([EXAMINE -- missing values])
404 AT_DATA([examine.sps], [dnl
405 DATA LIST LIST /x * y *.
406 BEGIN DATA.
407 1   1 
408 2   1
409 3   1
410 4   1
411 5   2
412 6   2
413 .   2
414 END DATA
415
416 EXAMINE /x by y
417         /MISSING = PAIRWISE
418         .
419 ])
420 AT_CHECK([pspp -o pspp.csv examine.sps])
421 AT_CHECK([cat pspp.csv], [0], [dnl
422 Table: Reading free-form data from INLINE.
423 Variable,Format
424 x,F8.0
425 y,F8.0
426
427 Table: Case Processing Summary
428 ,Cases,,,,,
429 ,Valid,,Missing,,Total,
430 ,N,Percent,N,Percent,N,Percent
431 x,6,85.7143%,1,14.2857%,7,100%
432
433 Table: Case Processing Summary
434 ,,Cases,,,,,
435 ,,Valid,,Missing,,Total,
436 ,y,N,Percent,N,Percent,N,Percent
437 x,1.00,4,100%,0,0%,4,100%
438 ,2.00,2,66.6667%,1,33.3333%,3,100%
439 ])
440 AT_CLEANUP
441
442
443 AT_SETUP([EXAMINE -- user missing values])
444 AT_DATA([examine-m.sps], [dnl
445 DATA LIST notable LIST /x * y *.
446 BEGIN DATA.
447 1                   2
448 9999999999          2
449 9999999999          99
450 END DATA.
451
452 MISSING VALUES x (9999999999).
453 MISSING VALUES y (99).
454
455 EXAMINE
456         /VARIABLES= x y
457         /MISSING=PAIRWISE.
458 ])
459 AT_CHECK([pspp -O format=csv examine-m.sps], [0], [dnl
460 Table: Case Processing Summary
461 ,Cases,,,,,
462 ,Valid,,Missing,,Total,
463 ,N,Percent,N,Percent,N,Percent
464 x,1,33.3333%,2,66.6667%,3,100%
465 y,2,66.6667%,1,33.3333%,3,100%
466 ])
467 AT_CLEANUP
468
469 AT_SETUP([EXAMINE -- missing values and percentiles])
470 AT_DATA([examine.sps], [dnl
471 DATA LIST LIST /X *.
472 BEGIN DATA.
473 99
474 99
475 5.00
476 END DATA.
477
478 MISSING VALUE X (99).
479
480 EXAMINE /x
481         /PERCENTILES=HAVERAGE.
482 ])
483 AT_CHECK([pspp -o pspp.csv examine.sps])
484 dnl Ignore output -- this is just a no-crash check.
485 AT_CLEANUP
486
487 dnl Tests the trimmed mean calculation in the case
488 dnl where the data is weighted towards the centre.
489 AT_SETUP([EXAMINE -- trimmed mean])
490 AT_DATA([examine.sps], [dnl
491 DATA LIST LIST /X * C *.
492 BEGIN DATA.
493 1 1
494 2 49
495 3 2
496 END DATA.
497
498 WEIGHT BY c.
499
500 EXAMINE
501         x
502         /STATISTICS=DESCRIPTIVES
503         .
504 ])
505 AT_CHECK([pspp -o pspp.csv examine.sps])
506 AT_CHECK([cat pspp.csv], [0], [dnl
507 Table: Reading free-form data from INLINE.
508 Variable,Format
509 X,F8.0
510 C,F8.0
511
512 Table: Case Processing Summary
513 ,Cases,,,,,
514 ,Valid,,Missing,,Total,
515 ,N,Percent,N,Percent,N,Percent
516 X,52.00,100%,.00,0%,52.00,100%
517
518 Table: Descriptives
519 ,,,Statistic,Std. Error
520 X,Mean,,2.02,.03
521 ,95% Confidence Interval for Mean,Lower Bound,1.95,
522 ,,Upper Bound,2.09,
523 ,5% Trimmed Mean,,2.00,
524 ,Median,,2.00,
525 ,Variance,,.06,
526 ,Std. Deviation,,.24,
527 ,Minimum,,1.00,
528 ,Maximum,,3.00,
529 ,Range,,2.00,
530 ,Interquartile Range,,.00,
531 ,Skewness,,1.19,.33
532 ,Kurtosis,,15.73,.65
533 ])
534 AT_CLEANUP
535
536 AT_SETUP([EXAMINE -- crash bug])
537 AT_DATA([examine.sps], [dnl
538 data list list /a * x * y *.
539 begin data.
540 3 1 3
541 5 1 4
542 7 2 3
543 end data.
544
545 examine a by x by y
546         /statistics=DESCRIPTIVES
547         . 
548 ])
549 AT_CHECK([pspp -o pspp.csv examine.sps])
550 dnl Ignore output -- this is just a no-crash check.
551 AT_CLEANUP
552
553 dnl Test that two consecutive EXAMINE commands don't crash PSPP.
554 AT_SETUP([EXAMINE -- consecutive runs don't crash])
555 AT_DATA([examine.sps], [dnl
556 data list list /y * z *.
557 begin data.
558 6 4
559 5 3
560 7 6
561 end data.
562
563 EXAMINE /VARIABLES= z BY y.
564
565 EXAMINE /VARIABLES= z. 
566 ])
567 AT_CHECK([pspp -o pspp.csv examine.sps])
568 dnl Ignore output -- this is just a no-crash check.
569 AT_CLEANUP
570
571 dnl Test that /DESCRIPTIVES does not crash in presence of missing values.
572 AT_SETUP([EXAMINE -- missing values don't crash])
573 AT_DATA([examine.sps], [dnl
574 data list list /x * y *.
575 begin data.
576 1 0
577 2 0
578 . 0
579 3 1
580 4 1
581 end data.
582 examine x by y /statistics=descriptives. 
583 ])
584 AT_CHECK([pspp -o pspp.csv examine.sps])
585 dnl Ignore output -- this is just a no-crash check.
586 AT_CLEANUP
587
588 dnl Test that having only a single case doesn't crash.
589 AT_SETUP([EXAMINE -- single case doesn't crash])
590 AT_DATA([examine.sps], [dnl
591 DATA LIST LIST /quality * .
592 BEGIN DATA
593 3  
594 END DATA
595
596
597 EXAMINE
598         quality 
599         /STATISTICS descriptives 
600         /PLOT = histogram
601         .
602 ])
603 AT_CHECK([pspp -o pspp.csv examine.sps], [0], [ignore])
604 dnl Ignore output -- this is just a no-crash check.
605 AT_CLEANUP
606
607 dnl Test that all-missing data doesn't crash.
608 AT_SETUP([EXAMINE -- all-missing data doesn't crash])
609 AT_DATA([examine.sps], [dnl
610 DATA LIST LIST /x *.
611 BEGIN DATA.
612 .
613 .
614 .
615 .
616 END DATA.
617
618 EXAMINE /x PLOT=HISTOGRAM.
619 ])
620 AT_CHECK([pspp -o pspp.csv examine.sps], [0], [ignore])
621 dnl Ignore output -- this is just a no-crash check.
622 AT_CLEANUP
623
624 dnl Test that big input doesn't crash (bug 11307).
625 AT_SETUP([EXAMINE -- big input doesn't crash])
626 AT_DATA([examine.sps], [dnl
627 INPUT PROGRAM.
628         LOOP #I=1 TO 50000.
629                 COMPUTE X=NORMAL(10).
630                 END CASE.
631         END LOOP.
632         END FILE.
633 END INPUT PROGRAM.
634
635
636 EXAMINE /x
637         /STATISTICS=DESCRIPTIVES.
638 ])
639 AT_CHECK([pspp -o pspp.csv examine.sps])
640 dnl Ignore output -- this is just a no-crash check.
641 AT_CLEANUP
642
643 dnl Another test that big input doesn't crash.
644 dnl The actual bug that this checks for has been lost.
645 AT_SETUP([EXAMINE -- big input doesn't crash 2])
646 AT_DATA([make-big-input.pl], 
647   [for ($i=0; $i<100000; $i++) { print "AB12\n" };
648    for ($i=0; $i<100000; $i++) { print "AB04\n" };
649 ])
650 AT_CHECK([$PERL make-big-input.pl > large.txt])
651 AT_DATA([examine.sps], [dnl
652 DATA LIST FILE='large.txt' /S 1-2 (A) X 3 .
653
654
655 AGGREGATE OUTFILE=* /BREAK=X /A=N.
656
657
658 EXAMINE /A BY X.
659 ])
660 AT_CHECK([pspp -o pspp.csv examine.sps])
661 dnl Ignore output -- this is just a no-crash check.
662 AT_DATA([more-big-input.pl], 
663   [for ($i=0; $i<25000; $i++) { print "AB04\nAB12\n" };
664 ])
665 AT_CHECK([$PERL more-big-input.pl >> large.txt])
666 AT_CHECK([pspp -o pspp.csv examine.sps])
667 dnl Ignore output -- this is just a no-crash check.
668 AT_CLEANUP
669
670
671 dnl Test that the ID command works with non-numberic variables
672 AT_SETUP([EXAMINE -- non-numeric ID])
673
674 AT_DATA([examine-id.sps], [dnl
675 data list notable list /x * y (a12).
676 begin data.
677 1  one
678 2  two
679 3  three
680 4  four
681 5  five
682 6  six
683 7  seven
684 8  eight
685 9  nine
686 10 ten
687 11 eleven
688 12 twelve
689 30 thirty
690 300 threehundred
691 end data.
692
693 examine x
694         /statistics = extreme
695         /id = y
696         /plot = boxplot
697         .
698 ])
699
700 AT_CHECK([pspp -O format=csv examine-id.sps], [0], 
701 [Table: Case Processing Summary
702 ,Cases,,,,,
703 ,Valid,,Missing,,Total,
704 ,N,Percent,N,Percent,N,Percent
705 x,14,100%,0,0%,14,100%
706
707 Table: Extreme Values
708 ,,,y,Value
709 x,Highest,1,threehundred,300.00
710 ,,2,thirty      ,30.00
711 ,,3,twelve      ,12.00
712 ,,4,eleven      ,11.00
713 ,,5,ten         ,10.00
714 ,Lowest,1,one         ,1.00
715 ,,2,two         ,2.00
716 ,,3,three       ,3.00
717 ,,4,four        ,4.00
718 ,,5,five        ,5.00
719 ])
720
721 AT_CLEANUP 
722
723 dnl Test for a crash which happened on cleanup from a bad input syntax
724 AT_SETUP([EXAMINE -- Bad Input])
725
726 AT_DATA([examine-bad.sps], [dnl
727 data list list /h * g *.
728 begin data.
729 1 1
730 2 1
731 3 1
732 4 1
733 5 2
734 6 2
735 7 2
736 8 2
737 9 2
738 end data.
739
740 EXAMINE 
741         /VARIABLES= h
742         BY  g
743         /STATISTICS = DESCRIPTIVES EXTREME
744         /PLOT = lkajsdas
745         .
746 ])
747
748 AT_CHECK([pspp -o pspp.csv examine-bad.sps], [1], [ignore])
749
750 AT_CLEANUP 
751
752
753 dnl Check the MISSING=REPORT option
754 AT_SETUP([EXAMINE -- MISSING=REPORT])
755
756
757 AT_DATA([examine-report.sps], [dnl
758 set format = F22.0.
759 data list list /x * g *.
760 begin data.
761 1   1
762 2   1
763 3   1
764 4   1
765 5   1
766 6   1
767 7   1
768 8   1
769 9   1
770 10   2
771 20   2
772 30   2
773 40   2
774 50   2
775 60   2
776 70   2
777 80   2
778 90   2
779 101   9
780 201   9
781 301   9
782 401   9
783 501   99
784 601   99
785 701   99
786 801   99
787 901   99
788 1001  .
789 2002  .
790 3003  .
791 4004  .
792 end data.
793
794 MISSING VALUES g (9, 99, 999).
795
796 EXAMINE
797         /VARIABLES = x
798         BY  g
799         /STATISTICS = EXTREME
800         /NOTOTAL
801         /MISSING = REPORT.
802 ])
803
804
805 AT_CHECK([pspp -O format=csv examine-report.sps], [0], [dnl
806 Table: Reading free-form data from INLINE.
807 Variable,Format
808 x,F8.0
809 g,F8.0
810
811 Table: Case Processing Summary
812 ,,Cases,,,,,
813 ,,Valid,,Missing,,Total,
814 ,g,N,Percent,N,Percent,N,Percent
815 x,. (missing),4,100%,0,0%,4,100%
816 ,1,9,100%,0,0%,9,100%
817 ,2,9,100%,0,0%,9,100%
818 ,9 (missing),4,100%,0,0%,4,100%
819 ,99 (missing),5,100%,0,0%,5,100%
820
821 Table: Extreme Values
822 ,g,,,Case Number,Value
823 x,. (missing),Highest,1,31,4004
824 ,,,2,30,3003
825 ,,,3,29,2002
826 ,,,4,28,1001
827 ,,,5,0,0
828 ,,Lowest,1,28,1001
829 ,,,2,29,2002
830 ,,,3,30,3003
831 ,,,4,31,4004
832 ,,,5,31,4004
833 ,1,Highest,1,9,9
834 ,,,2,8,8
835 ,,,3,7,7
836 ,,,4,6,6
837 ,,,5,5,5
838 ,,Lowest,1,1,1
839 ,,,2,2,2
840 ,,,3,3,3
841 ,,,4,4,4
842 ,,,5,5,5
843 ,2,Highest,1,18,90
844 ,,,2,17,80
845 ,,,3,16,70
846 ,,,4,15,60
847 ,,,5,14,50
848 ,,Lowest,1,10,10
849 ,,,2,11,20
850 ,,,3,12,30
851 ,,,4,13,40
852 ,,,5,14,50
853 ,9 (missing),Highest,1,22,401
854 ,,,2,21,301
855 ,,,3,20,201
856 ,,,4,19,101
857 ,,,5,0,0
858 ,,Lowest,1,19,101
859 ,,,2,20,201
860 ,,,3,21,301
861 ,,,4,22,401
862 ,,,5,22,401
863 ,99 (missing),Highest,1,27,901
864 ,,,2,26,801
865 ,,,3,25,701
866 ,,,4,24,601
867 ,,,5,23,501
868 ,,Lowest,1,23,501
869 ,,,2,24,601
870 ,,,3,25,701
871 ,,,4,26,801
872 ,,,5,27,901
873 ])
874
875
876 AT_CLEANUP 
877
878
879 dnl Run a test of the basic STATISTICS using a "real"
880 dnl dataset and comparing with "real" results kindly
881 dnl provided by Olaf Nöhring
882 AT_SETUP([EXAMINE -- sample unweighted])
883
884 AT_DATA([sample.sps], [dnl
885 set format = F22.4.
886 DATA LIST notable LIST /X *
887 BEGIN DATA.
888 461.19000000
889 466.38000000
890 479.46000000
891 480.10000000
892 483.43000000
893 488.30000000
894 489.00000000
895 491.62000000
896 505.62000000
897 511.30000000
898 521.53000000
899 526.70000000
900 528.25000000
901 538.70000000
902 540.22000000
903 540.58000000
904 546.10000000
905 548.17000000
906 553.99000000
907 566.21000000
908 575.90000000
909 584.38000000
910 593.40000000
911 357.05000000
912 359.73000000
913 360.48000000
914 373.98000000
915 374.13000000
916 381.45000000
917 383.72000000
918 390.00000000
919 400.34000000
920 415.32000000
921 415.91000000
922 418.30000000
923 421.03000000
924 422.43000000
925 426.93000000
926 433.25000000
927 436.89000000
928 445.33000000
929 446.33000000
930 446.55000000
931 456.44000000
932 689.49000000
933 691.92000000
934 695.00000000
935 695.36000000
936 698.21000000
937 699.46000000
938 706.61000000
939 710.69000000
940 715.82000000
941 715.82000000
942 741.39000000
943 752.27000000
944 756.73000000
945 757.74000000
946 759.57000000
947 796.07000000
948 813.78000000
949 817.25000000
950 825.48000000
951 831.28000000
952 849.24000000
953 890.00000000
954 894.78000000
955 935.65000000
956 935.90000000
957 945.90000000
958 1012.8600000
959 1022.6000000
960 1061.8100000
961 1063.5000000
962 1077.2300000
963 1151.6300000
964 1355.2800000
965 598.88000000
966 606.91000000
967 621.60000000
968 624.80000000
969 636.13000000
970 637.38000000
971 640.32000000
972 649.35000000
973 656.51000000
974 662.55000000
975 664.69000000
976 106.22000000
977 132.24000000
978 174.76000000
979 204.85000000
980 264.93000000
981 264.99000000
982 269.84000000
983 325.12000000
984 331.67000000
985 337.26000000
986 347.68000000
987 354.91000000
988 END DATA.
989
990 EXAMINE
991         x
992         /STATISTICS=DESCRIPTIVES
993         .
994 ])
995
996 AT_CHECK([pspp -O format=csv sample.sps], [0], [dnl
997 Table: Case Processing Summary
998 ,Cases,,,,,
999 ,Valid,,Missing,,Total,
1000 ,N,Percent,N,Percent,N,Percent
1001 X,100,100%,0,0%,100,100%
1002
1003 Table: Descriptives
1004 ,,,Statistic,Std. Error
1005 X,Mean,,587.6603,23.2665
1006 ,95% Confidence Interval for Mean,Lower Bound,541.4946,
1007 ,,Upper Bound,633.8260,
1008 ,5% Trimmed Mean,,579.7064,
1009 ,Median,,547.1350,
1010 ,Variance,,54132.8466,
1011 ,Std. Deviation,,232.6647,
1012 ,Minimum,,106.2200,
1013 ,Maximum,,1355.2800,
1014 ,Range,,1249.0600,
1015 ,Interquartile Range,,293.1575,
1016 ,Skewness,,.6331,.2414
1017 ,Kurtosis,,.5300,.4783
1018 ])
1019
1020 AT_CLEANUP 
1021
1022
1023
1024 dnl Test for a crash which happened on bad input syntax
1025 AT_SETUP([EXAMINE -- Empty Parentheses])
1026
1027 AT_DATA([examine-empty-parens.sps], [dnl
1028 DATA LIST notable LIST /X *
1029 BEGIN DATA.
1030 2
1031 3
1032 END DATA.
1033
1034
1035 EXAMINE
1036         x
1037         /PLOT = SPREADLEVEL()
1038         .
1039 ])
1040
1041 AT_CHECK([pspp -o pspp.csv examine-empty-parens.sps], [1], [ignore])
1042
1043 AT_CLEANUP