BookmarkSubscribeRSS Feed
thistleandtweed
Fluorite | Level 6

Hi Experts, 

 

I currently have a Python ML classification model that can run as a REST API. The idea was to take the labelled output dataset from the ML model and then send it to SAS Visual Analytics for visualization and further data exploration for the next phase of the project.

 

However, most of the information online about how to do something similar to this is quite outdated (Python 3.6 ish) and I'm quite lost on how I could enact something similar to the above? Could anyone provide guidance on how I can submit the data to SAS Visual Analytics or share any relevant links or documentation that could assist me in accomplishing this task?

 

Thank you

 

 

 

 

2 REPLIES 2
HarrySnart
SAS Employee

Hi @thistleandtweed 

 

To get the data into SAS VA you'll need to load data into a CAS table (in-memory dataset).

 

You can do this in several different ways by API, though if you are working in Python then you may want to use the SAS SWAT package. The project can be found here: https://github.com/sassoftware/python-swat

 

To get data refreshed in VA you'll need to create a CAS table and add it to the VA report, from there you can append new rows to the table via your Python API call. 

 

For example, here is something I've done in the past to append rows in real time to create a real-time dashboard in VA

 

import swat
import pandas as pd

# create connection to SAS Viya using swat
conn= swat.CAS(host, 443, user, pwd)

# load dataframe to CAS as temp table
conn.upload_frame(df_out,casout={'name':'temp','replace':True})

 # append to streaming dataset [note - there may be better ways to do this]
conn.dataStep.runCode(code = ''' data casuser.stream_output(append=yes);set casuser.temp;run;''')
 

There are, of course, many different ways you might do this programmatically and via the various APIs available in SAS Viya. The best option will depend on volume of data, whether you're working on batch/stream, whether there needs to be any user interaction from the front end etc. 

 

Thanks

Harry

thistleandtweed
Fluorite | Level 6

hi harry, 

 

thank you for the comprehensive reply. however, i am still facing the same issue as before where I am getting an unable to connect to <cas-host> at <port-number>. i tried contacting the person in charge of my account, but they are not able to help much. is there any other way I can import the csv file into SAS VA programmatically without having to use swat? i tried sasctl but i believe that is more meant for model manager

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 591 views
  • 0 likes
  • 2 in conversation