proc sql noprint;
select count(distinct USUBJID) into : N1 - : N4 from DM where upcase(ARM) ^= "SCREEN FAILURE"`
group by ARMN;
quit;
%macro TOTAL(name=,num=);
%do i=1 %to #`
%if ARMN=&i %then TOTAL= put(COUNT,3.)||" (" ||right(put(COUNT*100/&&name&num,5.1))||"%) ";
%end;
%mend TOTAL;
data TOTAL;
set DS;
%TOTAL(name=T,num=4);
/*if ARMN=1 then TOTAL= put(COUNT,3.)||" (" ||right(put(COUNT*100/&N1,5.1))||"%) ";*/
run;
The above code is to assign number of subjects in treatment groups to macro variables and using the same to calculate the percentage as shown in the above code. The macro block written is not getting resolved in the datastep TOTAL and is not throwing a warning or an error.