BookmarkSubscribeRSS Feed
jitendra_patil
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.

 

Thanks,

G2

1 REPLY 1
MarkBodt_NZ
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;

quit;

*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';

run;

 

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.

 

HTH

 

Mark

 

 

 

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1144 views
  • 0 likes
  • 2 in conversation