mirror of
https://github.com/sasjs/core.git
synced 2026-01-05 00:20:05 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a45d280a51 | ||
|
|
2536e299ad | ||
|
|
8b5238230b | ||
|
|
0ce7efee3e | ||
|
|
357677e45c |
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
sasjs lint
|
sasjs lint
|
||||||
|
|
||||||
# Avoid commits to the master branch
|
# Avoid commits to the master branch
|
||||||
|
|||||||
40
all.sas
40
all.sas
@@ -1340,6 +1340,38 @@ Usage:
|
|||||||
&is_directory
|
&is_directory
|
||||||
|
|
||||||
%mend mf_isdir;/**
|
%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
|
@file
|
||||||
@brief Returns physical location of various SAS items
|
@brief Returns physical location of various SAS items
|
||||||
@details Returns location of the PlatformObjectFramework tools
|
@details Returns location of the PlatformObjectFramework tools
|
||||||
@@ -2790,9 +2822,9 @@ run;
|
|||||||
|
|
||||||
/* create folders and copy content */
|
/* create folders and copy content */
|
||||||
data _null_;
|
data _null_;
|
||||||
set work.&tempds;
|
length msg $200;
|
||||||
length msg $256;
|
|
||||||
call missing(msg);
|
call missing(msg);
|
||||||
|
set work.&tempds;
|
||||||
if _n_ = 1 then dpos+sum(length(directory),2);
|
if _n_ = 1 then dpos+sum(length(directory),2);
|
||||||
filepath2="&target/"!!substr(filepath,dpos);
|
filepath2="&target/"!!substr(filepath,dpos);
|
||||||
if file_or_folder='folder' then call execute('%mf_mkdir('!!filepath2!!')');
|
if file_or_folder='folder' then call execute('%mf_mkdir('!!filepath2!!')');
|
||||||
@@ -17439,6 +17471,8 @@ options noquotelenmax;
|
|||||||
%local href cnt;
|
%local href cnt;
|
||||||
%let cnt=0;
|
%let cnt=0;
|
||||||
data _null_;
|
data _null_;
|
||||||
|
length rel href $512;
|
||||||
|
call missing(rel,href);
|
||||||
set &libref1..links;
|
set &libref1..links;
|
||||||
if rel='members' then do;
|
if rel='members' then do;
|
||||||
url=cats("'","&base_uri",href,"?limit=10000'");
|
url=cats("'","&base_uri",href,"?limit=10000'");
|
||||||
@@ -17758,6 +17792,8 @@ data;run;
|
|||||||
%local joburi;
|
%local joburi;
|
||||||
%let joburi=0;
|
%let joburi=0;
|
||||||
data _null_;
|
data _null_;
|
||||||
|
length name uri $512;
|
||||||
|
call missing(name,uri);
|
||||||
set &foldermembers;
|
set &foldermembers;
|
||||||
if name="&name" and uri=:'/jobDefinitions/definitions'
|
if name="&name" and uri=:'/jobDefinitions/definitions'
|
||||||
then call symputx('joburi',uri);
|
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;
|
||||||
@@ -54,9 +54,9 @@
|
|||||||
|
|
||||||
/* create folders and copy content */
|
/* create folders and copy content */
|
||||||
data _null_;
|
data _null_;
|
||||||
set work.&tempds;
|
length msg $200;
|
||||||
length msg $256;
|
|
||||||
call missing(msg);
|
call missing(msg);
|
||||||
|
set work.&tempds;
|
||||||
if _n_ = 1 then dpos+sum(length(directory),2);
|
if _n_ = 1 then dpos+sum(length(directory),2);
|
||||||
filepath2="&target/"!!substr(filepath,dpos);
|
filepath2="&target/"!!substr(filepath,dpos);
|
||||||
if file_or_folder='folder' then call execute('%mf_mkdir('!!filepath2!!')');
|
if file_or_folder='folder' then call execute('%mf_mkdir('!!filepath2!!')');
|
||||||
|
|||||||
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;
|
%local href cnt;
|
||||||
%let cnt=0;
|
%let cnt=0;
|
||||||
data _null_;
|
data _null_;
|
||||||
|
length rel href $512;
|
||||||
|
call missing(rel,href);
|
||||||
set &libref1..links;
|
set &libref1..links;
|
||||||
if rel='members' then do;
|
if rel='members' then do;
|
||||||
url=cats("'","&base_uri",href,"?limit=10000'");
|
url=cats("'","&base_uri",href,"?limit=10000'");
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ data;run;
|
|||||||
%local joburi;
|
%local joburi;
|
||||||
%let joburi=0;
|
%let joburi=0;
|
||||||
data _null_;
|
data _null_;
|
||||||
|
length name uri $512;
|
||||||
|
call missing(name,uri);
|
||||||
set &foldermembers;
|
set &foldermembers;
|
||||||
if name="&name" and uri=:'/jobDefinitions/definitions'
|
if name="&name" and uri=:'/jobDefinitions/definitions'
|
||||||
then call symputx('joburi',uri);
|
then call symputx('joburi',uri);
|
||||||
|
|||||||
Reference in New Issue
Block a user