Help using Base SAS procedures

Application of PROC GROOVY

Reply
Super Contributor
Posts: 326

Application of PROC GROOVY

Hi,

I'm just curious with proc groovy. Any thought on any practical applications of this procedure?

Thanks!

Milton

SAS Super FREQ
Posts: 8,864

Application of PROC GROOVY

Hi:

  As cool as the name is, it seems to me that you need to be using Java to get the most use out of PROC GROOVY:

http://support.sas.com/documentation/cdl/en/proc/63079/HTML/default/viewer.htm#p1x8agymll9gten1oczii...

where it says:

"Groovy is a dynamic language that runs on the Java Virtual Machine (JVM). PROC GROOVY enables SAS code to execute Groovy code on the JVM.

          

PROC GROOVY can run Groovy statements that are written as part of your SAS code, and it can run statements that are in files that you specify with PROC GROOVY commands. It can parse Groovy statements into Groovy Class objects, and run these objects or make them available to other PROC GROOVY statements or Java DATA Step Objects. You can also use PROC GROOVY to update your CLASSPATH environment variable with additional CLASSPATH strings or filerefs to jar files."

cynthia

Super Contributor
Posts: 326

Application of PROC GROOVY

Posted in reply to Cynthia_sas

Hi Cynthia,

Can it also be used to read sas datasets and store it in an object like the when using javaobj in a data step? Looking at the examples in the documentation on PROC GROOVY, I just can see on how it will be used by sas programmers. Maybe a little more advanced example could satisfy my curiousity on this.

Hope we can get some of the members of this community post their thoughts on how will it be used practically. Smiley Happy

Milton

Frequent Contributor
Posts: 102

Re: Application of PROC GROOVY

See FriedEgg's example in https://communities.sas.com/message/144937#144937 .

I'm thinking about submitting a SASGloF paper on ZIPping files with PROC GROOVY.  Getting a list of files in a ZIP file might be more practical - ZIPing files is already in base SAS as of 9.2, but reading ZIP files won't be there until 9.4 or later.

Trusted Advisor
Posts: 1,301

Re: Application of PROC GROOVY

I have submitted a paper to this coming SGF (2013 - San Fran) which heavily involves using PROC GROOVY for a number of things.  The acceptance is still pending, but the working title is "SAS/ACCESS for iPhone" and will demonstrate how to access data through only base SAS using a number of advanced techniques.  I use PROC GROOVY to perform data hashing and access JDBC data sources and bring the data into SAS, among other things.

There is plenty that can be done with PROC GROOVY and it's addition is nice for programmers, it adds very little that did not already exist however through usage of the java object previously...

To have Java (or Groovy....) read and write directly to/from SAS datasets requires the SAS JDBC drivers and either SAS/SHARE or SAS Integration Technologies.  You can also write classes and methods to help exchange data through SAS using component object without the additional licenses.

Frequent Contributor
Posts: 102

Re: Application of PROC GROOVY

I'm thinking of submitting a paper (I still have two days) on proc groovy for dummies - nowhere near the complexity of what you're talking about (basically, some simple uses of proc groovy that don't require any knowledge of groovy or java).  Your paper sounds very interesting (especially if it talks about error handling).  What section did you submit it to?

I tried some Ant examples I found on the web, and they didn't work because groovy couldn't find AntBuilder.  Do you know if it is not included in SAS, or if it's just a result of me not knowing what I'm doing?

Trusted Advisor
Posts: 1,301

Re: Application of PROC GROOVY

Posted in reply to JackHamilton

It should be part of your standard Java install, but it is probably not included in your environment by default.

proc groovy;

ADD SASJAR="ANT";

submit;

  def ant = new AntBuilder()

  ant.echo("Test")

endsubmit;

run;

Frequent Contributor
Posts: 102

Re: Application of PROC GROOVY

As I suspected, I don't know what I'm doing.  Your ADD statement worked.  Thanks.

Ask a Question
Discussion stats
  • 7 replies
  • 2164 views
  • 0 likes
  • 4 in conversation