BookmarkSubscribeRSS Feed
Calcite | Level 5

Hi All,


I have created CAS library ie. "XYZ" in SAS Viya 3.4 version through Prepare Data component. I want to assign this library to the new local library using Develop SAS Code component. Can anyone suggest the way how it can be done?


Much appreciate.




Obsidian | Level 7

So I interpret the question as: You've got some data in a CAS lib that you can see in SAS Viya.

You now want to use SAS Studio ("Develop SAS Code") to access the data in that CAS Library.


That's quite easy:

You need to use a libname statement using the CAS engine like this:


* here, abc is the libref, cas is the CAS engine and you specify the library name (exactly as defined in CAS) in caslib=;

Libname abc cas caslib='XYZ';


*the following will list the tables that are in the CAS library

proc datasets lib=abc;


*assuming you have a table called sales in the caslib, then you can use it in code like this:

data MaySales;

 set abc.sales;

 where Month='May';



I've made some assumptions with the above code, particularly the libname statement. I assume that you are using SAS StudioV that is in the same environment as SAS Viya. That way you don't have to specify CAS connection information.

If you are using SASStudio or other SAS Coding tools like Enterprise Guide that are separate from the SAS Viya environment then you will have to specify the cashost, port and maybe authentication.









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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation