1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-07 17:40:05 +00:00

Compare commits

..

13 Commits

Author SHA1 Message Date
d6056b9397 fix: adding mod statement to _webout to enable sas-side sasjs testing 2021-04-10 12:41:17 +02:00
Allan Bowe
00511c72c2 fix: removing deprecated params from mm_createstp 2021-04-09 11:46:37 +00:00
Allan Bowe
1d6f04fd56 chore: adding macro related lint settings and sasjs as a recommended extension 2021-04-08 15:59:08 +00:00
af4dbb5632 feat: switching to DATASTEP over PROCJSON for json delivery in sasjs/adapter 2021-04-08 09:49:50 +02:00
Allan Bowe
f48c291dce Merge pull request #13 from sasjs/issue12
fix: switching to data step for JSON generation in mp_jsonout and the…
2021-04-08 08:45:54 +01:00
rafgag
18be74a1c2 Update mp_jsonout.sas
mod option added to the file statement in the last %else %if statement (&action=CLOSE) to avoid output file being overwritten
2021-04-08 09:03:05 +02:00
Allan Bowe
456d10a90e fix: switching to data step for JSON generation in mp_jsonout and the sasjs/adapter for improved reliability when data contains special characters. Closes #12 2021-04-07 22:28:42 +00:00
Allan Bowe
a7fdb52231 fix: sasmeta vs basesas results 2021-04-05 18:26:31 +00:00
Allan Bowe
066ed00e44 chore: reducing line length in lint by 5 characters 2021-04-05 13:31:09 +00:00
Allan Bowe
49fbc210ad Update .gitpod.yml 2021-04-05 14:22:58 +01:00
Allan Bowe
951aa474f2 Update .gitpod.dockerfile 2021-04-05 14:16:22 +01:00
Allan Bowe
961dd54ee0 Update .gitpod.dockerfile 2021-04-05 13:29:39 +01:00
Allan Bowe
921354dac7 Update .gitpod.yml 2021-04-05 12:59:31 +01:00
14 changed files with 95 additions and 78 deletions

View File

