ae8bc5a0c9d4f72aa5b70057f171cb14b073010d
[pspp-builds.git] / tests / stats / descript-missing.sh
1 #!/bin/sh
2
3 # This program tests that the descriptives command actually works
4
5 TEMPDIR=/tmp/pspp-tst-$$
6
7 here=`pwd`;
8
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
11
12 STAT_CONFIG_PATH=$top_srcdir/config
13 export STAT_CONFIG_PATH
14
15
16 cleanup()
17 {
18      rm -rf $TEMPDIR
19 }
20
21
22 fail()
23 {
24     echo $activity
25     echo FAILED
26     cleanup;
27     exit 1;
28 }
29
30
31 no_result()
32 {
33     echo $activity
34     echo NO RESULT;
35     cleanup;
36     exit 2;
37 }
38
39 pass()
40 {
41     cleanup;
42     exit 0;
43 }
44
45 mkdir -p $TEMPDIR
46
47 cd $TEMPDIR
48
49 activity="create program"
50 cat > $TEMPDIR/descript.stat <<EOF
51 title 'Test DESCRIPTIVES procedure'.
52
53 data list / V1 TO V3 1-3.
54 mis val v1 to v3 (1).
55 begin data.
56 111
57    
58  1 
59 1 1
60 112
61 123
62 234
63 end data.
64
65 descript all/stat=all/format=serial.
66 descript all/stat=all/format=serial/missing=include.
67 descript all/stat=all/format=serial/missing=listwise.
68 descript all/stat=all/format=serial/missing=listwise include.
69
70 EOF
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73
74 activity="run program"
75 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/descript.stat
76 if [ $? -ne 0 ] ; then no_result ; fi
77
78 activity="compare output"
79 diff -B -b $TEMPDIR/pspp.list - <<EOF
80 1.1 DATA LIST.  Reading 1 record from the command file.
81 +--------+------+-------+------+
82 |Variable|Record|Columns|Format|
83 #========#======#=======#======#
84 |V1      |     1|  1-  1|F1.0  |
85 |V2      |     1|  2-  2|F1.0  |
86 |V3      |     1|  3-  3|F1.0  |
87 +--------+------+-------+------+
88
89 2.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 6.
90 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
91 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
92 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
93 |V1      #      1|        6|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
94 |V2      #      2|        5|2.500|    .500|   .707|    .500|    .   |    .   |    .   |    .   |1.000|  2.000|  3.000|5.000|
95 |V3      #      3|        4|3.000|    .577|  1.000|   1.000|    .   |    .   |    .000|   1.225|2.000|  2.000|  4.000|9.000|
96 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
97
98 3.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 3.
99 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
100 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
101 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
102 |V1      #      5|        2|1.200|    .200|   .447|    .200|   5.000|   2.000|   2.236|    .913|1.000|  1.000|  2.000| 6.000|
103 |V2      #      5|        2|1.600|    .400|   .894|    .800|    .312|   2.000|   1.258|    .913|2.000|  1.000|  3.000| 8.000|
104 |V3      #      5|        2|2.200|    .583|  1.304|   1.700|  -1.488|   2.000|    .541|    .913|3.000|  1.000|  4.000|11.000|
105 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
106
107 4.1 DESCRIPTIVES.  Valid cases = 1; cases with missing value(s) = 6.
108 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
109 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
110 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
111 |V1      #      1|        0|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
112 |V2      #      1|        0|3.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  3.000|  3.000|3.000|
113 |V3      #      1|        0|4.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  4.000|  4.000|4.000|
114 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
115
116 5.1 DESCRIPTIVES.  Valid cases = 4; cases with missing value(s) = 3.
117 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
118 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
119 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
120 |V1      #      4|        0|1.250|    .250|   .500|    .250|   4.000|   2.619|   2.000|   1.014|1.000|  1.000|  2.000| 5.000|
121 |V2      #      4|        0|1.750|    .479|   .957|    .917|  -1.289|   2.619|    .855|   1.014|2.000|  1.000|  3.000| 7.000|
122 |V3      #      4|        0|2.500|    .645|  1.291|   1.667|  -1.200|   2.619|    .000|   1.014|3.000|  1.000|  4.000|10.000|
123 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
124 EOF
125 if [ $? -ne 0 ] ; then fail ; fi
126
127
128 pass