Hello,
Current configuration:
SAS Viya version: 3.5
SAS Viya is installed on Linux
Python version 3.7.9
Python SWAT version 1.9.0
Supposing that we have two libraries defined in SAS VIYA, one CAS and one not CAS.
Would anybody know if is possible to upload a table from the non CAS library to the CAS library by using Python SWAT?
The equivalent process in SAS Studio would be:
proc casutil;
load data=NON_CAS_LIB.tablename outcaslib="CAS_LIB"
casout="targetTableName";
run;
Can this be done in SWAT?
After creating the SWAT connection I have tried using load_path like below but it didn't work.
test=conn.load_path('NON_CAS_LIB/Table_A', caslib='CAS_LIB')
Thank you,
Madalin
Hey Madalin,
Unfortunately, there's no simple way to access a table in a non-CAS library through swat. This is because swat only communicates with the CAS server, rather than the SAS Compute Service where SAS libraries are defined and SAS code is processed. CAS doesn't know anything about the libraries in SAS, and so unfortunately swat doesn't either.
Luckily, there are a couple of alternatives and workarounds!
SASPy.SASsession.sd2df('table', 'non_cas_libref')method to download the data into python, and upload it to CAS with swat. You can also use the
SASPy.SASsession.submit('code')method to directly submit SAS code, like the snippet you posted above, to be executed.
Hey Madalin,
Unfortunately, there's no simple way to access a table in a non-CAS library through swat. This is because swat only communicates with the CAS server, rather than the SAS Compute Service where SAS libraries are defined and SAS code is processed. CAS doesn't know anything about the libraries in SAS, and so unfortunately swat doesn't either.
Luckily, there are a couple of alternatives and workarounds!
SASPy.SASsession.sd2df('table', 'non_cas_libref')method to download the data into python, and upload it to CAS with swat. You can also use the
SASPy.SASsession.submit('code')method to directly submit SAS code, like the snippet you posted above, to be executed.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.