CAS Actions and Action Sets – a brief intro

This post was kindly contributed by SAS Users - go there to comment and to read the full post.

I’m excited to curate a series of posts focused on CAS Actions. However, before I dive into details and code, I thought I’d take a moment to lay a foundation for a better understanding of CAS and CAS actions. I’ll cover things here at a high level as there’s quite a bit of information out there already. Please see the Additional Resources section at the end of this article for more details.

CAS actions are highly optimized units of work for SAS Viya’s Cloud Analytics Services (CAS) distributed computing engine. Think of CAS actions as powerful functions or methods created specifically to process data in the CAS server. Actions can load data, manage tables, perform general analytics, statistics, and machine learning, as well as execute DATA step, FedSQL, DS2 and more. Did I mention they can do a lot?

Before we dive into details about actions, let’s quickly review the CAS server in SAS Viya.

CAS Server

First, the CAS Server. It provides cloud-based, run-time environment for data management and analytics in SAS Viya. You process data in all stages of the analytic life cycle using the power of distributing computing. To process data in the CAS server, you must first load data into memory from a data source.

Data Sources

Data sources connect to the CAS server through caslibs. Caslibs can access a wide variety of data sources including relational databases, streaming data, SAS data sets, unstructured data, and familiar file formats, such as XML, JSON, CSV, and XLSX.

CAS Actions

Once you have data available in the CAS server you can begin to process it using CAS actions. Actions are the native language of the CAS server. All actions are aggregated with other actions in action sets. You can think of an action set as a package, and the actions inside an action set as methods. There are dozens of CAS action sets and hundreds of CAS actions available.

Executing Actions

There are a variety of interfaces available to execute CAS actions. One method is using the native CAS Language (CASL). CASL is a statement based scripting language. With CASL you can use general programming logic to execute actions, work with the results, and develop analytic pipelines. You can also execute actions through the CAS API using languages like SAS, FedSQL, Python, R, Java, Lua and REST.

Using Familiar Language Methods

One major benefit of CAS actions is the CAS API allows you to execute familiar syntax in your language of choice. When using familiar methods, the CAS API will convert them into actions behind the scenes.

For example, to retrieve the first ten rows of a CAS table you can use the SAS PRINT procedure, the Python head method, or the R head function. All of these methods will convert to the fetch action behind the scenes through the CAS API. Many familiar procedures, methods and functions are available. See the SAS Viya Programming for Developers documentation for more details about specific languages.

NOTE: THE SWAT package is required to use Python and R with the CAS server.

Executing Actions in a Variety of Languages

Another benefit of CAS actions is that you can directly execute actions from a variety of languages. This allows for all types of programmers to work together using common actions. For example, you can execute the same fetch action in SAS, R and Python.

NOTE: THE SWAT package is required to use Python and R with the CAS server.

SAS Viya Applications

Lastly, SAS Viya has a many applications that can work with data in the CAS server, These applications provide a variety of functionality. From point and click to programming, executing actions behind the scenes.

Summary

Hopefully, I’ve provide enough of a base for CAS, CAS actions, and CAS action sets for you to get started. Here’s what you need to know to move forward:

  • SAS Viya’s CAS server is a powerful distributed comping engine that processes big data fast.
  • CAS actions are the native language of the CAS server.
  • CAS actions can be executed in a variety of languages like CASL, SAS, Python, R, Lua, Java and REST.
  • SAS Viya has additional applications to work with CAS data.

Additional Resources

SAS® Cloud Analytic Services: Fundamentals
The Architecture of the SAS® Cloud Analytic Services in SAS® Viya™
What is CASL?
SAS Viya Programming examples on GitHub
Using SAS Cloud Analytics Service REST APIs to run CAS Actions
SAS Developers Portal
SAS Developers Community

CAS Actions and Action Sets – a brief intro was published on SAS Users.

This post was kindly contributed by SAS Users - go there to comment and to read the full post.