Wednesday, August 4, 2010

Check for the existence of a dataset

-
The exist function checks for the existence of a dataset.
-
options mprint mlogic symbolgen;
%macro test;
%if %sysfunc(exist(work.dummy))=0 %then %do;
%goto quit;
%end;
%else %do;
proc sql; select count(distinct pt) into: tst from dummy;
run;
%put &tst;
%end;
%quit:
%mend;
-
%test;
-

Kill your datasets


This code will help the user kill the temporary datasets in work library.

proc datasets library=work kill;
run;