This, for a start?
data have;
input tasterId Q W E R;
datalines;
1 85 100 51 76
2 75 91 65 64
3 79 91 69 73
4 85 88 61 77
5 83 94 58 73
6 88 97 52 61
7 76 82 53 68
8 89 86 57 64
9 86 90 63 78
10 81 100 67 62
11 75 100 51 74
12 86 86 66 80
13 73 94 51 80
14 79 80 68 65
15 70 87 56 69
16 87 80 66 72
17 80 92 69 61
18 84 92 59 65
19 75 94 54 68
20 90 98 67 72
;
proc transpose data=have out=ratings(rename=col1=rating) name=tea ;
by tasterId;
var Q--R;
run;
proc sql;
select
tea label="Tea",
sum(prefered) as nbPrefered,
count(tasterId) as nbTasters
from
(select
tea,
tasterId,
rating >= max(rating) as prefered
from
ratings
group by tasterId)
group by tea;
quit;
Tea nbPrefered nbTasters
E 0 20
Q 3 20
R 0 20
W 18 20
... View more