+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+X1 × X2,0,.0%,1,100.0%,1,100.0%
+
+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 pspp.csv -o pspp.txt fisher-exact.sps])
+AT_CHECK([cat pspp.csv], [0], [Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+type of school × female,200,100.0%,0,.0%,200,100.0%
+
+Table: type of school × female
+,,,female,,Total
+,,,male,female,
+type of school,public,Count,77,91,168
+,private,Count,14,18,32
+Total,,Count,91,109,200
+
+Table: Chi-Square Tests
+,Value,df,Asymptotic 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%,200,100.0%
+
+Table: female × ses
+,,,ses,,,Total
+,,,low,middle,high,
+female,male,Count,15,47,29,91
+,female,Count,32,48,29,109
+Total,,Count,47,95,58,200
+
+Table: Chi-Square Tests
+,Value,df,Asymptotic 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
+
+AT_SETUP([CROSSTABS Pearson's R - 1])
+AT_DATA([pearson.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://www.statisticslectures.com/topics/pearsonr/.
+DATA LIST FREE/x y.
+BEGIN DATA.
+1 4
+3 6
+5 10
+5 12
+6 13
+END DATA.
+CROSSTABS x BY y/STATISTICS=CORR.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,5,100.0%,0,.0%,5,100.0%
+
+Table: x × y
+,,,y,,,,,Total
+,,,4.000,6.000,10.000,12.000,13.000,
+x,1.000,Count,1,0,0,0,0,1
+,3.000,Count,0,1,0,0,0,1
+,5.000,Count,0,0,1,1,0,2
+,6.000,Count,0,0,0,0,1,1
+Total,,Count,1,1,1,1,1,5
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Spearman Correlation,.975,.022,7.550
+Interval by Interval,Pearson's R,.968,.017,6.708
+N of Valid Cases,,5,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Pearson's R - 2])
+AT_DATA([pearson2.sps], [dnl
+SET FORMAT F8.3.
+
+* Checked with http://www.socscistatistics.com/tests/pearson/Default2.aspx.
+DATA LIST FREE/x y.
+BEGIN DATA.
+1 1.5
+2 1.5
+3 4
+4 6
+5 5
+6 7
+7 6.5
+8 9
+9 10.5
+10 11
+END DATA.
+CROSSTABS x BY y/STATISTICS=CORR.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson2.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,10,100.0%,0,.0%,10,100.0%
+
+Table: x × y
+,,,y,,,,,,,,,Total
+,,,1.500,4.000,5.000,6.000,6.500,7.000,9.000,10.500,11.000,
+x,1.000,Count,1,0,0,0,0,0,0,0,0,1
+,2.000,Count,1,0,0,0,0,0,0,0,0,1
+,3.000,Count,0,1,0,0,0,0,0,0,0,1
+,4.000,Count,0,0,0,1,0,0,0,0,0,1
+,5.000,Count,0,0,1,0,0,0,0,0,0,1
+,6.000,Count,0,0,0,0,0,1,0,0,0,1
+,7.000,Count,0,0,0,0,1,0,0,0,0,1
+,8.000,Count,0,0,0,0,0,0,1,0,0,1
+,9.000,Count,0,0,0,0,0,0,0,1,0,1
+,10.000,Count,0,0,0,0,0,0,0,0,1,1
+Total,,Count,2,1,1,1,1,1,1,1,1,10
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Spearman Correlation,.973,.015,11.844
+Interval by Interval,Pearson's R,.971,.017,11.580
+N of Valid Cases,,10,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Pearson's R - 3])
+AT_DATA([pearson3.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://learntech.uwe.ac.uk/da/Default.aspx?pageid=1442.
+DATA LIST FREE/x y.
+BEGIN DATA.
+56 87
+56 91
+65 85
+65 91
+50 75
+25 28
+87 122
+44 66
+35 58
+END DATA.
+CROSSTABS x BY y/STATISTICS=CORR.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson3.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,9,100.0%,0,.0%,9,100.0%
+
+Table: x × y
+,,,y,,,,,,,,Total
+,,,28.000,58.000,66.000,75.000,85.000,87.000,91.000,122.000,
+x,25.000,Count,1,0,0,0,0,0,0,0,1
+,35.000,Count,0,1,0,0,0,0,0,0,1
+,44.000,Count,0,0,1,0,0,0,0,0,1
+,50.000,Count,0,0,0,1,0,0,0,0,1
+,56.000,Count,0,0,0,0,0,1,1,0,2
+,65.000,Count,0,0,0,0,1,0,1,0,2
+,87.000,Count,0,0,0,0,0,0,0,1,1
+Total,,Count,1,1,1,1,1,1,2,1,9
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Spearman Correlation,.911,.068,5.860
+Interval by Interval,Pearson's R,.966,.017,9.915
+N of Valid Cases,,9,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Pearson's R - 4])
+AT_DATA([pearson4.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://psychology.ucdavis.edu/faculty_sites/sommerb/sommerdemo/correlation/hand/pearson_hand.htm.
+DATA LIST FREE/x y.
+BEGIN DATA.
+5 5
+10 20
+6 4
+8 15
+4 11
+4 9
+3 12
+10 18
+2 7
+6 2
+7 14
+9 17
+END DATA.
+CROSSTABS x BY y/STATISTICS=CORR.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson4.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,12,100.0%,0,.0%,12,100.0%
+
+Table: x × y
+,,,y,,,,,,,,,,,,Total
+,,,2.000,4.000,5.000,7.000,9.000,11.000,12.000,14.000,15.000,17.000,18.000,20.000,
+x,2.000,Count,0,0,0,1,0,0,0,0,0,0,0,0,1
+,3.000,Count,0,0,0,0,0,0,1,0,0,0,0,0,1
+,4.000,Count,0,0,0,0,1,1,0,0,0,0,0,0,2
+,5.000,Count,0,0,1,0,0,0,0,0,0,0,0,0,1
+,6.000,Count,1,1,0,0,0,0,0,0,0,0,0,0,2
+,7.000,Count,0,0,0,0,0,0,0,1,0,0,0,0,1
+,8.000,Count,0,0,0,0,0,0,0,0,1,0,0,0,1
+,9.000,Count,0,0,0,0,0,0,0,0,0,1,0,0,1
+,10.000,Count,0,0,0,0,0,0,0,0,0,0,1,1,2
+Total,,Count,1,1,1,1,1,1,1,1,1,1,1,1,12
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Spearman Correlation,.657,.140,2.758
+Interval by Interval,Pearson's R,.667,.132,2.830
+N of Valid Cases,,12,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Pearson's R - 5])
+AT_DATA([pearson5.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://www.statisticslectures.com/topics/pearsonr/.
+DATA LIST FREE/x y.
+BEGIN DATA.
+18 15000
+25 29000
+57 68000
+45 52000
+26 32000
+64 80000
+37 41000
+40 45000
+24 26000
+33 33000
+END DATA.
+CROSSTABS x BY y/STATISTICS=CORR.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson5.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,10,100.0%,0,.0%,10,100.0%
+
+Table: x × y
+,,,y,,,,,,,,,,Total
+,,,15000.00,26000.00,29000.00,32000.00,33000.00,41000.00,45000.00,52000.00,68000.00,80000.00,
+x,18.000,Count,1,0,0,0,0,0,0,0,0,0,1
+,24.000,Count,0,1,0,0,0,0,0,0,0,0,1
+,25.000,Count,0,0,1,0,0,0,0,0,0,0,1
+,26.000,Count,0,0,0,1,0,0,0,0,0,0,1
+,33.000,Count,0,0,0,0,1,0,0,0,0,0,1
+,37.000,Count,0,0,0,0,0,1,0,0,0,0,1
+,40.000,Count,0,0,0,0,0,0,1,0,0,0,1
+,45.000,Count,0,0,0,0,0,0,0,1,0,0,1
+,57.000,Count,0,0,0,0,0,0,0,0,1,0,1
+,64.000,Count,0,0,0,0,0,0,0,0,0,1,1
+Total,,Count,1,1,1,1,1,1,1,1,1,1,10
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Spearman Correlation,1.000,.000,+Infinit
+Interval by Interval,Pearson's R,.992,.004,22.638
+N of Valid Cases,,10,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 1])
+AT_DATA([lambda.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 424
+1 2 213
+1 3 59
+3 1 55
+3 2 188
+3 3 357
+END DATA.
+
+CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,1296.000,100.0%,.000,.0%,1296.000,100.0%
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.423,.021,16.875,.000
+,,x Dependent,.497,.024,15.986,.000
+,,y Dependent,.370,.020,16.339,.000
+,Goodman and Kruskal tau,x Dependent,.382,,,
+,,y Dependent,.198,,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 2])
+AT_DATA([lambda.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://vassarstats.net.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 19
+1 2 26
+1 3 8
+2 1 21
+2 2 13
+2 3 5
+3 1 6
+3 2 12
+3 3 27
+END DATA.
+
+CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,137.000,100.0%,.000,.0%,137.000,100.0%
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.259,.081,2.902,.004
+,,x Dependent,.250,.089,2.479,.013
+,,y Dependent,.267,.085,2.766,.006
+,Goodman and Kruskal tau,x Dependent,.129,,,
+,,y Dependent,.123,,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 3])
+AT_DATA([lambda.sps], [dnl
+SET FORMAT F8.3.
+
+* From Goodman, L.A., Kruskal, W.H. (1954) "Measures of association for
+ cross classifications". Part I. Journal of the American Statistical
+ Association, 49, 732-764.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 1768
+1 2 807
+1 3 189
+1 4 47
+2 1 946
+2 2 1387
+2 3 746
+2 4 53
+3 1 115
+3 2 438
+3 3 288
+3 4 16
+END DATA.
+CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,6800.000,100.0%,.000,.0%,6800.000,100.0%
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.208,.010,18.793,.000
+,,x Dependent,.224,.013,16.076,.000
+,,y Dependent,.192,.012,14.438,.000
+,Goodman and Kruskal tau,x Dependent,.089,,,
+,,y Dependent,.081,,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - treatment of ties])
+AT_DATA([lambda.sps], [dnl
+SET FORMAT F8.3.
+
+* From Douglas Bonett.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 225
+1 2 43
+1 3 216
+2 1 3
+2 2 1
+2 3 12
+END DATA.
+
+CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,500.000,100.0%,.000,.0%,500.000,100.0%
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.031,.013,2.336,.019
+,,x Dependent,.000,.000,NaN,NaN
+,,y Dependent,.033,.014,2.336,.019
+,Goodman and Kruskal tau,x Dependent,.012,,,
+,,y Dependent,.009,,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 1])
+AT_DATA([somersd.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://stats.stackexchange.com/questions/72203/problem-with-calculating-asymptotic-standard-error-for-somers-d.
+DATA LIST LIST NOTABLE/x y * w (F10.6).
+WEIGHT BY w.
+BEGIN DATA.
+1 1 0.000025
+1 2 0.0001
+1 3 0.001
+1 4 0.0025
+1 5 0.004
+1 6 0.0075
+1 7 0.0125
+2 1 0.049975
+2 2 0.0999
+2 3 0.199
+2 4 0.2475
+2 5 0.196
+2 6 0.1425
+2 7 0.0375
+END DATA.
+CROSSTABS x BY y/STATISTICS=D/CELLS=NONE.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt somersd.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,1.000000,100.0%,.000000,.0%,1.000000,100.0%
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,-.084,,-.149,.882
+,,x Dependent,-.045,.300,-.149,.882
+,,y Dependent,-.684,2.378,-.149,.882
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 2])
+AT_DATA([somersd.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://uregina.ca/~gingrich/gamma.pdf.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 34
+1 2 24
+1 3 15
+2 1 42
+2 2 74
+2 3 67
+3 1 28
+3 2 111
+3 3 292
+END DATA.
+CROSSTABS x BY y/STATISTICS=BTAU CTAU GAMMA D/CELLS=NONE.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt somersd.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,687.000,100.0%,.000,.0%,687.000,100.0%
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Kendall's tau-b,.372,.033,10.669
+,Kendall's tau-c,.310,.029,10.669
+,Gamma,.591,.043,10.669
+N of Valid Cases,,687.000,,
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,.371,,10.669,.000
+,,x Dependent,.351,.032,10.669,.000
+,,y Dependent,.394,.035,10.669,.000
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 3])
+AT_DATA([ordinal.sps], [dnl
+SET FORMAT F8.3.
+
+* From https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=9829, "Case 1".
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 2 40
+2 3 80
+3 4 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 2.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 40
+2 3 80
+3 4 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 3.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 4 40
+2 3 80
+3 2 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 4.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 20
+1 2 20
+2 3 80
+3 4 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 5.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 2 40
+2 2 80
+3 2 29
+3 3 1
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 6.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 3
+1 2 6
+1 3 28
+1 4 61
+2 1 4
+2 2 5
+2 3 21
+2 4 20
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 7.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 38
+1 2 6
+1 3 3
+1 4 51
+2 1 4
+2 2 20
+2 3 21
+2 4 5
+END DATA.
+CROSSTABS x BY y/STATISTICS=LAMBDA D PHI GAMMA/CELLS=NONE.
+
+* Same site, case 8.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 2
+1 2 3
+1 3 5
+1 4 1
+2 1 2
+2 2 16
+2 3 3
+2 4 6
+3 1 3
+3 2 10
+3 3 35
+3 4 27
+4 1 6
+4 2 15
+4 3 33
+4 4 45
+END DATA.
+CROSSTABS x BY y/STATISTICS=LAMBDA D PHI BTAU/CELLS=NONE.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt ordinal.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,150.000,100.0%,.000,.0%,150.000,100.0%
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841
+,Gamma,1.000,.000,24.841
+N of Valid Cases,,150.000,,
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
+,,x Dependent,1.000,.000,24.841,.000
+,,y Dependent,1.000,.000,24.841,.000
+
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,150.000,100.0%,.000,.0%,150.000,100.0%
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841
+,Gamma,1.000,.000,24.841
+N of Valid Cases,,150.000,,
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
+,,x Dependent,1.000,.000,24.841,.000
+,,y Dependent,1.000,.000,24.841,.000
+
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,150.000,100.0%,.000,.0%,150.000,100.0%
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Ordinal by Ordinal,Kendall's tau-b,-1.000,.000,-24.841
+,Gamma,-1.000,.000,-24.841
+N of Valid Cases,,150.000,,
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,-1.000,,-24.841,.000
+,,x Dependent,-1.000,.000,-24.841,.000
+,,y Dependent,-1.000,.000,-24.841,.000
+
+Table: Summary