Java application passing objects to SAS

Reply
New Contributor
Posts: 2

Java application passing objects to SAS

I am a Java developer streaming data through a Java application and need to pass the data objects to a SAS module. Because we have a streaming architecture, we would like to avoid writing out any files. Is it possible to pass an object in Java directly to a DATASTEP in SAS? This will be live streaming data that does not exist in any database. The SAS module that I need to pass my data to is provided by the federal government in support of a national program affecting payments to healthcare providers. So, I cannot port the code from SAS to another programming language. This module was written to process data in batch, but we are moving away from a batch model to a streaming model. 

 

Everything I am reading about SAS javaobj seems to indicate that it only works in the opposite direction-- instantiating a javaobj and then executing in Java. 

 

Are there any Java developers out there who have experience with a similar project? 

 

Thanks so much!

Super User
Posts: 1,102

Re: Java application passing objects to SAS

[ Edited ]

Hello @Cassidamius,

 

you left me a private message with a similar question. I will leave here my answer to you, in case that it might help others with similar questions, or the Java-bright minds ( as @boemskats) here would want to add information.

 

 

With java you can pass objects only to classes who have the interface for the class of that object. if this interface is not created, they cannot communicate, as you might well know. So SAS documents its API so you can use their objects.

 

So if this interface is not created in the java code within SAS, you cannot bring in an object that, for SAS will be undetermined, unless SAS does revert engeneering, which no program does at this moment, as far as I know.

 

But if you want to send a message to SAS, I am sure the APi will give you the framework where you can send the required message.

 

 

You can review the documentation at http://support.sas.com/documentation/cdl/en/itechjcdg/61499/PDF/default/itechjcdg.pdf http://support.sas.com/documentation/cdl/en/omaref/59983/HTML/default/viewer.htm#jomaconcepts.htm

 

Anyway, to answer your question, instead of looking the information within Java, probably you should look for it within the SAS statements (datalines and cards options in the infile statement)::

 

https://v8doc.sas.com/sashtml/lgref/z0188182.htm

http://www2.sas.com/proceedings/sugi29/253-29.pdf

http://support.sas.com/documentation/cdl/en/basess/68381/HTML/default/viewer.htm#p1a4qnhappx8wqn1xf6...

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000146292.htm

http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a002645725.htm

Frequent Contributor
Posts: 91

Re: Java application passing objects to SAS

Hi @Cassidamius

 

To take a step back, what SAS component are you looking to use? Is it some SAS Foundation based programs that previously worked in batch, or is it one of the newer solutions that uses something like ESP?

 

There are ways of designing a solution such as the one you're talking about, and while there are a few hacky ways that allow SAS foundation to process streaming data (named pipes etc), it's not really the ideal solution. Some level of caching will always need to be done somewhere. The ultimate design will be highly dependent on the component that's been passed on to you, so if you're able to share more detail on it, we'll be able to give you a more detailed answer.

 

 

Nik

Regular Contributor
Posts: 235

Re: Java application passing objects to SAS


Cassidamius wrote:

... The SAS module that I need to pass my data to is provided by the federal government ...


 

Can you explain what this "sas module" is? A stored process, a web service?

New Contributor
Posts: 2

Re: Java application passing objects to SAS

By "sas module", I was referring to a software program provided by a federal government agency written in SAS. It is a very simple program that, I believe, only requires Base SAS to run. We've been running various versions of this module for a number of years on SAS in a Linux server. Now, our goal is to stream our inputs to the service, rather than provide batched inputs.
Valued Guide
Posts: 2,174

Re: Java application passing objects to SAS

Have a look at at the google search result:

Using DATA Step Component Objects: Using the Java Object - SAS Support
support.sas.com › lrcon › HTML › default
Using the Java Object. The Java object provides a mechanism that is similar to the Java Native Interface (JNI) for instantiating Java classes and accessing fields and methods on the resultant objects. You can create hybrid applications that contain both Java and DATA step code.

To this url:
http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a003252712.htm


It is for SAS9.2 so expect improvements to be available
Valued Guide
Posts: 2,174

Re: Java application passing objects to SAS

I believed that is intended to be solved by
DATA Step Component Objects: Using the Java Object
Ask a Question
Discussion stats
  • 6 replies
  • 122 views
  • 4 likes
  • 5 in conversation