SAS Companion for the Microsoft Windows Environment |
You
can access routines that reside in external dynamic link
libraries (DLLs) by using the SAS MODULE family of functions within a DATA
step or SCL. This lets you access DLLs that you create or purchase; you can
even access operating system DLLs.
To access an external DLL, you must know:
- the name of the
DLL
- the function name or ordinal
- a description of the function's arguments
- a
description of the return code.
- CAUTION:
- Only experienced programmers should access external DLLs.
When you access an
external DLL, you are
passing control of your computer from the SAS System to the DLL function.
If done improperly, or if the DLL function is unreliable, you might lose
data or have to reset your computer (or both).
The general steps for accessing an external DLL routine
are:
- Create a text file that describes the DLL routine
you want to access, including the arguments it expects and the values it returns
(if any). This attribute file must be in a special format.
- Use the FILENAME statement to assign the SASCBTBL
fileref to the attribute file you created.
- In a DATA step or SCL code, use MODULE, MODULEN,
or MODULEC to invoke the DLL routine. The specific function you use depends
on the type of expected return value (none, numeric, or character). (You can
also use MODULEI, MODULEIN, or MODULEIC within a PROC IML step.)
Note: The MODULE routines can be a flexible and powerful
tool, especially when used with the SASCBTL file, SAS formats and informats,
and other SAS routines. As such, you should be extremely careful when invoking
external routines; if done improperly, you might lose data or have to reset
your computer.
For complete information about accessing DLLs from within
SAS, see Accessing External DLLs from the SAS System.
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.