@@ -1,10 +1,6 @@
FROM gitpod/workspace-full FROM gitpod/workspace-full
RUN sudo apt-get update \ RUN sudo apt-get update \
&& sudo apt-get install -y \ && sudo apt-get install -y \
doxygen \ doxygen \
&& npm i -g npm@latest \ && sudo rm -rf /var/lib/apt/lists/*
&& npm i -g @sasjs/cli \
&& npm i \
&& sudo rm -rf /var/lib/apt/lists/*

View File

@@ -1,8 +1,8 @@
tasks: tasks:
- init: npm i && clear - init: npm i -g @sasjs/cli
image: image:
file: .gitpod.dockerfile file: .gitpod.dockerfile
vscode: vscode:
extensions: extensions:
- sasjs.sasjs-for-vscode@1.7.2:R6y1nzpFh2P99BZg5FgH5g== - sasjs.sasjs-for-vscode

View File

@@ -2,8 +2,11 @@
"noTrailingSpaces": true, "noTrailingSpaces": true,
"noEncodedPasswords": true, "noEncodedPasswords": true,
"hasDoxygenHeader": true, "hasDoxygenHeader": true,
"hasMacroNameInMend": false,
"hasMacroParentheses": true,
"noNestedMacros": false,
"noSpacesInFileNames": true, "noSpacesInFileNames": true,
"maxLineLength": 140, "maxLineLength": 135,
"lowerCaseFileNames": true, "lowerCaseFileNames": true,
"noTabIndentation": true, "noTabIndentation": true,
"indentationMultiple": 2 "indentationMultiple": 2

5
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"recommendations": [
"sasjs.sasjs-for-vscode"
]
}

77
all.sas
View File

@@ -573,21 +573,23 @@ options noquotelenmax;
or "&sysprocessmode"= "SAS Compute Server" %then %do; or "&sysprocessmode"= "SAS Compute Server" %then %do;
SASVIYA SASVIYA
%end; %end;
%else %if "&sysprocessmode"="SAS Stored Process Server" %then %do; %else %if "&sysprocessmode"="SAS Stored Process Server"
or "&sysprocessmode"="SAS Workspace Server"
%then %do;
SASMETA SASMETA
%return; %return;
%end; %end;
%else %do; %else %do;
SAS BASESAS
%return; %return;
%end; %end;
%end; %end;
%else %if %symexist(_metaport) %then %do; %else %if %symexist(_metaport) or %symexist(_metauser) %then %do;
SASMETA SASMETA
%return; %return;
%end; %end;
%else %do; %else %do;
SAS BASESAS
%return; %return;
%end; %end;
%end; %end;
@@ -3917,8 +3919,11 @@ create table &outds (rename=(
@details PROC JSON is faster but will produce errs like the ones below if @details PROC JSON is faster but will produce errs like the ones below if
special chars are encountered. special chars are encountered.
>An object or array close is not valid at this point in the JSON text. > ERROR: Some code points did not transcode.
>Date value out of range
> An object or array close is not valid at this point in the JSON text.
> Date value out of range
If this happens, try running with ENGINE=DATASTEP. If this happens, try running with ENGINE=DATASTEP.
@@ -3927,7 +3932,9 @@ create table &outds (rename=(
filename tmp temp; filename tmp temp;
data class; set sashelp.class;run; data class; set sashelp.class;run;
%mp_jsonout(OPEN,jref=tmp)
%mp_jsonout(OBJ,class,jref=tmp) %mp_jsonout(OBJ,class,jref=tmp)
%mp_jsonout(CLOSE,jref=tmp)
data _null_; data _null_;
infile tmp; infile tmp;
@@ -3940,18 +3947,18 @@ create table &outds (rename=(
For more information see https://sasjs.io For more information see https://sasjs.io
@param action Valid values: @param action Valid values:
* OPEN - opens the JSON @li OPEN - opens the JSON
* OBJ - sends a table with each row as an object @li OBJ - sends a table with each row as an object
* ARR - sends a table with each row in an array @li ARR - sends a table with each row in an array
* CLOSE - closes the JSON @li CLOSE - closes the JSON
@param ds the dataset to send. Must be a work table. @param ds the dataset to send. Must be a work table.
@param jref= the fileref to which to send the JSON @param jref= the fileref to which to send the JSON
@param dslabel= the name to give the table in the exported JSON @param dslabel= the name to give the table in the exported JSON
@param fmt= Whether to keep or strip formats from the table @param fmt= Whether to keep or strip formats from the table
@param engine= Which engine to use to send the JSON, options are: @param engine= Which engine to use to send the JSON, valid options are:
* PROCJSON (default) @li PROCJSON (default)
* DATASTEP @li DATASTEP (more reliable when data has non standard characters)
@param dbg= DEPRECATED - was used to conditionally add PRETTY to @param dbg= DEPRECATED - was used to conditionally add PRETTY to
proc json but this can cause line truncation in large files. proc json but this can cause line truncation in large files.
@@ -4073,11 +4080,12 @@ create table &outds (rename=(
%end; %end;
%else %if &action=CLOSE %then %do; %else %if &action=CLOSE %then %do;
data _null_;file &jref encoding='utf-8'; data _null_;file &jref encoding='utf-8' mod;
put "}"; put "}";
run; run;
%end; %end;
%mend;/** %mend;
/**
@file @file
@brief Convert all library members to CARDS files @brief Convert all library members to CARDS files
@details Gets list of members then calls the <code>%mp_ds2cards()</code> macro. @details Gets list of members then calls the <code>%mp_ds2cards()</code> macro.
@@ -4472,7 +4480,8 @@ insert into &outds select distinct * from &append_ds;
/** /**
@file @file
@brief Reset an option to original value @brief Reset an option to original value
@details Inspired by the SAS Jedi - https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options/ @details Inspired by the SAS Jedi -
https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options
Called as follows: Called as follows:
options obs=30; options obs=30;
@@ -7298,8 +7307,6 @@ run;
*/ */
%mm_updatestpsourcecode(stp=&tree/&stpname %mm_updatestpsourcecode(stp=&tree/&stpname
,stpcode="&directory/&filename" ,stpcode="&directory/&filename"
,frefin=&frefin.
,frefout=&frefout.
,mdebug=&mdebug ,mdebug=&mdebug
,minify=&minify) ,minify=&minify)
@@ -7507,7 +7514,7 @@ data _null_;
put '%end; '; put '%end; ';
put ' '; put ' ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';
put ' data _null_;file &jref encoding=''utf-8''; '; put ' data _null_;file &jref encoding=''utf-8'' mod; ';
put ' put "}"; '; put ' put "}"; ';
put ' run; '; put ' run; ';
put '%end; '; put '%end; ';
@@ -7588,14 +7595,14 @@ data _null_;
put ' i+1; '; put ' i+1; ';
put ' call symputx(''wt''!!left(i),name,''l''); '; put ' call symputx(''wt''!!left(i),name,''l''); ';
put ' call symputx(''wtcnt'',i,''l''); '; put ' call symputx(''wtcnt'',i,''l''); ';
put ' data _null_; file &fref encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
put ' put ",""WORK"":{"; '; put ' 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 encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
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''); ';
@@ -7606,10 +7613,10 @@ 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 encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
put ' put "}"; '; put ' put "}"; ';
put ' %end; '; put ' %end; ';
put ' data _null_; file &fref encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
put ' put "}"; '; put ' put "}"; ';
put ' run; '; put ' run; ';
put ' %end; '; put ' %end; ';
@@ -11057,14 +11064,14 @@ run;
i+1; i+1;
call symputx('wt'!!left(i),name,'l'); call symputx('wt'!!left(i),name,'l');
call symputx('wtcnt',i,'l'); call symputx('wtcnt',i,'l');
data _null_; file &fref encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
put ",""WORK"":{"; 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 encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
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');
@@ -11075,10 +11082,10 @@ run;
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 encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
put "}"; put "}";
%end; %end;
data _null_; file &fref encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
put "}"; put "}";
run; run;
%end; %end;
@@ -11430,13 +11437,13 @@ options noquotelenmax;
needs to be attached to the beginning of the job needs to be attached to the beginning of the job
@param code= Fileref(s) of the actual code to be added @param code= Fileref(s) of the actual code to be added
@param access_token_var= The global macro variable to contain the access token @param access_token_var= The global macro variable to contain the access token
@param grant_type= valid values are "password" or "authorization_code" (unquoted). @param grant_type= valid values are "password" or "authorization_code"
The default is authorization_code. (unquoted). The default is authorization_code.
@param replace= select NO to avoid replacing any existing job in that location @param replace= select NO to avoid replacing any existing job in that location
@param contextname= Choose a specific context on which to run the Job. Leave @param contextname= Choose a specific context on which to run the Job. Leave
blank to use the default context. From Viya 3.5 it is possible to configure blank to use the default context. From Viya 3.5 it is possible to configure
a shared context - see a shared context - see
https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5pyhn1wg3ja0drdl6h.htm&docsetVersion=3.5&locale=en https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5pyhn1wg3ja0drdl6h.htm&docsetVersion=3.5&locale=en
@version VIYA V.03.04 @version VIYA V.03.04
@author [Allan Bowe](https://www.linkedin.com/in/allanbowe) @author [Allan Bowe](https://www.linkedin.com/in/allanbowe)
@@ -12034,7 +12041,7 @@ data _null_;
put '%end; '; put '%end; ';
put ' '; put ' ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';
put ' data _null_;file &jref encoding=''utf-8''; '; put ' data _null_;file &jref encoding=''utf-8'' mod; ';
put ' put "}"; '; put ' put "}"; ';
put ' run; '; put ' run; ';
put '%end; '; put '%end; ';
@@ -12166,7 +12173,7 @@ data _null_;
put '%end; '; put '%end; ';
put '%else %if &action=ARR or &action=OBJ %then %do; '; put '%else %if &action=ARR or &action=OBJ %then %do; ';
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt '; put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
put ' ,jref=&fref,engine=PROCJSON,dbg=%str(&_debug) '; put ' ,jref=&fref,engine=DATASTEP,dbg=%str(&_debug) ';
put ' ) '; put ' ) ';
put '%end; '; put '%end; ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';
@@ -15373,7 +15380,7 @@ libname &libref clear;
filename &fref1 clear; filename &fref1 clear;
%mend;/** %mend;/**
@file mv_webout.sas @file
@brief Send data to/from the SAS Viya Job Execution Service @brief Send data to/from the SAS Viya Job Execution Service
@details This macro should be added to the start of each Job Execution @details This macro should be added to the start of each Job Execution
Service, **immediately** followed by a call to: Service, **immediately** followed by a call to:
@@ -15385,7 +15392,7 @@ filename &fref1 clear;
following syntax: following syntax:
data some datasets; * make some data ; data some datasets; * make some data ;
retain some columns; retain some columns;
run; run;
%mv_webout(OPEN) %mv_webout(OPEN)
@@ -15536,7 +15543,7 @@ filename &fref1 clear;
%end; %end;
%else %if &action=ARR or &action=OBJ %then %do; %else %if &action=ARR or &action=OBJ %then %do;
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
,jref=&fref,engine=PROCJSON,dbg=%str(&_debug) ,jref=&fref,engine=DATASTEP,dbg=%str(&_debug)
) )
%end; %end;
%else %if &action=CLOSE %then %do; %else %if &action=CLOSE %then %do;

View File

@@ -27,21 +27,23 @@
or "&sysprocessmode"= "SAS Compute Server" %then %do; or "&sysprocessmode"= "SAS Compute Server" %then %do;
SASVIYA SASVIYA
%end; %end;
%else %if "&sysprocessmode"="SAS Stored Process Server" %then %do; %else %if "&sysprocessmode"="SAS Stored Process Server"
or "&sysprocessmode"="SAS Workspace Server"
%then %do;
SASMETA SASMETA
%return; %return;
%end; %end;
%else %do; %else %do;
SAS BASESAS
%return; %return;
%end; %end;
%end; %end;
%else %if %symexist(_metaport) %then %do; %else %if %symexist(_metaport) or %symexist(_metauser) %then %do;
SASMETA SASMETA
%return; %return;
%end; %end;
%else %do; %else %do;
SAS BASESAS
%return; %return;
%end; %end;
%end; %end;

View File

@@ -4,8 +4,11 @@
@details PROC JSON is faster but will produce errs like the ones below if @details PROC JSON is faster but will produce errs like the ones below if
special chars are encountered. special chars are encountered.
>An object or array close is not valid at this point in the JSON text. > ERROR: Some code points did not transcode.
>Date value out of range
> An object or array close is not valid at this point in the JSON text.
> Date value out of range
If this happens, try running with ENGINE=DATASTEP. If this happens, try running with ENGINE=DATASTEP.
@@ -14,7 +17,9 @@
filename tmp temp; filename tmp temp;
data class; set sashelp.class;run; data class; set sashelp.class;run;
%mp_jsonout(OPEN,jref=tmp)
%mp_jsonout(OBJ,class,jref=tmp) %mp_jsonout(OBJ,class,jref=tmp)
%mp_jsonout(CLOSE,jref=tmp)
data _null_; data _null_;
infile tmp; infile tmp;
@@ -27,18 +32,18 @@
For more information see https://sasjs.io For more information see https://sasjs.io
@param action Valid values: @param action Valid values:
* OPEN - opens the JSON @li OPEN - opens the JSON
* OBJ - sends a table with each row as an object @li OBJ - sends a table with each row as an object
* ARR - sends a table with each row in an array @li ARR - sends a table with each row in an array
* CLOSE - closes the JSON @li CLOSE - closes the JSON
@param ds the dataset to send. Must be a work table. @param ds the dataset to send. Must be a work table.
@param jref= the fileref to which to send the JSON @param jref= the fileref to which to send the JSON
@param dslabel= the name to give the table in the exported JSON @param dslabel= the name to give the table in the exported JSON
@param fmt= Whether to keep or strip formats from the table @param fmt= Whether to keep or strip formats from the table
@param engine= Which engine to use to send the JSON, options are: @param engine= Which engine to use to send the JSON, valid options are:
* PROCJSON (default) @li PROCJSON (default)
* DATASTEP @li DATASTEP (more reliable when data has non standard characters)
@param dbg= DEPRECATED - was used to conditionally add PRETTY to @param dbg= DEPRECATED - was used to conditionally add PRETTY to
proc json but this can cause line truncation in large files. proc json but this can cause line truncation in large files.
@@ -160,8 +165,8 @@
%end; %end;
%else %if &action=CLOSE %then %do; %else %if &action=CLOSE %then %do;
data _null_;file &jref encoding='utf-8'; data _null_;file &jref encoding='utf-8' mod;
put "}"; put "}";
run; run;
%end; %end;
%mend; %mend;

View File

@@ -1,7 +1,8 @@
/** /**
@file @file
@brief Reset an option to original value @brief Reset an option to original value
@details Inspired by the SAS Jedi - https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options/ @details Inspired by the SAS Jedi -
https://blogs.sas.com/content/sastraining/2012/08/14/jedi-sas-tricks-reset-sas-system-options
Called as follows: Called as follows:
options obs=30; options obs=30;

View File

@@ -376,8 +376,6 @@ run;
*/ */
%mm_updatestpsourcecode(stp=&tree/&stpname %mm_updatestpsourcecode(stp=&tree/&stpname
,stpcode="&directory/&filename" ,stpcode="&directory/&filename"
,frefin=&frefin.
,frefout=&frefout.
,mdebug=&mdebug ,mdebug=&mdebug
,minify=&minify) ,minify=&minify)

View File

@@ -196,7 +196,7 @@ data _null_;
put '%end; '; put '%end; ';
put ' '; put ' ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';
put ' data _null_;file &jref encoding=''utf-8''; '; put ' data _null_;file &jref encoding=''utf-8'' mod; ';
put ' put "}"; '; put ' put "}"; ';
put ' run; '; put ' run; ';
put '%end; '; put '%end; ';
@@ -277,14 +277,14 @@ data _null_;
put ' i+1; '; put ' i+1; ';
put ' call symputx(''wt''!!left(i),name,''l''); '; put ' call symputx(''wt''!!left(i),name,''l''); ';
put ' call symputx(''wtcnt'',i,''l''); '; put ' call symputx(''wtcnt'',i,''l''); ';
put ' data _null_; file &fref encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
put ' put ",""WORK"":{"; '; put ' 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 encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
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''); ';
@@ -295,10 +295,10 @@ 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 encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
put ' put "}"; '; put ' put "}"; ';
put ' %end; '; put ' %end; ';
put ' data _null_; file &fref encoding=''utf-8''; '; put ' data _null_; file &fref mod encoding=''utf-8''; ';
put ' put "}"; '; put ' put "}"; ';
put ' run; '; put ' run; ';
put ' %end; '; put ' %end; ';

