Please explain more about what output you want.
If the goal is to summarize each of the multiple diagnosis variables separately then that is simple.
proc freq data=wide;
tables diag: ;
run;
But if you want to create some type of combined summary that ignores the order that diagnosis appears. For example that counts the number of times that "stroke" appears independent of which variable it appears in then you will essentially need to get the data into a single variable.
You could possibly create a bunch of binary variables on each observation and then summarize those, but that is much harder to expand to other diagnoses.
data really_wide;
set wide ;
cancer = 0 < whichc('cancer', of diag:);
stroke = 0 < whichc('stroke ', of diag:);
...
run;
proc means sum mean min max data=really_wide;
var cancer stroke ....;
run;
The SUM of a binary variable is number of times it is true. The mean is the percent true. The min is whether it is ever false The max is whether it is ever true.