BookmarkSubscribeRSS Feed
marmont
Calcite | Level 5

Hello All!  We have an existing SAS solution that is based on SAS 9.3 (could be SAS 9.4).  We've created a client-server application where the client is a .NET application and SAS acts as the processing server.  We use SAS Integration Technologies (IOM) to have C# talk to SAS.

 

In order to submit code, we simply use the language service to invoke existing SAS Macros.  This has proven to be quite efficient and this is a technique we have used with success for several applications since 2009.

 

With the introduction of SAS Viya, we're trying to see if we could migrate to this new platform.  As such, we have began to explore the REST API of Viya.  We were expecting differences but I have to be honest that I never thought that it would be so much different.

 

My question is basically a 3 part question:

 

1. How can we use the SAS Viya REST API to invoke SAS Macro Code?  I realize that Viya is not suited to submit SAS Macro code but in order to salvage as much code as possible, we would like to invoke our macro on the workspace server on Viya to then adapt the data steps and some of the procs to leverage the CAS processing.

 

2. How can we retrieve data from SAS Viya REST API?  We want to get data from existing SAS datasets to show some of this content to our users on our GUI.  Right now, we using the OLE connection that we can derive from the IOM Workspace server.

3. Is it possible to have progress report on long processes from the SAS Viya REST API.  Right now, we use features from SAS itself where a command line called SYSECHO triggers an event into the IOM client.  We can even send SYSECHO command from within the DATA STEP using DOSUBL.  I realize that we may not be able to have all of this from the new API but anything we could suggest could help.

 

One other question : we know SAS Viya can be accessed through SAS Enterprise Guide.  When this is done, it the connection to SAS Viya done through the IOM client or has a completely new channel been added to SASEG where SASEG now invokes the REST API.  I'm asking because if we have a case where going through SAS EG means going through IOM to talk to Viya, then this might be the simplest solution for us.

 

Thanks!

3 REPLIES 3
ChrisHemedinger
Community Manager

Hi @marmont,

 

SAS Viya REST APIs are quite different from the IOM APIs.  My colleague @joeFurbee recently published an example of using the REST APIs to fetch a SAS Visual Analytics report image.    Your use case is much different, but the mechanics are similar.

 

You might also be interested in examining the restAF project.  Here's a SAS Global Forum paper that leads you through it.  It's a Node.js application, so quite different from .NET, but the mechanics for a .NET implementation would be very similar.


Chris

SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.
Kelin
SAS Employee

Hi,

 

answer one of your questions: 'We want to get data from existing SAS datasets to show some of this content to our users on our GUI.'  

 

This what I will do to dispatch SAS content to GUI - I will create a SAS JOB on Viya, the JOB will get data from a data source(csv,postgres and etc) then to CAS, then SAS JOB will calculate it and return JSON object for UI to use. here is the sample code for you to read.

 

// load data to CAS

// then when your data in CAS, here is the todo

proc sql;
create table work.subset
as select *
from sashelp.cars(where=(lowcase(origin) eq lowcase ("&ORIGIN")))
order by cylinders;
quit;

* Create the output data in a SAS table;

***TO DO: Save the table in a permanent library if desired;
***TO DO: Use PROC CASUTIL to load the SAS table into CAS;

ods output Summary=work.summary;

proc summary data=work.subset print stackods n mean stderr median q1 q3 min max;
class cylinders;
var msrp;
run; quit;

* Use PROC JSON to return JSON to the 3rd-party client;

proc json out=_webout nosastags pretty;

export work.summary;

run;
quit;

 

Note: SAS JOB takes in-memory data from CAS, then return a JSON object to the 3rd-party client. in your GUI, you can just take the JSON object and write out the content.

 

please feel free to ask if any question.

 

Kelin

RexDeus9
Quartz | Level 8

Hi Marmont,

 

If you can connect to Viya with SAS EG, you certainly can do the same with your .Net code. I think you just need scratch that part a little more. .Net examples with Viya will bloom shortly.

 

 

Thank you,

 

 

Yvan

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!
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.

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
  • 3 replies
  • 3127 views
  • 2 likes
  • 4 in conversation