BookmarkSubscribeRSS Feed

Ask the Expert: SASPy Demo: Q&A, Slides, Demo Notebook and On-Demand Recording

Started ‎08-26-2021 by
Modified ‎09-13-2021 by
Views 5,554

How Do I Use SASPy to Interface with SAS® From My Python Code? Q&A, Slides, Demo Notebook and On-Demand Recording

 

Watch this Ask the Expert session for an introduction to SASPy, our open source Python interface to SAS. We’ll explore use cases, resources and capabilities. 

 

Watch the webinar

 

You will learn:

  • How to integrate your existing software systems with the latest open source language to write mixed workflows.
  • How SASPy can open SAS to Python programmers so they can use the best of both worlds, together.
  • A full overview of SASPy, including documentation, support resources, use cases and capabilities.

 

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. The demo notebook that was used can be found here: Ask_the_Expert_Demo.

 

Q&A

Is there something like this for R?

No, we don’t have this available for R that integrates SAS into R like SASPy does for Python.

 

I have installed SASPy but have not gone through config yet so going through the configs would be very helpful.

I think a webinar dedicated to config would be quite useful. I need to see how to go about that.

 

Do you have any recommendations for users who have an AWS server set up with different servers for Python and SAS?

That varies by configuration. SASPy is just a Python module so you have Python running in whatever you’re running in Amazon. There are three different access methods so depending on what SAS you are trying to get at, the configuration would be different. If you’re trying to get to a workspace server inside you’re company, you would have to be able to get through the firewall from the client on Amazon. You can run SAS in a container in the cloud where you are running. And, getting at a Viya deployment from the cloud is probably the easiest, since it’s an HTTP interface and is cloud based in that respect already. FWIW, you can also get to our SAS On-Demand for Academics remotely, so you could test out things from Amazon by connecting to that. It’s IOM Remote, so if you were trying to get to your own, workspace servers, this could be a good test configuration as it’s accessible from externally already.

 

Have you used this to administer SAS Viya to Azure on Linux or Windows yet?

Not sure about what kind of administration you’re referring to. SASPy connects to SAS and submits SAS code, so the only admin you would really be able to accomplish would be something that would be done by submitting SAS code to a SAS session, which doesn’t strike me as administering systems like that. Viya has its own kind of administration and it isn’t via submitting SAS code to a SAS session.

 

If I am running on windows and using sas = saspy.SASsession(cfgname='winlocal', results='HTML'), why do I get a log output that does not recognize the SAS Config name 'iom' or 'winlocal'. Maybe I need to update a personal_config.py file specific for windows?

