From: Brian on
Hi, I am struggling to create a proc tabulate table for the below
data. I have 3 categorical variables:

Score1_bin: A B C D

Score2_bin: A B C D

Criteria: 1 2 3

I would like the table to look like this:

Score1_bin

A B C D

Score2_bin A 1 1 2 3

B 1 2 2 3

C 2 2 3 3

D 2 3 3 3

Thank you,

Brian

From: Patrick on
data have;
do score1_bin='A','B','C','D','E';
do score2_bin='A','B','C','D','E';
criteria=floor(ranuni(10)*99);
output;
end;
end;
run;

proc tabulate data=have;
class Score1_bin Score2_bin;
var criteria;
keylabel sum=' ';
table Score2_bin, Score1_bin*criteria=''*f=best32.;
run;
From: Patrick on
..... missed that all 3 vars are categorical. Means of course that
can't use "Criteria" as an analysis variable - and that a table like
the one you want wouldn't make sense. Or what do the numbers in the
cells represent?

Below tabulates for the possibilities you have (as far as I understand
this):

data have;
do score1_bin='A','B','C','D','E';
do score2_bin='A','B','C','D','E';
criteria=ceil(ranuni(10)*3);
output;
end;
end;
run;

options missing=' ';
proc tabulate data=have;
class Score1_bin Score2_bin criteria;
keylabel n=' ';
table Score2_bin, Score1_bin*criteria=''*f=best32.;
run;

options missing=' ';
proc tabulate data=have;
class Score1_bin Score2_bin criteria;
keylabel n=' ';
table Score2_bin*criteria, Score1_bin*f=best32.;
run;

options missing=' ';
proc tabulate data=have;
class Score1_bin Score2_bin criteria;
keylabel n=' ';
table criteria,Score2_bin, Score1_bin*f=best32.;
run;
From: Brian on
On Jun 26, 5:09 pm, Patrick <patrick.mat...(a)gmx.ch> wrote:
> .... missed that all 3 vars are categorical. Means of course that
> can't use "Criteria" as an analysis variable - and that a table like
> the one you want wouldn't make sense. Or what do the numbers in the
> cells represent?
>
> Below tabulates for the possibilities you have (as far as I understand
> this):
>
> data have;
>   do score1_bin='A','B','C','D','E';
>     do score2_bin='A','B','C','D','E';
>       criteria=ceil(ranuni(10)*3);
>       output;
>     end;
>   end;
> run;
>
> options missing=' ';
> proc tabulate data=have;
>   class Score1_bin Score2_bin criteria;
>   keylabel n=' ';
>   table Score2_bin, Score1_bin*criteria=''*f=best32.;
> run;
>
> options missing=' ';
> proc tabulate data=have;
>   class Score1_bin Score2_bin criteria;
>   keylabel n=' ';
>   table Score2_bin*criteria, Score1_bin*f=best32.;
> run;
>
> options missing=' ';
> proc tabulate data=have;
>   class Score1_bin Score2_bin criteria;
>   keylabel n=' ';
>   table criteria,Score2_bin, Score1_bin*f=best32.;
> run;


It's for auditing purpose only, not for analysis. I want make sure
that the criteria is assigned correctly in those cells. Thank you
everyone for helping.