BookmarkSubscribeRSS Feed
Sajid01
Meteorite | Level 14

Hello

It is possible to run an external C function from SAS (https://support.sas.com/kb/40/562.html)

I have a similar scenario in which I invoke a java jar file from SAS using x commands.

I was wondering if it is possible to use a jar as shown below :

/* From https://support.sas.com/kb/40/562.html for a C language dll)
proc proto stdcall package=work.proto_ds.cfcns;
  link 'c:\temp\myfactorial.dll';
  int myfactorial(int n) ;
run;
/* What I am looking to do is something like this */
proc proto stdcall package=work.proto_ds.cfcns;
  link 'c:\temp\myfactorial.jar';
  int myfactorial(int n) ;
run;

Wondering if somebody has attempted something like this.

 

3 REPLIES 3
SASKiwi
PROC Star

Only C and C++ are mentioned in the SAS documentation for PROTO and this functionally appears to go back at least to SAS 9.2 and doesn't look like it has changed much since then. I'm wondering if its a side-benefit from SAS being written in C. I doubt that PROTO goes beyond what the documentation says. Maybe there are alternative ways of adding Java functions.

andreas_lds
Jade | Level 19

You can't use proc proto, but you can use java objects in a data step, have a look at https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.4/lecompobjref/n186ts6janpgypn1k6dldyuh3xqs.htm for details.

Sajid01
Meteorite | Level 14

Thanks @andreas_lds for the response.
My intention was to enhance the capability of the SAS program using custom functions.
Unfortunately using the java object does not serve the purpose.
Looks like C/C++ is my only option.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1018 views
  • 0 likes
  • 3 in conversation