SAS Viya 3.5 Quick Start

About the SAS Viya Programming Documentation

This collection of documents provides task-based programming examples, syntax, and concepts for products in SAS Viya, such as:

  • SAS Visual Analytics programming
  • SAS Visual Statistics programming
  • SAS Visual Data Mining and Machine Learning programming
Note: On most hosts, SAS 9.4M5 and later releases are tightly integrated with SAS Viya. See SAS 9.4M5 Integration with SAS Viya in What’s New in Base SAS: Details. (The exceptions are z/OS and 32–bit Windows.)

To search this collection, click search icon. For search tips, click help icon, and select Help Tips.

Tip
If you are viewing this document in a stand-alone context, access the collection before you use the preceding information.
Note: Your site must license and install one or more SAS Viya products to access this functionality.

Orientation

This software supports analytical data preparation, variable transformations, exploratory analysis, analytical modeling, integrated model comparison, and scoring. Here are the main components of SAS Viya:

Main Components

Component

Description

SAS 9.4M6

SAS 9.4M6 is integrated with SAS Viya. SAS programs that are submitted from SAS 9.4M6 clients can call procedures that are unique to SAS Viya, as well as CAS-enabled DATA step code and procedures that have been modified to leverage a CAS server and its tables.

SAS Viya

The third generation of high-performance, in-memory analytics.

SAS Studio

The integrated SAS programming environment.

SAS Cloud Analytic Services (CAS)

The analytic engine. CAS uses high-performance, multithreaded analytic code to rapidly process requests against data of any size.

SAS Visual Analytics

Programming tools that provide baseline functionality, including reporting and basic analytics, such as:

  • analytical data preparation
  • variable transformations
  • exploratory analysis
  • descriptive statistics

SAS Visual Statistics

An additional set of advanced analytic functionality that builds on SAS Visual Analytics, such as:

  • building predictive models
  • integrated model comparison

SAS Visual Data Mining and Machine Learning

An additional set of advanced analytic functionality that builds on SAS Visual Statistics, such as:

  • tune machine learning algorithm hyperparameters
  • advanced statistical operations
  • analyzing complex data

SAS Econometrics

A set of functionality that provides techniques to model complex business and economic scenarios and to analyze the dynamic impact that specific events might have over time.

SAS Visual Forecasting

Provides automatic variable, event, and model selection. It then automatically generates your forecasts.

SAS Visual Text Analytics

A text analytics framework combining text mining, contextual extraction, categorization, sentiment analysis, and search.

SAS Optimization

A set of procedures for exploring models of distribution networks, production systems, resource allocation problems, and scheduling problems using the tools of operations research.

CAS-based procedures run against data that is in CAS. For example, before you can use CAS to work with a SAS data set, you must load that data set into CAS. The following instructions demonstrate the basic mechanics.

Tip
If you cannot securely sign in and start a CAS session, contact your administrator or see the troubleshooting topic in SAS Viya Administration: Identity Management.

Demonstration: Load Personal Data

  1. Sign in to SAS Studio.
    1. Open SAS Studio from a URL that is provided by your SAS administrator. For example, you might enter either of the following URLs:

      https://webserver-host-name/SASStudioV (for SAS Studio 5.2, which is available in full deployments)

    2. If you are prompted for credentials, sign in.
  2. Start a CAS session.
    1. In the Snippets section of the navigation pane, expand Snippetsthen selectSAS Viya Cloud Analytic Services.
    2. Right-click New CAS Session and select Open as program. The snippet opens in the code editor.
    3. In the toolbar, click the submit icon to run the New CAS Session code.
  3. Load a table.
    1. In the navigation pane, right-click Load data to caslib and select Open as program.
    2. In the code editor, edit the SAS data set section so that it looks like this:
      PROC CASUTIL;	LOAD DATA=sashelp.cars OUTCASLIB="CASUSER"	CASOUT="demoTable" PROMOTE;RUN;
      Tip
      CASUSER is your personal caslib. It is available across your sessions. You cannot enable other users to access it.
    3. Select the preceding code. In the toolbar, click the submit icon to run only the four lines of selected code.
  4. Verify that you can access the loaded data.
    1. In the navigation pane, right-click Generate SAS librefs for caslibs and select Open as program.
    2. In the toolbar, click the submit icon to run the code.
    3. In the Libraries section of the navigation pane, expand Librariesthen selectCASUSER.
    4. Double-click demoTable to open it.

Demonstration: Provide Shared Data

  1. Sign in to SAS Studio and start a CAS session, if you have not already done so.
    Tip
    For details, see the first two steps in the preceding demonstration.
  2. Create a container for shared CAS data.
    1. In the Snippets section of the navigation pane, expand Snippetsthen selectSAS Viya Cloud Analytic Services.
    2. Right-click New caslib for Path and select Open.
    3. In the code editor, edit the snippet so that it looks like this:
      CASLIB demoCas PATH="/filePath/" DATASOURCE=(SRCTYPE="path") GLOBAL;
      Note: Enter a path that is relative to and accessible from your CAS server. You can reference an empty directory.
    4. Click the submit icon to run the code.
      Note: If an error indicates that you do not have permission to create global caslibs, see Caslib Management Privileges in SAS Viya Administration: SAS Cloud Analytic Services. Initially, only administrators can add global caslibs. An administrator can enable non-administrators to add global caslibs.
  3. Give all users Read access to the new caslib.

    In the SAS Studio 5.2 Enterprise edition, complete these steps:

    1. Access the Data page in SAS Environment Manager.
      • Select Manage Environment from the applications menu (applications menu icon) and then click the Data icon in the vertical navigation bar.
    2. On the Data page, select the Data Sources tab. Right-click the new caslib, and select Edit authorization.
      Tip
      Data page functionality is also available in other contexts. See Data Selection Windows and SAS Data Explorer in SAS Data Explorer: User’s Guide.
    3. In the Edit Authorization window, adjust the gauge in the Access Level column to increase access for Authenticated Users from No access to Read.
    4. Click Save.
    5. Go back to SAS Studio.
      • Select Develop SAS Code from the applications menu (applications menu icon) .
  4. Load data to the new caslib.
    1. In the navigation pane of SAS Studio, right-click the snippet Load data to caslib and select Open as program.
    2. In the code editor, edit the SAS data set section so that it looks like this:
      PROC CASUTIL;	LOAD DATA=sashelp.cars OUTCASLIB="demoCas"	CASOUT="demoTable" PROMOTE;RUN;
    3. Select the preceding code. In the toolbar, click the submit icon to run only the four lines of selected code.
  5. Verify that other users can see the data. For example, ask them to complete these steps:
    1. Sign in to SAS Studio, start a CAS session, and run the Generate SAS librefs for caslibs snippet.
    2. In the Libraries section of the navigation pane, expand Librariesthen selectdemoCas.
    3. Double-click demoTable to open it.

Tip: Automatically Connect and Generate Librefs

For convenience, you can configure SAS Studio to perform the following tasks each time that you sign in:

  • Start a CAS session.
  • Generate SAS librefs for existing caslibs that have names that are no more than eight characters long.

Complete the following steps:

  1. Click Options and select Autoexec file.
  2. On the Autoexec.sas tab of the (Edit) Autoexec File window, paste the following code:
    cas casauto;caslib _all_ assign;
  3. Run the code.
  4. Save the code.

Documentation: References by Task

Documentation References by Task

Task

Refer to:

Do you need to migrate your data to UTF-8?

Migrating Data to UTF-8 for SAS Viya

Access your data

DATA Step Examples

Common Tasks for Accessing Data

Manipulate your data

Data Step Basics

Prepare, Model, Assess

MDSUMMARY Procedure

SAS Visual Data Mining and Machine Learning: Procedures

SAS Visual Statistics: Procedures

Graph your output data

Introduction to SAS Platform Graphing

Program with the Lua, Python, R, or CASL languages

Getting Started with SAS Viya for Lua

Getting Started with CASL Programming

Getting Started with SAS Viya for Python

Getting Started with SAS Viya for R

Learn more about SAS Viya and SAS 9 interactions.

An Introduction to SAS Viya Programming

SAS Guide to Software Updates and Product Changes

Last updated: November 12, 2019