+dnl PSPP - a program for statistical analysis.
+dnl Copyright (C) 2017 Free Software Foundation, Inc.
+dnl
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl
AT_BANNER([CORRELATIONS])
AT_SETUP([CORRELATIONS -- unweighted])
5 3 0 .
end data.
-correlations
+correlations
variables = foo bar wiz bang
/print nosig
/missing = listwise
.
-correlations
+correlations
variables = bar wiz
/print nosig
/missing = listwise
.
-correlations
+correlations
variables = foo bar wiz bang
/print nosig
/missing = pairwise
.
])
-AT_CHECK([pspp -o pspp.csv correlations.sps])
-AT_CHECK([cat pspp.csv], [0], [dnl
-Table: Correlations
+AT_CHECK([pspp -o pspp.csv -o pspp.txt correlations.sps])
+AT_CHECK([cat pspp.csv], [0],
+[[Table: Correlations
,,foo,bar,wiz,bang
-foo,Pearson Correlation,1.000,.802,.890,-.308
+foo,Pearson Correlation,1.000,.802,.890[a],-.308
,Sig. (2-tailed),,.055,.017,.553
bar,Pearson Correlation,.802,1.000,.519,.118
,Sig. (2-tailed),.055,,.291,.824
-wiz,Pearson Correlation,.890,.519,1.000,-.344
+wiz,Pearson Correlation,.890[a],.519,1.000,-.344
,Sig. (2-tailed),.017,.291,,.505
bang,Pearson Correlation,-.308,.118,-.344,1.000
,Sig. (2-tailed),.553,.824,.505,
+Footnote: a. Significant at .05 level
Table: Correlations
,,bar,wiz
Table: Correlations
,,foo,bar,wiz,bang
-foo,Pearson Correlation,1.000,.805,.883,-.308
+foo,Pearson Correlation,1.000,.805[a],.883[a],-.308
,Sig. (2-tailed),,.029,.008,.553
,N,7,7,7,6
-bar,Pearson Correlation,.805,1.000,.497,.164
+bar,Pearson Correlation,.805[a],1.000,.497,.164
,Sig. (2-tailed),.029,,.210,.725
,N,7,8,8,7
-wiz,Pearson Correlation,.883,.497,1.000,-.337
+wiz,Pearson Correlation,.883[a],.497,1.000,-.337
,Sig. (2-tailed),.008,.210,,.460
,N,7,8,8,7
bang,Pearson Correlation,-.308,.164,-.337,1.000
,Sig. (2-tailed),.553,.725,.460,
,N,6,7,7,7
-])
+Footnote: a. Significant at .05 level
+]])
AT_CLEANUP
AT_SETUP([CORRELATIONS -- weighted])
weight by w.
-correlations
+correlations
variables = foo bar wiz bang
/statistics=descriptives xprod
.
weight by w.
-correlations
+correlations
variables = foo bar wiz bang
/statistics=descriptives xprod
.
data list notable list /foo * bar * wiz *.
begin data.
1 1 6
-2 2 5
+2 2 5
3 3 4
4 4 3
5 5 2
6 6 1
end data.
-correlations
+correlations
variables = foo with bar wiz
.
])
AT_CHECK([sed '/a,Pearson/,$s/,\([[^,]]*\),.*/,\1,.../' pspp.csv], [0], [dnl
Table: Descriptive Statistics
,Mean,Std. Deviation,N
-a,24.00,8.93,14.00
-f,4.73,.85,12.00
-b,14.50,6.41,14.00
-c,21.71,4.98,14.00
-g,24.86,6.09,14.00
-h,23.57,6.30,14.00
-i,27.79,6.73,14.00
-e,27.21,4.95,14.00
-d,27.93,5.23,14.00
+a,24.00,8.93,14
+f,4.73,.85,12
+b,14.50,6.41,14
+c,21.71,4.98,14
+g,24.86,6.09,14
+h,23.57,6.30,14
+i,27.79,6.73,14
+e,27.21,4.95,14
+d,27.93,5.23,14
Table: Correlations
,,c,g,h,i,e,d
AT_SETUP([CORRELATIONS -- incorrect subtable selection])
AT_DATA([correlations.sps], [dnl
set format = F12.4.
+OUTPUT MODIFY /SELECT TABLES /TABLECELLS SELECT = [[CORRELATIONS]] FORMAT=F12.4.
set decimal = dot.
data list notable list /var1 var2 var3 var4 var5 *.
begin data.
])
-AT_CHECK([pspp -O format=csv correlations.sps], [0],
-[Table: Correlations
+AT_CHECK([pspp -o pspp.csv -o pspp.txt correlations.sps])
+AT_CHECK([cat pspp.csv], [0],
+[[Table: Correlations
,,var4,var5
-var1,Pearson Correlation,.5693,-.0519
-,Sig. (2-tailed),.0000,.6232
+var1,Pearson Correlation,.5693[a],-.0519
+,Sig. (2-tailed),.000,.623
,N,93,92
-var2,Pearson Correlation,.3792,-.0407
-,Sig. (2-tailed),.0002,.6985
+var2,Pearson Correlation,.3792[a],-.0407
+,Sig. (2-tailed),.000,.698
,N,95,93
-var3,Pearson Correlation,.3699,-.0543
-,Sig. (2-tailed),.0002,.6029
+var3,Pearson Correlation,.3699[a],-.0543
+,Sig. (2-tailed),.000,.603
,N,95,94
+Footnote: a. Significant at .05 level
Table: Correlations
,,var1,var2
-var3,Pearson Correlation,.6964,.5615
-,Sig. (2-tailed),.0000,.0000
+var3,Pearson Correlation,.6964[a],.5615[a]
+,Sig. (2-tailed),.000,.000
,N,96,97
-var4,Pearson Correlation,.5693,.3792
-,Sig. (2-tailed),.0000,.0002
+var4,Pearson Correlation,.5693[a],.3792[a]
+,Sig. (2-tailed),.000,.000
,N,93,95
var5,Pearson Correlation,-.0519,-.0407
-,Sig. (2-tailed),.6232,.6985
+,Sig. (2-tailed),.623,.698
,N,92,93
+Footnote: a. Significant at .05 level
+]])
+
+AT_CLEANUP
+
+
+dnl Crash found by zzuf
+AT_SETUP([CORRELATIONS -- empty dataset])
+
+AT_DATA([correlations.sps], [dnl
+data list list /a b c q g *.
+CORRELATIONS 'VARIABLES = a b.]
+)
+
+AT_CHECK([pspp -o pspp.csv correlations.sps], [1], [ignore])
+
+AT_CLEANUP
+
+dnl Another Crash found by zzuf
+AT_SETUP([CORRELATIONS -- empty dataset 2])
+
+AT_DATA([correlations.sps], [dnl
+data list notable list /foo * bar * wiz bang *.
+begin data.
+ 1 00 3 .
+ 3 9 -50 .
+98 78 104 .
+ . 4 4 .
+ 5 3 0 .
+end data.
+
+correlations
+ variables = foo bar wiz bang
+ /missing = listwise
+ .
+])
+
+AT_CHECK([pspp -O format=csv correlations.sps], [1], [dnl
+correlations.sps:13: error: CORRELATIONS: The data for the chosen variables are all missing or empty.
])
AT_CLEANUP