1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-08 18:00:06 +00:00

Compare commits

...

1 Commits

Author SHA1 Message Date
Allan Bowe
67079d8c17 fix: adding default value for exists in mf_existfunction 2021-08-19 00:20:49 +03:00
2 changed files with 12 additions and 8 deletions

10
all.sas
View File

@@ -160,21 +160,23 @@ options noquotelenmax;
Full credit to [Bart](https://sasensei.com/user/305) for the vfunc pointer Full credit to [Bart](https://sasensei.com/user/305) for the vfunc pointer
and the tidy approach for pure macro data set filtering. and the tidy approach for pure macro data set filtering.
Check out his [SAS Packages](https://github.com/yabwon/SAS_PACKAGES) Check out his [SAS Packages](https://github.com/yabwon/SAS_PACKAGES)
framework! framework! Where you can find the same [function](
https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md#functionexists-macro
).
@param [in] name (positional) - function name @param [in] name (positional) - function name
@author Allan Bowe @author Allan Bowe
**/ **/
/** @cond */ /** @cond */
%macro mf_existfunction(name %macro mf_existfunction(name
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
%local dsid rc exist; %local dsid rc exist;
%let dsid=%sysfunc(open(sashelp.vfunc(where=(fncname="%upcase(&name)")))); %let dsid=%sysfunc(open(sashelp.vfunc(where=(fncname="%upcase(&name)"))));
%let exist = %sysfunc(fetch(&dsid, NOSET)); %let exist=1;
%let rc = %sysfunc(close(&dsid)); %let exist=%sysfunc(fetch(&dsid, NOSET));
%let rc=%sysfunc(close(&dsid));
%sysevalf(0 = &exist) %sysevalf(0 = &exist)

View File

@@ -12,21 +12,23 @@
Full credit to [Bart](https://sasensei.com/user/305) for the vfunc pointer Full credit to [Bart](https://sasensei.com/user/305) for the vfunc pointer
and the tidy approach for pure macro data set filtering. and the tidy approach for pure macro data set filtering.
Check out his [SAS Packages](https://github.com/yabwon/SAS_PACKAGES) Check out his [SAS Packages](https://github.com/yabwon/SAS_PACKAGES)
framework! framework! Where you can find the same [function](
https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md#functionexists-macro
).
@param [in] name (positional) - function name @param [in] name (positional) - function name
@author Allan Bowe @author Allan Bowe
**/ **/
/** @cond */ /** @cond */
%macro mf_existfunction(name %macro mf_existfunction(name
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
%local dsid rc exist; %local dsid rc exist;
%let dsid=%sysfunc(open(sashelp.vfunc(where=(fncname="%upcase(&name)")))); %let dsid=%sysfunc(open(sashelp.vfunc(where=(fncname="%upcase(&name)"))));
%let exist = %sysfunc(fetch(&dsid, NOSET)); %let exist=1;
%let rc = %sysfunc(close(&dsid)); %let exist=%sysfunc(fetch(&dsid, NOSET));
%let rc=%sysfunc(close(&dsid));
%sysevalf(0 = &exist) %sysevalf(0 = &exist)