SAS Decision Manager 5.2 is fully integrated into the Viya stack with rich business rule functionality as well as custom code and analytic model integration. However, the most interesting aspect of the release has to be Data Grids.
If you're thinking "Data Grids? Huh?" then let me attempt to explain....
SAS Decision Manager publishes data services called "Decisions" or "Rule Sets." These manifest as REST or batch services with a simple, "flat" input data and output data vectors. In other words, a Decision/Rule Set expects an input row of data and outputs a row of data. For example, a customer churn decision might look like this:
Services with flat input vectors and flat output vectors are great. They can probably handle the majority of an organization's needs. However, most modern service architectures are based on some hierarchical message format, usually JSON or XML. What would something like this look like? If we extend the service above to include a nested address and score structure (so the customer can have any number of addresses and any number of scores), it might look like this:
So an input customer record might have 3 addresses (three rows in the nested "Customer Address" table) and the two scores (lifetime and recent value) would manifest as 2 rows in the nested "Value Scores" table.
So what are Decision Manager Data Grids? They are the nested tables. In the service above, the Customer Address structure is a data grid and the input and output Score structures are also data grids.
The Data Grids concept manifests in Decision Manager as a Data Type. For example, if we registered the above input data structure in Decision Manager, it would look like this:
Structuring the sub-table data to fit inside a single Decision Manager Data Grid field is done using JSON. For example, some data inside the above customerAddress data grid might look like this;
So Data Grids are basically nested JSON table structures stored within fields. How can we use that data in our decisions? Normal SAS functions won't be able to get to the address field within the customerAddress data grid.
To utilize the data within data grids, Decision Manager offers an entire library of functions to parse and process data grids. As an example, below is a function call to return the primary address of a customer from the sample customerAddress above.
There are also functions to count rows, sum amounts, calculate complex statistics, and even construct data grids for output.
Decision Manager Decisions and Rule Sets can be deployed as
While modern REST applications will often format their data as JSON automatically, the other deployment destinations are generally not equipped to easily nest JSON data structures inside table fields. To accommodate this, Decision Manager is delivered with two auto-call macros that can assist with creating data grids.
The %DCM_SERIALIZEGRID macro "serializes" table data into the required Data Grid JSON format. While the %DCM_MERGESERIALIZEDGRIDS macro merges tables that contain serialized data grid content with normal scalar data tables.
Even if you don't plan on deploying to CAS or an In-Database destination, you'll likely still need to use these macros during testing since Decision Manager tests are run in CAS.
Very informative thank you.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.