Table: Report
a,b,c,Mean,N,Std. Deviation
-fooberrycrumblexzaQ ,fosilationwereqd,one ,4.00,1,NaN
-,,two ,41.00,1,NaN
-,,zero ,3.00,1,NaN
+fooberrycrumblexzaQ,fosilationwereqd,one,4.00,1,NaN
+,,two,41.00,1,NaN
+,,zero,3.00,1,NaN
,,Total,16.00,3,21.66
-,onlyonekonboys ,one ,6.00,1,NaN
-,,zero ,5.00,1,NaN
+,onlyonekonboys,one,6.00,1,NaN
+,,zero,5.00,1,NaN
,,Total,5.50,2,.71
-,Total,one ,5.00,2,1.41
-,,two ,41.00,1,NaN
-,,zero ,4.00,2,1.41
+,Total,one,5.00,2,1.41
+,,two,41.00,1,NaN
+,,zero,4.00,2,1.41
,,Total,11.80,5,16.36
-wontledingbatsXASDF ,fosilationwereqd,one ,8.00,1,NaN
-,,zero ,7.00,1,NaN
+wontledingbatsXASDF,fosilationwereqd,one,8.00,1,NaN
+,,zero,7.00,1,NaN
,,Total,7.50,2,.71
-,onlyonekonboys ,one ,10.00,1,NaN
-,,zero ,9.00,1,NaN
+,onlyonekonboys,one,10.00,1,NaN
+,,zero,9.00,1,NaN
,,Total,9.50,2,.71
-,Total,one ,9.00,2,1.41
-,,zero ,8.00,2,1.41
+,Total,one,9.00,2,1.41
+,,zero,8.00,2,1.41
,,Total,8.50,4,1.29
-Total,fosilationwereqd,one ,6.00,2,2.83
-,,two ,41.00,1,NaN
-,,zero ,5.00,2,2.83
+Total,fosilationwereqd,one,6.00,2,2.83
+,,two,41.00,1,NaN
+,,zero,5.00,2,2.83
,,Total,12.60,5,16.01
-,onlyonekonboys ,one ,8.00,2,2.83
-,,zero ,7.00,2,2.83
+,onlyonekonboys,one,8.00,2,2.83
+,,zero,7.00,2,2.83
,,Total,7.50,4,2.38
-,Total,one ,7.00,4,2.58
-,,two ,41.00,1,NaN
-,,zero ,6.00,4,2.58
+,Total,one,7.00,4,2.58
+,,two,41.00,1,NaN
+,,zero,6.00,4,2.58
,,Total,10.33,9,11.73
])
AT_KEYWORDS([categorical categoricals])
AT_DATA([means-multi-combination.sps], [dnl
-data list notable list /one two three four five six.
+data list notable list /one (F22.5) two (F22.5) three four five six.
begin data
1 1 1 1 1 1
2 1 1 1 1 1
recode four (2 = 42) (1 = 41).
recode three (2 = 32) (1 = 31).
-set format F22.5.
-
means tables = one two BY three four BY five six.
])
AT_CLEANUP
+dnl Make sure that behaviour with SPLIT is correct.
+AT_SETUP([MEANS split])
+AT_KEYWORDS([categorical categoricals])
+
+AT_DATA([means-split.sps], [dnl
+data list notable list /b g *.
+begin data
+2 0
+2 0
+4 0
+4 0
+11 1
+11 1
+end data.
+
+split file by g.
+
+means b /cells = count mean.
+])
+
+AT_CHECK([pspp -O format=csv means-split.sps], [0], [dnl
+Table: Case Processing Summary
+,Cases,,,,,
+,Included,,Excluded,,Total,
+,N,Percent,N,Percent,N,Percent
+b,4,100.0%,0,.0%,4,100.0%
+
+Table: Report
+N,Mean
+4,3.00
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Included,,Excluded,,Total,
+,N,Percent,N,Percent,N,Percent
+b,2,100.0%,0,.0%,2,100.0%
+
+Table: Report
+N,Mean
+2,11.00
+])
+
+AT_CLEANUP
+
+
+dnl Test the output with unusual dependent variable formats
+AT_SETUP([MEANS formats])
+AT_KEYWORDS([categorical categoricals])
+
+AT_DATA([means-formats.sps], [dnl
+data list notable list /hours (TIME11.0) rate (DOLLAR8.2).
+begin data
+12:00 4.09
+14:01 5.23
+end data.
+
+means hours rate
+ /cells = mean count max range.
+])
+
+AT_CHECK([pspp -O format=csv means-formats.sps], [0], [dnl
+Table: Case Processing Summary
+,Cases,,,,,
+,Included,,Excluded,,Total,
+,N,Percent,N,Percent,N,Percent
+hours,2,100.0%,0,.0%,2,100.0%
+rate,2,100.0%,0,.0%,2,100.0%
+
+Table: hours * rate
+,hours,rate
+Mean,13:00:30,$4.66
+N,2,2
+Maximum,14:01:00,$5.23
+Range,02:01:00,$1.14
+])
+
+AT_CLEANUP
+AT_SETUP([MEANS syntax errors])
+AT_DATA([means.sps], [dnl
+DATA LIST LIST NOTABLE/x y z.
+MEANS TABLES **.
+MEANS x BY **.
+MEANS x/MISSING=**.
+MEANS x/CELLS=**.
+MEANS x/ **.
+])
+AT_CHECK([pspp -O format=csv means.sps], [1], [dnl
+"means.sps:2.14-2.15: error: MEANS: Syntax error expecting `='.
+ 2 | MEANS TABLES **.
+ | ^~"
+
+"means.sps:3.12-3.13: error: MEANS: Syntax error expecting variable name.
+ 3 | MEANS x BY **.
+ | ^~"
+
+"means.sps:4.17-4.18: error: MEANS: Syntax error expecting INCLUDE or DEPENDENT.
+ 4 | MEANS x/MISSING=**.
+ | ^~"
+
+"means.sps:5.15-5.16: error: MEANS: Syntax error expecting one of the following: MEAN, COUNT, STDDEV, SEMEAN, SUM, MIN, MAX, RANGE, VARIANCE, KURT, SEKURT, SKEW, SESKEW, FIRST, LAST, HARMONIC, GEOMETRIC.
+ 5 | MEANS x/CELLS=**.
+ | ^~"
+
+"means.sps:6.10-6.11: error: MEANS: Syntax error expecting MISSING or CELLS.
+ 6 | MEANS x/ **.
+ | ^~"
+])
+AT_CLEANUP
\ No newline at end of file