Date: Wed, 23 Jun 2004 16:53:44 -0400
Reply-To: Jim Groeneveld <jim.groeneveld@VITATRON.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim.groeneveld@VITATRON.COM>
Subject: Re: How to Erase old file and write on it
On Wed, 23 Jun 2004 13:23:32 -0700, kumar <subramanyam_22@YAHOO.COM> wrote:
>I have Program running that is supposed to erase all the old data and
>write new data on it somehow it is not doing it does anybody has an
>Idea, I do not Know I am be wrong but I looking code like this
>CALL SYSTEM('ERASE ' || "&PGMDRIVE" || '\INVEST\PRINTOUT\' ||
>TRIM(REPORT) || '.PRT');
>i am not sure Please help me
>Thank you in advance.
Apparently you want to delete any file in the Windows system (if it is
Windows you are working on), not just a SAS dataset. In that case you could
issue a DOS command via the CALL SYSTEM statement, the X command, or the %
SYSEXEC macro statement, but the DOS command for deleting is DEL, just the
three letters DEL, nothing more, not ERASE.
However, if you write some new ascii file with a FILE statement in your
data step, I think it is automagically overwritten already, unless you
would specify some append option OLD. So you don't really need to delete a
file physically beforehand.
If you want to delete an existing dataset you could:
DELETE <<Lib_name.dataset_name>>; * default lib_name = work;
Regards - Jim (as already said, from home via web, late in the evening).