BookmarkSubscribeRSS Feed

What SAS Python Packages are Available and What Do They Do? Q&A, Slides, and On-Demand Recording

Started ‎12-12-2022 by
Modified ‎12-14-2022 by
Views 5,434

Watch this Ask the Expert session to learn how SAS is the collaborative environment for open source developers and how it fosters productivity and streamlines workflows. 

 

Watch the webinar 

 

You will learn:

  • What SAS Python packages exist today, their key features and when to use them.
  • How to work with the packages (demonstration).
  • How to get started on your SAS Python journey.

 

The questions from the Q&A segment held at the end of the webinar are listed below and the slides from the webinar are attached.

 

Q&A

What's the best way in SASPy to inspect both the log (maybe in collapsed form?) and output?

When using SASPy the output is usually printed out automatically. If not, the output might be a dictionary and you can see them by looking at the elements of the dictionary. To see the log produced by the last submit, you can call the lastlog() method on your SAS session object. For more information and example, please refer to the SASPy documentation.

 

Can we run SAS code and get corresponding python code back?

That's unfortunately not possible right now.

 

How do we install SASPy? Is this a separate license from SAS?

You can install SASPy like any other Python package with “pip install SASpy”. Please refer to the documentation for more information. There is no separate license for any of the SAS Python packages. Anybody can install and use them. Please note: While using SASPy doesn’t require a license, it does not give you access to procedures you can’t access in your SAS environment.

 

Can SWAT connect to SAS9?

No, it unfortunately cannot. To my knowledge, it's exclusively to SAS Viya.

 

How do you set sascfg_personal.py to connect to a local SAS (windows system)?

There is not only a great documentation, but I think they go over exactly that case in the authentication Ask the Expert that I linked on that slide. They show how you can set up this configuration file. It's easier to do that than somewhere else remotely hosted suspend for environment. You will also find good examples and that should make it make it very easy for you to accomplish your connection.

 

This is very useful for Python users to leverage SAS. Are there SAS functions/packages /procs for SAS users to leverage Python resources?

Absolutely. SAS offers multiple ways to leverage Open Source methods inside of SAS. First of all, you can use PROC PYTHON to write plain Python code inside a SAS program and import/call any Python package you want. Additionally, you can integrate Python Scripts in your SAS Studio flows or write Python code inside the Open Source code node in SAS Model Studio.

 

Do all the packages work with SAS Viya only?

There are these little flags in the top right of every slide, so most packages only work with SAS Viya. There are some, like SASPy, that works with SAS 9.4. I think it was initially developed with SAS9.4 in mind. You don't gain extra capabilities usually from your source environment.

 

Are there Python packages for SAS solutions, such as CI360?

Not to my knowledge, no. Unfortunately, I think the packages I outlined here are all the packages we have globally from SAS.

 

Slightly unrelated to this seminar, what are the options to run Python scripts in SAS 9.4?

This is how: https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lecompobjref/n0idvcquwdq95mn1k36ld7acjyzn....

 

Why create complexity by using two languages?

It comes down to preference. People who are new to the game are more likely to use Python. But what we're trying to do with SASPy or SWAT is to make the language you choose more and more irrelevant. We don't want the language to be something that holds you back. Ideally, everybody uses everything, the language he or she wants to use. In the end, I think it comes down to preference and what functionality is available.

 

I don't have SAS Viya yet. Can I still use Python to access SAS procedures?

If you don't have access to a SAS environment, unfortunately, you can't. You can download it and write statements, but they are effectively no use to you. You need a working environment you can connect to use those packages and leverage all the functionality.

 

Are there additional Python packages being developed for SAS?

No, not for now.  When you look at SWAT, for example, you can see how frequently it is updated. They’re all on an open source license so you can see the whole source code. If you see it’s in development, you can actually ask the developers of those packages what they're working on. You can also request features there. What's happening more right now is the current packages we have, and especially the bigger ones, are developed and features are extended here, but I'm not aware of any new packages being developed right now.

 

Can we connect SASPy to an open/free license to test it out? I don't have SAS installed on my machine, but I would like to try this.

It is indeed possible to use SASPy/Swat with Viya test installations like with SAS Viya for Learners.

 

SAS Viya for teaching purposes is under-resourced. Will these SAS Python packages work there with large datasets?

Your environment should be able to handle the data you want to work with to begin with and the Python packages won't change anything. But it’s also hard to answer without knowing your environment, without knowing the data set. But the package won't get in your way of handling a certain size, certain type of data. That shouldn't be an issue.

 

Is there something in SAS that you can connect to R in a similar function to Proc Python?

There is a way with Proc IML. To my knowledge, you can run our code within SAS, so you could basically wrap our logic with Proc IML. Have a look at the documentation here. In Model Studio, you do not only use Python open-source code nodes, but also on a code basis. I think with Proc IML you're able to wrap our code in a SAS program.

 

What about the SAS Kernel and Keras packages?

You are free to install any packages in the Python environments you use in conjunction with SAS Viya. This includes Keras. After installation you can import and call Keras methods inside of PROC PYTHON for example.

 

