SAS Companion for the OS/2 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 environment DLLs.
To access an external DLL, you must have
- 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.
The MODULE routines
can be a flexible and
powerful tool, especially when they are used with the SASCBTL file, SAS formats
and informats, and other SAS routines. When you access an external DLL, you
are passing control of your computer from the SAS System to the DLL function.
If this is 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
that you want to access, including the arguments that 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 that you created.
- In a DATA step or SCL code, use MODULE,
MODULEN,
or MODULEC to invoke the DLL routine.
The specific function that 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.)
For complete information about accessing DLLs from within
SAS, see Overview of Dynamic Link Libraries in the SAS System.
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.