Macros for SAS Application Developers
https://github.com/sasjs/core
mv_jobexecute.sas File Reference

Executes a SAS Viya Job. More...

Go to the source code of this file.

Detailed Description

Triggers a SAS Viya Job, with optional URL parameters, using the JES web app.

First, compile the macros:

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

Then, execute the job!

%mv_jobexecute(path=/Public/folder
  ,name=somejob
)

Example with parameters:

%mv_jobexecute(path=/Public/folder
  ,name=somejob
  ,paramstring=%str("macvarname":"macvarvalue","answer":42)
)
Parameters
[in]access_token_var=The global macro variable to contain the access token
[in]grant_type=valid values:
  • password
  • authorization_code
  • detect - will check if access_token exists, if not will use sas_services if a SASStudioV session else authorization_code. Default option.
  • sas_services - will use oauth_bearer=sas_services
[in]path=The SAS Drive path to the job being executed
[in]name=The name of the job to execute
[in]paramstring=A JSON fragment with name:value pairs, eg: "name":"value" or "name":"value","name2":42. This will need to be wrapped instr()`.
[in]contextName=Context name with which to run the job. Default = SAS Job Execution compute context
[in]mdebug=set to 1 to enable DEBUG messages
[out]outds=(work.mv_jobexecute) The output dataset containing links
Version
VIYA V.03.04
Author
Allan Bowe, source: https://github.com/sasjs/core

SAS Macros

Definition in file mv_jobexecute.sas.