Date: Fri, 20 Apr 2007 12:52:50 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: Creating and deleting scratch files
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
From the direction of your "slashes" it looks like you are using Windows.
Have you looked into using a command like the UNIX touch. Similar
"touch" programs exist for windows and should allow you to modify the
attributes of Folder and/or Files directly. You could use SAS or
other tool to execute against a list of files.
On 4/20/07, firstname.lastname@example.org <email@example.com> wrote:
> Given a data set 'dirs' containing the names of some directories, this
> step creates an empty scratch file 'tempfile.txt' in each one -
> data _null_;
> set dirs;
> tempfilename = trim(directory) || '\tempfile.txt';
> file temp filevar=tempfilename;
> rc = system('del ' || tempfilename);
> but it fails to delete the files afterwards - which is what I wanted
> "system('del ' || tempfilename)" to do.
> I think it fails because each file is still open when I try to delete
> it. Is there some statement I can add to do close the file?
> As it is, I just delete the files in a separate step, which works
> fine; just looking for a more elegant solution.
> (The object of the exercise is to ensure that the last-written dates
> of the directories are in a particular order, for the benefit of some
> third-party software that I can't do anything about.)
> SAS 9.1.3 on Windows XP.