Previous Page | Next Page

Special Considerations for SAS/AF Programmers under Windows

Accessing External DLLs from SAS

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 action lets you access DLLs that you create or purchase; you can even access operating system DLLs.

To access an external DLL, you must know:

CAUTION:
Only experienced programmers should access external DLLs.

When you access an external DLL, you are passing control of your computer from SAS 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).  [cautionend]

The general steps for accessing an external DLL routine are:

  1. 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.

  2. Use the FILENAME statement to assign the SASCBTBL fileref to the attribute file you created.

  3. 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 SASCBTBL 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.  [cautionend]

For complete information about accessing DLLs from within SAS, see Accessing External DLLs from SAS under Windows.

Previous Page | Next Page | Top of Page