BookmarkSubscribeRSS Feed
ChrisHemedinger
Community Manager

I'm cross-posting this announcement from @FriedEgg who shared it on SAS-L.  I love the SAS-L list, but I don't want them to get all of the scoop on this exciting news for Python coders who use SAS (or is it SAS programmers who use Python?).  Quoting FriedEgg here:

Just wanted to share a very exciting release from SAS on Github that happened just recently.  This is a fantastic expansion of functionality and a huge step forward for those interested in Open Source Integration with SAS.  I, personally, am most happy to see all of the expanded connection options.

 

the Real saspy

This release changes almost everything about saspy. In version 1 saspy only had a submit method to enable the sas_kernel. It now has much much more.

Here are the highlights:

  • Transfer of SAS datasets and Pandas dataframes
  • SAS Data object which provides methods for working with data in SAS. Here is a few of the methods (see the doc for the complete list)
    • Graphics (histogram, barchart, heatmap)
    • Partitioning data
    • Scoring data
    • Assessing models
    • Filtering (where, keep, drop)
  • SAS Result object to store and display ODS results from modeling and data analysis
  • Support for connections to SAS Grid Manager, PC SAS, and any other SAS IOM interface (even the mainframe)
  • Analytical modeling methods
    • Statistics
    • Machine Learning
    • Econometric Time Series (ETS)
    • Quality Control
  • Documentation using Sphinx: https://sassoftware.github.io/saspy/index.htm

 

We'll have more documentation and articles coming on this, including plenty of content featured from SAS Global Forum in just a couple of weeks.  In the meantime -- go check out the SAS Software GitHub and play with SASPy!  It works with SAS 9.4 on Windows, Unix, and even the mainframe.  

 

(Kudos to the developers from SAS: @Jared and Tom Weber.  You'll see their fingerprints all over the GitHub commits.)

 

Chris

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
2 REPLIES 2
ChrisHemedinger
Community Manager

If you want to learn more about SASPy, I've summarized the news in this blog post.  The blog also contains a video explanation and demo from @Jared, one of the SASPy developers.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
mich1
Obsidian | Level 7

Robot wink

These comments are for other SAS Programmers who want to run saspy in Anaconda3 in Windows 10 using a local BASE SAS installation...

 

Download Anaconda and install using the recommended option

Note...Your computer may have mutiple versions of Python installed and configured various ways.The Anaconda distribution takes care of most of the setup problems by installing all this within an App

Verify the following:
(base) C:\Users\YOURWINDOWSNAME>python --version
Python 3.6.3 :: Anaconda custom (64-bit)

From the Anaconda DOS prompt (It's an app in your Anaconda3 folder): (base) C:\> pip install saspy
That'll install the saspy package. If you want the SAS kernel too, type pip install sas_kernel. Then you will be able to use the SAS kernel in Jupyter (i.e. write SAS code from a Jupyter notebook - cool eh?)

 

Now that the saspy package is installed, you have to add the directory that contains the file sspiauth.dll to our Path variable. This file is located at ~\SASHome\SASFoundation\9.4\core\sasext

Update your Path in Windows 10...You need to have Admin rights
In Windows 10 > From the Power User Task Menu > click System > Advanced Settings > Environment Variables > Edit a variable labelled "Path". There are already several folders in a list displayed - Add ~\SASHome\SASFoundation\9.4\core\sasext to the list.

As a check, if you open the cmd line in DOS and type c:\>path you will see something like:

PATH=C:\Oracle\product\11.2.0\client_X64\bin;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;F:\SAS\SASHome\SASFoundation\9.4\ets\sasexe;F:\SAS\SASHome\Secure\ccme4;F:\SAS\SASHome\SASFoundation\9.4\core\sasext;C:\Users\YOURWINDOWSNAME\AppData\Local\Microsoft\WindowsApps;

Or, Open Base SAS and run the following to find the PATH – The results will be the same
data _null_;
x=sysget('PATH');
put x;
run;

Now you use IDLE to edit saspy.cfg - It's in C:\Users\YOURWINDOWSNAME\AppData\Local\Continuum\Anaconda3 (somewhere...).
You will need to go to ~\SAS\SASHome\SASDeploymentManager\9.4\products\~ and make updates according to the versions you see. Note that '\\' means '\' when you are setting paths in your Python editor

The saspy.cfg file looks like
…scroll down to the config names below and make some changes

SAS_config_names=['winlocal','winiomwin','winiomIWA']

…scroll down to the path files below

# build out a local classpath variable to use below for Windows clients
cpW = "F:\\SAS\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__NUMBER__prt__xx__sp0__1\\deploywiz\\sas.svc.connection.jar"
cpW += ";F:\\SAS\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__NUMBER__prt__xx__sp0__1\\deploywiz\\log4j.jar"
cpW += ";F:\\SAS\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__NUMBER__prt__xx__sp0__1\\deploywiz\\sas.security.sspi.jar"
cpW += ";F:\\SAS\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__NUMBER__prt__xx__sp0__1\\deploywiz\\sas.core.jar"
cpW += ";C:\\ProgramData\\Anaconda3\\Lib\\site-packages\\saspy\\java\\saspyiom.jar"

…cpW is aliased as winlocal (see below)

winlocal = {'java' : 'java',
'encoding' : 'windows-1252',
'classpath' : cpW
}

The following Python code will start a session: sas = saspy.SASsession(cfgname='winlocal')

You can test your installation using
import saspy
import saspy.sascfg
sas = saspy.SASsession(cfgname='winlocal')
cars = sas.sasdata("CARS","SASHELP")
cars.describe()

and you should see a SASHELP data set about cars.

 

 - Bread Crumbs and Circuses for all

Bread Crumbs and Circuses for All

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 4193 views
  • 11 likes
  • 2 in conversation