You do have to configure SASPy so it knows which SAS, where, you’re trying to get to. There are many possibilities there. You should create your sascfg_personal.py file with the configuration definition for the SAS deployment you’re trying to connect to. This is all in the config doc (https://sassoftware.github.io/saspy/install.html#configuration ). The config names (winlocal, …) are simply examples for the various configurations you might need. The names themselves can be anything, I just made the names be somewhat self-describing to help, instead of naming them ‘foo’ and ‘bar’ and ‘bob’, which aren’t helpful at all. If you are still having issues, just open an issue on GitHub and I can help you set it up (https://github.com/sassoftware/saspy/issues). But looking at the doc first should be helpful.

 

The histograms shown, are those Python based histograms, or is the Python invoking SAS visualizations?

The histograms are SGPLOT so it is invoking SAS visualizations.

 

Do I need PC SAS to run this?

No. You can connect to any SAS that’s out there.

 

Our organization uses a Citrix virtual server to connect to SAS. We also have fobs with dynamic PINs that we use to authenticate, in addition to username and password.  Would using SASPy be an option for us?

I think I’d have to look into that in more detail. I would need to know where the python client is, in this setup, what SAS deployment it’s trying to connect to. If you’d like to open an issue, I can help you try to figure it out.

 

Can "Submit" create a dataset/dataframe?

The SUBMIT method(s) submit the SAS code you provide in the SAS session you’re connected to. It’s no different than submitting code in SAS, or from any other client that is connected to SAS (EG for instance). So, SAS code can certainly be used to create SAS Data Sets, but SAS code doesn’t create Pandas data frames. The sasdata2dataframe (sd2df for short) creates a Pandas dataframe from a SAS data set or view, and dataframe2sasdata (df2sd) creates a SAS data set from a Pandas dataframe.

 

Can you go over windows IOM config for sascfg.py to access SASPy?

Sorry I didn’t have time to go through configuration. That is a topic that can be its own presentation. I’d like to see about doing something like this, as it would be a good hour with Q&A. I’ll look into how I might be able to do something like this. Meanwhile, you can look at the documentation that shows how to do this here: https://sassoftware.github.io/saspy/install.html#configuration

 

How would you handle large tables stored on SAS server for Python processing?

By default everything that SASPy does, it does it in the SAS session and returns to you the results of whatever that method was, which means the data stays on SAS and was processed on SAS. The table, chart or plot is brought back to Python for displaying or rendering. Moving data is under your control. In SAS, the data is not sitting in memory. In Python, a panda data frame is in memory.

 

Can SASPy connect to Mainframe SAS datasets?

Yes. If you have a workspace server running on your mainframe, you can connect using an IOM remote connection. The default file system needs to be hfs.

 

Will you please share this Jupyter notebook with attendees?

You can find the Jupyter notebook on GitHub. Look for it under the SAS Contributed Directory.

Here’s the link: https://github.com/sassoftware/saspy-examples/blob/main/SAS_contrib/Ask_the_Expert_Demo.ipynb

 

You showed the example of submitting the PROC SQL code. Can I submit something like a %include to run a pre-written .sas program?

Yes; sas.submit(“ %include ‘file.sas’; “)

 

If libname, macro variable, macros defined in one Submit, are they available in the next Submit in the same session or should they be included in each submitted piece of code?

This is all one long running SAS session, so, yes, if you assign a libref or define a macro, then that’s there till that SAS session ends or you deassign it or remove the macro. It’s just a SAS session.

 

If I want to output the XGBoost model from Python to SAS Viya and use SAS Viya pipeline to do model comparison with SAS Viya models. How can I do it?

I’m afraid that’s a bit out of my area of expertise. Are you talking about using CAS in Viya, or is this still with SAS in Viya? There is other software in SAS for handling models and running scoring, including SAS models (DS2 and such) but also Python Models. So you can execute Python models and compare them to SAS models. But that’s an entirely different area than SASPy, as it’s a client that interfaces SAS to your Python program. It isn’t specific to all of that, though it can be part of the equation or the workflow. If it’s about doing things w/ CAS, then SWAT is the Python client that interfaces to CAS. So that can also be used in the same Python workflow with SASPy; one talks to SAS and the other to CAS. Either way, I’m afraid I don’t have a straight answer to that question.

If it’s any help, I googled your question and found an SGF paper, that maybe is relevant? https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2020/4384-2020.pdf

 

Do you need any SAS connect modules to execute on Linux, or does it just run SSH?"

SASPy is a client which connect to SAS, not unlike EG or other clients. It can connect to different SAS deployments, from single stand-alone installs on win or Linux, to Workspace server deployments on any host, or to Compute servers in Viya. This table in the doc identifies what combinations of SAS deployments you can connect to from which type of clients (OS’s) using which SASPy Access Methods: https://sassoftware.github.io/saspy/install.html#choosing-an-access-method

None of this needs anything to do with SAS/Connect. A stand-alone Linux install of SAS (Not a workspace server deployment) can be access using the STDIO Access Method from Python on that same Linux machine. To connect to it from a different client machine, you would need to use STDIO over SSH, as that’s how STDIO can connect remotely.

 

What would you say are the strengths and weaknesses of SASPy? I'm new to SAS/SAS Viya but I came to SAS for SAS functions. How can this help me there?

Well, SASPy enables you to integrate SAS processes, workflows, functionality, into your Python programming workflow. So, if you wanted to use SAS functions from your Python code, you could do that. The premise is that you are writing code in Python, and want to incorporate some SAS functionality into that Python program/workflow. You can use the symput()/symget() methods to pass Python variables to SAS (as macro variables), and then use those macro variables in the functions you want to execute, returning the results back to Python variables. If you’re talking about functions in a data step to process data, you can do that, and move whole tables back and forth between SAS and Python, if that’s your workflow. It’s all about mixed workflow in your Python program, integrating SAS into it.

 

Can you embed Python code directly into SAS and run the Python modules in stream?

Currently, I call the Python executable and frame up the command line to do this.

SASPy is python code that lets you interact w/ SAS from Python. SAS itself doesn’t (until a month ago in Viya 4), have to ability to simply execute Python code; you can’t submit Python code into a SAS session. So, from SAS code itself, there hasn’t been a way to integrate Python into a SAS program/workflow; sort of the reverse of SASPy. But, that has changed with the introduction of Proc Python in Viya 4 (release 2021.1.3). With that proc, you can execute free form Python code and the proc has the ability to interact between the Python session it starts up and the SAS session itself to do things like move variables between SAS and Python (symget()/symput()), and move data between SAS data sets in that session and Pandas dataframes in the python process (sd2df(), df2sd()), and there is a submit() method so in the python code you’re running in that proc, you can submit other SAS code back to the SAS process to execute right there, inline in your python code. You can think of the Proc as the reverse of SASPy, where it allows you to integrate Python into your SAS programs/workflows similarly to how SASPy allows you to integrate SAS into your Python programs/workflows.

 

Does SASPy work same with SAS Viya 4?

I recall this question saying something about SASPy running IN Viya pods ...

No, SASPy isn’t in any Viya pods. SASPy is just a Python module from the client side that you would use; from whatever client you have python installed on. It’s not part of Viya. It connects to the compute server in SAS Viya 4. It’s similar to the work space server in SAS 9. You use Rest APIs to interface. You use HTTP to interface to different services. It connects to the compute server just like the IOM access method connects to a workspace server in SAS 9. The compute server is running a pod in the Viya deployment in the cloud, but SASPy is running wherever you are running Python on the client side.

On a related note, the question of does SASPy work the same regardless of which access method I use, and which kind of SAS deployment I connect to, is YES. That means that if you wrote a python program using SASPy when connected to a local windows install on your laptop (Local IOM connection), and then you wanted to run that same code against a Workspace server (Remote IOM to any system), or a local Linux install (STDIO Local or over SSH Remote), and in the future, use that exact same program when connecting to Viya in the cloud, your code would work without needing any changes to it at all!

You would simply change your configuration in your sascfg_personal.py file to point to the other SAS system, but your code would work and behave the same in any different configuration. Maybe this was the original question; so the answer is YES. 😊

 

Can we use SASPy with the survey procedures?

I don’t know if those are pre-generated methods already or not. They don’t show up for me on a sasstat object, as methods, though I see documentation saying they are part of SAS/Stat. I’m not a proc guy, so I’m not actually familiar with the procs. I don’t know if I just don’t have them in the SAS session I’m connecting to, or if they were just left out of the method, Proc generation, code. Jared Dean wrote the proc generation code and created the existing analytic methods for SASPy. There are instructions for adding new methods, for other procs, here: https://sassoftware.github.io/saspy/adding-procedures.html This can be used to contribute new procs to SASPy. You can also open an issue asking for these to be added, and I can assign it to Jared; he’s the data scientist who did all the proc code generation work.

 

How do you find out what your current configuration is?

Well, after importing SASPy, there are an attribute and a method you can invoke to see what the default config file that will be used is, and what all config files are found in the search path. You can specify a specific config file to override the default, on the SASsession() call itself. The doc on the config file is here: https://sassoftware.github.io/saspy/install.html#sascfg-personal-py including the order of where SASPy looks for these files.

 

Is it possible to have Python installed on the SAS server so that you don't have to download data from the SAS server to your local computer?

Certainly, you can install Python on any machine. Of course, that may be up to your IT dept ..., but sure, any of the access methods work for Local connection, where Python and SAS are on the same machine, as well as for Remote connections when they aren’t.

 

Can we have more SASPy demo sessions like this in the future?

Ok with me 😊 Have to figure out how, what the forum could be. I’ll try to find out.

 

Can we create a GUI tool and pass this code?

Other customers have used SASPy as the ‘under the covers’ interface to SAS which their applications use. They write their own apps, including UI apps that are what their users need, and SASPy is completely out of their end users’ sights. You can write any kind of GUI or other applications, embedding SASPy into it as the interface to SAS.

 

I use SAS on an intranet without outside internet access. Is there a way for me to download SASPy?

Yes, since SASPy is just source code, you can download it from GitHub, on any computer that can access the internet and just copy the files (or the .zip) to another machine. From there you can install it from that local copy of the code. Download from GitHub, copy .zip to local machine, unzip to a directory, cd to that directory and do a pip install from that dir: ‘pip install .’  Dot is current directory.

 

I spent a bit of time trying to get SASPy up and running using Jupyter Notebook. It seemed like everything worked installing and updating the config file, but I tested it by typing sas. and hitting tab with no luck. Is there anyone that can help me out?

Having the cursor just after the dot in sas. And hitting tab usually works in Jupyter. Sometimes I see it take a long time or not work just right. But it usually works. If it never works, I would open an issue on the Jupyter GitHub site and see what they think. I don’t work on Jupyter nor am any kind of expert in it, it’s just nice to use for demos.

 

Is there any issue with using SASPy with SAS Enterprise Guide?

Well, no issue, but I’m not sure of the question really. SASPy and EG are both simple Clients which can connect to SAS servers. SASPy doesn’t ‘connect’ to EG, nor vice versa. SASPy and EG can connect to the same App Servers (Workspace servers), so any predefined libraries or other specific configuration or permissions that are set up on a given workspace (App Server definition) you use from EG, SASPy can connect to the same one, so the same libraries, configuration, permissions are the same from both clients!

 

If I don't have SAS and I only have SASPy, can I convert something like txt fille to sasdat7 dataset?

Nope, SASPy without a SAS session to connect to doesn’t have any real functionality.

 

Is there a cheat sheet for SASPy commands?

Well, not so much a cheat sheet, but rather the API doc itself, listing all of the methods, their signatures, and some explanation of how to use them: https://sassoftware.github.io/saspy/api.html

This part of the doc is autogenerated from the code, as opposed to hand typed in by me like most of the rest of it (don’t know which is better 😊).

 

What is the benefit to use Python since everything is running SAS code over Python?

Well, the point would be that you are using python, that’s the language you’re writing your programs in, and you want to integrate some amount of SAS processing into those Python programs or workflows. It’s not really about trying to get a SAS programmer out of SAS and to make them start using Python instead of a SAS client. So, it’s about integrating and mixing workflows from disparate system, from one language. And, then the mention of Proc Python, is kind of the same thing, but integrating Python code into a SAS program/workflow.

 

Are there any examples of using SQLAlchemy to connect to SAS or would SASPy not benefit from an ORM connection?

I’m not familiar with that. I googled it to see what it is. It provides a Python module that lets you do SQL to databases? I don’t really know if it can connect to SAS. It sounds like a big set of tools to build your own transactional applications with, for doing data base interfaces. I’m not exactly sure how that relates to SASPy, or if you’re looking for SASPy to do things like that itself. I don’t think I have a good answer for your question, sorry.

 

Can we use PYCharm to connect to SASPy?

SASPy is just a Python module, so yes, you can import and run it from any Python implementation you like, from a batch script, to line mode in a terminal window, to a UI like PyCharm or an IDE like VSCode, or any other python thing you can interact with.

 

saspy.SAScfg - can you show an example how you configurate to SAS Viya?

Yes, again, the documentation shows how to configure SASPy for all of the various combinations you might need to use. The specific section for Viya is here: https://sassoftware.github.io/saspy/install.html#http though you should really read the whole config doc to understand how to go about doing this. The HTTP access method is probably the easiest to configure, as you just need the URL, and then you need to know which method Viya is set up to use for authentication; there are multiple possibilities from user/pw, to SingleSignOn, like I tried to show in the demo, to using a JWT, like from Azure to just providing the auth token that you manually got by interacting with SASLogon yourself (the least likely case, but it’s supported).

 

Do we need to buy license to use Python in SAS?

No, SASPy if free, you just need to have SAS somewhere for it to connect to for it to be useful.

 

Is there a PROC PYTHON in SAS?

There is as of a month ago. It’s only in Viya 4 at this time (no idea if it will be shipped anywhere else). As of version 2021.1.3 the Proc is available. There’s some user doc here: https://go.documentation.sas.com/doc/en/pgmsascdc/v_016/proc/n0asd2rsj9aedgn1828aptww56of.htm

It creates a Python subprocess off of the SAS process, and allows you to run any python code you want, and allows integration back with the SAS session by moving variables back and forth, data sets back and forth, and submitting SAS code from w/in the python code and even executing SAS functions in Python on Python variables. It can be used interactively, like in a terminal, so you can execute one line of python at a time and get the results. This even allows prompting from Python back to the SAS session, so you can enter a response after the prompt and continue. It allows the ability to use pdb (the Python line mode debugger) to debug the python code you are running, live right there from w/in the proc. It’s really kind of cool what you can do with it. Kind of like SASPy in reverse, though as it’s integrating Python into SAS code, from w/in SAS, there isn’t a lot needed beyond those capabilities, as you’re writing the other parts in SAS. You can go in and out of the Proc, back into your other SAS code, and the Python Session stays around for the life of the SAS session (you can terminate and start Python at will, if you like), and that lets you mix your workflow from other SAS code, with Python code mixed in as needed by submitting the proc when you need it.

 

Is there any free cas server like SAS on demand we can sign on and use it?

We have SAS On-Demand for Academics. You can test it out there. I believe you can sign up for free trials using Viya, and thus CAS, here: https://developer.sas.com/home.html#sas-trials

 

The notebook seems to be installed locally (localhost in the address bar). Are we using local memory for data loading and calculation even when we connect to SAS?

All of the SASPy methods that operate on SAS data do so in SAS; wherever that SAS server is that you’re connect to. SASPy submits SAS code to the SAS server, so that code runs there. You have the choice to move (copy) data between Python and SAS, so you can do that to get data from SAS into Pandas in Python and to Python work on it, or send data from Python to SAS, creating a SAS data set on the SAS server. Results from running SAS code on SAS against SAS data which is on the SAS server, are returned to Python to display or interact with.

 

I've worked with a tool that runs SAS inside R. It's limited in that it starts each SAS query as a brand new session for each new code chunk. Its graphics are not as well rendered back to the session as they are in these examples. It exists but the tool I saw a couple of years ago anyway, isn't as solid as what you're showing us here.

I’m not even sure what that is. And no, I’ve never looked at trying to create something like this from R. Python is so much more of a general programming language and has such low level OS interfaces like subprocess creation and control, I/O, a real socket interface, other interprocess interfaces and all of the other things needed to be able to build out a system like this. 

 

Can we output the data frame as a SAS dataset to a library?

Yes, of course, that’s what the dataframe2sasdata() (df2sd()) method does. If takes a dataframe and creates a SAS Data Set from it. You tell it what data set to create, and since this is SAS, it’s by definition in a library, so you provide the libref (it defaults to work if you don’t), and the table name to use. So you can create it in any library you choose.

 

Do you recommend running SAS code through Python or running Python scripts through SAS? Which tends to be more computationally efficient?

Well, that’s just a matter of which language you want to write the code in. Either way, SAS executes the SAS code, and Python executes the Python code. So, in the end, whatever actual code you run is done by the system of the code you submit. Between SASPy and Proc python, it’s a matter of if you’re writing Python coed and trying to use SAS from there, or writing SAS code and trying to use Python in there.

 

How would use this in PC-SAS?

Well, I wouldn’t use it IN pc-SAS, but it allows you to connect to your PC-SAS (IOM Local connection from that same PC), from Python, if you want to write Python code and integrate/interact with SAS from that Python code.

 

Can this be used with Office 365?

SASPy Connect to SAS. So, I’m not really sure the question. SASPy doesn’t know anything about Office. If SAS integrates in some way to Office, then you can do whatever SAS stuff does that, from the SAs session you’re connected to from Python. Again, SASPy is a client that connect to SAS and submits SAS code to SAS. I’m not sure if this answered the question.

 

Are there any plans to integrate a Python coder with SAS itself? (I'm thinking of how there's a module in SAS allowing SQL code to be called.)

My best guess is that Proc Python is what you’re looking for here? See a number of the above questions where I’ve provided info on the new Proc Python in Viya 4, that integrates a Python process w/ the SAS session and allows you to run any python code, as well as interact between SAS and that python process by moving data/variables between them (sd2df, and df2sd, symget/put) and run SAS code back in SAS from you Python code and execute SAS functions in Python.

 

How can we call SAS Miner features from Python such as interactive binning, splitting data or variable clustering?

I’m not terribly familiar with these, but I believe some of these are just supported via procs that do that. Some of these may already be methods already Here’s the list in the doc for what’s currently defined: https://sassoftware.github.io/saspy/api.html#machine-learning-sas-enterprise-miner

Any proc can be added, btw: https://sassoftware.github.io/saspy/adding-procedures.html

 

Most of our code is run in an automated environment overnight. What kinds of pitfalls and resolutions might I run into when connecting to SASPy if connectivity issues could be a problem?

I’m not sure how to answer that. You do have connectivity problems? SASPy itself doesn’t have connectivity problems, to speak of. If your SAS environment can accept connections, then I don’t know of any problems. Clearly, you would need to be able to connect without having to provide any input, so if you’re SAS deployment is Workspace servers, you’d need to be able to connect and authenticate w/out having to dynamically provide user/pw or anything like that. SASPY supports that for user/pw authentication via the authinfo file. So connections can be made automatically. If local installs on either Win or Linux, there isn’t authentication, so those both work on their own. I’m not sure what connectivity problems you’re thinking of, so I’m not sure I can be more specific than this.

 

Will we have SASPy containers/pods with SAS Viya 4?

SASPy is not is SAS Viya 4. SASPy is just a Python module from the client side that you would use. It connects to the compute server in SAS Viya 4. It’s similar to the workspace server in SAS 9. You use Rest APIs to interface. It connects to the compute server just like the IOM access method connects to a workspace server in SAS 9. The compute server is running a pod in the Viya deployment in the cloud, but SASPy is running wherever you are running Python on the client side.

 

What are the major advantages of using SASPy over just SAS?

You are writing Python code. If you aren’t using Python, and you just want to write SAS code in a SAS interface, then there’s not an advantage. This is a Python module for Python programmers to use to interface to SAS from their Python code.

 

Can SAS and Python share macro variable contents (between SAS and Python sessions)?

Yes, you can move macro variable to Python via symget() and Python variable to SAS Macro variables via symput(). These are in the API doc: https://sassoftware.github.io/saspy/api.html they are on the SAS session object (just scroll down to them, it’s alphabetical) and there’s also an example notebook showing how to use these here: https://github.com/sassoftware/saspy-examples/blob/main/SAS_contrib/Using_SYMGET_and_SYMPUT.ipynb

 

Here’s the API doc, just to put it here too:

symexist(name: str)

Parameters:

name – [required] name of the macro variable to check for existence

Returns:

Bool

symget(name: strouttype=None)

Parameters:

·         name – [required] name of the macro variable to get

·         outtype – [optional] desired output type of the python variable; valid types are [int, float, str] provide an object of the type [1, 1.0, ‘ ‘] or a string of ‘int’, ‘float’ or ‘str’

symput(name: strvaluequoting='NRBQUOTE')

Parameters:

·         name – name of the macro variable to set

·         value – python variable, that can be resolved to a string, to use for the value to assign to the macro variable

·         quoting – None for ‘asis’ macro definition. Or any of the special SAS quoting function like BQUOTE, NRBQUOTE, QUOTE, NRQUOTE, STR, NRSTR, SUPERQ, ... default is NRBQUOTE

 

 

Is there a way to run Python in SAS? Like the other way around?

That would be Proc Python, which I’ve provided info on in some of the other questions up above. Sorry, but can you look at those responses back in those questions; hate to type it all in again here 😊

 

Can we run all commands together or just one by one?

Do you mean executing methods in one Jupyter cell? Else, it’s just python, you can submit as many lines of code as you want; depends on the interface and what you’re trying to do. If this is about Jupyter and how I have only about one method per cell, then yes, you have to figure out how Jupyter renders output. Often if you have multiple methods per cell that each return output, Jupyter will only render the output from the last one. But sometimes you can get multiple outputs. It’s up to Jupyter and what the methods are. You’ll have to play with that to learn how it behaves. Having one method that produces output per cell, it the easiest, then you can try combining and see what you get.

 

Would SAS please update the version of SAS in SAS on-demand server?

I can’t speak to that. I would suggest contacting SAS ODA. I see a support link here: https://support.sas.com/en/software/ondemand-for-academics-support.html

 

Our code currently exist in SAS Enterprise Guide... do we need to split the individual programs into their owns SAS files?

I’m not really sure what you mean here. I’m not sure what you’d be trying to do. If it helps, you can execute a whole SAS script (.sas file) with SASPy. You can read it in and submit it, or you can submit(“ %include ‘the/file.sas’; “), or other ways too if you want. It’s SAS code, I presume, and you can run SAS code via SASPy a few different ways. In fact, a user just contributed a new script to SASPy which you can use to execute a .sas file, running as a batch Python script: https://sassoftware.github.io/saspy/api.html#saspy-scripts

 

 

Recommended Resources

Support on SASPy

SASPy on GitHub

SASPy Documentation on GitHub

SASPy Examples

The History and Evolution of SASPy

PROC PYTHON Documentation

SAS Programmer Week (Free + Virtual)

 

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.  

 

Version history
Last update:
‎09-13-2021 05:20 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