@sasjs/core 4.13.0 → 4.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -204,6 +204,7 @@ When contributing to this library, it is therefore important to ensure that all
204
204
 
205
205
  We are currently on major release v4. Breaking changes should be marked with the [deprecated](https://www.doxygen.nl/manual/commands.html#cmddeprecated) doxygen tag. The following changes are planned when the next major/breaking release (v5) becomes necessary:
206
206
 
207
+ * mf_getuniquelibref.sas to have the deprecated maxtried parameter removed (no longer needed)
207
208
  * mp_testservice.sas to be renamed as mp_execute.sas (as it doesn't actually test anything)
208
209
  * `insert_cmplib` option of mcf_xxx macros will be deprecated (the option is now checked automatically with value inserted only if needed)
209
210
  * mcf_xxx macros to have `wrap=` option defaulted to YES for convenience. Set this option explicitly to avoid issues.
@@ -14,27 +14,44 @@
14
14
 
15
15
  > mclib3
16
16
 
17
- @param prefix= first part of libref. Remember that librefs can only be 8 characters,
18
- so a 7 letter prefix would mean that maxtries should be 10.
19
- @param maxtries= the last part of the libref. Provide an integer value.
17
+ A blank value is returned if no usable libname is determined.
18
+
19
+ @param [in] prefix= (mclib) first part of the returned libref. As librefs can
20
+ be as long as 8 characters, a maximum length of 7 characters is premitted
21
+ for this prefix.
22
+ @param [in] maxtries= Deprecated parameter. Remains here to ensure a
23
+ non-breaking change. Will be removed in v5.
20
24
 
21
25
  @version 9.2
22
26
  @author Allan Bowe
23
27
  **/
24
28
 
25
-
26
29
  %macro mf_getuniquelibref(prefix=mclib,maxtries=1000);
27
- %local x libref;
28
- %let x=0;
29
- %do x=0 %to &maxtries;
30
- %if %sysfunc(libref(&prefix&x)) ne 0 %then %do;
31
- %let libref=&prefix&x;
32
- %let rc=%sysfunc(libname(&libref,%sysfunc(pathname(work))));
33
- %if &rc %then %put %sysfunc(sysmsg());
34
- &prefix&x
35
- %*put &sysmacroname: Libref &libref assigned as WORK and returned;
30
+ %local x;
31
+
32
+ %if ( %length(&prefix) gt 7 ) %then %do;
33
+ %put %str(ERR)OR: The prefix parameter cannot exceed 7 characters.;
34
+ 0
35
+ %return;
36
+ %end;
37
+ %else %if (%sysfunc(NVALID(&prefix,v7))=0) %then %do;
38
+ %put %str(ERR)OR: Invalid prefix (&prefix);
39
+ 0
36
40
  %return;
37
41
  %end;
42
+
43
+ /* Set maxtries equal to '10 to the power of [# unused characters] - 1' */
44
+ %let maxtries=%eval(10**(8-%length(&prefix))-1);
45
+
46
+ %do x = 0 %to &maxtries;
47
+ %if %sysfunc(libref(&prefix&x)) ne 0 %then %do;
48
+ &prefix&x
49
+ %return;
50
+ %end;
51
+ %let x = %eval(&x + 1);
38
52
  %end;
39
- %put unable to find available libref in range &prefix.0-&maxtries;
53
+
54
+ %put %str(ERR)OR: No usable libref in range &prefix.0-&maxtries;
55
+ %put %str(ERR)OR- Try reducing the prefix or deleting some libraries!;
56
+ 0
40
57
  %mend mf_getuniquelibref;
@@ -104,7 +104,9 @@
104
104
 
105
105
  %let ds=&syslast;
106
106
 
107
- proc compare base=&scopeds compare=&ds;
107
+ proc compare
108
+ base=&scopeds(where=(upcase(name) not in (%mf_getquotedstr(&ilist))))
109
+ compare=&ds;
108
110
  run;
109
111
 
110
112
  %if &sysinfo=0 %then %do;
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "@sasjs/cli": "3.6.0",
37
37
  "@sasjs/core": "4.4.7"
38
38
  },
39
- "version": "4.13.0"
39
+ "version": "4.13.1"
40
40
  }