Integrate SAS with Python
Getting started with SAS and Python integration
SAS integrates with Python through various code libraries and tools that allow open source developers to unite the Python language with the analytic power of SAS. Which package to use depends on your role, goal, system environment and so on.
Use the descriptions below to choose the right package for your project. Each is open source, available on GitHub and allows you to:
- Load, import and profile data using an integrated development environment (IDE) or REST APIs.
- Cleanse, prepare and transform your data.
- Use functions to manage and provide governance for data assets and their relationships.
SASPy is the key that allows Python developers (who may or may not code in SAS) access to SAS 9.4 data and analytics capabilities, without having to code in SAS.
• Generate SAS code supplied Python objects and methods
• Convert data between SAS data sets and Pandas data frames.
• Interface with Jupyter notebooks or interactive and batch Python.
SAS DLPy is a high-level open-source package for the Python APIs that are created for the SAS Viya 3.4 (and newer) Deep Learning back end.
• Provides a way to apply deep learning functions to solve the computer vision, NLP, forecasting and speech processing problems.
• Fetch data from the SAS back end andd convert it to data format such as numpy array or DataFrame.
• Blend of the easy and lazy Keras and a bit of PyTorch flavor.
The ESPPy package enables you to create SAS Event Stream Processing (ESP) models programmatically in Python. Using ESPPy, you can connect to an ESP server and interact with projects and their components as Python objects.
• Provides support for streaming charts and images .
• Allows full integration with Jupyter notebooks including visualizing diagrams of your ESP projects.
• Access information about the server, manage and construct projects and interact with windows in your projects.
The SAS Scripting Wrapper for Analytics Transfer (SWAT) package is the Python client to SAS Cloud Analytic Services (CAS). SWAT allows users to execute CAS actions and process the results all from Python.
• Load and analyze data sets of any size on your desktop or in the cloud.
• Execute workflows of CAS analytic actions.
• Uses many features of the Pandas Python package and other dependencies of Pandas.
More Python tools on SAS GitHub
A user-friendly REST client for SAS Viya. The sasctl package enables easy communication between the SAS Viya platform and a Python runtime.
• Available as a module or as a command line interface.
• Facilitates full model management lifecycle (build, register, publish, score).
• Processes models built by various tools (SAS, sci-kit learn, R, etc.).
sasoptpy is a Python package providing a modeling interface for SAS Viya Optimization solvers.
• Provides a quick way for users to deploy optimization models and solve them using CAS Actions.
• The library can handle linear, mixed integer linear and nonlinear optimization problems.
• sasoptpy uses the swat package to communicate SAS Viya, and uses the saspy package to communicate SAS 9.4 installations.
Python tools for SAS Viya
The pyviyatools are a set of command-line tools that call the SAS Viya REST API's from Python.
• Make direct calls to any REST endpoint.
• Mainly used by SAS administrators.
• Used in conjunction with the sas-admin command line interface (CLI).