mirror of
https://github.com/sasjs/core.git
synced 2026-01-03 23:50:06 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0a0274990 | ||
|
|
b3d374f1b1 | ||
|
|
1c4458faf6 | ||
|
|
96e1d146f4 | ||
|
|
aadc4fb83d | ||
|
|
988ee89cdb | ||
|
|
51cbfbf4bc | ||
|
|
4b69e91362 | ||
|
|
8f9715035a | ||
|
|
35ddccaa16 | ||
|
|
cb0ddfb61c |
@@ -98,7 +98,18 @@
|
|||||||
"contributions": [
|
"contributions": [
|
||||||
"ideas"
|
"ideas"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "VladislavParhomchik",
|
||||||
|
"name": "Vladislav Parhomchik",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/83717836?v=4",
|
||||||
|
"profile": "https://github.com/VladislavParhomchik",
|
||||||
|
"contributions": [
|
||||||
|
"test",
|
||||||
|
"review"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributorsPerLine": 7
|
"contributorsPerLine": 7,
|
||||||
|
"skipCi": true
|
||||||
}
|
}
|
||||||
|
|||||||
4
.github/workflows/run-tests.yml
vendored
4
.github/workflows/run-tests.yml
vendored
@@ -12,12 +12,12 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [12.x]
|
node-version: [lts/fermium]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- init: nvm install --latest-npm && npm i -g @sasjs/cli
|
- init: nvm install --lts && npm i -g @sasjs/cli
|
||||||
|
|
||||||
image:
|
image:
|
||||||
file: .gitpod.dockerfile
|
file: .gitpod.dockerfile
|
||||||
@@ -20,6 +20,6 @@ github:
|
|||||||
# add a "Review in Gitpod" button as a comment to pull requests (defaults to true)
|
# add a "Review in Gitpod" button as a comment to pull requests (defaults to true)
|
||||||
addComment: true
|
addComment: true
|
||||||
# add a "Review in Gitpod" button to pull requests (defaults to false)
|
# add a "Review in Gitpod" button to pull requests (defaults to false)
|
||||||
addBadge: true
|
addBadge: false
|
||||||
# add a label once the prebuild is ready to pull requests (defaults to false)
|
# add a label once the prebuild is ready to pull requests (defaults to false)
|
||||||
addLabel: prebuilt-in-gitpod
|
addLabel: prebuilt-in-gitpod
|
||||||
@@ -9,3 +9,4 @@ sasjs/
|
|||||||
main.dox
|
main.dox
|
||||||
make_singlefile.sh
|
make_singlefile.sh
|
||||||
*.md
|
*.md
|
||||||
|
.all-contributorsrc
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ If you find this library useful, please leave a [star](https://github.com/sasjs/
|
|||||||
|
|
||||||
## Contributors ✨
|
## Contributors ✨
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
[](#contributors-)
|
[](#contributors-)
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
||||||
|
|
||||||
@@ -208,6 +208,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center"><a href="https://github.com/kkchandok"><img src="https://avatars.githubusercontent.com/u/46090627?v=4?s=100" width="100px;" alt=""/><br /><sub><b>kkchandok</b></sub></a><br /><a href="#ideas-kkchandok" title="Ideas, Planning, & Feedback">🤔</a></td>
|
<td align="center"><a href="https://github.com/kkchandok"><img src="https://avatars.githubusercontent.com/u/46090627?v=4?s=100" width="100px;" alt=""/><br /><sub><b>kkchandok</b></sub></a><br /><a href="#ideas-kkchandok" title="Ideas, Planning, & Feedback">🤔</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/VladislavParhomchik"><img src="https://avatars.githubusercontent.com/u/83717836?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vladislav Parhomchik</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=VladislavParhomchik" title="Tests">⚠️</a> <a href="https://github.com/sasjs/core/pulls?q=is%3Apr+reviewed-by%3AVladislavParhomchik" title="Reviewed Pull Requests">👀</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
11
all.sas
11
all.sas
@@ -1830,7 +1830,7 @@ Usage:
|
|||||||
msg=cats('"',msg,'"');
|
msg=cats('"',msg,'"');
|
||||||
if symexist('_debug') then debug=quote(trim(symget('_debug')));
|
if symexist('_debug') then debug=quote(trim(symget('_debug')));
|
||||||
else debug='""';
|
else debug='""';
|
||||||
if debug ge '"131"' then put '>>weboutBEGIN<<';
|
put '>>weboutBEGIN<<';
|
||||||
put '{"START_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '"';
|
put '{"START_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '"';
|
||||||
put ',"sasjsAbort" : [{';
|
put ',"sasjsAbort" : [{';
|
||||||
put ' "MSG":' msg ;
|
put ' "MSG":' msg ;
|
||||||
@@ -1862,7 +1862,7 @@ Usage:
|
|||||||
put ",""SYSWARNINGTEXT"" : " syswarningtext;
|
put ",""SYSWARNINGTEXT"" : " syswarningtext;
|
||||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||||
put "}" @;
|
put "}" @;
|
||||||
if debug ge '"131"' then put '>>weboutEND<<';
|
put '>>weboutEND<<';
|
||||||
run;
|
run;
|
||||||
|
|
||||||
%put _all_;
|
%put _all_;
|
||||||
@@ -4466,8 +4466,11 @@ create table &outds as
|
|||||||
on upcase(a.TABLE_CATALOG)=upcase(b.TABLE_CATALOG)
|
on upcase(a.TABLE_CATALOG)=upcase(b.TABLE_CATALOG)
|
||||||
and upcase(a.TABLE_NAME)=upcase(b.TABLE_NAME)
|
and upcase(a.TABLE_NAME)=upcase(b.TABLE_NAME)
|
||||||
and a.constraint_name=b.constraint_name
|
and a.constraint_name=b.constraint_name
|
||||||
where upcase(a.TABLE_CATALOG)="&lib"
|
/**
|
||||||
and upcase(b.TABLE_CATALOG)="&lib"
|
* We cannot apply this clause to the underlying dictionary table. See:
|
||||||
|
* https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771554#M244867
|
||||||
|
*/
|
||||||
|
where calculated libref="&lib"
|
||||||
%if "&ds" ne "" %then %do;
|
%if "&ds" ne "" %then %do;
|
||||||
and upcase(a.TABLE_NAME)="&ds"
|
and upcase(a.TABLE_NAME)="&ds"
|
||||||
and upcase(b.TABLE_NAME)="&ds"
|
and upcase(b.TABLE_NAME)="&ds"
|
||||||
|
|||||||
@@ -169,7 +169,7 @@
|
|||||||
msg=cats('"',msg,'"');
|
msg=cats('"',msg,'"');
|
||||||
if symexist('_debug') then debug=quote(trim(symget('_debug')));
|
if symexist('_debug') then debug=quote(trim(symget('_debug')));
|
||||||
else debug='""';
|
else debug='""';
|
||||||
if debug ge '"131"' then put '>>weboutBEGIN<<';
|
put '>>weboutBEGIN<<';
|
||||||
put '{"START_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '"';
|
put '{"START_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '"';
|
||||||
put ',"sasjsAbort" : [{';
|
put ',"sasjsAbort" : [{';
|
||||||
put ' "MSG":' msg ;
|
put ' "MSG":' msg ;
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
put ",""SYSWARNINGTEXT"" : " syswarningtext;
|
put ",""SYSWARNINGTEXT"" : " syswarningtext;
|
||||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||||
put "}" @;
|
put "}" @;
|
||||||
if debug ge '"131"' then put '>>weboutEND<<';
|
put '>>weboutEND<<';
|
||||||
run;
|
run;
|
||||||
|
|
||||||
%put _all_;
|
%put _all_;
|
||||||
|
|||||||
@@ -49,8 +49,11 @@ create table &outds as
|
|||||||
on upcase(a.TABLE_CATALOG)=upcase(b.TABLE_CATALOG)
|
on upcase(a.TABLE_CATALOG)=upcase(b.TABLE_CATALOG)
|
||||||
and upcase(a.TABLE_NAME)=upcase(b.TABLE_NAME)
|
and upcase(a.TABLE_NAME)=upcase(b.TABLE_NAME)
|
||||||
and a.constraint_name=b.constraint_name
|
and a.constraint_name=b.constraint_name
|
||||||
where upcase(a.TABLE_CATALOG)="&lib"
|
/**
|
||||||
and upcase(b.TABLE_CATALOG)="&lib"
|
* We cannot apply this clause to the underlying dictionary table. See:
|
||||||
|
* https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771554#M244867
|
||||||
|
*/
|
||||||
|
where calculated libref="&lib"
|
||||||
%if "&ds" ne "" %then %do;
|
%if "&ds" ne "" %then %do;
|
||||||
and upcase(a.TABLE_NAME)="&ds"
|
and upcase(a.TABLE_NAME)="&ds"
|
||||||
and upcase(b.TABLE_NAME)="&ds"
|
and upcase(b.TABLE_NAME)="&ds"
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
@file mp_unzip.sas
|
@file mp_unzip.sas
|
||||||
@brief Unzips a zip file
|
@brief Unzips a zip file
|
||||||
@details Opens the zip file and copies all the contents to another directory.
|
@details Opens the zip file and copies all the contents to another directory.
|
||||||
It is not possible to retain permissions / timestamps, also the BOF marker
|
It is not possible to retain permissions / timestamps, also the BOF marker
|
||||||
is lost so it cannot extract binary files.
|
is lost so it cannot extract binary files.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
||||||
%inc mc;
|
%inc mc;
|
||||||
@@ -16,8 +16,9 @@
|
|||||||
@li mf_mkdir.sas
|
@li mf_mkdir.sas
|
||||||
@li mf_getuniquefileref.sas
|
@li mf_getuniquefileref.sas
|
||||||
|
|
||||||
@param ziploc= fileref or quoted full path to zip file ("/path/to/file.zip")
|
@param ziploc= Fileref or quoted full path to zip file ("/path/to/file.zip")
|
||||||
@param outdir= directory in which to write the outputs (created if non existant)
|
@param outdir= (%sysfunc(pathname(work))) Directory in which to write the
|
||||||
|
outputs (created if non existant)
|
||||||
|
|
||||||
@version 9.4
|
@version 9.4
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
@@ -35,7 +36,8 @@
|
|||||||
%let fname2=%mf_getuniquefileref();
|
%let fname2=%mf_getuniquefileref();
|
||||||
%let fname3=%mf_getuniquefileref();
|
%let fname3=%mf_getuniquefileref();
|
||||||
|
|
||||||
filename &fname1 ZIP &ziploc; * Macro variable &datazip would be read from the file*;
|
/* Macro variable &datazip would be read from the file */
|
||||||
|
filename &fname1 ZIP &ziploc;
|
||||||
|
|
||||||
/* Read the "members" (files) from the ZIP file */
|
/* Read the "members" (files) from the ZIP file */
|
||||||
data _data_(keep=memname isFolder);
|
data _data_(keep=memname isFolder);
|
||||||
|
|||||||
37
base/mp_wait4file.sas
Normal file
37
base/mp_wait4file.sas
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Wait until a file arrives before continuing execution
|
||||||
|
@details Loops with a `sleep()` command until a file arrives or the max wait
|
||||||
|
period expires.
|
||||||
|
|
||||||
|
@example
|
||||||
|
|
||||||
|
Wait 3 minutes OR for /tmp/flag.txt to appear
|
||||||
|
|
||||||
|
%mp_wait4file(/tmp/flag.txt , maxwait=60*3)
|
||||||
|
|
||||||
|
@param [in] file The file to wait for. Must be provided.
|
||||||
|
@param [in] maxwait= (0) Number of seconds to wait. If set to zero, will
|
||||||
|
loop indefinitely (to a maximum of 46 days, per SAS [documentation](
|
||||||
|
https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001418809.htm
|
||||||
|
)). Otherwise, execution will proceed upon sleep expiry.
|
||||||
|
@param [in] interval= (1) The wait period between sleeps, in seconds
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
%macro mp_wait4file(file, maxwait=0, interval=1);
|
||||||
|
|
||||||
|
%if %str(&file)=%str() %then %do;
|
||||||
|
%put %str(ERR)OR: file not provided;
|
||||||
|
%end;
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
maxwait=&maxwait;
|
||||||
|
if maxwait=0 then maxwait=60*60*24*46;
|
||||||
|
do until (fileexist("&file") or slept>maxwait );
|
||||||
|
slept=sum(slept,sleep(&interval,1));
|
||||||
|
end;
|
||||||
|
run;
|
||||||
|
|
||||||
|
%mend mp_wait4file;
|
||||||
1245
package-lock.json
generated
1245
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,6 @@
|
|||||||
"prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
|
"prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sasjs/cli": "^2.38.8"
|
"@sasjs/cli": "^2.39.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,10 @@
|
|||||||
"appLoc": "/Shared Data/temp/macrocore",
|
"appLoc": "/Shared Data/temp/macrocore",
|
||||||
"macroFolders": [
|
"macroFolders": [
|
||||||
"tests/sas9only"
|
"tests/sas9only"
|
||||||
]
|
],
|
||||||
|
"deployConfig": {
|
||||||
|
"deployServicePack": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "docsonly",
|
"name": "docsonly",
|
||||||
|
|||||||
29
tests/crossplatform/mp_getconstraints.test.sas
Normal file
29
tests/crossplatform/mp_getconstraints.test.sas
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
@file
|
||||||
|
@brief Testing mp_getconstraints.sas macro
|
||||||
|
|
||||||
|
<h4> SAS Macros </h4>
|
||||||
|
@li mf_nobs.sas
|
||||||
|
@li mp_getconstraints.sas
|
||||||
|
@li mp_assert.sas
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
proc sql;
|
||||||
|
create table work.example(
|
||||||
|
TX_FROM float format=datetime19.,
|
||||||
|
DD_TYPE char(16),
|
||||||
|
DD_SOURCE char(2048),
|
||||||
|
DD_SHORTDESC char(256),
|
||||||
|
constraint pk primary key(tx_from, dd_type,dd_source),
|
||||||
|
constraint unq unique(tx_from, dd_type),
|
||||||
|
constraint nnn not null(DD_SHORTDESC)
|
||||||
|
);
|
||||||
|
|
||||||
|
%mp_getconstraints(lib=work,ds=example,outds=work.constraints)
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mf_nobs(work.constraints)=6),
|
||||||
|
desc=Output table work.constraints created with correct number of records,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user