BookmarkSubscribeRSS Feed
USP2405
Obsidian | Level 7

Hi,

 

How do I connect/execute python code into SAS Viya?

Is there any way other than Python SWAT?

 

 

 

Please suggest what are the possible ways to execute python script into SAS VIYA.

10 REPLIES 10
alexal
SAS Employee

@USP2405,

 

If you do not want to use Python SWAT, you can write your own library which will communicate with CAS server over REST API.

USP2405
Obsidian | Level 7

Thanks Alexal fro your reply!

 

Just to give you brief about my query:

I have python scripts which imports data and do some statistcial analysis. I want to execute the same script in SAS Viya without using SWAT. It would be great if you can assist me with some sample code or any document which will help me to understand/wirte my own library to communicate with CAS server over REST API.

 

 

 

 

USP2405
Obsidian | Level 7

Can I write python script in SAS code window instead of using Juyter Notebook as a interface and get output result directly on SAS Viya ?

alexal
SAS Employee

@USP2405,

 

You can write a Python code in SAS code editor, but you won't be able to run it.

USP2405
Obsidian | Level 7

Okay.

 

Can I call python scirpt using Proc IML? If yes do you have any reference to share please.

alexal
SAS Employee

@USP2405,

 

No. You can call an external Python script using X command or filename pipe statement.

USP2405
Obsidian | Level 7
we can call R using Proc IML...same way is any other way to call python code (except using jupyter)
Rain
Obsidian | Level 7

@USP2405 did you find a solution to your problem?

I am in similar situation. We have Viya environment and Python scripts from pilot project done outside SAS. Trying to understand if there's any change we can run Python scripts using SAS Viya end-user tools as it is without installing any third-party tools. These scripts produce csv files.

@alexal, do you know if there's been advancements in this area as this post was originally posted several years ago.

Thank you
Rain


joeFurbee
Community Manager

Hi @Rain,

@alexal may have additional insight, but I'd recommend starting with the Python tools outlined on developer.sas.com. There, you can browse multiple tools for SAS and Python integration.

 

There is also Proc FCMP; however, this looks to be more inline with the original question vs your situation.


Join us for SAS Community Trivia
SAS Bowl XLIII, The New SAS Developer Portal
Wednesday, August 14, 2024, at 10 a.m. ET | #SASBowl

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 10 replies
  • 4124 views
  • 2 likes
  • 4 in conversation