BeOptimized - SAS to Python

Summary

In recent years, we have seen more and more companies eager to convert their SAS processes into Python.
At BeOptimized, we love both programming languages and can help you with that translation process.

Just like translating from French to English isn't an easy task, moving from SAS to Python is not straightforward either, as both languages are unique and operate differently. Nowadays, using AI, it is easy, cheap, fast, and accurate to translate programming languages. Moreover, you can easily estimate the cost of an AI translation versus a human translation. However, can you estimate the cost that a mistranslation could have on your business?
Always remember that these SAS codes are the heart of your business!

Like the butterfly effect, a small change in the code can have a huge impact in the end... So, you need a perfect understanding of the SAS code for this task, which is why BeOptimized can help you better than anyone else.

SAS









Python

Benefits

  • +15 years of experience with SAS code
  • Fully SAS-certified expert in Base SAS, SAS Advanced, and SAS Viya
  • Strong Python knowledge with PCEP and PCAP certifications
  • Step-by-step approach: SAS and Python codes are run in parallel to ensure the results are the same
  • Use the SASpy Python package to access historical SAS datasets
  • Possibility to be coached on how to convert SAS code to Python

Constraints

Currently, the service is limited to converting pure Base SAS code to Python:

  • We do not convert SAS Metadata or Data Integration Jobs / DataFlux
  • We focus on the SAS code only, not on graphics or reports
  • We do not convert statistical procedures from the SAS/STAT module or SAS/OR module
  • A valid SAS license must be in place on-site in order to run jobs in parallel

SAS and Python

Not all SAS users want to use Python... Did you know that you could develop a Python script to access SAS data and continue using your SAS Software?
If you are still using SAS9, you can run both SAS and Python programs in the same environment using the SASpy package developed by SAS. It allows flexibility to transfer data between a Pandas DataFrame and a SAS Dataset. Imagine a situation where you have data in a Pandas DataFrame and wish to run a SAS statistical procedure on it without switching between SAS and Python environments.
If you are using the latest version of SAS, SAS Viya, you can use Python in various ways: from your Python environment or directly in the user interface.

  • The SAS Scripting Wrapper for Analytics Transfer (SWAT) package is a Python interface to SAS Cloud Analytic Services (CAS). Using SWAT, you can execute workflows of CAS analytic actions, then pull down the summarized data to further process on the client side in Python, or merge with data from other sources using familiar Pandas data structures.
  • With the October 2021 release of SAS Viya, SAS introduced the Python Code Editor. Data scientists and Python programmers can now code, execute, and schedule Python scripts from within the SAS code editor interface (SAS Studio) or add Python steps to a SAS Flow quickly and intuitively. Behind the scenes, SAS Studio runs SAS code invoking the PYTHON Procedure and embeds the Python code in a submit/endsubmit block.
  • SAS Viya Workbench is a cloud-based application that is designed for developers and data scientists. The multi-language architecture enables you to natively run SAS Analytics in other programming languages such as Python. Users can access SAS Viya Workbench through a browser on the desktop. SAS Viya Workbench is for SAS programmers who want to access SAS in VS Code and for Python programmers who use VS Code or Jupyter.

Service Description

If you really want to migrate your SAS code into Python, BeOptimized can help you. At BeOptimized, we work with Agile methodology where each story represents a group of SAS codes. After conversion, SAS codes are run in parallel with Python codes and validated by business. Sprints can only be closed by the business. We work as follows:
  • An analysis is made on your SAS environment to list all the SAS codes in place. Then we group the SAS codes into stories:
    • We estimate the complexity of the codes based on criteria such as the size, number of Data Steps or Proc SQL, Data Step size, the presence of macros, the presence of specific SAS statements (retain, first, last, infile...)
    • We use this estimation to create the stories/sprints and put them into the backlog together with the Scrum Master.
  • When the sprint starts:
    • Data is loaded into Python: if the data is coming from SAS7BDAT, we import it using SASPy to limit dependency.
    • SAS code is then converted into Python,
    • Results are compared with SAS results and discussed with business who can decide to validate or not the sprint
    • We continue with the next sprint.
    • When all sprints are completed, we revisit those where we used SASpy and adapt them so that their input corresponds to the output of another sprint.
  • When all SAS codes of a story are done, it's important to run them in production and in parallel with existing SAS jobs. This ensures to have exactly the same performance and behavior with real data.
To optimize knowledge transfer, individual coaching sessions can be organized during the project realization.
Have a question? Please don't hesitate to contact us for more information.
Okay, it sounds too good to be true... converting SAS code to Python is impossible... Why not? Let's make a POC!
  • Send us a SAS code of maximum 200 lines (the code must run in our local environment)
  • Send us the datasets used in that code (please anonymize them beforehand)
  • Be patient and wait for the result!
If you're convinced, we can continue the process!

This site uses cookies. .

By continuing to browse the site you are agreeing to our use of cookies. Review our cookies information for more details.