1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-13 07:24:35 +00:00

Compare commits

..

7 Commits

Author SHA1 Message Date
Allan Bowe
98a0d185ff fix: compatibility with compute sessions 2020-07-15 09:58:48 +02:00
Allan Bowe
888e07468c fix: pretty option always in proc json 2020-07-11 11:57:56 +02:00
Allan Bowe
f491fa3ef5 fix: file based upload with sasjs_tables for testing 2020-07-11 11:18:17 +02:00
Allan Bowe
6b1ea7323c fix: updating ref to main (not master) 2020-07-09 09:38:29 +02:00
Krishna Acondy
5f1eaefa11 Merge pull request #1 from sasjs/ci-update
fix(ci): update default branch to main
2020-07-09 08:21:59 +01:00
Krishna Acondy
77aec4a9da fix(ci): update default branch to main 2020-07-09 08:20:27 +01:00
Allan Bowe
a9e9f28e05 docs: revamp with new repo location 2020-07-07 23:09:33 +02:00
47 changed files with 288 additions and 189 deletions

View File

@@ -6,7 +6,7 @@ name: SASjs Core Publish
on: on:
push: push:
branches: branches:
- master - main
jobs: jobs:
release: release:

View File

@@ -1,11 +1,11 @@
# Macro Core # Macro Core
Much quality. Many standards. The **Macro Core** library exists to save time and development effort! Herein ye shall find a veritable host of MIT-licenced, production quality SAS macros. These are a mix of tools, utilities, functions and code generators that are useful in the context of Application Development on the SAS platform (eg https://datacontroller.io). [Contributions](https://github.com/sasjs/core/blob/master/CONTRIBUTING.md) are welcomed. Much quality. Many standards. The **Macro Core** library exists to save time and development effort! Herein ye shall find a veritable host of MIT-licenced, production quality SAS macros. These are a mix of tools, utilities, functions and code generators that are useful in the context of Application Development on the SAS platform (eg https://datacontroller.io). [Contributions](https://github.com/sasjs/core/blob/main/CONTRIBUTING.md) are welcomed.
You can download and compile them all in just two lines of SAS code: You can download and compile them all in just two lines of SAS code:
```sas ```sas
filename mc url "https://raw.githubusercontent.com/sasjs/core/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
``` ```
@@ -54,7 +54,7 @@ The above can be done directly in your sas program, via an autoexec, or an initi
Alternatively - for quick access - simply run the following! This file contains all the macros. Alternatively - for quick access - simply run the following! This file contains all the macros.
```sas ```sas
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
``` ```

View File

@@ -7,10 +7,10 @@
'included' in SAS with just 2 lines of code: 'included' in SAS with just 2 lines of code:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
The `build.py` file in the https://github.com/macropeople/macrocore repo The `build.py` file in the https://github.com/sasjs/core repo
is used to create this file. is used to create this file.
@author Allan Bowe @author Allan Bowe
@@ -497,7 +497,7 @@ options noquotelenmax;
%end; %end;
%else %put %str(ERR)OR: Unable to find key &key in ds &libds; %else %put %str(ERR)OR: Unable to find key &key in ds &libds;
%mend;/** %mend;/**
@file mf_getplatform @file mf_getplatform.sas
@brief Returns platform specific variables @brief Returns platform specific variables
@details Enables platform specific variables to be returned @details Enables platform specific variables to be returned
@@ -1765,7 +1765,7 @@ run;
Usage: Usage:
%* compile macros ; %* compile macros ;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* write some code; %* write some code;
@@ -2311,7 +2311,7 @@ data _null_;
put '/*******************************************************************'; put '/*******************************************************************';
put " Datalines for %upcase(%scan(&base_ds,2)) dataset "; put " Datalines for %upcase(%scan(&base_ds,2)) dataset ";
put " Generated by %nrstr(%%)mp_ds2cards()"; put " Generated by %nrstr(%%)mp_ds2cards()";
put " Available on github.com/macropeople/macrocore"; put " Available on github.com/sasjs/core";
put '********************************************************************/'; put '********************************************************************/';
put "data &tgt_ds &indexes;"; put "data &tgt_ds &indexes;";
put "attrib "; put "attrib ";
@@ -2465,7 +2465,7 @@ create table &outds as
@version 9.3 @version 9.3
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -2748,7 +2748,7 @@ create table &outds (rename=(
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mp_guesspk(sashelp.class,outds=classpks) %mp_guesspk(sashelp.class,outds=classpks)
@@ -3062,7 +3062,8 @@ create table &outds (rename=(
run; run;
If you are building web apps with SAS then you are strongly encouraged to use If you are building web apps with SAS then you are strongly encouraged to use
the mX_createwebservice macros in combination with [sasjs](https://github.com/macropeople/sasjs). the mX_createwebservice macros in combination with the
[sasjs adapter](https://github.com/sasjs/adapter).
For more information see https://sasjs.io For more information see https://sasjs.io
@param action Valid values: @param action Valid values:
@@ -3079,11 +3080,13 @@ create table &outds (rename=(
* PROCJSON (default) * PROCJSON (default)
* DATASTEP * DATASTEP
@param dbg= Typically used with an _debug (numeric) option @param dbg= DEPRECATED - was used to conditionally add PRETTY to
proc json but this can cause line truncation in large files.
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -3105,9 +3108,8 @@ create table &outds (rename=(
proc sql;drop table &tempds; proc sql;drop table &tempds;
data &tempds /view=&tempds;set &ds; data &tempds /view=&tempds;set &ds;
%if &fmt=N %then format _numeric_ best32.;; %if &fmt=N %then format _numeric_ best32.;;
proc json out=&jref proc json out=&jref pretty
%if &action=ARR %then nokeys ; %if &action=ARR %then nokeys ;
%if &dbg ge 131 %then pretty ;
;export &tempds / nosastags fmtnumeric; ;export &tempds / nosastags fmtnumeric;
run; run;
proc sql;drop view &tempds; proc sql;drop view &tempds;
@@ -3268,7 +3270,7 @@ select distinct lowcase(memname)
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -3451,7 +3453,7 @@ run;
@version 9.3 @version 9.3
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -3657,7 +3659,7 @@ proc sql
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -3719,7 +3721,7 @@ proc sql
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -3769,7 +3771,7 @@ proc sql
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mp_streamfile(contenttype=csv,inloc=/some/where.txt,outname=myfile.txt) %mp_streamfile(contenttype=csv,inloc=/some/where.txt,outname=myfile.txt)
@@ -3783,7 +3785,7 @@ proc sql
@param outname= the name of the file, as downloaded by the browser @param outname= the name of the file, as downloaded by the browser
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -3861,6 +3863,64 @@ proc sql
%mp_binarycopy(inloc="&inloc",outref=_webout) %mp_binarycopy(inloc="&inloc",outref=_webout)
%mend;/**
@file mp_testwritespeedlibrary.sas
@brief Tests the write speed of a new table in a SAS library
@details Will create a new table of a certain size in an
existing SAS library. The table will have one column,
and will be subsequently deleted.
%mp_testwritespeedlibrary(
lib=work
,size=0.5
,outds=work.results
)
@param lib= (WORK) The library in which to create the table
@param size= (0.1) The size in GB of the table to create
@param outds= (WORK.RESULTS) The output dataset to be created.
<h4> Dependencies </h4>
@li mf_getuniquename.sas
@li mf_existds.sas
@version 9.4
@author Allan Bowe
**/
%macro mp_testwritespeedlibrary(lib=WORK
,outds=work.results
,size=0.1
)/*/STORE SOURCE*/;
%local ds start;
/* find an unused, unique name for the new table */
%let ds=%mf_getuniquename();
%do %until(%mf_existds(&lib..&ds)=0);
%let ds=%mf_getuniquename();
%end;
%let start=%sysfunc(datetime());
data &lib..&ds(compress=no keep=x);
header=128*1024;
size=(1073741824/8 * &size) - header;
do x=1 to size;
output;
end;
run;
proc sql;
drop table &lib..&ds;
data &outds;
lib="&lib";
start_dttm=put(&start,datetime19.);
end_dttm=put(datetime(),datetime19.);
duration_seconds=end_dttm-start_dttm;
run;
%mend;/** %mend;/**
@file mp_unzip.sas @file mp_unzip.sas
@brief Unzips a zip file @brief Unzips a zip file
@@ -3870,7 +3930,7 @@ proc sql
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mp_unzip(ziploc="/some/file.zip",outdir=/some/folder) %mp_unzip(ziploc="/some/file.zip",outdir=/some/folder)
@@ -3884,7 +3944,7 @@ proc sql
@version 9.4 @version 9.4
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -4044,7 +4104,7 @@ alter table &libds modify &var char(&len);
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -5949,12 +6009,12 @@ run;
%mend;/** %mend;/**
@file mm_createwebservice.sas @file mm_createwebservice.sas
@brief Create a Web Ready Stored Process @brief Create a Web Ready Stored Process
@details This macro creates a Type 2 Stored Process with the macropeople @details This macro creates a Type 2 Stored Process with the mm_webout macro
mm_webout macro included as pre-code. included as pre-code.
Usage: Usage:
%* compile macros ; %* compile macros ;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* parmcards lets us write to a text file from open code ; %* parmcards lets us write to a text file from open code ;
@@ -6052,9 +6112,8 @@ data _null_;
put ' proc sql;drop table &tempds; '; put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; '; put ' data &tempds /view=&tempds;set &ds; ';
put ' %if &fmt=N %then format _numeric_ best32.;; '; put ' %if &fmt=N %then format _numeric_ best32.;; ';
put ' proc json out=&jref '; put ' proc json out=&jref pretty ';
put ' %if &action=ARR %then nokeys ; '; put ' %if &action=ARR %then nokeys ; ';
put ' %if &dbg ge 131 %then pretty ; ';
put ' ;export &tempds / nosastags fmtnumeric; '; put ' ;export &tempds / nosastags fmtnumeric; ';
put ' run; '; put ' run; ';
put ' proc sql;drop view &tempds; '; put ' proc sql;drop view &tempds; ';
@@ -6149,7 +6208,8 @@ data _null_;
put '%end; '; put '%end; ';
put '%mend; '; put '%mend; ';
put '%macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y); '; put '%macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y); ';
put '%global _webin_file_count _webin_fileref1 _webin_name1 _program _debug; '; put '%global _webin_file_count _webin_fileref1 _webin_name1 _program _debug ';
put ' sasjs_tables; ';
put '%local i tempds; '; put '%local i tempds; ';
put ' '; put ' ';
put '%if &action=FETCH %then %do; '; put '%if &action=FETCH %then %do; ';
@@ -6176,6 +6236,7 @@ data _null_;
put ' if _n_<20 then putlog _infile_; '; put ' if _n_<20 then putlog _infile_; ';
put ' %end; '; put ' %end; ';
put ' run; '; put ' run; ';
put ' %let sasjs_tables=&sasjs_tables &&_webin_name&i; ';
put ' %end; '; put ' %end; ';
put '%end; '; put '%end; ';
put ' '; put ' ';
@@ -8289,13 +8350,14 @@ libname _XML_ clear;
/** /**
@file @file
@brief Retrieves properties of the SAS web app server @brief Retrieves properties of the SAS web app server
@description usage: @details
Usage:
%mm_getwebappsrvprops(outds= some_ds) %mm_getwebappsrvprops(outds= some_ds)
data _null_; data _null_;
set some_ds(where=(name='webappsrv.server.url')); set some_ds(where=(name='webappsrv.server.url'));
put value=; put value=;
run; run;
@param outds the dataset to create that contains the list of properties @param outds the dataset to create that contains the list of properties
@@ -8309,7 +8371,7 @@ libname _XML_ clear;
@version 9.4 @version 9.4
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -8433,7 +8495,7 @@ filename __shake clear;
Usage: Usage:
%* import the macros (or make them available some other way); %* import the macros (or make them available some other way);
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* create sample text file as input to the macro; %* create sample text file as input to the macro;
@@ -8555,7 +8617,7 @@ run;
Usage: Usage:
%* load macros; %* load macros;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* export everything; %* export everything;
@@ -9186,7 +9248,8 @@ run;
**/ **/
%macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y); %macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y);
%global _webin_file_count _webin_fileref1 _webin_name1 _program _debug; %global _webin_file_count _webin_fileref1 _webin_name1 _program _debug
sasjs_tables;
%local i tempds; %local i tempds;
%if &action=FETCH %then %do; %if &action=FETCH %then %do;
@@ -9213,6 +9276,7 @@ run;
if _n_<20 then putlog _infile_; if _n_<20 then putlog _infile_;
%end; %end;
run; run;
%let sasjs_tables=&sasjs_tables &&_webin_name&i;
%end; %end;
%end; %end;
@@ -9359,7 +9423,7 @@ run;
Usage: Usage:
%* import the macros (or make them available some other way); %* import the macros (or make them available some other way);
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* create sample text file as input to the macro; %* create sample text file as input to the macro;
@@ -9457,7 +9521,7 @@ run;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -9597,7 +9661,7 @@ options noquotelenmax;
@details Code is passed in as one or more filerefs. @details Code is passed in as one or more filerefs.
%* Step 1 - compile macros ; %* Step 1 - compile macros ;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* Step 2 - Create some code and add it to a web service; %* Step 2 - Create some code and add it to a web service;
@@ -9648,7 +9712,7 @@ options noquotelenmax;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -9834,9 +9898,8 @@ data _null_;
put ' proc sql;drop table &tempds; '; put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; '; put ' data &tempds /view=&tempds;set &ds; ';
put ' %if &fmt=N %then format _numeric_ best32.;; '; put ' %if &fmt=N %then format _numeric_ best32.;; ';
put ' proc json out=&jref '; put ' proc json out=&jref pretty ';
put ' %if &action=ARR %then nokeys ; '; put ' %if &action=ARR %then nokeys ; ';
put ' %if &dbg ge 131 %then pretty ; ';
put ' ;export &tempds / nosastags fmtnumeric; '; put ' ;export &tempds / nosastags fmtnumeric; ';
put ' run; '; put ' run; ';
put ' proc sql;drop view &tempds; '; put ' proc sql;drop view &tempds; ';
@@ -9931,7 +9994,8 @@ data _null_;
put '%end; '; put '%end; ';
put '%mend; '; put '%mend; ';
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); '; put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); ';
put '%global _webin_file_count _webin_fileuri _debug _omittextlog ; '; put '%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name ';
put ' sasjs_tables SYS_JES_JOB_URI; ';
put '%if %index("&_debug",log) %then %let _debug=131; '; put '%if %index("&_debug",log) %then %let _debug=131; ';
put ' '; put ' ';
put '%local i tempds; '; put '%local i tempds; ';
@@ -9945,11 +10009,11 @@ data _null_;
put ' %if not %symexist(_webin_fileuri1) %then %do; '; put ' %if not %symexist(_webin_fileuri1) %then %do; ';
put ' %let _webin_file_count=%eval(&_webin_file_count+0); '; put ' %let _webin_file_count=%eval(&_webin_file_count+0); ';
put ' %let _webin_fileuri1=&_webin_fileuri; '; put ' %let _webin_fileuri1=&_webin_fileuri; ';
put ' %let _webin_name1=&_webin_name; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' %if %symexist(sasjs_tables) %then %do; '; put ' /* if the sasjs_tables param is passed, we expect param based upload */ ';
put ' /* small volumes of non-special data are sent as params for responsiveness */ '; put ' %if %length(&sasjs_tables.XX)>2 %then %do; ';
put ' /* to do - deal with escaped values */ ';
put ' filename _sasjs "%sysfunc(pathname(work))/sasjs.lua"; '; put ' filename _sasjs "%sysfunc(pathname(work))/sasjs.lua"; ';
put ' data _null_; '; put ' data _null_; ';
put ' file _sasjs; '; put ' file _sasjs; ';
@@ -10028,13 +10092,19 @@ data _null_;
put ' infile indata firstobs=2 dsd termstr=crlf ; '; put ' infile indata firstobs=2 dsd termstr=crlf ; ';
put ' input &input_statement; '; put ' input &input_statement; ';
put ' run; '; put ' run; ';
put ' %let sasjs_tables=&sasjs_tables &&_webin_name&i; ';
put ' %end; '; put ' %end; ';
put '%end; '; put '%end; ';
put '%else %if &action=OPEN %then %do; '; put '%else %if &action=OPEN %then %do; ';
put ' /* setup webout */ '; put ' /* setup webout */ ';
put ' OPTIONS NOBOMFILE; '; put ' OPTIONS NOBOMFILE; ';
put ' filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" '; put ' %if "X&SYS_JES_JOB_URI.X"="XX" %then %do; ';
put ' name="_webout.json" lrecl=999999 mod; '; put ' filename _webout temp lrecl=999999 mod; ';
put ' %end; ';
put ' %else %do; ';
put ' filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" ';
put ' name="_webout.json" lrecl=999999 mod; ';
put ' %end; ';
put ' '; put ' ';
put ' /* setup temp ref */ '; put ' /* setup temp ref */ ';
put ' %if %upcase(&fref) ne _WEBOUT %then %do; '; put ' %if %upcase(&fref) ne _WEBOUT %then %do; ';
@@ -10064,13 +10134,13 @@ data _null_;
put ' i+1; '; put ' i+1; ';
put ' call symputx(''wt''!!left(i),name); '; put ' call symputx(''wt''!!left(i),name); ';
put ' call symputx(''wtcnt'',i); '; put ' call symputx(''wtcnt'',i); ';
put ' data _null_; file &fref; put ",""WORK"":{"; '; put ' data _null_; file &fref mod; put ",""WORK"":{"; ';
put ' %do i=1 %to &wtcnt; '; put ' %do i=1 %to &wtcnt; ';
put ' %let wt=&&wt&i; '; put ' %let wt=&&wt&i; ';
put ' proc contents noprint data=&wt '; put ' proc contents noprint data=&wt ';
put ' out=_data_ (keep=name type length format:); '; put ' out=_data_ (keep=name type length format:); ';
put ' run;%let tempds=%scan(&syslast,2,.); '; put ' run;%let tempds=%scan(&syslast,2,.); ';
put ' data _null_; file &fref; '; put ' data _null_; file &fref mod; ';
put ' dsid=open("WORK.&wt",''is''); '; put ' dsid=open("WORK.&wt",''is''); ';
put ' nlobs=attrn(dsid,''NLOBS''); '; put ' nlobs=attrn(dsid,''NLOBS''); ';
put ' nvars=attrn(dsid,''NVARS''); '; put ' nvars=attrn(dsid,''NVARS''); ';
@@ -10081,9 +10151,9 @@ data _null_;
put ' put '',"nvars":'' nvars; '; put ' put '',"nvars":'' nvars; ';
put ' %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) '; put ' %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) ';
put ' %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) '; put ' %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) ';
put ' data _null_; file &fref;put "}"; '; put ' data _null_; file &fref mod;put "}"; ';
put ' %end; '; put ' %end; ';
put ' data _null_; file &fref;put "}";run; '; put ' data _null_; file &fref mod;put "}";run; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' /* close off json */ '; put ' /* close off json */ ';
@@ -10248,7 +10318,7 @@ run;
@details If not executed in Studio 5+ will expect oauth token in a global @details If not executed in Studio 5+ will expect oauth token in a global
macro variable (default ACCESS_TOKEN). macro variable (default ACCESS_TOKEN).
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mv_createwebservice(path=/Public/test, name=blah) %mv_createwebservice(path=/Public/test, name=blah)
@@ -10265,7 +10335,7 @@ run;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -10399,7 +10469,7 @@ libname &libref1a clear;
@details If not executed in Studio 5+ will expect oauth token in a global @details If not executed in Studio 5+ will expect oauth token in a global
macro variable (default ACCESS_TOKEN). macro variable (default ACCESS_TOKEN).
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mv_createwebservice(path=/Public/test, name=blah) %mv_createwebservice(path=/Public/test, name=blah)
@@ -10415,7 +10485,7 @@ libname &libref1a clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -10560,7 +10630,7 @@ libname &libref1a clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -10689,7 +10759,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mv_tokenrefresh.sas @li mv_tokenrefresh.sas
@@ -10721,7 +10791,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mv_registerclient.sas @li mv_registerclient.sas
@@ -10746,7 +10816,7 @@ libname &libref1 clear;
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -10770,7 +10840,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -10857,7 +10927,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -10960,7 +11030,7 @@ libname &libref1 clear;
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
Now we can run the macro! Now we can run the macro!
@@ -10985,7 +11055,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -11066,7 +11136,7 @@ filename &fname1 clear;
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -11090,7 +11160,7 @@ filename &fname1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -11161,7 +11231,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mv_tokenauth.sas @li mv_tokenauth.sas
@@ -11196,7 +11266,7 @@ libname &libref1 clear;
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -11220,7 +11290,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -11297,7 +11367,7 @@ libname &libref1 clear;
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -11339,7 +11409,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -11419,7 +11489,7 @@ libname &libref1 clear;
Usage: Usage:
%* compile macros; %* compile macros;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* specific client with just openid scope; %* specific client with just openid scope;
@@ -11460,7 +11530,7 @@ libname &libref1 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -11657,7 +11727,7 @@ libname &libref clear;
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
@@ -11683,7 +11753,7 @@ libname &libref clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -11826,7 +11896,7 @@ filename &fref2 clear;
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas
@@ -11952,7 +12022,8 @@ filename &fref1 clear;
**/ **/
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); %macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y);
%global _webin_file_count _webin_fileuri _debug _omittextlog ; %global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name
sasjs_tables SYS_JES_JOB_URI;
%if %index("&_debug",log) %then %let _debug=131; %if %index("&_debug",log) %then %let _debug=131;
%local i tempds; %local i tempds;
@@ -11966,11 +12037,11 @@ filename &fref1 clear;
%if not %symexist(_webin_fileuri1) %then %do; %if not %symexist(_webin_fileuri1) %then %do;
%let _webin_file_count=%eval(&_webin_file_count+0); %let _webin_file_count=%eval(&_webin_file_count+0);
%let _webin_fileuri1=&_webin_fileuri; %let _webin_fileuri1=&_webin_fileuri;
%let _webin_name1=&_webin_name;
%end; %end;
%if %symexist(sasjs_tables) %then %do; /* if the sasjs_tables param is passed, we expect param based upload */
/* small volumes of non-special data are sent as params for responsiveness */ %if %length(&sasjs_tables.XX)>2 %then %do;
/* to do - deal with escaped values */
filename _sasjs "%sysfunc(pathname(work))/sasjs.lua"; filename _sasjs "%sysfunc(pathname(work))/sasjs.lua";
data _null_; data _null_;
file _sasjs; file _sasjs;
@@ -12049,13 +12120,19 @@ filename &fref1 clear;
infile indata firstobs=2 dsd termstr=crlf ; infile indata firstobs=2 dsd termstr=crlf ;
input &input_statement; input &input_statement;
run; run;
%let sasjs_tables=&sasjs_tables &&_webin_name&i;
%end; %end;
%end; %end;
%else %if &action=OPEN %then %do; %else %if &action=OPEN %then %do;
/* setup webout */ /* setup webout */
OPTIONS NOBOMFILE; OPTIONS NOBOMFILE;
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" %if "X&SYS_JES_JOB_URI.X"="XX" %then %do;
name="_webout.json" lrecl=999999 mod; filename _webout temp lrecl=999999 mod;
%end;
%else %do;
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
name="_webout.json" lrecl=999999 mod;
%end;
/* setup temp ref */ /* setup temp ref */
%if %upcase(&fref) ne _WEBOUT %then %do; %if %upcase(&fref) ne _WEBOUT %then %do;
@@ -12085,13 +12162,13 @@ filename &fref1 clear;
i+1; i+1;
call symputx('wt'!!left(i),name); call symputx('wt'!!left(i),name);
call symputx('wtcnt',i); call symputx('wtcnt',i);
data _null_; file &fref; put ",""WORK"":{"; data _null_; file &fref mod; put ",""WORK"":{";
%do i=1 %to &wtcnt; %do i=1 %to &wtcnt;
%let wt=&&wt&i; %let wt=&&wt&i;
proc contents noprint data=&wt proc contents noprint data=&wt
out=_data_ (keep=name type length format:); out=_data_ (keep=name type length format:);
run;%let tempds=%scan(&syslast,2,.); run;%let tempds=%scan(&syslast,2,.);
data _null_; file &fref; data _null_; file &fref mod;
dsid=open("WORK.&wt",'is'); dsid=open("WORK.&wt",'is');
nlobs=attrn(dsid,'NLOBS'); nlobs=attrn(dsid,'NLOBS');
nvars=attrn(dsid,'NVARS'); nvars=attrn(dsid,'NVARS');
@@ -12102,9 +12179,9 @@ filename &fref1 clear;
put ',"nvars":' nvars; put ',"nvars":' nvars;
%mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
%mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
data _null_; file &fref;put "}"; data _null_; file &fref mod;put "}";
%end; %end;
data _null_; file &fref;put "}";run; data _null_; file &fref mod;put "}";run;
%end; %end;
/* close off json */ /* close off json */

View File

@@ -1,5 +1,5 @@
/** /**
@file mf_getplatform @file mf_getplatform.sas
@brief Returns platform specific variables @brief Returns platform specific variables
@details Enables platform specific variables to be returned @details Enables platform specific variables to be returned

View File

@@ -7,7 +7,7 @@
Usage: Usage:
%* compile macros ; %* compile macros ;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* write some code; %* write some code;

View File

@@ -179,7 +179,7 @@ data _null_;
put '/*******************************************************************'; put '/*******************************************************************';
put " Datalines for %upcase(%scan(&base_ds,2)) dataset "; put " Datalines for %upcase(%scan(&base_ds,2)) dataset ";
put " Generated by %nrstr(%%)mp_ds2cards()"; put " Generated by %nrstr(%%)mp_ds2cards()";
put " Available on github.com/macropeople/macrocore"; put " Available on github.com/sasjs/core";
put '********************************************************************/'; put '********************************************************************/';
put "data &tgt_ds &indexes;"; put "data &tgt_ds &indexes;";
put "attrib "; put "attrib ";

View File

@@ -29,7 +29,7 @@
@version 9.3 @version 9.3
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -11,7 +11,7 @@
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mp_guesspk(sashelp.class,outds=classpks) %mp_guesspk(sashelp.class,outds=classpks)

View File

@@ -22,7 +22,8 @@
run; run;
If you are building web apps with SAS then you are strongly encouraged to use If you are building web apps with SAS then you are strongly encouraged to use
the mX_createwebservice macros in combination with [sasjs](https://github.com/macropeople/sasjs). the mX_createwebservice macros in combination with the
[sasjs adapter](https://github.com/sasjs/adapter).
For more information see https://sasjs.io For more information see https://sasjs.io
@param action Valid values: @param action Valid values:
@@ -39,11 +40,13 @@
* PROCJSON (default) * PROCJSON (default)
* DATASTEP * DATASTEP
@param dbg= Typically used with an _debug (numeric) option @param dbg= DEPRECATED - was used to conditionally add PRETTY to
proc json but this can cause line truncation in large files.
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -65,9 +68,8 @@
proc sql;drop table &tempds; proc sql;drop table &tempds;
data &tempds /view=&tempds;set &ds; data &tempds /view=&tempds;set &ds;
%if &fmt=N %then format _numeric_ best32.;; %if &fmt=N %then format _numeric_ best32.;;
proc json out=&jref proc json out=&jref pretty
%if &action=ARR %then nokeys ; %if &action=ARR %then nokeys ;
%if &dbg ge 131 %then pretty ;
;export &tempds / nosastags fmtnumeric; ;export &tempds / nosastags fmtnumeric;
run; run;
proc sql;drop view &tempds; proc sql;drop view &tempds;

View File

@@ -16,7 +16,7 @@
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -37,7 +37,7 @@
@version 9.3 @version 9.3
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -17,7 +17,7 @@
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -28,7 +28,7 @@
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -6,7 +6,7 @@
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mp_streamfile(contenttype=csv,inloc=/some/where.txt,outname=myfile.txt) %mp_streamfile(contenttype=csv,inloc=/some/where.txt,outname=myfile.txt)
@@ -20,7 +20,7 @@
@param outname= the name of the file, as downloaded by the browser @param outname= the name of the file, as downloaded by the browser
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -7,7 +7,7 @@
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mp_unzip(ziploc="/some/file.zip",outdir=/some/folder) %mp_unzip(ziploc="/some/file.zip",outdir=/some/folder)
@@ -21,7 +21,7 @@
@version 9.4 @version 9.4
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -23,7 +23,7 @@
@version 9.2 @version 9.2
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -69,17 +69,17 @@ header="""
'included' in SAS with just 2 lines of code: 'included' in SAS with just 2 lines of code:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
The `build.py` file in the https://github.com/macropeople/macrocore repo The `build.py` file in the https://github.com/sasjs/core repo
is used to create this file. is used to create this file.
@author Allan Bowe @author Allan Bowe
**/ **/
options noquotelenmax; options noquotelenmax;
""" """
f = open('mc_all.sas', "w") # r / r+ / rb / rb+ / w / wb f = open('all.sas', "w") # r / r+ / rb / rb+ / w / wb
f.write(header) f.write(header)
folders=['base','meta','metax','viya','lua'] folders=['base','meta','metax','viya','lua']
for folder in folders: for folder in folders:

View File

@@ -28,8 +28,8 @@ echo "INPUT+=main.dox" >> $BUILD_FOLDER/Doxyfile
doxygen Doxyfile doxygen Doxyfile
# refresh github pages site # refresh github pages site
git clone git@github.com:macropeople/macrocore.github.io.git git clone git@github.com:sasjs/core.github.io.git
cd macrocore.github.io cd core.github.io
git rm -r * git rm -r *
mv $BUILD_FOLDER/out/doxy/* . mv $BUILD_FOLDER/out/doxy/* .
echo 'core.sasjs.io' > CNAME echo 'core.sasjs.io' > CNAME
@@ -37,4 +37,4 @@ git add *
git commit -m "build.sh build on $(date +%F:%H:%M:%S)" git commit -m "build.sh build on $(date +%F:%H:%M:%S)"
git push git push
echo "check it out: https://macropeople.github.io/macrocore.github.io/files.html" echo "check it out: https://sasjs.github.io/core.github.io/files.html"

View File

@@ -2,7 +2,7 @@
<li class="footer"><b>$generatedby</b> <li class="footer"><b>$generatedby</b>
<a href="http://www.doxygen.org/index.html"> <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> <img class="footer" src="doxygen.png" alt="doxygen"/></a>
<i> For more information visit the </i> <a href="https://github.com/macropeople/macrocore">macropeople MacroCore library</a>.</li> <i> For more information visit the </i> <a href="https://github.com/sasjs/core">Macro Core library</a>.</li>
</ul> </ul>
</div> </div>
@@ -10,7 +10,7 @@
<!--BEGIN !GENERATE_TREEVIEW--> <!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/> <hr class="footer"/>
<table width="100%"><tbody><tr><td> <table width="100%"><tbody><tr><td>
For more information visit the <a href="https://github.com/macropeople/macrocore">macropeople MacroCore library</a>. For more information visit the <a href="https://github.com/sasjs/core">Macro Core library</a>.
</td><td><address class="footer"><small> </td><td><address class="footer"><small>
&copy;$year<br/> &copy;$year<br/>
$generatedby <a href="http://www.doxygen.org/index.html"> $generatedby <a href="http://www.doxygen.org/index.html">

View File

@@ -45,8 +45,8 @@ $extrastylesheet
<td> <td>
<table style="padding-left: 2em;" cellspacing="0" cellpadding="0"> <table style="padding-left: 2em;" cellspacing="0" cellpadding="0">
<tr><td> Production Ready Macros for SAS Application Developers</td></tr> <tr><td> Production Ready Macros for SAS Application Developers</td></tr>
<tr><td><a href="https://github.com/macropeople/macrocore"> <tr><td><a href="https://github.com/sasjs/core">
https://github.com/macropeople/macrocore https://github.com/sasjs/core
</a></td></tr> </a></td></tr>
</table> </table>
</td> </td>

View File

@@ -1,6 +1,6 @@
/** \dir . /** \dir .
* \brief Open Source Macro Library for Developers of the SAS Language. See: https://github.com/macropeople/macrocore * \brief Open Source Macro Library for Developers of the SAS Language. See: https://github.com/sasjs/core
* \details To use - add the subfolders to your `SASAUTOS` call path. * \details To use - add the subfolders to your `SASAUTOS` call path.
*/ */

View File

@@ -13,10 +13,10 @@ cat > $OUTFILE <<'EOL'
'included' in SAS with just 2 lines of code: 'included' in SAS with just 2 lines of code:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/macrocore.sas"; "https://raw.githubusercontent.com/sasjs/core/main/macrocore.sas";
%inc mc; %inc mc;
The `build.sh` file in the https://github.com/macropeople/macrocore repo The `build.sh` file in the https://github.com/sasjs/core repo
is used to create this file. is used to create this file.
@author Allan Bowe @author Allan Bowe

View File

@@ -1,12 +1,12 @@
/** /**
@file mm_createwebservice.sas @file mm_createwebservice.sas
@brief Create a Web Ready Stored Process @brief Create a Web Ready Stored Process
@details This macro creates a Type 2 Stored Process with the macropeople @details This macro creates a Type 2 Stored Process with the mm_webout macro
mm_webout macro included as pre-code. included as pre-code.
Usage: Usage:
%* compile macros ; %* compile macros ;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* parmcards lets us write to a text file from open code ; %* parmcards lets us write to a text file from open code ;
@@ -104,9 +104,8 @@ data _null_;
put ' proc sql;drop table &tempds; '; put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; '; put ' data &tempds /view=&tempds;set &ds; ';
put ' %if &fmt=N %then format _numeric_ best32.;; '; put ' %if &fmt=N %then format _numeric_ best32.;; ';
put ' proc json out=&jref '; put ' proc json out=&jref pretty ';
put ' %if &action=ARR %then nokeys ; '; put ' %if &action=ARR %then nokeys ; ';
put ' %if &dbg ge 131 %then pretty ; ';
put ' ;export &tempds / nosastags fmtnumeric; '; put ' ;export &tempds / nosastags fmtnumeric; ';
put ' run; '; put ' run; ';
put ' proc sql;drop view &tempds; '; put ' proc sql;drop view &tempds; ';
@@ -201,7 +200,8 @@ data _null_;
put '%end; '; put '%end; ';
put '%mend; '; put '%mend; ';
put '%macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y); '; put '%macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y); ';
put '%global _webin_file_count _webin_fileref1 _webin_name1 _program _debug; '; put '%global _webin_file_count _webin_fileref1 _webin_name1 _program _debug ';
put ' sasjs_tables; ';
put '%local i tempds; '; put '%local i tempds; ';
put ' '; put ' ';
put '%if &action=FETCH %then %do; '; put '%if &action=FETCH %then %do; ';
@@ -228,6 +228,7 @@ data _null_;
put ' if _n_<20 then putlog _infile_; '; put ' if _n_<20 then putlog _infile_; ';
put ' %end; '; put ' %end; ';
put ' run; '; put ' run; ';
put ' %let sasjs_tables=&sasjs_tables &&_webin_name&i; ';
put ' %end; '; put ' %end; ';
put '%end; '; put '%end; ';
put ' '; put ' ';

View File

@@ -1,13 +1,14 @@
/** /**
@file @file
@brief Retrieves properties of the SAS web app server @brief Retrieves properties of the SAS web app server
@description usage: @details
Usage:
%mm_getwebappsrvprops(outds= some_ds) %mm_getwebappsrvprops(outds= some_ds)
data _null_; data _null_;
set some_ds(where=(name='webappsrv.server.url')); set some_ds(where=(name='webappsrv.server.url'));
put value=; put value=;
run; run;
@param outds the dataset to create that contains the list of properties @param outds the dataset to create that contains the list of properties
@@ -21,7 +22,7 @@
@version 9.4 @version 9.4
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/

View File

@@ -12,7 +12,7 @@
Usage: Usage:
%* import the macros (or make them available some other way); %* import the macros (or make them available some other way);
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* create sample text file as input to the macro; %* create sample text file as input to the macro;

View File

@@ -15,7 +15,7 @@
Usage: Usage:
%* load macros; %* load macros;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* export everything; %* export everything;

View File

@@ -33,7 +33,8 @@
**/ **/
%macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y); %macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y);
%global _webin_file_count _webin_fileref1 _webin_name1 _program _debug; %global _webin_file_count _webin_fileref1 _webin_name1 _program _debug
sasjs_tables;
%local i tempds; %local i tempds;
%if &action=FETCH %then %do; %if &action=FETCH %then %do;
@@ -60,6 +61,7 @@
if _n_<20 then putlog _infile_; if _n_<20 then putlog _infile_;
%end; %end;
run; run;
%let sasjs_tables=&sasjs_tables &&_webin_name&i;
%end; %end;
%end; %end;

View File

@@ -8,7 +8,7 @@
Usage: Usage:
%* import the macros (or make them available some other way); %* import the macros (or make them available some other way);
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* create sample text file as input to the macro; %* create sample text file as input to the macro;

View File

@@ -12,6 +12,9 @@
"type": "git", "type": "git",
"url": "https://github.com/sasjs/core" "url": "https://github.com/sasjs/core"
}, },
"release": {
"branches": ["main"]
},
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },

View File

@@ -16,7 +16,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -4,7 +4,7 @@
@details Code is passed in as one or more filerefs. @details Code is passed in as one or more filerefs.
%* Step 1 - compile macros ; %* Step 1 - compile macros ;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* Step 2 - Create some code and add it to a web service; %* Step 2 - Create some code and add it to a web service;
@@ -55,7 +55,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
**/ **/
@@ -241,9 +241,8 @@ data _null_;
put ' proc sql;drop table &tempds; '; put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; '; put ' data &tempds /view=&tempds;set &ds; ';
put ' %if &fmt=N %then format _numeric_ best32.;; '; put ' %if &fmt=N %then format _numeric_ best32.;; ';
put ' proc json out=&jref '; put ' proc json out=&jref pretty ';
put ' %if &action=ARR %then nokeys ; '; put ' %if &action=ARR %then nokeys ; ';
put ' %if &dbg ge 131 %then pretty ; ';
put ' ;export &tempds / nosastags fmtnumeric; '; put ' ;export &tempds / nosastags fmtnumeric; ';
put ' run; '; put ' run; ';
put ' proc sql;drop view &tempds; '; put ' proc sql;drop view &tempds; ';
@@ -338,7 +337,8 @@ data _null_;
put '%end; '; put '%end; ';
put '%mend; '; put '%mend; ';
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); '; put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); ';
put '%global _webin_file_count _webin_fileuri _debug _omittextlog ; '; put '%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name ';
put ' sasjs_tables SYS_JES_JOB_URI; ';
put '%if %index("&_debug",log) %then %let _debug=131; '; put '%if %index("&_debug",log) %then %let _debug=131; ';
put ' '; put ' ';
put '%local i tempds; '; put '%local i tempds; ';
@@ -352,11 +352,11 @@ data _null_;
put ' %if not %symexist(_webin_fileuri1) %then %do; '; put ' %if not %symexist(_webin_fileuri1) %then %do; ';
put ' %let _webin_file_count=%eval(&_webin_file_count+0); '; put ' %let _webin_file_count=%eval(&_webin_file_count+0); ';
put ' %let _webin_fileuri1=&_webin_fileuri; '; put ' %let _webin_fileuri1=&_webin_fileuri; ';
put ' %let _webin_name1=&_webin_name; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' %if %symexist(sasjs_tables) %then %do; '; put ' /* if the sasjs_tables param is passed, we expect param based upload */ ';
put ' /* small volumes of non-special data are sent as params for responsiveness */ '; put ' %if %length(&sasjs_tables.XX)>2 %then %do; ';
put ' /* to do - deal with escaped values */ ';
put ' filename _sasjs "%sysfunc(pathname(work))/sasjs.lua"; '; put ' filename _sasjs "%sysfunc(pathname(work))/sasjs.lua"; ';
put ' data _null_; '; put ' data _null_; ';
put ' file _sasjs; '; put ' file _sasjs; ';
@@ -435,13 +435,19 @@ data _null_;
put ' infile indata firstobs=2 dsd termstr=crlf ; '; put ' infile indata firstobs=2 dsd termstr=crlf ; ';
put ' input &input_statement; '; put ' input &input_statement; ';
put ' run; '; put ' run; ';
put ' %let sasjs_tables=&sasjs_tables &&_webin_name&i; ';
put ' %end; '; put ' %end; ';
put '%end; '; put '%end; ';
put '%else %if &action=OPEN %then %do; '; put '%else %if &action=OPEN %then %do; ';
put ' /* setup webout */ '; put ' /* setup webout */ ';
put ' OPTIONS NOBOMFILE; '; put ' OPTIONS NOBOMFILE; ';
put ' filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" '; put ' %if "X&SYS_JES_JOB_URI.X"="XX" %then %do; ';
put ' name="_webout.json" lrecl=999999 mod; '; put ' filename _webout temp lrecl=999999 mod; ';
put ' %end; ';
put ' %else %do; ';
put ' filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" ';
put ' name="_webout.json" lrecl=999999 mod; ';
put ' %end; ';
put ' '; put ' ';
put ' /* setup temp ref */ '; put ' /* setup temp ref */ ';
put ' %if %upcase(&fref) ne _WEBOUT %then %do; '; put ' %if %upcase(&fref) ne _WEBOUT %then %do; ';
@@ -471,13 +477,13 @@ data _null_;
put ' i+1; '; put ' i+1; ';
put ' call symputx(''wt''!!left(i),name); '; put ' call symputx(''wt''!!left(i),name); ';
put ' call symputx(''wtcnt'',i); '; put ' call symputx(''wtcnt'',i); ';
put ' data _null_; file &fref; put ",""WORK"":{"; '; put ' data _null_; file &fref mod; put ",""WORK"":{"; ';
put ' %do i=1 %to &wtcnt; '; put ' %do i=1 %to &wtcnt; ';
put ' %let wt=&&wt&i; '; put ' %let wt=&&wt&i; ';
put ' proc contents noprint data=&wt '; put ' proc contents noprint data=&wt ';
put ' out=_data_ (keep=name type length format:); '; put ' out=_data_ (keep=name type length format:); ';
put ' run;%let tempds=%scan(&syslast,2,.); '; put ' run;%let tempds=%scan(&syslast,2,.); ';
put ' data _null_; file &fref; '; put ' data _null_; file &fref mod; ';
put ' dsid=open("WORK.&wt",''is''); '; put ' dsid=open("WORK.&wt",''is''); ';
put ' nlobs=attrn(dsid,''NLOBS''); '; put ' nlobs=attrn(dsid,''NLOBS''); ';
put ' nvars=attrn(dsid,''NVARS''); '; put ' nvars=attrn(dsid,''NVARS''); ';
@@ -488,9 +494,9 @@ data _null_;
put ' put '',"nvars":'' nvars; '; put ' put '',"nvars":'' nvars; ';
put ' %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) '; put ' %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) ';
put ' %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) '; put ' %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) ';
put ' data _null_; file &fref;put "}"; '; put ' data _null_; file &fref mod;put "}"; ';
put ' %end; '; put ' %end; ';
put ' data _null_; file &fref;put "}";run; '; put ' data _null_; file &fref mod;put "}";run; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' /* close off json */ '; put ' /* close off json */ ';

View File

@@ -4,7 +4,7 @@
@details If not executed in Studio 5+ will expect oauth token in a global @details If not executed in Studio 5+ will expect oauth token in a global
macro variable (default ACCESS_TOKEN). macro variable (default ACCESS_TOKEN).
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mv_createwebservice(path=/Public/test, name=blah) %mv_createwebservice(path=/Public/test, name=blah)
@@ -21,7 +21,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -4,7 +4,7 @@
@details If not executed in Studio 5+ will expect oauth token in a global @details If not executed in Studio 5+ will expect oauth token in a global
macro variable (default ACCESS_TOKEN). macro variable (default ACCESS_TOKEN).
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%mv_createwebservice(path=/Public/test, name=blah) %mv_createwebservice(path=/Public/test, name=blah)
@@ -20,7 +20,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -17,7 +17,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -4,7 +4,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mv_tokenrefresh.sas @li mv_tokenrefresh.sas

View File

@@ -4,7 +4,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mv_registerclient.sas @li mv_registerclient.sas

View File

@@ -6,7 +6,7 @@
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -30,7 +30,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -16,7 +16,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -6,7 +6,7 @@
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
Now we can run the macro! Now we can run the macro!
@@ -31,7 +31,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -6,7 +6,7 @@
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -30,7 +30,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -4,7 +4,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mv_tokenauth.sas @li mv_tokenauth.sas

View File

@@ -6,7 +6,7 @@
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -30,7 +30,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -6,7 +6,7 @@
Using the macros here: Using the macros here:
filename mc url filename mc url
"https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
An administrator needs to set you up with an access code: An administrator needs to set you up with an access code:
@@ -48,7 +48,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -12,7 +12,7 @@
Usage: Usage:
%* compile macros; %* compile macros;
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
%* specific client with just openid scope; %* specific client with just openid scope;
@@ -53,7 +53,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -15,7 +15,7 @@
Usage: Usage:
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas"; filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; %inc mc;
@@ -41,7 +41,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -41,7 +41,7 @@
@version VIYA V.03.04 @version VIYA V.03.04
@author Allan Bowe @author Allan Bowe
@source https://github.com/macropeople/macrocore @source https://github.com/sasjs/core
<h4> Dependencies </h4> <h4> Dependencies </h4>
@li mp_abort.sas @li mp_abort.sas

View File

@@ -36,7 +36,8 @@
**/ **/
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); %macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y);
%global _webin_file_count _webin_fileuri _debug _omittextlog ; %global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name
sasjs_tables SYS_JES_JOB_URI;
%if %index("&_debug",log) %then %let _debug=131; %if %index("&_debug",log) %then %let _debug=131;
%local i tempds; %local i tempds;
@@ -50,11 +51,11 @@
%if not %symexist(_webin_fileuri1) %then %do; %if not %symexist(_webin_fileuri1) %then %do;
%let _webin_file_count=%eval(&_webin_file_count+0); %let _webin_file_count=%eval(&_webin_file_count+0);
%let _webin_fileuri1=&_webin_fileuri; %let _webin_fileuri1=&_webin_fileuri;
%let _webin_name1=&_webin_name;
%end; %end;
%if %symexist(sasjs_tables) %then %do; /* if the sasjs_tables param is passed, we expect param based upload */
/* small volumes of non-special data are sent as params for responsiveness */ %if %length(&sasjs_tables.XX)>2 %then %do;
/* to do - deal with escaped values */
filename _sasjs "%sysfunc(pathname(work))/sasjs.lua"; filename _sasjs "%sysfunc(pathname(work))/sasjs.lua";
data _null_; data _null_;
file _sasjs; file _sasjs;
@@ -133,13 +134,19 @@
infile indata firstobs=2 dsd termstr=crlf ; infile indata firstobs=2 dsd termstr=crlf ;
input &input_statement; input &input_statement;
run; run;
%let sasjs_tables=&sasjs_tables &&_webin_name&i;
%end; %end;
%end; %end;
%else %if &action=OPEN %then %do; %else %if &action=OPEN %then %do;
/* setup webout */ /* setup webout */
OPTIONS NOBOMFILE; OPTIONS NOBOMFILE;
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" %if "X&SYS_JES_JOB_URI.X"="XX" %then %do;
name="_webout.json" lrecl=999999 mod; filename _webout temp lrecl=999999 mod;
%end;
%else %do;
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
name="_webout.json" lrecl=999999 mod;
%end;
/* setup temp ref */ /* setup temp ref */
%if %upcase(&fref) ne _WEBOUT %then %do; %if %upcase(&fref) ne _WEBOUT %then %do;
@@ -169,13 +176,13 @@
i+1; i+1;
call symputx('wt'!!left(i),name); call symputx('wt'!!left(i),name);
call symputx('wtcnt',i); call symputx('wtcnt',i);
data _null_; file &fref; put ",""WORK"":{"; data _null_; file &fref mod; put ",""WORK"":{";
%do i=1 %to &wtcnt; %do i=1 %to &wtcnt;
%let wt=&&wt&i; %let wt=&&wt&i;
proc contents noprint data=&wt proc contents noprint data=&wt
out=_data_ (keep=name type length format:); out=_data_ (keep=name type length format:);
run;%let tempds=%scan(&syslast,2,.); run;%let tempds=%scan(&syslast,2,.);
data _null_; file &fref; data _null_; file &fref mod;
dsid=open("WORK.&wt",'is'); dsid=open("WORK.&wt",'is');
nlobs=attrn(dsid,'NLOBS'); nlobs=attrn(dsid,'NLOBS');
nvars=attrn(dsid,'NVARS'); nvars=attrn(dsid,'NVARS');
@@ -186,9 +193,9 @@
put ',"nvars":' nvars; put ',"nvars":' nvars;
%mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
%mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
data _null_; file &fref;put "}"; data _null_; file &fref mod;put "}";
%end; %end;
data _null_; file &fref;put "}";run; data _null_; file &fref mod;put "}";run;
%end; %end;
/* close off json */ /* close off json */