1 AT_BANNER([CROSSTABS procedure])
3 AT_SETUP([CROSSTABS integer mode crash])
4 AT_DATA([crosstabs.sps],
5 [DATA LIST LIST /A * B * X * Y * .
10 CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y.
12 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
13 [[Table: Reading free-form data from INLINE.
22 ,Valid,,Missing,,Total,
23 ,N,Percent,N,Percent,N,Percent
24 X * Y,1,100.0%,0,0.0%,1,100.0%
28 X,1.00,2.00,3.00,4.00,5.00,6.00,7.00,Total
29 1.00,.00,.00,.00,.00,.00,.00,.00,.00
30 2.00,.00,.00,.00,.00,.00,.00,.00,.00
31 3.00,.00,.00,.00,.00,.00,.00,.00,.00
32 4.00,.00,.00,.00,.00,1.00,.00,.00,1.00
33 5.00,.00,.00,.00,.00,.00,.00,.00,.00
34 6.00,.00,.00,.00,.00,.00,.00,.00,.00
35 7.00,.00,.00,.00,.00,.00,.00,.00,.00
36 Total,.00,.00,.00,.00,1.00,.00,.00,1.00
41 AT_SETUP([CROSSTABS long string crash])
42 AT_DATA([crosstabs.sps],
43 [data list list /x * y (a18).
54 CROSSTABS /TABLES = x BY y.
56 AT_CHECK([pspp -o - -O format=csv crosstabs.sps], [0],
57 [[Table: Reading free-form data from INLINE.
62 "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."
64 "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."
68 ,Valid,,Missing,,Total,
69 ,N,Percent,N,Percent,N,Percent
70 x * y,4,66.7%,2,33.3%,6,100.0%
74 x,one unity ,three lots ,two duality ,zero none ,Total
75 1.00,1.00,.00,.00,1.00,2.00
76 2.00,.00,.00,1.00,.00,1.00
77 3.00,.00,1.00,.00,.00,1.00
78 Total,1.00,1.00,1.00,1.00,4.00
82 AT_SETUP([CROSSTABS crash])
83 AT_DATA([crosstabs.sps],
104 CROSSTABS TABLES y by z.
106 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
107 [[Table: Reading 1 record from INLINE.
108 Variable,Record,Columns,Format
127 ,Valid,,Missing,,Total,
128 ,N,Percent,N,Percent,N,Percent
129 y * z,9,100.0%,0,0.0%,9,100.0%
131 Table: y * z [count].
140 # Bug #26739, which caused CROSSTABS to crash or to fail to output
141 # chi-square results.
142 AT_SETUP([CROSSTABS chi-square crash])
143 AT_DATA([crosstabs.sps],
144 [[DATA LIST LIST /x * y *.
156 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
157 [[Table: Reading free-form data from INLINE.
164 ,Valid,,Missing,,Total,
165 ,N,Percent,N,Percent,N,Percent
166 x * y,4,100.0%,0,0.0%,4,100.0%
168 Table: x * y [count].
176 Table: Chi-square tests.
177 Statistic,Value,df,Asymp. Sig. (2-tailed)
178 Pearson Chi-Square,2.00,2,.37
179 Likelihood Ratio,2.77,2,.25
180 Linear-by-Linear Association,.27,1,.60
186 AT_SETUP([CROSSTABS crash with SPLIT FILE])
187 AT_DATA([crosstabs.sps],
188 [data list notable / v0 to v2 1-6 (A)
202 SPLIT FILE SEPARATE BY v0.
206 /FORMAT=AVALUE TABLES PIVOT
208 /CELLS=COUNT ROW COLUMN TOTAL.
210 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
211 [[Variable,Value,Label
216 ,Valid,,Missing,,Total,
217 ,N,Percent,N,Percent,N,Percent
218 v1 * v2,6,100.0%,0,0.0%,6,100.0%
220 "Table: v1 * v2 [count, row %, column %, total %]."
224 ,75.00%,25.00%,100.00%
225 ,75.00%,50.00%,66.67%
226 ,50.00%,16.67%,66.67%
228 ,50.00%,50.00%,100.00%
229 ,25.00%,50.00%,33.33%
230 ,16.67%,16.67%,33.33%
232 ,66.67%,33.33%,100.00%
233 ,100.00%,100.00%,100.00%
234 ,66.67%,33.33%,100.00%
236 Table: Chi-square tests.
237 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
238 Pearson Chi-Square,.38,1,.54,,
239 Likelihood Ratio,.37,1,.54,,
240 Fisher's Exact Test,,,,1.00,.60
241 Continuity Correction,.00,1,1.00,,
242 N of Valid Cases,6,,,,
249 ,Valid,,Missing,,Total,
250 ,N,Percent,N,Percent,N,Percent
251 v1 * v2,4,100.0%,0,0.0%,4,100.0%
253 "Table: v1 * v2 [count, row %, column %, total %]."
257 ,.00%,100.00%,100.00%
261 ,33.33%,66.67%,100.00%
262 ,100.00%,66.67%,75.00%
263 ,25.00%,50.00%,75.00%
265 ,25.00%,75.00%,100.00%
266 ,100.00%,100.00%,100.00%
267 ,25.00%,75.00%,100.00%
269 Table: Chi-square tests.
270 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
271 Pearson Chi-Square,.44,1,.50,,
272 Likelihood Ratio,.68,1,.41,,
273 Fisher's Exact Test,,,,1.00,.75
274 Continuity Correction,.00,1,1.00,,
275 N of Valid Cases,4,,,,
280 AT_SETUP([3-way CROSSTABS])
281 AT_DATA([crosstabs.sps],
302 CROSSTABS TABLES x BY y BY z/STATISTICS=ALL.
304 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
305 [[Table: Reading 1 record from INLINE.
306 Variable,Record,Columns,Format
325 ,Valid,,Missing,,Total,
326 ,N,Percent,N,Percent,N,Percent
327 x * y * z,9,100.0%,0,0.0%,9,100.0%
329 Table: x * y * z [count].
337 Total,,4.00,1.00,5.00
342 Total,,3.00,1.00,4.00
344 Table: Chi-square tests.
345 z,Statistic,Value,df,Asymp. Sig. (2-tailed)
346 1,Pearson Chi-Square,5.00,4,.29
347 ,Likelihood Ratio,5.00,4,.29
348 ,Linear-by-Linear Association,.01,1,.94
349 ,N of Valid Cases,5,,
350 2,Pearson Chi-Square,4.00,3,.26
351 ,Likelihood Ratio,4.50,3,.21
352 ,Linear-by-Linear Association,1.58,1,.21
353 ,N of Valid Cases,4,,
355 Table: Symmetric measures.
356 z,Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
357 1,Nominal by Nominal,Phi,1.00,,,
359 ,,Contingency Coefficient,.71,,,
360 ,Ordinal by Ordinal,Kendall's tau-b,.00,.32,.00,
361 ,,Kendall's tau-c,.00,.32,.00,
363 ,,Spearman Correlation,.00,.22,.00,
364 ,Interval by Interval,Pearson's R,.04,.22,.18,
365 ,N of Valid Cases,,5,,,
366 2,Nominal by Nominal,Phi,1.00,,,
368 ,,Contingency Coefficient,.71,,,
369 ,Ordinal by Ordinal,Kendall's tau-b,-.71,.20,-1.73,
370 ,,Kendall's tau-c,-.75,.43,-1.73,
371 ,,Gamma,-1.00,.00,-1.73,
372 ,,Spearman Correlation,-.77,.17,-6.77,
373 ,Interval by Interval,Pearson's R,-.73,.18,-5.49,
374 ,N of Valid Cases,,4,,,
376 Table: Directional measures.
377 z,Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
378 1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.02,
379 ,,,x Dependent,.25,NaN,1.12,
380 ,,,y Dependent,1.00,NaN,1.12,
381 ,,Goodman and Kruskal tau,x Dependent,.25,,,
382 ,,,y Dependent,1.00,,,
383 ,,Uncertainty Coefficient,Symmetric,.47,.18,1.51,
384 ,,,x Dependent,.31,.15,2.02,
385 ,,,y Dependent,1.00,.00,2.02,
386 ,Ordinal by Ordinal,Somers' d,Symmetric,.00,.09,.00,
387 ,,,x Dependent,.00,.50,.00,
388 ,,,y Dependent,.00,.20,.00,
389 ,Nominal by Interval,Eta,x Dependent,.04,,,
390 ,,,y Dependent,1.00,,,
391 2,Nominal by Nominal,Lambda,Symmetric,.50,.25,1.51,
392 ,,,x Dependent,.33,NaN,1.15,
393 ,,,y Dependent,1.00,NaN,1.15,
394 ,,Goodman and Kruskal tau,x Dependent,.33,,,
395 ,,,y Dependent,1.00,,,
396 ,,Uncertainty Coefficient,Symmetric,.58,.17,1.56,
397 ,,,x Dependent,.41,.17,2.36,
398 ,,,y Dependent,1.00,.00,2.36,
399 ,Ordinal by Ordinal,Somers' d,Symmetric,-.67,.04,-1.73,
400 ,,,x Dependent,-1.00,.00,-1.73,
401 ,,,y Dependent,-.50,.29,-1.73,
402 ,Nominal by Interval,Eta,x Dependent,.73,,,
403 ,,,y Dependent,1.00,,,
409 AT_SETUP([CROSSTABS descending sort order])
410 AT_DATA([crosstabs-descending.sps],
411 [[DATA LIST NOTABLE LIST /x * y *.
426 AT_CHECK([pspp -O format=csv crosstabs-descending.sps], [0],
429 ,Valid,,Missing,,Total,
430 ,N,Percent,N,Percent,N,Percent
431 x * y,6,100.0%,0,0.0%,6,100.0%
433 Table: x * y [count].
444 AT_SETUP([CROSSTABS crash when all cases missing])
445 AT_DATA([crosstabs.sps], [dnl
446 DATA LIST LIST NOTABLE /X1 X2.
451 MISSING VALUES x2 (1).
453 CROSSTABS /TABLES= X1 by X2.
455 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
458 ,Valid,,Missing,,Total,
459 ,N,Percent,N,Percent,N,Percent
460 X1 * X2,0,0.0%,1,100.0%,1,100.0%
462 crosstabs.sps:8: warning: CROSSTABS: Crosstabulation X1 * X2 contained no non-missing cases.
468 dnl This example comes from http://www.ats.ucla.edu/stat/spss/whatstat/whatstat.htm#chisq
469 AT_SETUP([CROSSTABS Fisher Exact Test])
471 AT_DATA([fisher-exact.sps], [dnl
475 DATA LIST notable LIST /schtyp (F9.2) female (F9.2) ses (F9.2) .
679 VARIABLE LABEL schtyp 'type of school'.
680 ADD VALUE LABELS female 0 male 1 female.
681 ADD VALUE LABELS ses 1 low 2 middle 3 high.
682 ADD VALUE LABELS schtyp 1 public 2 private.
684 crosstabs /tables = schtyp by female /statistic = chisq.
685 crosstabs /tables = female by ses /statistic = chisq.
688 AT_CHECK([pspp -O format=csv fisher-exact.sps], [0], [dnl
691 ,Valid,,Missing,,Total,
692 ,N,Percent,N,Percent,N,Percent
693 type of school * female,200,100.0%,0,0.0%,200,100.0%
695 Table: type of school * female [[count]].
697 type of school,male,female,Total
698 public,77.000,91.000,168.000
699 private,14.000,18.000,32.000
700 Total,91.000,109.000,200.000
702 Table: Chi-square tests.
703 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
704 Pearson Chi-Square,.047,1,.828,,
705 Likelihood Ratio,.047,1,.828,,
706 Fisher's Exact Test,,,,.849,.492
707 Continuity Correction,.001,1,.981,,
708 Linear-by-Linear Association,.047,1,.829,,
709 N of Valid Cases,200,,,,
713 ,Valid,,Missing,,Total,
714 ,N,Percent,N,Percent,N,Percent
715 female * ses,200,100.0%,0,0.0%,200,100.0%
717 Table: female * ses [[count]].
719 female,low,middle,high,Total
720 male,15.000,47.000,29.000,91.000
721 female,32.000,48.000,29.000,109.000
722 Total,47.000,95.000,58.000,200.000
724 Table: Chi-square tests.
725 Statistic,Value,df,Asymp. Sig. (2-tailed)
726 Pearson Chi-Square,4.577,2,.101
727 Likelihood Ratio,4.679,2,.096
728 Linear-by-Linear Association,3.110,1,.078
729 N of Valid Cases,200,,