Date: Sun, 2 Mar 1997 14:52:23 GMT
Reply-To: "Christopher W. Donald" <donaldc@VOICENET.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Christopher W. Donald" <donaldc@VOICENET.COM>
Organization: Voicenet - Internet Access - (215)674-9290
Subject: Re: Delete dataset from within SAS program?
lpogoda@aol.com wrote:
> It's not entirely clear from your post exactly what you mean by "temporary
datasets".
> 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
library,
> 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
above.
> 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 <stow@sk.sympatico.ca>
writes:
>>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
>>temporary datasets.
>>
>>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.
yet another simple option is to just create a new data step using the
name of the data set that you want to delete without a set statement.
I assume that the empty data set will exist, but I assume the real
issue is to free up space in the work directory.
*** eg to delete the data set foo
data foo;
Christopher W. Donald
Philadelphia, PA
donaldc@merck.com (work)
donaldc@voicenet.com (home)
donaldc@compuserve.com (CIS)
My kingdon for a sig.
|