@sasjs/core 5.1.0 → 5.2.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/base/mp_validatecol.sas +17 -0
- package/package.json +1 -1
package/base/mp_validatecol.sas
CHANGED
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
@param [in] rule The rule to apply. Current rules:
|
|
29
29
|
@li ISINT - checks if the variable is an integer
|
|
30
30
|
@li ISLIB - checks if the value is a valid libref (NOT whether it exists)
|
|
31
|
+
@li ISNAME - checks if the value is a valid SAS NAME (V7 rules - up to 32
|
|
32
|
+
chars, starting with a letter or underscore, followed by letters,
|
|
33
|
+
numbers or underscores)
|
|
31
34
|
@li ISNUM - checks if the variable is numeric
|
|
32
35
|
@li LIBDS - matches LIBREF.DATASET format
|
|
33
36
|
@li FORMAT - checks if the provided format is syntactically valid
|
|
@@ -79,6 +82,20 @@
|
|
|
79
82
|
if prxmatch(&tempcol, trim(&incol)) then &outcol=1;
|
|
80
83
|
else &outcol=0;
|
|
81
84
|
%end;
|
|
85
|
+
%else %if &rule=ISNAME %then %do;
|
|
86
|
+
/* match a valid SAS name (V7 rules) */
|
|
87
|
+
if _n_=1 then do;
|
|
88
|
+
retain &tempcol;
|
|
89
|
+
&tempcol=prxparse('/^[_a-z]\w{0,31}$/i');
|
|
90
|
+
if missing(&tempcol) then do;
|
|
91
|
+
putlog 'ERR' +(-1) "OR: Invalid expression for ISNAME";
|
|
92
|
+
stop;
|
|
93
|
+
end;
|
|
94
|
+
drop &tempcol;
|
|
95
|
+
end;
|
|
96
|
+
if prxmatch(&tempcol, trim(&incol)) then &outcol=1;
|
|
97
|
+
else &outcol=0;
|
|
98
|
+
%end;
|
|
82
99
|
%else %if &rule=LIBDS %then %do;
|
|
83
100
|
/* match libref.dataset */
|
|
84
101
|
if _n_=1 then do;
|
package/package.json
CHANGED