Replies: 5 comments 10 replies
-
Yes, of course. You can use it with notebooks, any other UI (vscode, spyder, .....), no UI just line mode in a terminal, or even in python batch scripts. The |
Beta Was this translation helpful? Give feedback.
-
I can't stand our SAS Macro language either! :) So, what you're describing is a perfectly fine use of SASPy. You can use it for whatever you want to do. It's simply a Python interface to SAS, so you can integrate SAS into your Python workflow, just use SAS as a data source pulling data into Python and doing everything in python, use it to easily script SAS code execution in a easy language - Python (what you're suggesting) or write other applications in Python which use saspy under the covers, ... Customers use saspy in a lot of different ways for different reasons. Replacing SAS Macro with Python as your scripting/control language for running SAS code is perfectly reasonable. In fact, one of the uses of proc python (only available in viya), is that same idea, using it in SAS as a scripting language instead of macro; that's what proc lua was originally written for; to use instead of macro. Proc Python supports more full integration of Python into you SAS workflow than what lua does, but even just using it for scripting SAS code execution is what some users will use it for, though a lot is, of course, data science workflows which are a perfect integration point for SAS and Python. So with SASPy and Proc Python, you can integrate one language into the other. Perhaps an easy place to start is to look over (download/run/play with) the main notebook in saspy-examples to become familiar with the functionality it provides. That goes over most of the code functionality saspy has, in an easy to read and see notebook. And, also of course, the doc! The API will help too! |
Beta Was this translation helpful? Give feedback.
-
Does this override my default shell (csh)? I suspect my .cshrc is not getting executed I see this works in my sas bacthes+interactive sessions: But this does not: 27 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods |
Beta Was this translation helpful? Give feedback.
-
I tried to reply to the first question, but it seems to be removed such that I couldn't send this reply. But it has info about what you were asking, so I'll just post it here. There's an example notebook here that walks you though all of the general functionality of SASPy. It's a notebook cuz those are useful for examples like this. At cell 63 it shows how to run saspy in a batch python script. Maybe that's something you're looking for? The 'batch' setting changes methods that otherwise would render output (which is expected when running interactively), to return that output instead. In this way you can choose what to do with it yourself; render it, write it to a file so you can open it in another application that can view it (HTML for example). I'm not completely sure what scenario you're trying to accomplish. 'interactive' and 'notebook' aren't exactly the same thing. I run interactively in line mode (in a terminal not in a notebook). You mention results, and yes, you can set the 'results' for tabular output to be either 'pandas' (the default), 'html' or 'text'. This controls how tabular results are returned to SASPy from SAS (table or datasets). The log output will be text, unless you use the colorLOG config setting in which case that becomes html. When using the submit*() methods, the results setting can affect the Listing (LST). If results is 'text' then the LST will be text. Again, I use this setting when running in a terminal session since HTML won't be rendered in line mode. Otherwise the LST will be returned as HTML (ODS output) from the submit methods. Output from analytic methods often contains multiple outputs, some tabluar and others as plots/graphs/charts (these are ODS output which are HTML by default). These plots/graphs ... can't be returned as text, so those will always be the ODS output, which again, is HTML by default. But other results from them that aren't plots/graphs abide by the 'results' setting. |
Beta Was this translation helpful? Give feedback.
-
In practice my confusion is that I did not know there was a pandas output option. Thanks incidentally... would pandas also apply to line 64 of this? https://github.com/sassoftware/saspy/blob/main/saspy/sascfg.py |
Beta Was this translation helpful? Give feedback.
-
Hi
Can saspy be used without using notebooks? I seem to get html responses on my calls.
Thanks
Stefano
Beta Was this translation helpful? Give feedback.
All reactions