1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-11 06:24:35 +00:00

fix: avoid open file handle when the variable to find is not provided (in mf_existvar)

Includes a test that was failing and is now passing
This commit is contained in:
allan
2023-04-05 15:29:53 +01:00
parent 7471bd42a4
commit 32dd057e83
3 changed files with 36 additions and 8 deletions

12
all.sas
View File

@@ -312,13 +312,17 @@ https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md#functionex
%local dsid rc;
%let dsid=%sysfunc(open(&libds,is));
%if &dsid=0 or %length(&var)=0 %then %do;
%if &dsid=0 %then %do;
%put %sysfunc(sysmsg());
0
0
%end;
%else %if %length(&var)=0 %then %do;
0
%let rc=%sysfunc(close(&dsid));
%end;
%else %do;
%sysfunc(varnum(&dsid,&var))
%let rc=%sysfunc(close(&dsid));
%sysfunc(varnum(&dsid,&var))
%let rc=%sysfunc(close(&dsid));
%end;
%mend mf_existvar;