SASware Ballot Ideas

An Idea Exchange for SAS software and services
BookmarkSubscribeRSS Feed

Can PROC DELETE be updated to allow some method to suppress warning message if the dataset (object) being deleted does not exist?  Perhaps a NOWARN option that would convert the warning into a NOTE instead?

 

17    proc delete data=test; run;

NOTE: Deleting WORK.TEST (memtype=DATA).
NOTE: PROCEDURE DELETE used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


18    proc delete data=test; run;

WARNING: File WORK.TEST.DATA does not exist.
NOTE: PROCEDURE DELETE used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

Also why does PROC DELETE use parentheses around the options on the PROC step instead of the more normal SAS syntax of a slash? 

 

If you want to keep the ( ) then can they be made to apply just to the names that immediately precede them?  Currently the last value overrides all of the previous settings. As in this example:

61    proc sql ;
62     create table test as select * from sashelp.class;
NOTE: Table WORK.TEST created, with 19 rows and 5 columns.

63     create view testv as select * from sashelp.class;
NOTE: SQL view WORK.TESTV has been defined.
64    quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.11 seconds
      cpu time            0.04 seconds


65
66    proc delete data=test (memtype=data) testv(memtype=view);
67    run;

WARNING: File WORK.TEST.VIEW does not exist.
NOTE: Deleting WORK.TESTV (memtype=VIEW).
NOTE: PROCEDURE DELETE used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
4 Comments
SASKiwi
PROC Star

A workaround would be to switch to PROC DATASETS  which has a NOWARN option.

ballardw
Super User

Or

data _null_;
   if exist("work.test") then 
   call execute("Proc delete data=work.test;run;");
run;

which only runs the proc delete if the data set(or view or what have you exists.

 

lc_isp
Quartz | Level 8

Adding a NOWARN to PROC DELETE seems a shortcut to embed the "if exist("work.test") then...".

If other procs have a NOWARN option, it seems fair even DELETE one can have, IMHO.

jimbarbour
Meteorite | Level 14

I like the idea of a NOWARN option as on other procedures.

 

A decent work around is to create a little macro like the following:

%MACRO	DelDS(DSN);
	%IF	%QSYSFUNC(EXIST(&DSN))	%THEN
		%DO;
			PROC	DELETE	DATA=&DSN;
			RUN;
		%END;
	%ELSE
		%DO;
			%PUT	NOTE:  Dataset &DSN does not exist;
		%END;
%MEND	DelDS;

Then a simple %DelDS(MyLib.MyData) takes care of business.

 

Jim