@sasjs/core 4.62.1 → 4.63.0
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/base/mp_validatecol.sas +15 -1
- package/package.json +1 -1
package/base/mp_validatecol.sas
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file
|
|
3
|
-
@brief Used to validate
|
|
3
|
+
@brief Used to validate values in a data step
|
|
4
4
|
@details Useful when sanitising inputs, to ensure that they arrive with a
|
|
5
5
|
certain pattern.
|
|
6
6
|
Usage:
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
@param [in] incol The column to be validated
|
|
28
28
|
@param [in] rule The rule to apply. Current rules:
|
|
29
29
|
@li ISINT - checks if the variable is an integer
|
|
30
|
+
@li ISLIB - checks if the value is a valid libref (NOT whether it exists)
|
|
30
31
|
@li ISNUM - checks if the variable is numeric
|
|
31
32
|
@li LIBDS - matches LIBREF.DATASET format
|
|
32
33
|
@li FORMAT - checks if the provided format is syntactically valid
|
|
@@ -65,6 +66,19 @@
|
|
|
65
66
|
else &outcol=1;
|
|
66
67
|
drop &tempcol;
|
|
67
68
|
%end;
|
|
69
|
+
%else %if &rule=ISLIB %then %do;
|
|
70
|
+
if _n_=1 then do;
|
|
71
|
+
retain &tempcol;
|
|
72
|
+
&tempcol=prxparse('/^[_a-z]\w{0,7}$/i');
|
|
73
|
+
if missing(&tempcol) then do;
|
|
74
|
+
putlog 'ERR' +(-1) "OR: Invalid expression for ISLIB";
|
|
75
|
+
stop;
|
|
76
|
+
end;
|
|
77
|
+
drop &tempcol;
|
|
78
|
+
end;
|
|
79
|
+
if prxmatch(&tempcol, trim(&incol)) then &outcol=1;
|
|
80
|
+
else &outcol=0;
|
|
81
|
+
%end;
|
|
68
82
|
%else %if &rule=LIBDS %then %do;
|
|
69
83
|
/* match libref.dataset */
|
|
70
84
|
if _n_=1 then do;
|
package/package.json
CHANGED