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;
上面的代码是将治疗组中的受试者数量分配给宏观变量,并使用它来计算上面代码所示的百分比。写入的宏块在数据步 TOTAL 中没有得到解决,也没有引发警告或错误。