BookmarkSubscribeRSS Feed
gcapo94
Calcite | Level 5

Hello everyone,

I have recently discovered the existence of proc python. I did some tests to see if writing in pure sas is more convient than proc python, in terms of time.
I wanted to understand how proc python works: does sas internally translate python language into sas language? 

Thank you all!

3 REPLIES 3
Quentin
Super User

UPDATE: What I wrote below is indeed completely wrong.

I was thinking about how I think SWAT (https://developer.sas.com/guides/python-swat.html) works.  So writing python code, and having it run on CAS.  But that's the opposite of PROC PYTHON (writing SAS code, including python code that will run 'on' python).

 

____

Here's my understanding (may be wrong!).

 

When you use PROC PYTHON on Viya I think it gets translated into CAS actions.  (maybe that means CASL code?)

 

Similarly when you run SAS code on Viya it is also (I think) translated into CAS actions (unless it runs on the SAS 9 compute engine).

 

I would be interested to know if there is an option to let you see the CAS action code that was generated (either by PROC PYTHON or from SAS code).  That would be interesting to explore.

 

In terms of efficiency, it would be a fun thing to test, and if you do, please consider writing up a post (and/or user group paper) with your results.

 

Found a good CASL paper, which discusses python->CASL, but not specifically PROC PYTHON.

https://support.sas.com/resources/papers/proceedings19/3040-2019.pdf

 

sbxkoenk
SAS Super FREQ

I would be interested to know if there is an option to let you see the CAS action code that was generated (either by PROC PYTHON or from SAS code).  That would be interesting to explore.

When using CAS-enabled procedures the CAS option LISTHISTORY will display the CASL actions in the SAS Log.

 

Print all of the actions that were executed in the current session:

cas casauto listhistory _all_;

Print the last 5 actions that were executed in the current session:

cas casauto listhistory 5;


BR,

Koen

SASKiwi
PROC Star

How PROC PYTHON works is described in the documentation. When you run Python code inside the PROC, SAS passes this to a Python deployment installed alongside Viya.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1402 views
  • 2 likes
  • 4 in conversation