BookmarkSubscribeRSS Feed

Me and SASPy (SASPy working with HP-UX sever vs. Windows Client)

Started ‎06-26-2017 by
Modified ‎07-19-2017 by
Views 2,762

This article is to address how to setup SASPy on Windows client to connect to SAS servers installed on UNIX. And, my goal is to utilize the new interface SASPy to facilitate SAS environment adminitration remotely via python. 

 

Before we start, I would like to say that it is a good move to have a interface with python, which is like opening a door to another world. And, it reminds me a picture I saw "Windows Loves Linux", so I draw a similar one just for fun 🙂

 sas_loves_python.PNG

 

In the comming paragraphs, I will introduce the story between me and SASPy (how to setup): 

  • Install SASPy and dependencies
  • Configure SASPy on Windows client
  • Examples
  • My wish (compatible to python 2.7)

Before installation, you may find a lot of useful information about SASpy from here

To install SASpy, I installed python 3.6.1 first, and then run the following commands under the command line of my Windows PC, 

 

# pip install pygments
# pip install saspy
# pip install pandas

To install Python, please refer to link

Next, I need to install SAS Integration Technologies Client, which is used to connect to SAS servers via IOM. You can find it over here, in case of need.  

Jupyter Notebook has also been installed to show the examples, you can find the howtos at here

 

After installation, it is time to configure SASpy to connect to SAS servers, which is the key point of this article. 

How to locate SASpy configuration file sascfg.py: 

 

>> import saspy
>> saspy.SAScfg

About how to update it, you need to define a configure name first: 

 

 

SAS_config_names = ['winiomhpux']

Then, build out a local classpath variable to use below for Windows clients: 

cpW = "C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94140__prt__xx__sp0__1\\deploywiz\\sas.svc.connection.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94140__prt__xx__sp0__1\\deploywiz\\log4j.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94140__prt__xx__sp0__1\\deploywiz\\sas.security.sspi.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94140__prt__xx__sp0__1\\deploywiz\\sas.core.jar"
cpW += ";C:\\Python36-32\\Lib\\site-packages\\saspy\\java\\saspyiom.jar"

In fact, the jar files can be found under the installation of SAS Integration Technologies Client. 

 

 

And, the following configuration definitions are for connecting over IOM: 

 

winiomhpux  = {'java'   : 'C:\\Program Files\\SASHome\\SASPrivateJavaRuntimeEnvironment\\9.4\\jre\\bin\\java',
            'iomhost'   : '<server name>',
            'iomport'   : <port # of workspace server>,
            'encoding'  : '<SAS session encoding>',
            'classpath' : cpW,
	    'omruser'   : '<username>',
	    'omrpw'     : '<password>'
            }

Please note that the user name have to have the relevant permissions to run the examples, e.g. SAS Metadata Server. 

So far, you have finished all the configuration. 

 

Now, it's the show time!

 

Here are some examples to demostrate how it works with python code. 

To access sashelp at SAS servers: Access to sashelp

 

To list active users on SAS servers: 

List active users

Both the 2 examples are running on Windows client. And, you can also put the code input into a file to run it in batch mode. 

It is pretty exciting, right?

 

Finally, it is one of my wish -- I hope SASpy can support python 2.7 for SAS 9.4.

Because my SAS server is SAS 9.4M2, so only python 3+ is supported. And, I can only install python 2.7 on HP-UX somehow. 

Generally, I like this function very much. Thanks to the innovation of SAS, it makes that is possible for me to port my python code to work with SAS. 

 

That is it. Hope the story between me and SASpy can give you some inspiration somehow. 

 

Comments

-- Edward,

Thank you for your write up on SASPy and and SAS 9.4+. I saw your wish to have the package supported on python 2.7. I think you can accomplish what you're after (to have a Jupyter notebook server running from your HPUX server) if you install Python3. It looks like ActiveState has a port here. You might also check Anaconda but I didn't see a port for HPUX explicitly listed.

 

Python 2.7 support is something we're evaluating but many of the extensions for Juypter are only supported on Python 3 and so I think moving to Python 3 is the better long term move.

 

Your example is great. For those looking for more background the documentation for the package is here: https://sassoftware.github.io/saspy/

 

Hi Jared, 

 

Thanks for your suggestion and the link about python 3. 

 

BTW, may I ask if SASpy has any functions or interface to handle daily operation tasks?  

Thanks in advance. 

 

 

BR./Edward

Edward,

Can you give an example of what you mean by "daily operation tasks"? 

 

Thanks,

Jared

Jared,

 

They can be some interfaces/functions like what "proc iomoperate" does, e.g. user administration / monitoring / auditing / performance. Maybe, it is ice on the cake. 😉

 

 

BR./Edward

Edward,

I don't think we have any of those at the momemnt but if you enter an issue on the GitHub repo (https://github.com/sassoftware/saspy/issues) for what you're looking for one of hte maintainers or community members can help you get it created.

 

Best,

Jared

@EdwardJinThanks for your detailed post. So, If I don't understand wrong, with this configuration you use python (installed locally on Windows machine) to connect with SAS server on HP-UX, that's correct? We have SAS 9.4 installed on a HP-UX 11.31 Itanium and we'd like to integrate with Python but we had a lot a difficult to find the Python Machine Learning packages for HP-UX. 

@MariaD,

SASPy has matured since my last update on this thread. You can configure it to communicate from your PC or a seperate unix server thorough IOM to HP-UX. 

This allows python programmers to use SAS analytics for their computing. It also simplifies collaboration between SAS programmers and Python programers for analytical tasks.

Here are some links: 

IOM configuration doc for SASPy: https://sassoftware.github.io/saspy/install.html#remote

SAS Global Forum 2019 Papers with mention of SASPy: https://support.sas.com/en/search.html.html?q=saspy&fq=siteArea%3A%22Papers%20%26%20Proceedings%22&f...

 

 

 

@Jared Thanks!

 

Version history
Last update:
‎07-19-2017 01:11 AM
Updated by:
Contributors

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags