You mean the value have "countofmostfrequent" ?
data have;
input Id (system1 system2 system3 system4) ($);
cards;
1 0001 0001 0001 0002
2 0002 0001 0002 0003
3 0003 0002 0002 0004
4 . 0001 . .
;
data want;
if _n_=1 then do;
length k value $ 100 n countofmostfrequent 8;
call missing(k,n,value,countofmostfrequent);
declare hash h();
h.definekey('k');
h.definedata('n');
h.definedone();
end;
set have;
h.clear();
array x{*} $ system:;
do i=1 to dim(x);
if not missing(x{i}) then do;
k=x{i};
if h.find()=0 then do;n+1;h.replace(); end;
else do;n=1;h.replace(); end;
if countofmostfrequent<n then do;value=k; countofmostfrequent=n;end;
end;
end;
drop k n i;
run;
... View more