%macro subgroup_tables(subgroup_cond=, subgroup_lbl=, titletext=, order=);
proc sql;
select unique(aebodsys) into :aebodsyss separated by '#' from adam.adae ;
select count(unique(aebodsys)) into :catn from adam.adae ;
quit;
/*loop through the aebodsys and aedecod groups*/
%do i=1 %to &catn;
%let aebodsys_select = %scan(%bquote(&aebodsyss), &i., '#' );
%let aedecod = %str();
proc sql;
select unique(aedecod) into :aedecods separated by '#' from adam.adae where aebodsys = "&aebodsys_select.";
select count(unique(aedecod)) into :scatn from adam.adae where aebodsys = "&aebodsys_select.";
quit;
%end;
%PROP_BINCI(dsn=ae, aedsn=adam.adae, out=aebodsys_&i., whr=%str(aebodsys = "&aebodsys_select." ), lbl=%str(&aebodsys_select.));
%mend subgroup_tables;
%subgroup_tables(subgroup_cond=, subgroup_lbl=All, titletext=All participants , order=1) data for aebodsys:
... View more