Is there an API integration that allows converting Python data frame %2B metadata to SAS transport file?

Both SASPy and SWAT have methods to convert data frames to SAS-tables and vice versa.

 

Are any of the SAS packages relaxant for Studio or Miner?

Yes. When you use Enterprise Miner, you can use SASPy to connect to your local or remote SAS 9.4 environment.

 

When will SAS integrate Tableau software? Or will SAS be accessible in Tableau?

There are no official plans for integration with Tableau at this moment.

 

Can you please provide the location where packages are available? What is the cadence? Where can I find code use examples or a SASPy list of commands/arguments if any? Please recommend resources for beginner user experience level.

Please head to the SAS Github Page. You can find the repositories for all packages, documentations, examples, etc. For example, the repository of SASPy. The examples start with easy problems and are a good fit for beginners. Additionally, you can check out the dedicated Webinar for SASPy

 

When would you use Python packages in SAS? What are the benefits of using Python packages?

If you are a Python developer that wants/needs to leverage data or technology from the SAS platform, then is the time to use the SAS packages. It comes down to preference. Another reason could be that you need to integrate SAS data/models/functionality inside another application. For example, for scoring a model.

 

Are there free training resources (SAS Viya or 9.4) where we can test this notebook and play around with it?

For Students and Lecturers, there is Viya for Learners.

 

What advantage does SASPy have over other Python packages?

It’s not really an either/or. But SASPy allows you to leverage SAS Viya with all the data and technology available on it. This can be an advantage for data and computationally intensive use cases.

 

Does SAS Viya include Python, or do you have to separately install Python on the server to use Python within SAS?

Usually, a SAS Viya installation includes a standard Python environment. You can also provide your own.

Also, you can install any Python packages you want in those environments. There are no limitations from SAS in that regard.

 

Are your example notebooks available on GitHub?

Yes, please just follow this link to the official SAS Software Github page. There you find all repositories for SAS packages including example notebooks. Just have a look at the packages you are interested in.

 

I am currently using SAS EG 8.3. Is there a way I can call python code in my EG environment?

I’m afraid SASPy isn’t supposed to work with SAS Enterprise Guide directly. But you can connect with SASPy to a local or remote SAS installation. Have a look at this.

 

I have BASE SAS 9.4, TSM5. I tried running PROC PYTHON and I got: ERROR: Procedure PYTHON not found. What do I do?

PROC PYTHON was introduced on SAS Viya and hence is not available on SAS 9.4. But, to work with Python under SAS 9.4 please refer to PROC FCMP.

 

Does SAS technical support embrace the Python issues running in the SAS system?

SAS support is happy to assist you around all features provided within SAS like PROC Python. There is no support for technical issues concerning Python itself. Regarding feature requests and problems with python packages: You can open an issue on the corresponding GitHub pages. Our continually active developer's community is usually quick to find a solution.

 

We want to use Jupyter and SAS Studio for coding. How can we integrate/relate both languages?

You can use all SAS Python packages to leverage everything SAS offers, and you can use PROC PYTHON to integrate Python logic into your SAS programs. Furthermore, you can write straight Python code in the newer version of SAS Studio and in the Open-Source Code Nodes in Model Studio for example. On a development environment level, you can use Git for collaboration and version control and use our new SAS Visual Studio Code extension to get Syntax highlighting within VS Code.

 

Is there any SAS %2B R?

There is a SWAT equivalent for R called R-SWAT that works similarly. You also have the option to use PROC IML to call R packages.

 

Is there a PROC Python step for SAS 9.4? And can you import python modules into SAS Code? E.g. "Pandas".

While PROC Python is not available under SAS 9.4, you can use PROC FCMP. No, you cannot import Python packages into SAS. But you can write plain Python code inside PROC Python for example where you can use any Python package you want. For further information about the possibilities with PROC FCMP, please refer to the linked documentation. There are some great examples.

 

Is there SASPy you could connect to SAS server data?

You can use SASPy to access data available on the SAS Server.

 

Does the SASPy packages also integrate with an Azure deployment of SAS?

Yes.

 

Recommended Resources

SAS Open Source Resources

SAS Software on GitHub

Drive Analytic Innovation Through SAS® and Open Source Integration

Mastering Model Lifecycle Orchestration – An Interactive Guide

Moving from SAS®9 to SAS® Viya®

Please see additional resources in the attached slide deck.

 

Want more tips? Be sure to subscribe to the Ask the Expert board to receive follow up Q&A, slides and recordings from other SAS Ask the Expert webinars.  

Comments

Can we connect SASPy to an open/free license to test it out? I don't have SAS installed on my machine, but I would like to try this.

 

may be limited to SAS9.4 but you can certainly connect SASPy to an OnDemand-For-Academics session which is free [for personal non-commercial use] - and not restricted to academics. Original answer (to save you looking back) states it can be used for Viya test.

Version history
Last update:
‎12-14-2022 02:52 PM
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!

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Article Tags