AT_BANNER([CROSSTABS procedure]) AT_SETUP([CROSSTABS integer mode crash]) AT_DATA([crosstabs.sps], [DATA LIST LIST /A * B * X * Y * . BEGIN DATA. 2 3 4 5 END DATA. CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y. ]) AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [[Table: Reading free-form data from INLINE. Variable,Format A,F8.0 B,F8.0 X,F8.0 Y,F8.0 Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent X * Y,1,100.0%,0,0.0%,1,100.0% Table: X * Y [count]. ,Y,,,,,,, X,1.00,2.00,3.00,4.00,5.00,6.00,7.00,Total 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 # Bug #22037. AT_SETUP([CROSSTABS long string crash]) AT_DATA([crosstabs.sps], [data list list /x * y (a18). begin data. 1. 'zero none' 1 'one unity' 2 'two duality' 3 'three lots' end data. CROSSTABS /TABLES = x BY y. ]) AT_CHECK([pspp -o - -O format=csv crosstabs.sps], [0], [[Table: Reading free-form data from INLINE. Variable,Format x,F8.0 y,A18 "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: 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,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent x * y,4,66.7%,2,33.3%,6,100.0% Table: x * y [count]. ,y,,,, x,one unity ,three lots ,two duality ,zero none ,Total 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 AT_SETUP([CROSSTABS crash]) AT_DATA([crosstabs.sps], [[DATA LIST FIXED / x 1-2 y 3 z 4. BEGIN DATA. 0111 0222 0311 0412 0521 0612 0711 0811 0912 END DATA. LIST. CROSSTABS TABLES y by z. ]]) AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [[Table: Reading 1 record from INLINE. Variable,Record,Columns,Format x,1,1- 2,F2.0 y,1,3- 3,F1.0 z,1,4- 4,F1.0 Table: Data List x,y,z 1,1,1 2,2,2 3,1,1 4,1,2 5,2,1 6,1,2 7,1,1 8,1,1 9,1,2 Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent y * z,9,100.0%,0,0.0%,9,100.0% Table: y * z [count]. ,z,, y,1,2,Total 1,4.00,3.00,7.00 2,1.00,1.00,2.00 Total,5.00,4.00,9.00 ]]) AT_CLEANUP # Bug #26739, which caused CROSSTABS to crash or to fail to output # chi-square results. AT_SETUP([CROSSTABS chi-square crash]) AT_DATA([crosstabs.sps], [[DATA LIST LIST /x * y *. BEGIN DATA. 2 2 3 1 4 2 4 1 END DATA. CROSSTABS /TABLES= x BY y /STATISTICS=CHISQ. ]]) AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [[Table: Reading free-form data from INLINE. Variable,Format x,F8.0 y,F8.0 Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent x * y,4,100.0%,0,0.0%,4,100.0% Table: x * y [count]. ,y,, x,1.00,2.00,Total 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) Pearson Chi-Square,2.00,2,.368 Likelihood Ratio,2.77,2,.250 Linear-by-Linear Association,.27,1,.602 N of Valid Cases,4,, ]]) AT_CLEANUP # Bug #27883. AT_SETUP([CROSSTABS crash with SPLIT FILE]) AT_DATA([crosstabs.sps], [data list notable / v0 to v2 1-6 (A) begin data. a c e a c e a c e a d e a d f b d f b d f b c f b d e a c f end data. SORT CASES BY v0. SPLIT FILE SEPARATE BY v0. CROSSTABS /TABLES= v1 BY v2 /FORMAT=AVALUE TABLES PIVOT /STATISTICS=CHISQ /CELLS=COUNT ROW COLUMN TOTAL. ]) AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [[Variable,Value,Label v0,a , Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent v1 * v2,6,100.0%,0,0.0%,6,100.0% "Table: v1 * v2 [count, row %, column %, total %]." ,v2,, v1,e ,f ,Total 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) Pearson Chi-Square,.38,1,.540,, Likelihood Ratio,.37,1,.545,, Fisher's Exact Test,,,,1.000,.600 Continuity Correction,.00,1,1.000,, N of Valid Cases,6,,,, Variable,Value,Label v0,b , Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent v1 * v2,4,100.0%,0,0.0%,4,100.0% "Table: v1 * v2 [count, row %, column %, total %]." ,v2,, v1,e ,f ,Total 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) Pearson Chi-Square,.44,1,.505,, Likelihood Ratio,.68,1,.410,, Fisher's Exact Test,,,,1.000,.750 Continuity Correction,.00,1,1.000,, N of Valid Cases,4,,,, ]]) AT_CLEANUP # Bug #24752. AT_SETUP([3-way CROSSTABS]) AT_DATA([crosstabs.sps], [[DATA LIST FIXED / x 1-2 y 3 z 4. BEGIN DATA. 0111 0222 0311 0412 0521 0612 0711 0811 0912 END DATA. LIST. CROSSTABS TABLES x BY y BY z/STATISTICS=ALL. ]]) AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [[Table: Reading 1 record from INLINE. Variable,Record,Columns,Format x,1,1- 2,F2.0 y,1,3- 3,F1.0 z,1,4- 4,F1.0 Table: Data List x,y,z 1,1,1 2,2,2 3,1,1 4,1,2 5,2,1 6,1,2 7,1,1 8,1,1 9,1,2 Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent x * y * z,9,100.0%,0,0.0%,9,100.0% Table: x * y * z [count]. z,,y,, ,x,1,2,Total 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) 1,Pearson Chi-Square,5.00,4,.287 ,Likelihood Ratio,5.00,4,.287 ,Linear-by-Linear Association,.01,1,.938 ,N of Valid Cases,5,, 2,Pearson Chi-Square,4.00,3,.261 ,Likelihood Ratio,4.50,3,.212 ,Linear-by-Linear Association,1.58,1,.209 ,N of Valid Cases,4,, Table: Symmetric measures. z,Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig. 1,Nominal by Nominal,Phi,1.00,,, ,,Cramer's V,1.00,,, ,,Contingency Coefficient,.71,,, ,Ordinal by Ordinal,Kendall's tau-b,.00,.32,.00, ,,Kendall's tau-c,.00,.32,.00, ,,Gamma,.00,.50,.00, ,,Spearman Correlation,.00,.22,.00, ,Interval by Interval,Pearson's R,.04,.22,.18, ,N of Valid Cases,,5,,, 2,Nominal by Nominal,Phi,1.00,,, ,,Cramer's V,1.00,,, ,,Contingency Coefficient,.71,,, ,Ordinal by Ordinal,Kendall's tau-b,-.71,.20,-1.73, ,,Kendall's tau-c,-.75,.43,-1.73, ,,Gamma,-1.00,.00,-1.73, ,,Spearman Correlation,-.77,.17,-6.77, ,Interval by Interval,Pearson's R,-.73,.18,-5.49, ,N of Valid Cases,,4,,, Table: Directional measures. z,Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig. 1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.02, ,,,x Dependent,.25,NaN,1.12, ,,,y Dependent,1.00,NaN,1.12, ,,Goodman and Kruskal tau,x Dependent,.25,,, ,,,y Dependent,1.00,,, ,,Uncertainty Coefficient,Symmetric,.47,.18,1.51, ,,,x Dependent,.31,.15,2.02, ,,,y Dependent,1.00,.00,2.02, ,Ordinal by Ordinal,Somers' d,Symmetric,.00,.09,.00, ,,,x Dependent,.00,.50,.00, ,,,y Dependent,.00,.20,.00, ,Nominal by Interval,Eta,x Dependent,.04,,, ,,,y Dependent,1.00,,, 2,Nominal by Nominal,Lambda,Symmetric,.50,.25,1.51, ,,,x Dependent,.33,NaN,1.15, ,,,y Dependent,1.00,NaN,1.15, ,,Goodman and Kruskal tau,x Dependent,.33,,, ,,,y Dependent,1.00,,, ,,Uncertainty Coefficient,Symmetric,.58,.17,1.56, ,,,x Dependent,.41,.17,2.36, ,,,y Dependent,1.00,.00,2.36, ,Ordinal by Ordinal,Somers' d,Symmetric,-.67,.04,-1.73, ,,,x Dependent,-1.00,.00,-1.73, ,,,y Dependent,-.50,.29,-1.73, ,Nominal by Interval,Eta,x Dependent,.73,,, ,,,y Dependent,1.00,,, ]]) AT_CLEANUP AT_SETUP([CROSSTABS descending sort order]) AT_DATA([crosstabs-descending.sps], [[DATA LIST NOTABLE LIST /x * y *. BEGIN DATA. 2 2 2 2 3 1 4 1 3 2 3 2 END DATA. CROSSTABS /TABLES= x BY y /FORMAT = DVALUE. ]]) AT_CHECK([pspp -O format=csv crosstabs-descending.sps], [0], [[Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent x * y,6,100.0%,0,0.0%,6,100.0% Table: x * y [count]. ,y,, x,2.00,1.00,Total 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 # Bug #31260. AT_SETUP([CROSSTABS crash when all cases missing]) AT_DATA([crosstabs.sps], [dnl DATA LIST LIST NOTABLE /X1 X2. BEGIN DATA. 1 1 END DATA. MISSING VALUES x2 (1). CROSSTABS /TABLES= X1 by X2. ]) AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl Table: Summary. ,Cases,,,,, ,Valid,,Missing,,Total, ,N,Percent,N,Percent,N,Percent X1 * X2,0,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 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