Sample: Running SAS Code Using Enterprise Guide Automation
Do you have a SAS program that you would like to run automatically or on a regular basis? Maybe you have a number of different SAS programs that you would like to automate and schedule.
This Visual Basic sample code demonstrates how to use the Enterprise Guide 4.2 automation interface to read a SAS code file, create a simple project file for Enterprise Guide, run the code, and store the log file to a safe location. With a few simple modifications of file names or path variables, you can run your own SAS code and direct the log file to a location of your choosing.
Details and Limitations
This vb script will open a code file that is supplied by the user and is called SASCodeToRun.sas. It will read the file and add the code object to an EG project called TestCodeProject.egp
The code will be run and the project and the log file produced by running the code will be saved.
This script expects to find the following file:
This script will create the following files:
- The SAS code that is supplied in SASCodeToRun.sas must be valid
code and must run cleanly on the server that is specified as the
codeServer in the dowork subroutine below. For the purposes of
this script, the server is set to the SASMain server.
Any data or other resources referenced in the SAS code that you
supply must be available for the SAS code to run correctly.
- This sample is one in a series of samples available to demonstrate some of the features of the Enterprise Guide 4.2 automation interface for Visual Basic. There is typically a great deal of additional information available in the comments of the code sample.