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.
To start a CAS session, a Snippet named New CAS Session is available. This looks as follows:
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:
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:
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.
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:
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.
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:
Above, you can see the additional metrics given using the metrics=true session option.
Congratulations, you have now successfully connected to CAS.