Table: X * Y [count].
,Y,,,,,,,
X,1.00,2.00,3.00,4.00,5.00,6.00,7.00,Total
-1.00,.0,.0,.0,.0,.0,.0,.0,.0
-2.00,.0,.0,.0,.0,.0,.0,.0,.0
-3.00,.0,.0,.0,.0,.0,.0,.0,.0
-4.00,.0,.0,.0,.0,1.0,.0,.0,1.0
-5.00,.0,.0,.0,.0,.0,.0,.0,.0
-6.00,.0,.0,.0,.0,.0,.0,.0,.0
-7.00,.0,.0,.0,.0,.0,.0,.0,.0
-Total,.0,.0,.0,.0,1.0,.0,.0,1.0
+1.00,.00,.00,.00,.00,.00,.00,.00,.00
+2.00,.00,.00,.00,.00,.00,.00,.00,.00
+3.00,.00,.00,.00,.00,.00,.00,.00,.00
+4.00,.00,.00,.00,.00,1.00,.00,.00,1.00
+5.00,.00,.00,.00,.00,.00,.00,.00,.00
+6.00,.00,.00,.00,.00,.00,.00,.00,.00
+7.00,.00,.00,.00,.00,.00,.00,.00,.00
+Total,.00,.00,.00,.00,1.00,.00,.00,1.00
]])
AT_CLEANUP
x,F8.0
y,A18
-"crosstabs.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
+"crosstabs.sps:4: warning: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
-"crosstabs.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
+"crosstabs.sps:6: warning: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
Table: Summary.
,Cases,,,,,
Table: x * y [count].
,y,,,,
x,one unity ,three lots ,two duality ,zero none ,Total
-1.00,1.0,.0,.0,1.0,2.0
-2.00,.0,.0,1.0,.0,1.0
-3.00,.0,1.0,.0,.0,1.0
-Total,1.0,1.0,1.0,1.0,4.0
+1.00,1.00,.00,.00,1.00,2.00
+2.00,.00,.00,1.00,.00,1.00
+3.00,.00,1.00,.00,.00,1.00
+Total,1.00,1.00,1.00,1.00,4.00
]])
AT_CLEANUP
Table: y * z [count].
,z,,
y,1,2,Total
-1,4.0,3.0,7.0
-2,1.0,1.0,2.0
-Total,5.0,4.0,9.0
+1,4.00,3.00,7.00
+2,1.00,1.00,2.00
+Total,5.00,4.00,9.00
]])
AT_CLEANUP
Table: x * y [count].
,y,,
x,1.00,2.00,Total
-2.00,.0,1.0,1.0
-3.00,1.0,.0,1.0
-4.00,1.0,1.0,2.0
-Total,2.0,2.0,4.0
+2.00,.00,1.00,1.00
+3.00,1.00,.00,1.00
+4.00,1.00,1.00,2.00
+Total,2.00,2.00,4.00
Table: Chi-square tests.
Statistic,Value,df,Asymp. Sig. (2-tailed)
CROSSTABS
/TABLES= v1 BY v2
- /FORMAT=AVALUE LABELS TABLES PIVOT
+ /FORMAT=AVALUE TABLES PIVOT
/STATISTICS=CHISQ
/CELLS=COUNT ROW COLUMN TOTAL.
])
"Table: v1 * v2 [count, row %, column %, total %]."
,v2,,
v1,e ,f ,Total
-c ,3.0,1.0,4.0
-,75.0%,25.0%,100.0%
-,75.0%,50.0%,66.7%
-,50.0%,16.7%,66.7%
-d ,1.0,1.0,2.0
-,50.0%,50.0%,100.0%
-,25.0%,50.0%,33.3%
-,16.7%,16.7%,33.3%
-Total,4.0,2.0,6.0
-,66.7%,33.3%,100.0%
-,100.0%,100.0%,100.0%
-,66.7%,33.3%,100.0%
+c ,3.00,1.00,4.00
+,75.00%,25.00%,100.00%
+,75.00%,50.00%,66.67%
+,50.00%,16.67%,66.67%
+d ,1.00,1.00,2.00
+,50.00%,50.00%,100.00%
+,25.00%,50.00%,33.33%
+,16.67%,16.67%,33.33%
+Total,4.00,2.00,6.00
+,66.67%,33.33%,100.00%
+,100.00%,100.00%,100.00%
+,66.67%,33.33%,100.00%
Table: Chi-square tests.
Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
"Table: v1 * v2 [count, row %, column %, total %]."
,v2,,
v1,e ,f ,Total
-c ,.0,1.0,1.0
-,.0%,100.0%,100.0%
-,.0%,33.3%,25.0%
-,.0%,25.0%,25.0%
-d ,1.0,2.0,3.0
-,33.3%,66.7%,100.0%
-,100.0%,66.7%,75.0%
-,25.0%,50.0%,75.0%
-Total,1.0,3.0,4.0
-,25.0%,75.0%,100.0%
-,100.0%,100.0%,100.0%
-,25.0%,75.0%,100.0%
+c ,.00,1.00,1.00
+,.00%,100.00%,100.00%
+,.00%,33.33%,25.00%
+,.00%,25.00%,25.00%
+d ,1.00,2.00,3.00
+,33.33%,66.67%,100.00%
+,100.00%,66.67%,75.00%
+,25.00%,50.00%,75.00%
+Total,1.00,3.00,4.00
+,25.00%,75.00%,100.00%
+,100.00%,100.00%,100.00%
+,25.00%,75.00%,100.00%
Table: Chi-square tests.
Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
Table: x * y * z [count].
z,,y,,
,x,1,2,Total
-1,1,1.0,.0,1.0
-,3,1.0,.0,1.0
-,5,.0,1.0,1.0
-,7,1.0,.0,1.0
-,8,1.0,.0,1.0
-Total,,4.0,1.0,5.0
-2,2,.0,1.0,1.0
-,4,1.0,.0,1.0
-,6,1.0,.0,1.0
-,9,1.0,.0,1.0
-Total,,3.0,1.0,4.0
+1,1,1.00,.00,1.00
+,3,1.00,.00,1.00
+,5,.00,1.00,1.00
+,7,1.00,.00,1.00
+,8,1.00,.00,1.00
+Total,,4.00,1.00,5.00
+2,2,.00,1.00,1.00
+,4,1.00,.00,1.00
+,6,1.00,.00,1.00
+,9,1.00,.00,1.00
+Total,,3.00,1.00,4.00
Table: Chi-square tests.
z,Statistic,Value,df,Asymp. Sig. (2-tailed)
Table: x * y [count].
,y,,
x,2.00,1.00,Total
-4.00,.0,1.0,1.0
-3.00,2.0,1.0,3.0
-2.00,2.0,.0,2.0
-Total,4.0,2.0,6.0
+4.00,.00,1.00,1.00
+3.00,2.00,1.00,3.00
+2.00,2.00,.00,2.00
+Total,4.00,2.00,6.00
]])
AT_CLEANUP
crosstabs.sps:8: warning: CROSSTABS: Crosstabulation X1 * X2 contained no non-missing cases.
])
AT_CLEANUP
+
+
+
+dnl This example comes from http://www.ats.ucla.edu/stat/spss/whatstat/whatstat.htm#chisq
+AT_SETUP([CROSSTABS Fisher Exact Test])
+
+AT_DATA([fisher-exact.sps], [dnl
+SET FORMAT F12.3.
+SET DECIMAL DOT.
+
+DATA LIST notable LIST /schtyp (F9.2) female (F9.2) ses (F9.2) .
+begin data.
+ 1.00 .00 1.00
+ 1.00 1.00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 3.00
+ 1.00 .00 1.00
+ 1.00 .00 1.00
+ 1.00 .00 3.00
+ 2.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 2.00 .00 2.00
+ 2.00 .00 3.00
+ 1.00 .00 1.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 2.00 .00 3.00
+ 1.00 .00 2.00
+ 2.00 .00 3.00
+ 1.00 .00 3.00
+ 2.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 1.00
+ 1.00 .00 2.00
+ 2.00 .00 2.00
+ 2.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 1.00
+ 1.00 .00 3.00
+ 1.00 .00 1.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 2.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 2.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 1.00
+ 1.00 .00 2.00
+ 2.00 .00 2.00
+ 1.00 .00 2.00
+ 2.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 1.00
+ 1.00 .00 2.00
+ 2.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 1.00
+ 1.00 .00 1.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 2.00
+ 1.00 .00 1.00
+ 1.00 .00 3.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 3.00
+ 1.00 .00 1.00
+ 2.00 .00 2.00
+ 1.00 .00 1.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 3.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 3.00
+ 1.00 .00 2.00
+ 1.00 .00 1.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 2.00 1.00 3.00
+ 1.00 1.00 3.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 3.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 2.00 1.00 1.00
+ 2.00 1.00 3.00
+ 1.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 2.00 1.00 3.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 2.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 3.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 3.00
+ 2.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 2.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 3.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 2.00 1.00 3.00
+ 1.00 1.00 2.00
+ 2.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 1.00 1.00 3.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 2.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 1.00
+ 2.00 1.00 2.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 2.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 2.00
+ 1.00 1.00 2.00
+ 2.00 1.00 3.00
+ 1.00 1.00 1.00
+ 1.00 1.00 1.00
+ 2.00 1.00 3.00
+ 2.00 1.00 2.00
+ 1.00 1.00 3.00
+ 2.00 1.00 2.00
+ 2.00 1.00 2.00
+ 1.00 1.00 2.00
+ 2.00 1.00 2.00
+ 1.00 1.00 2.00
+ 1.00 1.00 3.00
+end data.
+
+VARIABLE LABEL schtyp 'type of school'.
+ADD VALUE LABELS female 0 male 1 female.
+ADD VALUE LABELS ses 1 low 2 middle 3 high.
+ADD VALUE LABELS schtyp 1 public 2 private.
+
+crosstabs /tables = schtyp by female /statistic = chisq.
+crosstabs /tables = female by ses /statistic = chisq.
+])
+
+AT_CHECK([pspp -O format=csv fisher-exact.sps], [0], [dnl
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+type of school * female,200,100.0%,0,0.0%,200,100.0%
+
+Table: type of school * female [[count]].
+,female,,
+type of school,male,female,Total
+public,77.000,91.000,168.000
+private,14.000,18.000,32.000
+Total,91.000,109.000,200.000
+
+Table: Chi-square tests.
+Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
+Pearson Chi-Square,.047,1,.828,,
+Likelihood Ratio,.047,1,.828,,
+Fisher's Exact Test,,,,.849,.492
+Continuity Correction,.001,1,.981,,
+Linear-by-Linear Association,.047,1,.829,,
+N of Valid Cases,200,,,,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+female * ses,200,100.0%,0,0.0%,200,100.0%
+
+Table: female * ses [[count]].
+,ses,,,
+female,low,middle,high,Total
+male,15.000,47.000,29.000,91.000
+female,32.000,48.000,29.000,109.000
+Total,47.000,95.000,58.000,200.000
+
+Table: Chi-square tests.
+Statistic,Value,df,Asymp. Sig. (2-tailed)
+Pearson Chi-Square,4.577,2,.101
+Likelihood Ratio,4.679,2,.096
+Linear-by-Linear Association,3.110,1,.078
+N of Valid Cases,200,,
+])
+
+AT_CLEANUP
\ No newline at end of file