BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
sarafrass
Fluorite | Level 6

Good morning everyone,

 

I'm trying to write a python code for adding a correlation matrix in my SAS analysis.

I wrote it in Jupyter notebook but I'm having issues in connecting it to my SAS.

The code I tried is:

 

import sys
import os
import swat
#Connect to CAS
s = swat.CAS(os.environ['CASUSER'], os.environ['CASPORT'], None, os.environ.get("SAS_VIYA_TOKEN"))
s

 The error I get is:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-23-06a09f769b64> in <module>
      1 #Connect to CAS
----> 2 s = swat.CAS(os.environ['CASUSER'], os.environ['CASPORT'], None, os.environ.get("SAS_VIYA_TOKEN"))
      3 s

~/opt/anaconda3/lib/python3.8/os.py in __getitem__(self, key)
    673         except KeyError:
    674             # raise KeyError with the original key value
--> 675             raise KeyError(key) from None
    676         return self.decodevalue(value)
    677 

KeyError: 'CASUSER'

 

Thank you so much! 

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
BrunoMueller
SAS Super FREQ

Please have a look at this blog post here https://blogs.sas.com/content/sgf/2020/04/15/getting-started-with-python-integration-to-sas-viya-par... it walks through how to connect to the CAS in SAS Viya for Learners.

SASRobot
Calcite | Level 5

Hi Bruno, thank you!

Would you know how to connect to SASPy from SAS Viya For Learners
I can't find that information anywhere,

Thanks for your orientation,

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

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.

Discussion stats
  • 2 replies
  • 1016 views
  • 1 like
  • 3 in conversation