Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitpod.dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions .gitpod.yml

This file was deleted.

1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
all.sas
build.py
.gitpod*
tests/
sasjs/
.github/
Expand Down
115 changes: 115 additions & 0 deletions all.sas
Original file line number Diff line number Diff line change
Expand Up @@ -26428,6 +26428,7 @@ libname &libref1a JSON fileref=&fname1a;
/* %put Getting object uri from &libref1a..items; */
data _null_;
length contenttype name $1000;
call missing(of _all_);
set &libref1a..items;
if contenttype='jobDefinition' and upcase(name)="%upcase(&name)" then do;
call symputx('uri',cats("&base_uri",uri),'l');
Expand Down Expand Up @@ -30910,6 +30911,117 @@ endsub;
%end;

%mend mcf_string2file;/**
@file mx_createjob.sas
@brief Create a job in SAS 9, Viya or SASjs
@details Creates a Stored Process in SAS 9, a Job Execution Service in SAS
Viya, or a Stored Program on SASjs Server - depending on the executing
environment.

Usage:

%* compile macros ;
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

%* write some code;
filename ft15f001 temp;
parmcards4;
data example1;
set sashelp.class;
run;
;;;;

%* create the job;
%mx_createjob(path=/Public/app/jobs,name=myjob,replace=YES)

<h4> SAS Macros </h4>
@li mf_getplatform.sas
@li mm_createstp.sas
@li ms_createfile.sas
@li mv_createjob.sas

@param [in,out] path= The full folder path where the job will be created
@param [in,out] name= Job name. Avoid spaces.
@param [in] desc= The description of the job (optional)
@param [in] precode= Space separated list of filerefs, pointing to the code
that needs to be attached to the beginning of the job (optional)
@param [in] code= (ft15f001) Space seperated fileref(s) of the actual code to
be added
@param [in] replace= (YES) Select YES to replace any existing job in that
location
@param [in] mDebug= (0) set to 1 to show debug messages in the log

@author Allan Bowe

<h4> Related Macros </h4>
@li mx_createjob.test.sas
@li mx_createwebservice.sas

**/

%macro mx_createjob(path=HOME
,name=initJob
,precode=
,code=ft15f001
,desc=This job was created by the mx_createjob macro
,replace=YES
,mdebug=0
)/*/STORE SOURCE*/;

%if &syscc ge 4 %then %do;
%put syscc=&syscc - &sysmacroname will not execute in this state;
%return;
%end;

/* combine precode and code into a single file */
%local tempref x fref freflist;
%let tempref=%mf_getuniquefileref();
%local work tmpfile;
%let work=%sysfunc(pathname(work));
%let tmpfile=&tempref..sas;
filename &tempref "&work/&tmpfile";
%let freflist=&precode &code ;
%do x=1 %to %sysfunc(countw(&freflist));
%let fref=%scan(&freflist,&x);
%put &sysmacroname: adding &fref;
data _null_;
file &tempref lrecl=3000 termstr=crlf mod;
infile &fref lrecl=3000;
input;
put _infile_;
run;
%end;

%local platform; %let platform=%mf_getplatform();
%if &platform=SASVIYA %then %do;
%if "&path"="HOME" %then %let path=/Users/&sysuserid/My Folder;
%mv_createjob(path=&path
,name=&name
,code=&tempref
,desc=&desc
,replace=&replace
)
%end;
%else %if &platform=SASJS %then %do;
%if "&path"="HOME" %then %let path=/Users/&_sasjs_username/My Folder;
%ms_createfile(&path/&name..sas
,inref=&tempref
,mdebug=&mdebug
)
%end;
%else %do;
%if "&path"="HOME" %then %let path=/User Folders/&_METAPERSON/My Folder;
%mm_createstp(stpname=&name
,filename=&tmpfile
,directory=&work
,tree=&path
,stpdesc=&desc
,mDebug=&mdebug
)
%end;
filename &tempref clear;
%mend mx_createjob;
/**
@file mx_createwebservice.sas
@brief Create a web service in SAS 9, Viya or SASjs
@details Creates a SASJS ready Stored Process in SAS 9, a Job Execution
Expand Down Expand Up @@ -30959,6 +31071,9 @@ Usage:

@author Allan Bowe

<h4> Related Macros </h4>
@li mx_createjob.sas

**/

%macro mx_createwebservice(path=HOME
Expand Down
Loading