BookmarkSubscribeRSS Feed

Data Grids - SAS Decision Manager 5.2

Started ‎12-14-2018 by
Modified ‎12-17-2018 by
Views 2,028

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....

 

"Flat" Decisions and Rule Sets

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:

 

1Flat-Decision.png

 

Beyond Flat Services

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:

 

2Nested-Service.png

 

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.

 

Data Grids

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.

 

3Data-Grid-Decision.png

 

Data Grids in Decision Manager

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:

 

4Data-Grid-Type.png

 

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;

 

5Data-Grid-Data.png

Sample Data Grid Data

 

Processing Data Grids

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.

 

6Data-Grid-Function-2.png

 

There are also functions to count rows, sum amounts, calculate complex statistics, and even construct data grids for output.

 

Creating Data Grids

Decision Manager Decisions and Rule Sets can be deployed as

  • REST services
  • CAS-enabled DS2 packages (programs that run in CAS)
  • In-Database DS2 pacakges (programs that run in-database).

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.

Comments
VDD

Very informative thank you.

Version history
Last update:
‎12-17-2018 10:56 AM
Updated by:
Contributors

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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 Labels
Article Tags