Well, if you don't know what data you have, then your going to have an uphill struggle anyways. But to check this, why bother with all the macro nonsense making harder to read/maintain/debug code when you can simply:
data _null_;
call symputx("adverse",exist(work.adverse));
call symputx("conmeds",exist(work.conmeds));
call symputx("ipdmin",exist(work.ipdmin));
run;
Or just execute your code conditionally:
data _null_;
set sashelp.vtable (where=(libname="WORK" and memname in ("ADVERSE","CONMEDS","IPDMIN")));
if memname="ADVERSE" then call execute('%adverse_macro();');
if memname="CONMEDS" then call execute('%conmeds_macro();');
if memname="IPDMIN" then call execute('%ipdmin_macro();');
run;
Or, far better to fix the problem at source, i.e create three empty datasets called adverse, conmeds, ipdmin, and then append any data you get to them. The data always exists then even if there are no observations.
... View more