Something like this? data have; input gdrg (icd_n1-icd_n5) ($) fab $; datalines; 1 test1 test10 test test70 test50 fab51 1 test15 test10 test test70 test50 fab4 0 test10 test10 test test50 test15 fab32 1 test1 test10 test15 test70 test50 fab4 1 test1 test15 test test70 test50 fab10 ; data haveList(keep=t fab); set have; array icd_n{100}; if gdrg; do i = 1 to dim(icd_n); t = icd_n{i}; if not missing(t) then output; end; run; proc sql; create table wantList as select t, fab, count(*) as n from haveList group by t, fab order by t; quit; proc transpose data=wantList out=want(drop=_name_); by t; var n; id fab; run; PG
... View more