Converting SAS Commands to Python with AI

One of the critical challenges in some companies is how they can convert SAS to Python

Posted by Dirouz on March 3, 2024

Transitioning from SAS to Python: Overcoming Code Conversion Challenges with AI-Driven Optimization

Migration from SAS to another language is the only key and python is regarded as the pioneer among other candidates due to its scalability, similarity to SAS in terms of covering almost all of its libraries, large community of developers and the numerous online SAS to Py convertors.

code conversion is a very sensitive matter especially when working with larger code bases and by the time of this research there's no convertor with more than 90 percent accuracy which is quite scary since we will need to start debugging the new code and processing it all over again.

Line to line conversion is the oldest method in the book and is the most ineffective one since it has no understanding of whats going on in context of the code it just simply converts the syntax line by line.

Semantic Designs company offers a SAS2PY translator claiming it understands the general idea of the code but it works best with smaller SAS applications. read more

Another problem in code conversion is the translated code complexity which might make it more difficult to maintain than before.

Our solution however includes approaching the problem with advanced AI and of course machine learning technologies but defers with other companies in the case that we are not training a model to convert code instead we use OpenAI's O1 API to not only translate the code but optimize it to get even faster and a more standard code than it was in SAS. However the process does not end here and we need other scripts to mix the different parts of the translated codes together and after that comes CI/CD and deployment automations.