mirror of
https://github.com/sasjs/core.git
synced 2025-12-29 05:40:04 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e41182521 | ||
|
|
7185032680 | ||
|
|
d49b21f3f1 | ||
|
|
a45d280a51 | ||
|
|
2536e299ad | ||
|
|
8b5238230b |
38
all.sas
38
all.sas
@@ -1340,6 +1340,38 @@ Usage:
|
||||
&is_directory
|
||||
|
||||
%mend mf_isdir;/**
|
||||
@file
|
||||
@brief Returns 1 if the variable contains only digits 0-9, else 0
|
||||
@details Note that numerics containing any punctuation (including decimals
|
||||
or exponents) will be flagged zero.
|
||||
|
||||
If you'd like support for this, then do raise an issue (or even better, a
|
||||
pull request!)
|
||||
|
||||
Usage:
|
||||
|
||||
%put %mf_isint(1) returns 1;
|
||||
%put %mf_isint(1.1) returns 0;
|
||||
%put %mf_isint(%str(1,1)) returns 0;
|
||||
|
||||
@param [in] arg input value to check
|
||||
|
||||
@version 9.2
|
||||
**/
|
||||
|
||||
%macro mf_isint(arg
|
||||
)/*/STORE SOURCE*/;
|
||||
/* remove minus sign if exists */
|
||||
|
||||
%local val;
|
||||
%if "%substr(%str(&arg),1,1)"="-" %then %let val=%substr(%str(&arg),2);
|
||||
%else %let val=&arg;
|
||||
|
||||
/* check remaining chars */
|
||||
%if %sysfunc(findc(%str(&val),,kd)) %then %do;0%end;
|
||||
%else %do;1%end;
|
||||
|
||||
%mend mf_isint;/**
|
||||
@file
|
||||
@brief Returns physical location of various SAS items
|
||||
@details Returns location of the PlatformObjectFramework tools
|
||||
@@ -17439,6 +17471,8 @@ options noquotelenmax;
|
||||
%local href cnt;
|
||||
%let cnt=0;
|
||||
data _null_;
|
||||
length rel href $512;
|
||||
call missing(rel,href);
|
||||
set &libref1..links;
|
||||
if rel='members' then do;
|
||||
url=cats("'","&base_uri",href,"?limit=10000'");
|
||||
@@ -17758,6 +17792,8 @@ data;run;
|
||||
%local joburi;
|
||||
%let joburi=0;
|
||||
data _null_;
|
||||
length name uri $512;
|
||||
call missing(name,uri);
|
||||
set &foldermembers;
|
||||
if name="&name" and uri=:'/jobDefinitions/definitions'
|
||||
then call symputx('joburi',uri);
|
||||
@@ -18914,6 +18950,8 @@ data;run;
|
||||
%local joburi;
|
||||
%let joburi=0;
|
||||
data _null_;
|
||||
length name uri $512;
|
||||
call missing(name,uri);
|
||||
set &foldermembers;
|
||||
if name="&name" and uri=:'/jobDefinitions/definitions'
|
||||
then call symputx('joburi',uri);
|
||||
|
||||
33
base/mf_isint.sas
Normal file
33
base/mf_isint.sas
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
@file
|
||||
@brief Returns 1 if the variable contains only digits 0-9, else 0
|
||||
@details Note that numerics containing any punctuation (including decimals
|
||||
or exponents) will be flagged zero.
|
||||
|
||||
If you'd like support for this, then do raise an issue (or even better, a
|
||||
pull request!)
|
||||
|
||||
Usage:
|
||||
|
||||
%put %mf_isint(1) returns 1;
|
||||
%put %mf_isint(1.1) returns 0;
|
||||
%put %mf_isint(%str(1,1)) returns 0;
|
||||
|
||||
@param [in] arg input value to check
|
||||
|
||||
@version 9.2
|
||||
**/
|
||||
|
||||
%macro mf_isint(arg
|
||||
)/*/STORE SOURCE*/;
|
||||
/* remove minus sign if exists */
|
||||
|
||||
%local val;
|
||||
%if "%substr(%str(&arg),1,1)"="-" %then %let val=%substr(%str(&arg),2);
|
||||
%else %let val=&arg;
|
||||
|
||||
/* check remaining chars */
|
||||
%if %sysfunc(findc(%str(&val),,kd)) %then %do;0%end;
|
||||
%else %do;1%end;
|
||||
|
||||
%mend mf_isint;
|
||||
@@ -46,7 +46,7 @@
|
||||
run;
|
||||
|
||||
options
|
||||
autocorrect /* disallow mis-spelled procedure names */
|
||||
noautocorrect /* disallow misspelled procedure names */
|
||||
compress=CHAR /* default is none so ensure we have something! */
|
||||
datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */
|
||||
%str(err)orcheck=STRICT /* catch errs in libname/filename statements */
|
||||
|
||||
33
tests/crossplatform/mf_isint.test.sas
Normal file
33
tests/crossplatform/mf_isint.test.sas
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mf_isint macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_isint.sas
|
||||
@li mp_assert.sas
|
||||
|
||||
**/
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(
|
||||
"%mf_isint(1)"="1"
|
||||
),
|
||||
desc=Checking basic mf_isint(1),
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(
|
||||
"%mf_isint(1.1)"="0"
|
||||
),
|
||||
desc=Checking basic mf_isint(1.1),
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(
|
||||
"%mf_isint(-1)"="1"
|
||||
),
|
||||
desc=Checking mf_isint(-1),
|
||||
outds=work.test_results
|
||||
)
|
||||
@@ -100,6 +100,8 @@ options noquotelenmax;
|
||||
%local href cnt;
|
||||
%let cnt=0;
|
||||
data _null_;
|
||||
length rel href $512;
|
||||
call missing(rel,href);
|
||||
set &libref1..links;
|
||||
if rel='members' then do;
|
||||
url=cats("'","&base_uri",href,"?limit=10000'");
|
||||
|
||||
@@ -92,6 +92,8 @@ data;run;
|
||||
%local joburi;
|
||||
%let joburi=0;
|
||||
data _null_;
|
||||
length name uri $512;
|
||||
call missing(name,uri);
|
||||
set &foldermembers;
|
||||
if name="&name" and uri=:'/jobDefinitions/definitions'
|
||||
then call symputx('joburi',uri);
|
||||
|
||||
@@ -115,6 +115,8 @@ data;run;
|
||||
%local joburi;
|
||||
%let joburi=0;
|
||||
data _null_;
|
||||
length name uri $512;
|
||||
call missing(name,uri);
|
||||
set &foldermembers;
|
||||
if name="&name" and uri=:'/jobDefinitions/definitions'
|
||||
then call symputx('joburi',uri);
|
||||
|
||||
Reference in New Issue
Block a user