LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 2 Sep 2003 15:29:58 -0400
Reply-To:   Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:   Re: How to delete a table>?
Comments:   To: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Content-Type:   text/plain

Paul,

Assuming data set W has variables COND and MEMNAME then here is a portable DATA step to do the deletion.

data _null_ ; length list $ 1000 ; set W end = eof ; if cond and index (list , trim(memname)) = 0 then list = trim(list) || " " || memname ; if eof then call execute ( "proc datasets lib = &libname ;" || " delete " || trim(list) || "memtype=data;" || "run ; quit ;" ) ; run ;

Of course the same trick will work with many different data structures.

While true that the actual deletion is done in a PROC step afterward, I cannot see how it would matter to the application.

IanWhitlock@westat.com -----Original Message----- From: Choate, Paul@DDS [mailto:pchoate@DDS.CA.GOV] Sent: Tuesday, September 02, 2003 2:35 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: How to delete a table>?

Bruce - Hill's original request was for a datastep method to delete a SAS dataset. Being able to conditionally delete a dataset from a datastep could have applications...

Paul

-----Original Message----- From: Bruce Johnson [mailto:bjohnson@SOLUCIENT.COM] Sent: Tuesday, September 02, 2003 10:55 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: How to delete a table>?

Paul, is there a reason why you don't want to use Proc Datasets?

________________________________ Bruce A. Johnson bjohnson@solucient.com

-----Original Message----- From: Kevin Roland Viel [mailto:kviel@EMORY.EDU] Sent: Tuesday, September 02, 2003 12:54 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: How to delete a table>?

Paul,

Great question. I don't know. In fact, I don't even know how MVS stores a SAS dataset :)

I work mostly on Windows. Unfortunately, I have not touched Unix in over a year. I scoured my code for the SCL functions believing that I had deleted a SAS dataset using another function. It took all of five seconds to peruse my code because IT has my computer since it was wiped out by a virus attack.

I briefly perused the online docs. I think there is a function, but cannot say with certainty. If we watch this thread, perhaps a MVP will fill in my ignorance.

Regards,

Kevin

On Tue, 2 Sep 2003, Choate, Paul@DDS wrote:

> This is great on Windows where a dataset is a file, but what about MVS > where the library is the file? Can a MVS SAS dataset be deleted > within a datastep? > > Paul Choate > DDS Data Extraction > (916) 654-2160 > > -----Original Message----- > From: Kevin Roland Viel [mailto:kviel@EMORY.EDU] > Sent: Tuesday, September 02, 2003 9:54 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: How to delete a table>? > > Hill, > > You can delete datasets within a data step. In general, you > need SCL functions. They are listed with all the other functions. > > > data _null_; > rc=filename("fname", "C:\x.sas7bdat"); > if rc = 0 and fexist("fname") then > rc=fdelete("fname"); > rc=filename("fname"); > run; > > NOTE: You may want to follow this thread since FDELETE is supposed to > work on external files. > > Regards, > > Kevin > > > > -----Original Message----- > > From: Hill Smith [mailto:ldh3@SINA.COM] > > Sent: Tuesday, September 02, 2003 9:01 AM > > To: SAS-L@LISTSERV.UGA.EDU > > Subject: How to delete a table? > > > > Dear all, > > > > I know I can empty a data set by these codes. > > data p; > > set _null_; > > run; > > > > But how can I thoroughly delete a table in data step? Thank you. > > > > Yours Hill Smith > > >

This message is a private communication. It may contain information that is confidential and legally protected from disclosure. If you are not an intended recipient, please do not read, copy or use this message or any attachments, and do not disclose them to others.

Please notify the sender of the delivery error by replying to this message, and then delete it and any attachments from your system. Thank you. Solucient LLC.


Back to: Top of message | Previous page | Main SAS-L page