If I understand your problem correctly then no, you can't have conditional table statements within Proc Tabulate. What you can do is call Proc Tabulate multiple times and you can do this data driven.
Below some sample code to illustrate the approach.
%macro demo(type,name);
%if &type=1 %then
%do;
title "Table type 1 for &name";
proc tabulate data=sashelp.class;
where name = "&name";
class sex;
keylabel n=' ';
table sex;
run;
title;
%end;
%else
%if &type=2 %then
%do;
title "Table type 2 for &name";
proc tabulate data=sashelp.class;
where name = "&name";
class age;
keylabel n=' ';
table age;
run;
title;
%end;
%mend;
%demo(James);
proc format;
value $type
'Alfred'
,'Joyce'
,'Judy'
,'Louise'
,'Henry'
,'James'
,'Jane'
,'Janet'= '1'
'Jeffrey'
,'Alice'
,'Barbara'
,'Carol'
,'John'
,'Mary'
,'Philip'
,'Robert'
,'Ronald'
,'Thomas'
,'William'='2'
other = 'na'
;
run;
data _null_;
set sashelp.class;
by name;
if first.name then
do;
cmd=cats('%demo(',put(name,$type.),',',name,')');
call execute(cmd);
end;
run;
... View more