BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gfish
Fluorite | Level 6

Hi,

 

I am trying to call a compiled c program using SAS. The c script was compiled using VS. Does anyone know how to do that? so that I can execute the c syntax in a do loop. 

 

Many thanks!!

 

C.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

This compiled program, is it compiled to an EXE?  If so then you call that via your OS using X command or %sysfunc().  If its compiled to something else, a DLL or something then it will be different.

 

 

View solution in original post

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

This compiled program, is it compiled to an EXE?  If so then you call that via your OS using X command or %sysfunc().  If its compiled to something else, a DLL or something then it will be different.

 

 

Gfish
Fluorite | Level 6

It's compiled as an EXE and called by SAS for execution. 

 

I realized that there are other options for compiling the script file such as DLL, and the DLL can be used by SAS with combination to Proc FTP.

 

Lots of options...for a newbie to C and VS. 

 

Thanks everyone!

Kurt_Bremser
Super User

If it is something you can call from the commandline, you can use it as argument in a system() function call or in the call system() subroutine in a data step.

Caveat: you cannot run an executable on your desktop from SAS code that runs on a remote workspace server (SAS Studio or Enterprise Guide with a remote SAS server).

Peter_C
Rhodochrosite | Level 12
I regret the passing of my access to SAS on z/os.
Running pre-compiled programs worked so neatly.

PROC FTP ;
RUN ;
Replacing FTP with the relevant program name.

Ok that program had to be able to be found in one of the paths that the op.sys would search.
Given that, input and output files also needed to be pre-assigned with FILENAME statements.
Integration with SAS was so good you would imagine this program was a part of SAS - system messages appearing in the SASlog along with a NOTE: like
NOTE: Procedure FTP completed.

The system option NOPROC was supposed to disable this simple flexibility but somehow it was never switched on .

different days

Kurt_Bremser
Super User

To catch the output from external commands to the SAS log, use filename pipe:

 

filename oscmd pipe "command 2>&1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 1073 views
  • 5 likes
  • 5 in conversation