BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Mayank_61
Calcite | Level 5

Hi,

Is there any way in which we can automate the conversion of a SAS code to Python.

The automation process not necessarily need to be in SAS, it can also be in python with some predefined python library.

Any link to the solution or some predefined workflow will be really helpful.

Thank you

 

Regards,

Mayank 

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

I doubt there's a good way.  See this thread with same question:

https://communities.sas.com/t5/SAS-Data-Science/SAS-to-Python/td-p/729384

 

If you google a bit you'll fine companies selling translations / translators, but I'm not sure I would trust them.  One has a 90% guarantee.  Hard to imagine something worse than correctly translating 90% of a program into a new language.

 

If you're going to switch to python, probably better to invest in hiring / learning python, and have python programmers sit down with requirements and build in python.  SAS code is pretty easy to read, so if you have requirements, SAS code, and a few people who know SAS, would think it could be done.  Of course it's a big migration (potentially), you might want to rearchitect your full analytic environment at one time, not just switch the language.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

View solution in original post

9 REPLIES 9
r_behata
Barite | Level 11

Check SASPy

Quentin
Super User

I doubt there's a good way.  See this thread with same question:

https://communities.sas.com/t5/SAS-Data-Science/SAS-to-Python/td-p/729384

 

If you google a bit you'll fine companies selling translations / translators, but I'm not sure I would trust them.  One has a 90% guarantee.  Hard to imagine something worse than correctly translating 90% of a program into a new language.

 

If you're going to switch to python, probably better to invest in hiring / learning python, and have python programmers sit down with requirements and build in python.  SAS code is pretty easy to read, so if you have requirements, SAS code, and a few people who know SAS, would think it could be done.  Of course it's a big migration (potentially), you might want to rearchitect your full analytic environment at one time, not just switch the language.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
Sajid01
Meteorite | Level 14

Hello @Mayank_61 

I agree with what @Quentin has suggested.

SAS and Python are two different application softwares which perform identical set of tasks for example data analysis, statistics etc in their own distinct way. But there is no one to one corrospondence between a function in SAS with that in Python. Any translator, if available, may not be effiecient.
It is better to focus on the task a SAS program does and write the same job in Python. This will require more resources in development but save time in debugging a faulty translation.

 

maryana
Calcite | Level 5

I am just doing a market research on Automatic tool/services for translating from SAS code to python (don't want to use them).

So far, I found wise with data, SAS2PY and Semantic Designs.

Would you please name the translator tool/services if you know any more?

 

Thanks

kbohle
Obsidian | Level 7

Hi,

 

please look at https://www.wisewithdata.com/sas-to-pyspark-migration-solution-2/

This company I found in addition to the two you already listed.

 

I found in addition a Web based tool doing translations between differnt programming languages. This tool offers a lot of programming languages including SAS and Python.

https://codeconverter.com/?gclid=Cj0KCQjw6cKiBhD5ARIsAKXUdyb7-UR64w8VG8vk7aDhWYX8PXhR1sAlOgsAXl-mAxT...

 

 

Arjun-V
Calcite | Level 5

We tested and fond that our tool perform far better than wisewithdata, leap logic, sas2py and symantic designs

Kurt_Bremser
Super User

What I said in the thread @Quentin linked to still holds true. Start with the original requirements, and have the program(s) rebuilt from scratch by (a) Python specialist(s). Don't even think about a "conversion" that will have you end up with a piece of unmaintainable junk.

If this proves to make no sense economically, stay with SAS.

 

Keep in mind: this is not like translating PASCAL to C. The paradigms are completely different.

 

SASKiwi
PROC Star

Just to add to the specific SAS to Python code conversion discussion, I've never seen a reliable, automatic way to convert from ANY computer language to ANY other one where the architecture and syntax is radically different. It's a different story where you have different flavours of the same computer language like SQL, BASIC, C and so on but that's not what we are talking about here. And let's not get started on software that's incompatible between versions...  

Arjun-V
Calcite | Level 5

Hi Mayank,

 

We have exactly done the same. We have parsed SAS code and converted into Python code. We were able to achieve 95% during the automation process and 5% manual intervention is needed to do some configuration etc. If you are interested, you can reach out to me and discuss in detail. 

My name is Varatharajkumar (Als.) Arjun, from Chennai, India. I am the Founder and COO of Rushmore Technologies Private Limited.

My Mail id : arjun@rushmoretech.in

Mobile No: +91 9840171191.

You can feel free to reach me anytime at your convenience. Thank you. 

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
  • 9 replies
  • 25929 views
  • 7 likes
  • 9 in conversation