*SPSS syntax example by www.spss-tutorials.com.
*Create Test Data: 2 categorical variables with 3 categories each.
data list free/v1 v2.
begin data
1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3
end data.
*Compute frequencies.
set seed rng mc 1.
compute ofreq = rv.binom(50,.5).
execute.
*Weight by frequencies.
weight by ofreq.
*Basic Chi-Square Test. Note that there's 228 weighted cases in the data.
crosstabs v1 by v2/statistics all.
*For Fisher's exact test add "method = exact". Note that this'll only run when SPSS "exact tests" option is installed (run SHOW LICENSE if in doubt).
crosstabs v1 by v2/statistics all/method = exact.
*Final note: Fisher's exact test is always reported for 2 by 2 crosstabs.