BookmarkSubscribeRSS Feed
nitaki
Calcite | Level 5

I have a simple data like this:

 

Types[A-D]  Points[1-5]

A                  4

B                  5

A                  2

C                 4

D                 1

A                  5

...                 ...

 

 

I need to create a table where there are frequencies of each type-points pair with rowpctns plus total mean and std for each type:

 

         1           2       ...       Mean      Std

      N  %     N  %    ...        

A    3   12    4  16   ...        3.2          0.3
B    4   16    1   5    ...        2             0.5
C    1   5      4   16  ...        14           0.2

...

 

I can create both result tables separately with proc tabulate depending on if I treat points as class or analysis variable. Yet, I cannot wrap my head around how to create the table I described above. How should I approach this?

1 REPLY 1
Ksharp
Super User

Opps. I think I made a mistake.

 

data have;
input type $ point;
cards;
A                  4
B                  5
A                  2
C                 4
D                 1
A                  5
;
proc freq data=have noprint;
table type*point/out=temp list;
run;

proc tabulate data=temp ;
class type point;
var count;
table type ,point*count=' '*(sum='n'*f=f10. rowpctsum='%') count=' '*(mean std);
run;