BookmarkSubscribeRSS Feed

Maximize Coding and Data Freedom with SAS, Python and Databricks

Started ‎04-24-2024 by
Modified ‎04-24-2024 by
Views 343

Freedom of choice is now more important than ever, especially when you want to get the most out of your data as an AI specialists. Boasting compatibility with 80+ data sources, including widely adopted open data standards and formats such as Parquet and ORC, the possibilities for data access are virtually limitless with SAS Viya. Check out my colleague Cecily’s blog on how easy it is to set up data access with SAS Viya. Databricks is one of these data sources that SAS Viya works well with, as explained in my colleague Jarno’s blog on harnessing the analytical power of Databricks with SAS. Most versions of Python are supported by Databricks, and as Jarno explains in his blog, you can write Python code natively in SAS Studio on SAS Viya as well. We will touch upon how to use Python inside SAS Viya as well as in your favorite Python tool of choice when using SAS Viya.

 

larsarne_0-1713939197844.png

 

Figure 1: SAS Viya as the execution hub for SAS and open-source coders.

 

As the illustration above shows, SAS Viya not only excels in its native language but also:

  • Embraces Python and other popular coding languages for analytics
  • Offers a plethora of integration options, including intuitive visual interfaces
  • Provides programming interfaces using Python, R, and other languages, with optimized libraries to access functionality within SAS Viya
  • Delivers API interfaces for direct access to the majority of functionalities inside SAS Viya, accommodating various types of users

See below for a deeper dive into these options and discover how to leverage SAS and Python for enhanced analytical prowess.  

 

Use of Python in SAS Viya for Model development and Decision flows

The tools in SAS Viya for model development and building decision flows have explicit support for Python in code nodes where you can write your own Python code directly. The illustration below shows how you can compare a Python gradient boosting model against an R random forest model and a couple of SAS models in Model Studio.

 

larsarne_1-1713939197850.png
Figure 2: Analytical pipeline in SAS Model Studio showing a mix of Python, R, and SAS models.

 

Using Python inside SAS Studio

In SAS Studio, the Data Engineering tool on SAS Viya, there is native support for Python in the editor. In addition, you can choose code nodes with Python code as well as SAS code when building visual data pipelines. You can even create custom transformation steps with python code and share with your colleagues to enhance their productivity.

larsarne_2-1713939197851.png

Figure 3: Writing Python code in a visual data pipeline in SAS Studio.

 

SAS Notebooks in Visual Studio Code with SAS Extension

Visual Studio Code with SAS Extension supports SAS Notebooks where you can code with SAS blocks and Python blocks, similar to how notebooks work in Jupyter lab and Databricks.

larsarne_3-1713939197853.png

Figure 4: Using SAS Extension in Visual Studio Code with a SAS Notebook – SAS Code and Python.

 

Access to SAS Viya from Python environments

Any Python environments that have network access to a SAS Viya environment can use specialized Python libraries curated and powered by SAS to provide efficient access to the power of SAS Viya:

  • SWAT to access the in-memory based analytical engine.
  • sasctl for convenient access to the platform for model management.
  • sasdply to access SAS deep learning features
  • sasoptpy  to quickly formulate and solve mathematical optimization problems
  • CVPy  provides APIs to assist with the processing, analyzing, and visualization of images
  • There is also a set of useful administrative utilities at pyviyatools that are useful for CICD automation and more.
  • You can even access the REST APIs to SAS Viya directly to access most functions available.

 

Run Python inside the in-memory based parallel analytics engine of SAS Viya

If you want to get even deeper in SAS Viya with your Python code, you can have your Python code executed directly inside the SAS in-memory parallel analytics engine using the in-memory gateway action set, see SAS Help Center: CAS Gateway Details.

larsarne_4-1713939197858.png

Figure 5: Python code running in parallel on the SAS in-memory server.

 

Summary

SAS Viya offers a rich array of Python integration options, catering to both built-in SAS Viya applications and external Python environments seeking to tap into the formidable capabilities of SAS Viya. This versatility combined with access to most types of data sources available empowers data scientists, analysts, and AI teams with the freedom of choice to seamlessly collaborate across platforms.

 

Learn more about SAS and Databricks

Expand your SAS and Databricks knowledge further by exploring these blogs by my colleagues, and anticipate our upcoming blogs posted every Wednesday in SAS Communities.

Harness the analytical power of your Databricks platform with SAS

Data everywhere and anyhow! Gain insights from across the clouds with SAS

Elevated efficiency and reduced cost: SAS in the era of Cloud Adoption

SAS and Databricks: Your Practical Guide to Data Access and Analysis

Data to Databricks? No need to recode - get your existing SAS jobs to SAS Viya in the cloud

 

 

Version history
Last update:
‎04-24-2024 04:48 AM
Updated by:

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags