@sasjs/core 2.57.1 → 2.58.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/mf_isint.sas +33 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Returns 1 if the variable contains only digits 0-9, else 0
|
|
4
|
+
@details Note that numerics containing any punctuation (including decimals
|
|
5
|
+
or exponents) will be flagged zero.
|
|
6
|
+
|
|
7
|
+
If you'd like support for this, then do raise an issue (or even better, a
|
|
8
|
+
pull request!)
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
|
|
12
|
+
%put %mf_isint(1) returns 1;
|
|
13
|
+
%put %mf_isint(1.1) returns 0;
|
|
14
|
+
%put %mf_isint(%str(1,1)) returns 0;
|
|
15
|
+
|
|
16
|
+
@param [in] arg input value to check
|
|
17
|
+
|
|
18
|
+
@version 9.2
|
|
19
|
+
**/
|
|
20
|
+
|
|
21
|
+
%macro mf_isint(arg
|
|
22
|
+
)/*/STORE SOURCE*/;
|
|
23
|
+
/* remove minus sign if exists */
|
|
24
|
+
|
|
25
|
+
%local val;
|
|
26
|
+
%if "%substr(%str(&arg),1,1)"="-" %then %let val=%substr(%str(&arg),2);
|
|
27
|
+
%else %let val=&arg;
|
|
28
|
+
|
|
29
|
+
/* check remaining chars */
|
|
30
|
+
%if %sysfunc(findc(%str(&val),,kd)) %then %do;0%end;
|
|
31
|
+
%else %do;1%end;
|
|
32
|
+
|
|
33
|
+
%mend mf_isint;
|
package/package.json
CHANGED