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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.