The macro operates on a file specified by its path, which is an external resource to the SAS program itself. No SASHELP data is used or created internally.
1 Code Block
MACRO di_util_del_file
Explanation : This block defines the `di_util_del_file` macro. It uses the `%sysfunc(fileexist(...))` function to check if the file specified by the `file` parameter exists. If it does, it uses `%sysfunc(filename(...))` to assign a logical 'fileref' to the file, then `%sysfunc(fdelete(...))` to delete it from the file system. If the file does not exist, a message is sent to the SAS log via `%put`.
Copied!
%macro di_util_del_file(file=);
%if %sysfunc(fileexist(&file)) ge 1 %then %do;
%let rc=%sysfunc(filename(temp,&file));
%let rc=%sysfunc(fdelete(&temp));
%end;
%else %put The file &file does not exist;
%mend di_util_del_file;
1
%macro di_util_del_file(file=);
2
%IF %sysfunc(fileexist(&file)) ge 1 %THEN %DO;
3
%let rc=%sysfunc(filename(temp,&file));
4
%let rc=%sysfunc(fdelete(&temp));
5
%END;
6
%ELSE %put The file &file does not exist;
7
%mend di_util_del_file;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.