How about: data disease;
infile cards missover;
input (Role a b c d e)(:$12.);
cards;
IT Bone Diabetes haemoglobin . Fibrin
Doctor Bone . haemoglobin Blood .
Doctor . Diabetes haemoglobin Blood Fibrin
Clinic Bone . . Blood Fibrin
Clinic Bone . haemoglobin Blood
;;;;
run;
proc sql noprint;
create table have as
select role,cats(count(a),'(',put(count(a)/count(*),percent8.),')') as bone ,
cats(count(b),'(',put(count(b)/count(*),percent8.),')') as diabetes,
cats(count(c),'(',put(count(c)/count(*),percent8.),')') as haemoglobin,
cats(count(d),'(',put(count(d)/count(*),percent8.),')') as blood,
cats(count(e),'(',put(count(e)/count(*),percent8.),')') as fibrin
from disease
group by role;
quit;
proc transpose data=have out=want;
id role ;
var bone diabetes haemoglobin blood fibrin;
run;
Ksharp
... View more