@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 +1 -0
- package/base/mf_getuniquelibref.sas +31 -14
- package/base/mp_assertscope.sas +3 -1
- package/package.json +1 -1
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
|
-
|
|
18
|
-
|
|
19
|
-
@param
|
|
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
|
|
28
|
-
|
|
29
|
-
%
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
%
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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;
|
package/base/mp_assertscope.sas
CHANGED
package/package.json
CHANGED