SAS Institute. The Power to Know

Run a Stored Process as a VBA Macro

If you want to run a stored process, but do not have a SAS metadata server available, then you can run an IOM direct interface stored process by using a VBA macro.

IOM direct interface stored processes differ from SAS stored processes in that they run on a workspace server and cannot return streaming output.

To access a stored process from ArcMap:

Define a SAS program:
  1. In SAS, select File New Program from the menu bar.
  2. Write your program. You can encapsulate any SAS DATA step or macro code in a stored process.
  3. Save the program. By default, the file extension is .sas. If you use this default extension, then you do not need to specify it in your ArcMap VBA macro.
Define a VBA macro in ArcMap:
  1. Select Tools Macros Visual Basic Editor from the ArcMap menubar.
  2. Select Tools References from the menubar of the Visual Basic Editor.
  3. Select the following libraries from the References window:
    • SAS Bridge for ESRI 3.1 Type Library
    • SAS: Integrated Object Model (IOM) (SAS System 9.2) Type Library
    • SAS WorkspaceManager 1.1 Type Library
  4. Select Insert Module from the menubar of the Visual Basic Editor.
  5. Type the macro code. See Sample VBA macro to run a stored process for a sample macro that prints a SAS data set as an HTML file.
Run the macro:
  1. Select Tools Macros from the Visual Basic Editor menubar (or, Tools Macros Macros from the ArcMap menubar).
  2. Select the macro you want to run.
  3. Click Run.