Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mf_existfileref.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Checks whether a fileref exists
4  @details You can probably do without this macro as it is just a one liner.
5  Mainly it is here as a convenient way to remember the syntax!
6 
7  @param fref the fileref to detect
8 
9  @return output Returns 1 if found and 0 if not found. Note - it is possible
10  that the fileref is found, but the file does not (yet) exist. If you need
11  to test for this, you may as well use the fileref function directly.
12 
13  @version 8
14  @author [Allan Bowe](https://www.linkedin.com/in/allanbowe/)
15 **/
16 
17 %macro mf_existfileref(fref
18 )/*/STORE SOURCE*/;
19 
20  %if %sysfunc(fileref(&fref))=0 %then %do;
21  1
22  %end;
23  %else %do;
24  0
25  %end;
26 
27 %mend;