Comparing differences between discrete variables in two datasets of unequal size
I have two datasets, X, Y, containing discrete variables which both have a different number of instances. I want to analyse the difference between the datasets for each of these variables. When these discrete variables are binary, I can use the Chi2 test (as suggested in Chi square test when sample sizes are different? ) or Fishers Exact test (as in Compare means of two datasets of binary data ). However, one of these discrete features isn't binary and I'm struggling to find a test for discrete variables where the datasets are of unequal length. This discrete variable is ordinal and has values 0, 1 or 2. Maybe one approach could be to treat this as a continuous variable and use a non-parametric test for continuous distributions like Kolmogorov-Smirnov test, but this gives me suspiciously low p values (e.g. $1\times 10 ^{-60}$ ). Another approach might be to bin the variable by setting 1 to 0 or 2, and then use one of the above tests, but this would skew the data and lose information. Is there an appropriate test for this situation?