Hi @monday89
Another possibility, using only Proc Sql with an inner join to merge two queries:
proc sql;
create table want as
select a.*, b.total_event
from
(select treatment_group, AgeGroup, group1, group2,
count(group1) as event
from have
group by treatment_group, AgeGroup,group1,group2) as a
inner join
(select treatment_group, AgeGroup, group1, group2,
count(group1) as total_event
from have
group by treatment_group, AgeGroup,group1) as b
on a.treatment_group=b.treatment_group and a.AgeGroup=b.AgeGroup and
a.group1=b.group1 and a.group2=b.group2;
run;
... View more