SAS Viya Programming
for developers

Getting started with SAS Viya Programming

Access the capabilities of the SAS Viya through Cloud Analytic Services (CAS) actions for data access and analytics, run directly from SAS applications.

CAS Actions
SAS Viya uses CAS to perform tasks. The smallest unit of work for the CAS server is a CAS action. CAS actions can load data, transform data, compute statistics, perform analytics and create output. Each action is configured by specifying a set of input parameters. Running a CAS action in the CAS server processes the action's parameters and the data and creates an action result. For more information, see “Programming with CAS Actions” in An Introduction to SAS Viya Programming.

SAS Viya provides a variety of interfaces for running CAS actions, including the following:

  • from a SAS session using the CAS procedure. The CAS procedure uses the CASL language for specifying CAS actions and their input parameters. CASL also supports normal program logic such as conditional and looping statements and user-written functions.
  • from Python, R or Lua using the SAS Scripting Wrapper for Analytics Transfer (SWAT) libraries.
  • from Java using the CASClient class.
  • via REST using the CAS REST APIs.

Sample code

The sample code below uses the table.loadTable action that performs a server-side load. For a list of full Actions and Action Sets, refer to the online documentation.

Loading a Table and Viewing Table Information Using Tables Action Set

This example uses the table.loadTable action that performs a server-side load.
/* change the host and port to match your site */
options cashost="" casport=5570;

/* start a session, if you do not already have one */
*cas casauto;

proc cas;
   session casauto;

   /* Load source data (IRIS) into a table. */
   table.loadTable /                  /*#1*/

   table.tableInfo   / table="iris";  /*#2*/
   table.tableDetails / table="iris"; /*#3*/
/*  1. Use table.loadTable action to load a table from a caslib’s data source. */
/*  2. Use table.tableInfo action to view information about the table. */
/*  3. Use the table.tableDetails action to get detailed information about a table. */

Back to Top