Date: Sun, 2 Mar 1997 09:39:49 GMT
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
Organization: AOL http://www.aol.com
Subject: Re: Delete dataset from within SAS program?
It's not entirely clear from your post exactly what you mean by "temporary
SAS datasets created with a single-level name (i.e. without a library
specification) are by default in the WORK library. The WORK library and it's
contents are automatically deleted at the end of a SAS session (assuming a
normal exit from the SAS system). No action by you is necessary.
To delete work datasets during a SAS session, you can use either PROC
DATASETS or PROC SQL. I usually use PROC SQL since it outputs less junk to the
log. See the DROP statement for sql in the proc manual.
The above assumes you have not directed single-level names to some other
If, on the other hand, you mean that you create datasets in some other SAS
library, you again can delete datasets using PROC DATASETS or PROC SQL as
If you mean that you create non-SAS files, then you'll probably need a CALL
SYSTEM or X statement. These statements *ought* to work with SAS datasets as
well (though I wouldn't use them with SAS datasets during a session).
In article <331724C1.4B88@sk.sympatico.ca>, Rob Stow <firstname.lastname@example.org>
>I often create several temporary datasets during the
>course of a SAS program and I would like those programs
>to clean up after themselves by getting rid of their
>I have read everything in the on-line help and manuals
>that I can find that contains words like "delete" and
>"erase" and none of it has anything to do with deleting
>files. ( Of course not - that would be logical, and the
>guys at SAS who create the manuals and on-line help go
>to great pains to make sure that doesn't happen. )
>I have also tried quite a few variations on things like
> Call System(Del c:\temp\temp*.sd2);
>without any luck.
>If it can be done, I would appreciate it very much
>if someone could tell me how.