BookmarkSubscribeRSS Feed

Where to define your SAS libraries in SAS Viya? Part 1

Started ‎05-10-2024 by
Modified ‎05-15-2024 by
Views 785

In SAS Viya, you have multiple ways to define your SAS libraries. In this post, we will walk through the different ways of creating SAS libraries in SAS Viya and describe what their benefits are.

 

@GerryNelson wrote a nice post some time ago about managing SAS libraries using the “New Library Connection” dialog in SAS Studio. Please check it out to get more details about some approaches explained later, especially in part 2.   @DavidStern wrote a very useful post too that will help understand the scope of the various ways to define libraries.

 

Finding a way to set up a library is still highly correlated to finding where to set up an autoexec in SAS Viya. We’ll see that this is slowly changing as new approaches become available.

 

The global way

 

In SAS Viya, we have multiple ways to start a SAS session depending on how we instantiate it. SAS Studio users will start a compute server. Automated tasks, run through the SAS Viya CLI for example, will probably start a batch server. SAS 9 users might start a connect server in SAS Viya.

 

So, a server is the highest level for defining an autoexec and thus SAS libraries.

 

You can specify an autoexec and SAS libraries in SAS Environment Manager for the specific server. Below is an example of an autoexec set up for the compute server:

 

nir_post_95_01_ev_global_autoexec-1536x844.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

 

Defining a library at this level means it will be available globally to all users starting a compute server. So, it is a good way to make your shared libraries available to all SAS users, regardless of the context they will be using.

 

The same configuration exists for batch and connect servers. If you want this library to be available everywhere, then you would also have to add it to the batch and connect autoexec. The configuration steps are similar.

 

The contextual way

 

Under the server, there is this concept of context. A compute server is run under a compute context. A batch server is run under a batch context. Etc. A context provides additional specific configuration to run a particular server. By definition, “a compute context is a specification that contains the information that is needed to run a compute server”.

 

Contexts exist for compute, batch and connect servers. However, only compute contexts allow an admin to specify an autoexec.

 

There are some pre-existing contexts out-of-the-box:

 

nir_post_95_02_ev_context_list.png

 

SAS Studio compute context is the default context used when you open SAS Studio.

 

You can create your own contexts (group-based, project-based), for example to provide dedicated resources to groups of users, or to a specific project. And then provide them with different libraries, or same library names pointing to different locations.

 

You still use SAS Environment Manager to define an autoexec on a context like in this example below:

 

nir_post_95_03_ev_context_autoexec-1024x624.png

 

The personal way

 

In addition, a SAS Studio user can add his own library definitions in his own private autoexec. This autoexec is not tied to a computing environment but rather to a user. This means that, regardless of the context the user chooses, the libraries defined in his autoexec will always be available to him (in SAS Studio). We’ll see in the recap, part 2, how the different scopes work together.

 

Here is how to add libraries to one’s SAS Studio autoexec:

 

nir_post_95_04_sas_studio_autoexec-1024x476.png

 

At this point, in SAS Studio, I have 3 different libraries coming from 3 different levels of configuration:

 

nir_post_95_05_libraries_list.png

 

Stay tuned for the second part of this article where we will explore additional ways of creating libraries and how they impact what we have seen so far.

 

Thanks for reading.

Version history
Last update:
‎05-15-2024 11:12 AM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started