This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post. |
One of the big benefits of the SAS Viya platform is how approachable it is for programmers of other languages. You don’t have to learn SAS in order to become productive quickly. We’ve seen a lot of interest from people who code in Python, maybe because that language has become known for its application in machine learning. SAS has a new product called SAS Visual Data Mining and Machine Learning. And these days, you can’t offer such a product without also offering something special to those Python enthusiasts.
Introducing Python SWAT
And so, SAS has published the Python SWAT project (where “SWAT” stands for the SAS scripting wapper for analytical transfer. The project is a Python code library that SAS released using an open source model. That means that you can download it for free, make changes locally, and even contribute those changes back to the community (as some developers have already done!). You’ll find it at github.com/sassoftware/python-swat.
SAS developer Kevin Smith is the main contributor on Python SWAT, and he’s a big fan of Python. He’s also an expert in SAS and in many programming languages. If you’re a SAS user, you probably run Kevin’s code every day; he was an original developer on the SAS Output Delivery System (ODS). Now he’s a member of the cloud analytics team in SAS R&D. (He’s also the author of more than a few conference papers and SAS books.)
Kevin enjoys the dynamic, fluid style that a scripting language like Python affords – versus the more formal “code-compile-build-execute” model of a compiled language. Watch this video (about 14 minutes) in which Kevin talks about what he likes in Python, and shows off how Python SWAT can drive SAS’ machine learning capabilities.
New — but familiar — syntax for Python coders
The analytics engine behind the SAS Viya platform is called CAS, or SAS Cloud Analytic Services. You’ll want to learn that term, because “CAS” is used throughout the SAS documentation and APIs. And while CAS might be new to you, the Python approach to CAS should feel very familiar for users of Python libraries, especially users of pandas, the Python Data Analysis Library.
CAS and SAS’ Python SWAT extends these concepts to provide intuitive, high-performance analytics from SAS Viya in your favorite Python environment, whether that’s a Jupyter notebook or a simple console. Watch the video to see Kevin’s demo and discussion about how to get started. You’ll learn:
- How to connect your Python session to the CAS server
- How to upload data from your client to the CAS server
- How SWAT extends the concept of the DataFrame API in pandas to leverage CAS capabilities
- How to coax CAS to provide descriptive statistics about your data, and then go beyond what’s built into the traditional DataFrame methods.
Learn more about SAS Viya and Python
There are plenty of helpful resources to help you learn about using Python with SAS Viya:
- Kevin wrote a book (with coauthor Xiangxiang “X2” Meng) about this topic: SAS Viya: The Python Perspective. The authors also shared the sample code from the book on GitHub. Check out the many sample Python notebooks (including one specifically for people who are new to Python).
- Kevin and others have also been populating the sas-viya-programming project on GitHub. You’ll find Python code samples, plus examples for accessing SAS Viya from other languages including SAS and R.
- SAS trainers have recorded a tight 5-minute tutorial, “Getting Started with the Python Interface of SAS Viya”. Be sure to check that out for a great overview of connecting to CAS and using several of the available actions.
- And don’t forget to check out the SAS Support Communities for SAS Viya coders. You can post questions and connect with the experts from SAS (and the rest of the world).
And finally, what if you don’t have SAS Viya yet, but you’re interested in using Python with SAS 9.4? Check out the SASPy project, which allows you to access your traditional SAS features from a Jupyter notebook or Python console. It’s another popular open source project from SAS R&D.
The post Using Python to work with SAS Viya and CAS appeared first on The SAS Dummy.
This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post. |