View File

@@ -108,14 +108,14 @@
i+1; i+1;
call symputx('wt'!!left(i),name,'l'); call symputx('wt'!!left(i),name,'l');
call symputx('wtcnt',i,'l'); call symputx('wtcnt',i,'l');
data _null_; file &fref encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
put ",""WORK"":{"; 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 encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
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');
@@ -126,10 +126,10 @@
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 encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
put "}"; put "}";
%end; %end;
data _null_; file &fref encoding='utf-8'; data _null_; file &fref mod encoding='utf-8';
put "}"; put "}";
run; run;
%end; %end;

View File

@@ -39,13 +39,13 @@
needs to be attached to the beginning of the job needs to be attached to the beginning of the job
@param code= Fileref(s) of the actual code to be added @param code= Fileref(s) of the actual code to be added
@param access_token_var= The global macro variable to contain the access token @param access_token_var= The global macro variable to contain the access token
@param grant_type= valid values are "password" or "authorization_code" (unquoted). @param grant_type= valid values are "password" or "authorization_code"
The default is authorization_code. (unquoted). The default is authorization_code.
@param replace= select NO to avoid replacing any existing job in that location @param replace= select NO to avoid replacing any existing job in that location
@param contextname= Choose a specific context on which to run the Job. Leave @param contextname= Choose a specific context on which to run the Job. Leave
blank to use the default context. From Viya 3.5 it is possible to configure blank to use the default context. From Viya 3.5 it is possible to configure
a shared context - see a shared context - see
https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5pyhn1wg3ja0drdl6h.htm&docsetVersion=3.5&locale=en https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5pyhn1wg3ja0drdl6h.htm&docsetVersion=3.5&locale=en
@version VIYA V.03.04 @version VIYA V.03.04
@author [Allan Bowe](https://www.linkedin.com/in/allanbowe) @author [Allan Bowe](https://www.linkedin.com/in/allanbowe)

View File

@@ -335,7 +335,7 @@ data _null_;
put '%end; '; put '%end; ';
put ' '; put ' ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';
put ' data _null_;file &jref encoding=''utf-8''; '; put ' data _null_;file &jref encoding=''utf-8'' mod; ';
put ' put "}"; '; put ' put "}"; ';
put ' run; '; put ' run; ';
put '%end; '; put '%end; ';
@@ -467,7 +467,7 @@ data _null_;
put '%end; '; put '%end; ';
put '%else %if &action=ARR or &action=OBJ %then %do; '; put '%else %if &action=ARR or &action=OBJ %then %do; ';
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt '; put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
put ' ,jref=&fref,engine=PROCJSON,dbg=%str(&_debug) '; put ' ,jref=&fref,engine=DATASTEP,dbg=%str(&_debug) ';
put ' ) '; put ' ) ';
put '%end; '; put '%end; ';
put '%else %if &action=CLOSE %then %do; '; put '%else %if &action=CLOSE %then %do; ';

View File

@@ -1,5 +1,5 @@
/** /**
@file mv_webout.sas @file
@brief Send data to/from the SAS Viya Job Execution Service @brief Send data to/from the SAS Viya Job Execution Service
@details This macro should be added to the start of each Job Execution @details This macro should be added to the start of each Job Execution
Service, **immediately** followed by a call to: Service, **immediately** followed by a call to:
@@ -11,7 +11,7 @@
following syntax: following syntax:
data some datasets; * make some data ; data some datasets; * make some data ;
retain some columns; retain some columns;
run; run;
%mv_webout(OPEN) %mv_webout(OPEN)
@@ -162,7 +162,7 @@
%end; %end;
%else %if &action=ARR or &action=OBJ %then %do; %else %if &action=ARR or &action=OBJ %then %do;
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
,jref=&fref,engine=PROCJSON,dbg=%str(&_debug) ,jref=&fref,engine=DATASTEP,dbg=%str(&_debug)
) )
%end; %end;
%else %if &action=CLOSE %then %do; %else %if &action=CLOSE %then %do;