+
+AT_CHECK([pspp -o pspp.csv -o pspp.txt kappa.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+p1 × p2,20.000,100.0%,.000,.0%,20.000,100.0%
+
+Table: p1 × p2
+,,,p2,,Total
+,,,.000,1.000,
+p1,.000,Count,18.000,1.000,19.000
+,1.000,Count,1.000,.000,1.000
+Total,,Count,19.000,1.000,20.000
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Measure of Agreement,Kappa,-.053,.037,-.235
+N of Valid Cases,,20.000,,
+])
+
+AT_CLEANUP
+
+
+AT_SETUP([CROSSTABS many statistics])
+AT_DATA([crosstabs.sps], [dnl
+SET FORMAT=F8.4.
+
+* From http://www4.stat.ncsu.edu/~dzhang2/st744/table3.9.lst.txt.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 25
+1 2 25
+1 3 12
+2 2 1
+2 3 3
+END DATA.
+CROSSTABS x BY y/STATISTICS=CHISQ PHI CC LAMBDA UC BTAU CTAU GAMMA D CORR/CELLS=NONE.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,66.0000,100.0%,.0000,.0%,66.0000,100.0%
+
+Table: Chi-Square Tests
+,Value,df,Asymptotic Sig. (2-tailed)
+Pearson Chi-Square,6.9562,2.0000,.031
+Likelihood Ratio,6.6901,2.0000,.035
+Linear-by-Linear Association,5.8450,1.0000,.016
+N of Valid Cases,66.0000,,
+
+Table: Symmetric Measures
+,,Value,Asymp. Std. Error,Approx. T
+Nominal by Nominal,Phi,.3246,,
+,Cramer's V,.3246,,
+,Contingency Coefficient,.3088,,
+Ordinal by Ordinal,Kendall's tau-b,.2752,.0856,1.9920
+,Kendall's tau-c,.1497,.0751,1.9920
+,Gamma,.8717,.1250,1.9920
+,Spearman Correlation,.2908,.0906,2.4311
+Interval by Interval,Pearson's R,.2999,.0973,2.5147
+N of Valid Cases,,66.0000,,
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.0455,.1629,.2723,.785
+,,x Dependent,.0000,.0000,NaN,NaN
+,,y Dependent,.0500,.1791,.2723,.785
+,Goodman and Kruskal tau,x Dependent,.1054,,,
+,,y Dependent,.0434,,,
+,Uncertainty Coefficient,Symmetric,.0780,.0474,,
+,,x Dependent,.2217,.1062,1.5373,
+,,y Dependent,.0473,.0306,1.5373,
+Ordinal by Ordinal,Somers' d,Symmetric,.1960,,1.9920,.046
+,,x Dependent,.1152,.0572,1.9920,.046
+,,y Dependent,.6573,.1417,1.9920,.046
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS uncertainy coefficient])
+AT_DATA([uc.sps], [dnl
+* From http://groups.chass.utoronto.ca/pol242/5bMeasuringAssociation.htm.
+SET FORMAT=F8.3.
+
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 416
+1 2 121
+2 1 335
+2 2 2
+3 1 112
+3 2 1
+END DATA.
+CROSSTABS x BY y/STATISTICS=LAMBDA UC/CELLS=NONE.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt uc.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x × y,987.000,100.0%,.000,.0%,987.000,100.0%
+
+Table: Directional Measures
+,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.000,.000,NaN,NaN
+,,x Dependent,.000,.000,NaN,NaN
+,,y Dependent,.000,.000,NaN,NaN
+,Goodman and Kruskal tau,x Dependent,.076,,,
+,,y Dependent,.108,,,
+,Uncertainty Coefficient,Symmetric,.105,.012,,
+,,x Dependent,.073,.009,7.890,
+,,y Dependent,.184,.019,7.890,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS estimated risk])
+dnl Example data and expected output from
+dnl http://www.psychology.nottingham.ac.uk/staff/ddc/c8cxpa/further/Project_resources/SPSSCrosstabW.pdf
+AT_DATA([risk.sps], [dnl
+DATA LIST LIST /factor disease count (F8.0).
+WEIGHT BY count.
+VALUE LABELS /factor 0 'Placebo' 1 'Aspirin'
+ /disease 1 'No' 0 'Yes'.
+BEGIN DATA.
+0 1 80
+0 0 20
+1 1 135
+1 0 15
+END DATA.
+CROSSTABS factor BY disease/STATISTICS=RISK CHISQ.
+])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt risk.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+factor,F8.0
+disease,F8.0
+count,F8.0
+
+Table: Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+factor × disease,250,100.0%,0,.0%,250,100.0%
+
+Table: factor × disease
+,,,disease,,Total
+,,,Yes,No,
+factor,Placebo,Count,20,80,100
+,Aspirin,Count,15,135,150
+Total,,Count,35,215,250
+
+Table: Chi-Square Tests
+,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
+Pearson Chi-Square,4.98,1,.026,,
+Likelihood Ratio,4.88,1,.027,,
+Fisher's Exact Test,,,,.039,.021
+Continuity Correction,4.19,1,.041,,
+Linear-by-Linear Association,4.96,1,.026,,
+N of Valid Cases,250,,,,
+
+Table: Risk Estimate
+,Value,95% Confidence Interval,
+,,Lower,Upper
+Odds Ratio for factor (Placebo / Aspirin),2.25,2.25,2.25
+For cohort disease = Yes,1.08,1.08,1.08
+For cohort disease = No,.99,.99,.99
+N of Valid Cases,250.00,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS barchart])
+AT_DATA([bc.sps], [dnl
+SET FORMAT=F8.3.
+
+DATA LIST LIST NOTABLE /x (a20) y (f8) z (f8) w (f8) .
+BEGIN DATA.
+This 1 0 416
+That 2 0 121
+Other 2 0 335
+This 2 0 231
+That 3 0 112
+Other 4 0 130
+This 1 1 160
+That 2 1 211
+Other 2 1 352
+This 2 1 212
+That 3 1 121
+Other 4 1 101
+END DATA.
+
+WEIGHT BY w.
+
+CROSSTABS
+ /table x BY y BY z
+ /table x BY y
+ /barchart.
+])
+
+AT_CHECK([pspp -O format=txt -o xxx bc.sps], [0], [ignore])
+
+AT_CHECK([test -e xxx-1.png], [0], [ignore])
+AT_CHECK([test -e xxx-2.png], [0], [ignore])
+
+AT_CHECK([diff xxx-1.png xxx-2.png], [0], [ignore])
+