Date: Sun, 16 Nov 2003 12:59:39 -0800
Reply-To: Don STanley <don.stanley@NBNZ.CO.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Don STanley <don.stanley@NBNZ.CO.NZ>
Organization: http://groups.google.com
Subject: Re: how to delete external file (filename or pathname has space
inside) in SAS?
Content-Type: text/plain; charset=ISO-8859-1
2 suggestions
(1) following your approach (uses a DOS window)
%let report=c:\this is ;
data _null_;
command="del " !! '"' !! "&report" !! 'myfile.emf"';
call system(command);
run;
You need double quotes around the file name, so you need to build a
string containing the double quotes
(2) better approach (my opinion!) -- does not use a DOS window. Note
all the quotes are double quotes.
%let report=c:\this is ;
filename remove pipe "del ""&report.myfile.emf""" ;
data _null_;
file remove ;
stop ;
run;
filename remove clear ;
4039 %let report=c:\this is ;
4040 filename remove pipe "del ""&report.myfile.emf""" ;
4041
4042 data _null_;
4043 file remove ;
4044 stop ;
4045 run;
NOTE: The file REMOVE is:
Unnamed Pipe Access Device,
PROCESS=del "c:\this ismyfile.emf",RECFM=V,
LRECL=256
NOTE: 0 records were written to the file REMOVE.
NOTE: DATA statement used:
real time 0.01 seconds
cpu time 0.00 seconds
4046
4047 filename remove clear ;
NOTE: Fileref REMOVE has been deassigned.
sunchunkui@hotmail.com (Helen) wrote in message news:<64ae24c.0311141242.211ead85@posting.google.com>...
> Dear SAS-L,
>
> I would like to delete some temp files which either have space in
> filename or have space in pathname in SAS. But I couldn't do it via
> the following codes:
>
> data _null_;
> command="del &report.myfile.emf";
> call system(command);
> run;
>
> Because the pathname(&report=c:\my project1\reports and listing\) has
> spaces inside which MSDOS command don't take it.
>
> Could someone tell me a way to do it in SAS? Thanks!
>
> Helen