BookmarkSubscribeRSS Feed
Not applicable
I am not a SAS programmer, user, or administrator and I know very little about SAS in general (not ideal, but that's how it is right now). I am developing a Java application which needs to connect to a SAS stored process server (pooled from the metadata server), execute a stored process and handle the results. Not a web app, just a plain old command line single method java application. Using the STP web app is not an option, the portal and web layer are not installed. I was hoping the SAS site would have a complete example of doing this, but I wasn't able to find one.

I started with "Connecting with Server Attributes Read from a SAS Metadata Server"

Instead of specifying the workspace server's logical name login015Logical, I specified the load balanced stored process server's logical name.

I then narrow the object and get a reference to the stored process server instead of the workspace server:
IStoredProcessServer stpServer = IStoredProcessServerHelper.narrow(obj);

I then create the context for the stored process (, which seems to take the physical locations, not the logical locations

StringHolder arg0 = new StringHolder();
String[] names = {};
String[] values = {};
String sessionId = "";
String repos = "/var/sasrepo";
String process = "";
IStoredProcessContext stpContext= stpServer.CreateContext(repos, process,names, values, sessionId);

Following that I execute it with

Now, this works, the stored process is executed from what I can tell... using stpContext.GetFormattedSasLog returns the expected log results.

What I am unsure of is how to get the resulting dataset from the stored process. Using the Workspace server from the original example I would do a executeWithResults and get a ResultSet back or grab a Connection and select results from work.out. With the IStoredProcessContext object I'm not sure how to go about retreiving results or how/what the stored process coder needs to send the results to within the process.

Compounding this problem is there appears to be no documentation for IStoredProcessServer, IStoredProcessContext and their related classes.

Am I barking up the wrong tree? Is there a simpler way to execute processes on a pooled stored process server using the metadata server to get the connection... is there a complete example? I can imagine people have done this and I am just missing some easier way to do it, but I've gone over all the documentation I can find and am sad to say I'm just not seeing it.
Rhodochrosite | Level 12
Try contacting our Technical Support department. They may have some starter code for you to try:

Vince DelGobbo



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation