Macros for SAS Application Developers
https://github.com/sasjs/core
mf_deletefile.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Deletes a physical file, if it exists
4 @details Usage:
5
6 %mf_writefile(&sasjswork/myfile.txt,l1=some content)
7
8 %mf_deletefile(&sasjswork/myfile.txt)
9
10 %mf_deletefile(&sasjswork/myfile.txt)
11
12
13 @param filepath Full path to the target file
14
15 @returns The return code from the fdelete() invocation
16
17 <h4> Related Macros </h4>
18 @li mf_deletefile.test.sas
19 @li mf_writefile.sas
20
21 @version 9.2
22 @author Allan Bowe
23**/
24
25%macro mf_deletefile(file
26)/*/STORE SOURCE*/;
27 %local rc fref;
28 %let rc= %sysfunc(filename(fref,&file));
29 %if %sysfunc(fdelete(&fref)) ne 0 %then %put %sysfunc(sysmsg());
30 %let rc= %sysfunc(filename(fref));
31%mend mf_deletefile;