Since you are new to SAS, here is one coded solution to your problem.
data sample;
length group 3 code 3;
infile cards dlm='|' truncover;
input
group
code @;
output;
do while ( not missing( code ));
input code @;
if not missing( code ) then output;
end;
cards;
1 |231|322|414|
1 |231|322|2 |231|
2 |231|114|
2
3
3
;
run;
proc sort nodupkey data=sample; * nodup option would also work since all variables are in by-group;
by group code;
run;
* Summary #1: Proc Means;
proc summary data=sample nway;
class group;
var code;
output out=summary (drop=_:) n=count;
run;
* Summary #2: Proc SQL;
proc sql;
create table summary2 as
select
group,
sum( case
when not missing( code ) then 1
else 0
end ) as count
from
sample
group by 1
;
quit;
... View more