BookmarkSubscribeRSS Feed

How to Make a Decision Available to Other Applications with Viya 3.4

Started ‎06-27-2019 by
Modified ‎08-22-2019 by
Views 4,536

A real decision is measured by the fact that you have taken a new action. If there is no action you have not truly decided.


In SAS Viya 3.4, a decision developed in SAS Decision Manager can be "operationalized", made available to other applications, through MAS. This "openness" enables a whole range of scenarios for many SAS customers. The SAS Micro Analytic Service or MAS is the execution engine. MAS provides the capability to publish a decision into operational environments. This video and post will show you how:




Decision Scenario

For example, you need to assist a SAS customer, a car leasing company buying second-hand cars on the market. The company wishes to take an automatic decision, to BID or NOT TO BID for a car. This is the output of the decision. The decision is dependent on many variables, such as the catalogue price, the make, the year, the mileage. These are the input variables. A decision can be defined by business rules, conditions, analytic models and custom code. You developed and tested a decision for your customer. The customer wants to call the decision from another application.


You can apply or publish a decision with MAS. What is MAS? The SAS Micro Analytic Service or MAS provides the capability to publish a decision into operational environments. When deployed as part of SAS Decision Manager, MAS is called as a web application with a REST interface by both SAS Decision Manager and by other client applications. MAS provides hosting for DS2 and Python programs and supports a “compile-once, execute-many-times” usage pattern. The REST interface provides easy integration with client applications and adds persistence and clustering for scalability and high availability.


Publish the Decision to MAS

In SAS Decision Manager

You developed and tested the decision. Publish:



Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.


Select the maslocal (SAS Micro Analytic Service) publishing destination and click Publish.

(The publishing destination is defined in SAS Environment Manager).




You should receive a message that the decision was published successfully. Click on the Scoring Tab and select the Publishing Validation sub-tab.  Click on the link associated with the maslocal destination.  Choose the right table as the Data Source table. Run the validation.

The validation ran successfully. You must then click the results icon associated with the maslocal publishing destination. Go to Code. The code contains a template to run in the Decision REST service.  Any web application, curl, SOAPUI, etc. can execute the service by POSTing a message to the service endpoint (the URL that ends in "/execute").





Prepare the Request

Open Notepad++.

Open a new file and copy the service endpoint URI: 

Replace with your server name. Open a new file and copy the line containing the decision manager internal request body:
dcm_internal_requestBody = '{""version"":1,""inputs"":[{""name"":""BLUEBOOKPRICE_"",""value"":""{{BLUEBOOKPRICE}}""},{""name"":""CURRENTBID_"",""value"":""{{CURRENTBID}}""},{""name"":""MAKE_"",""value"":""{{MAKE}}""},{""name"":""MILES_"",""value"":""{{MILES}}""},{""name"":""MODEL_"",""value"":""{{MODEL}}""},{""name"":""ORIGINALINVOICE_"",""value"":""{{ORIGINALINVOICE}}""},{""name"":""ORIGINALMSRP_"",""value"":""{{ORIGINALMSRP}}""},{""name"":""VIN_"",""value"":""{{VIN}}""},{""name"":""YEAR_"",""value"":""{{YEAR}}""},{""name"":""STATE_"",""value"":""{{STATE}}""}]}';

Delete the first part until first {
Go to the end of the file and delete ‘;
Replace the values {{ }} with an accepted data type e.g. {{BLUEBOOKPRICE}} with 5000 or {{MAKE}} with Buick until you arrive at:

This is the body of the request you can pass in the API.



Only if you do not have it in your Google Chrome browser: go to Chrome webstore and Add the Postman Extension to Chrome Open Postman. You can Skip registration.



There are many options. One of them is to obtain and use a Viya access token. You need to read and execute the instructions in: Authenticate to SAS Viya first.


Make a POST Request to Decision Manager


Open Postman. In the upper right-hand corner where you see “No environment” select “Manage environments”.



Create a new environment and give it a name (e.g.: Viya34).
Set the Key to “authtoken” and in the value, paste the “authtoken” you obtained previously:




Finally, click “Add” and “Close” the Manage environments window. Return to the main page and prepare a new request. Select POST at the left. Set Environment at your top right to Viya34 .

In the Authorizations tab, select: “No Auth”

Return to the main page and prepare a new request.

Select POST at the left. Set Environment from the right to Viya34 .

In the Authorizations tab, select: “No Auth”:




In the Headers tab create:

Authorization  “bearer {{authtoken}}”

Accept application/json

Content type application/json;charset=utf-8




In the Body: paste the json request you prepared in the Body. It has to look like:



If everything was done correctly you should be able to POST the inputs and receive the outputs of the executed Decision.

The REST API decision response comes back into the body: the Decision is executed over MAS (e.g.: 'Bid on the Car!'):




Authenticate to SAS Viya: Register a Client ID


If you feel confused about the whole process, you should start from here: Joe Furbee explains Authentication to Viya.

Option 1 is to use the command line interface and probably the easiest. Option 2 is to use sas code. Option 3 is to use python code. There are too many options: please pick the the weapon of your choice: CLI, curl, sas, python, etc.




Interested in learning more about SAS Decision Manager 5.2? The documentation is a good place to start.

The SAS Micro Analytic Service has a layered architecture described in depth in the MAS documentation.


You gained an overview of what a decision is: rules combined with models and custom code. The decision developed in SAS Decision Manager can then be "operationalized" in the application of your choice, through MAS. This "openness" enables a whole range of scenarios for many SAS customers.


Thank you for your time reading this post. If you have tried working with decisions and published them, please share your experiences via the comment box.

Version history
Last update:
‎08-22-2019 11:48 PM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags