Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

SAS® Viya™: Starting a CAS Session

To start up a CAS session within SAS Viya, you will need to use the SAS Studio. Within SAS Viya, many Snippets are available to perform tasks within CAS. These can be found within the Snippets section of the toolbar, under Cloud Analytics Services.

SAS Viya Starting a CAS Session Image 1

To start a CAS session, a Snippet named New CAS Session is available. This looks as follows:

SAS Viya Starting a CAS Session Image 2

The default code will connect a CAS session within SAS Viya, but let's take a look at how we can customise this…

Starting a CAS session with the default options

To start a basic CAS session using the default options there is only one option we need to define. The session name:

SAS Viya Starting a CAS Session Image 3
The session name is specified directly after the keyword cas and there are only two rules for them:

  • They must be less than 256 characters 
  • They must not be enclosed within quotation marks.

This session name is used as a unique identifier for your session. This enables users to reconnect to a CAS session at any point within a single SAS session, if the active session has been changed at any point.

When you connect to a CAS session using the default options, the following will be displayed within the log:

SAS Viya Starting a CAS Session Image 4
You can see the SAS Viya server name and port which you are connected to along with your unique identifier (UUID) defined within the system. This is related to your Session ID, but you do not need to remember this as you only need to remember the session name. Finally, you will also be able to view the active CASLIB.

Session options

A number of session options are available within CAS. Within the New CAS Session Snippet, the caslib=casuser, timeout=1800 and locale=”en_US” session options are set. These session options can be changed as preferred. A list of some of the available options are detailed below with example values and the default value if these options are not set:

SAS Viya Starting a CAS Session Image 8

Connecting to a CAS session

These session options can be used together to specify your own connection to CAS. Below, these options have been specified to show how these can be modified to personalise your connection to CAS.

Note: not all the keywords are picked within the SAS Studio editor but they are still valid.

SAS Viya Starting a CAS Session Image 6

Verifying the session was connected successfully

Once you have run the code to connect to the CAS session, the logs within SAS Studio should be like the following:

SAS Viya Starting a CAS Session Image 7
Above, you can see the additional metrics given using the metrics=true session option.

Congratulations, you have now successfully connected to CAS.