Read the data and create two datasets. Pull the column headings from the var one name per obs. Sort and eliminate dups. Second dataset each obs has the code ,the coll, and the count (after the colon); Do a file print. read the cols data set and print the codes across the top line. Read the code dataset .Move across the page puting the counts under the code column names.
I don’t know if you want to use file print but here is a strt of some code The code has errors may give you some ideas.
data code cols(keep=col); infile cards truncover; input (code var2 var3 var4 var5 var6) (:$15.); if var2 ne " " then do; col=scan(var2,1,':'); output cols; count=scan(var2,2,':'); output code; end; if var3 ne " " then do; col=scan(var3,1,':'); output cols; count=scan(var3,2,':'); output code; end; if var4 ne " " then do; col=scan(var4,1,':'); output cols; count=scan(var4,2,':'); output code; end; if var5 ne " " then do; col=scan(var5,1,':'); output cols; count=scan(var5,2,':'); output code; end; if var6 ne " " then do; col=scan(var6,1,':'); output cols; count=scan(var6,2,':'); output code; end; cards; C000501 C000873:3 C000501:3 C000873 C003330:1 C000873:39 C003402:1 C000501:3 C001758:6 C001758 C001758:12 C003330:4 C000873:6 C003330 C001758:4 C000873:1 C003330:12 C003402 C000873:1 C003402:4 ; proc print data=code; id code col count; run; proc print data=cols; id col; run; data code; set code; if count gt " "; keep code col count; proc print ; run; proc sort data=cols; by col; proc sort; data=code; by code col;
data cols; set cols; by col; if last.col; proc print; run; data; set cols; file print; x+10; put @x col@;
data; set code; by code; file print; if first.code then do; x=0; put @5 code @; end; X+10; put @x count @; if last.code then put '. '; run;
... View more