SAS Example - Describing WinExec() in SASCBTBL

SAS requires a description of a dll method in order to use it.

SAS users can run Windows programs using a variety of commands and statements, including X, system(), and Fileref pipes. All these techniques will, on occasion, flash a DOS box window open and close as the command starts and finishes. This flashing is an annoyance.

SAS users can also invoke .dll methods. The following SAS code defines a SASCBTBL interface to the Windows API routine WinExec(). WinExec() runs a Windows program and does not flash a DOS box.

The SAS moduleN() routine can be used in a Data Step or SCL to call the WinExec() routine to run the ppbS program. Example

filename sascbtbl catalog 'work.sascbtbl.winexec.source';

data _null_;
file sascbtbl;
input;
put _infile_;
cards4;
routine WinExec
minarg=2
maxarg=2
stackpop=called
module=KERNEL32
returns=SHORT;
arg 1 char format=$cstr200.;   * lpCmdLine;
arg 2 num  format=pib2.;       * nShowCmd;
;;;;

You can learn more about SAS at http://www.sas.com.

SAS® software is a registered trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. SAS Institute Inc. is located at SAS Campus Drive, Cary, North Carolina 27513.