diff --git a/all.sas b/all.sas index 360f97b..c720190 100644 --- a/all.sas +++ b/all.sas @@ -133,7 +133,13 @@ options noquotelenmax; %macro mf_existfileref(fref )/*/STORE SOURCE*/; - %if %sysfunc(fileref(&fref))=0 %then %do; + %local rc; + %let rc=%sysfunc(fileref(&fref)); + %if &rc=0 %then %do; + 1 + %end; + %else %if &rc<0 %then %do; + %put &sysmacroname: Fileref &fref exists but the underlying file does not; 1 %end; %else %do; diff --git a/base/mf_existfileref.sas b/base/mf_existfileref.sas index bbec773..0423696 100644 --- a/base/mf_existfileref.sas +++ b/base/mf_existfileref.sas @@ -17,7 +17,13 @@ %macro mf_existfileref(fref )/*/STORE SOURCE*/; - %if %sysfunc(fileref(&fref))=0 %then %do; + %local rc; + %let rc=%sysfunc(fileref(&fref)); + %if &rc=0 %then %do; + 1 + %end; + %else %if &rc<0 %then %do; + %put &sysmacroname: Fileref &fref exists but the underlying file does not; 1 %end; %else %do; diff --git a/tests/base/mf_existfileref.test.sas b/tests/base/mf_existfileref.test.sas new file mode 100644 index 0000000..d5327d4 --- /dev/null +++ b/tests/base/mf_existfileref.test.sas @@ -0,0 +1,35 @@ +/** + @file + @brief Testing mf_existfileref macro + +