- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;