i have 3 datasets , fruits, vegetables and diary dataset names. if datasets (fruits, vegetables,diary ) exists do condiftional statements if datasets (fruits, vegetables ) exists do conditional statements i have code as follows, but it running all the all conditions: %macro checkds(dsn,dsn1,dsn2); %if %sysfunc(exist(&dsn)) %then %do; %if %sysfunc(exist(&dsn1)) %then %do; %if %sysfunc(exist(&dsn2)) %then %do; proc sql; create table test.. quit; ..... %end; %end; %end; %else %do; data _null_; file print; put #3 @10 "Data set &dsn. does not exist"; put #3 @10 "Data set &dsn1. does not exist"; put #3 @10 "Data set &dsn2. does not exist"; run; %end; %mend checkds; %checkds(vegetables,Fruits,Dairy) ---For two datasets check i have code as below---- %macro checkds(dsn,dsn1); %if %sysfunc(exist(&dsn)) %then %do; %if %sysfunc(exist(&dsn1)) %then %do; proc sql; create table test.. quit; ..... %end; %end; %else %do; data _null_; file print; put #3 @10 "Data set &dsn. does not exist"; put #3 @10 "Data set &dsn1. does not exist"; run; %end; %mend checkds; %checkds(vegetables,Fruits)
... View more