Usage Note 2696: How to schedule an SAS® Enterprise Guide® project to run in batch and direct results to a web page
The built in Scheduler in SAS Enterprise Guide 3.0.0.369 and higher can
be used to execute projects in batch.
In some cases you may need to save results during the batch process.
For SAS Enterprise Guide 3.x, please refer to this Sample:
#25275
SAS Enterprise Guide 4.1 and higher includes new features for exporting
and emailing results so that when the project is executed in batch the
results are automatically sent without having to write vbscript code.
The following example is for SAS Enterprise Guide 2.x only.
A VBScript file can be used to execute an SAS Enterprise Guide project.
The VBScript file can then be scheduled to run in batch using MS NT
Scheduler that can execute the VBScript file nightly, weekly, etc.
SAS Enterprise Guide must be installed on the machine running the
VBScript. The machine that executes the vbscript to run the project
must be on.
Users can use their client machines to schedule a vbscript to execute
a project that will execute the SAS code on a remote SAS server,
however, the client machine must remain on and connected to the network.
There is no interface in SAS Enterprise Guide that will allow users to
schedule a project from their machine then logoff their machine.
Refer to SAS Enterprise Guide Help relating to OLE Automation. The
following URL has a link at the bottom to download the OLE Automation
reference:
http://www.sas.com/technologies/bi/query_reporting/guide/ole.html
Below is a sample VBScript file that when executed will execute the
specified SAS Enterprise Guide project file. This sample VBScript will
direct the results from the Enterprise Guide project's List task to an
HTML file, and will also send an email notification with an attachment.
For more VBScript examples, refer to the following SAS Notes:
#009042 , #010667 , and #011748 .
Follow these steps to execute the sample VBScript found at the end:
1. Important: In order to use this exact VBScript, create a SAS
Enterprise Guide project that uses the SASHELP.CLASS table as input for
a List task, then save the project file to a folder known to the machine
that will execute the VBScript. In this example, the Enterprise Guide
project was saved to: c:\public\sample.seg. (NOTE: You do not have to
run the project; simply set it up and save it without generating the
results.) Once you understand this sample VBScript, then you can modify
it to execute your projects based on the data and task you want to use
instead of the SASHELP.CLASS table and the List task.
2. Next, you can use Microsoft Notepad to modify the sample VBScript
file below to direct the results of the project to whatever file you
want. In this example, the results from the project are directed to an
.HTML file which can be linked to a URL of your choice:
c:\proj\AnalysisResults.html. The results can also be sent to one or
more email addresses by modifying the sample VBScript's email
destinations.
3. Once you have modified the VBScript in Microsoft Notepad, save it as
Test.VBS.
4. To run the VBScript, first save your SAS Enterprise Guide project and
exit. Then, go to My Computer to the location you saved T est.VBS. From
there, double-click on Test.vbs. You will get several message boxes as
the script executes and completes.
Here is the sample VBScript code to be modified and saved using
Microsoft Notepad as Test.VBS.
Dim objGuide
Dim objProject
'---- Create the Enterprise Guide application.
Set objGuide = WScript.CreateObject("SASEGuide.Application")
'---- Open an existing project file
Set objProject = objGuide.Open("C:\public\sample.seg")
'---- Run all the tasks
objProject.Run
'---- Get the results
Dim objResults
Set objResults =
objProject.ProjectItems("CLASS").Tasks("List Data").Results("HTML")
'--- Change the style of the HTML results before we SaveAs
objResults.Style = "SAS Web"
'---- Save the results to a file on the local server
objResults.SaveAs ( "C:\public\AnalysisResults.htm")
Dim toList(1)
toList(0) = "John Smith"
toList(1) = "john.smith@business.com"
Dim copyList(0)
toList(0) = "jane.smith@business.com"
Dim strSubject
Dim strBody
strSubject = "Analysis results"
strBody = "Attached are the results of the class analysis"
objResults.SendMail "", "", toList, copyList, strSubject, strBody
objProject.Close
objGuide.Quit
Operating System and Release Information
| Product Family | Product | System | Reported Release | Fixed Release* |
| SAS System | SAS Enterprise Guide | Microsoft Windows NT Workstation | 1.0 | |
| Microsoft Windows 95/98 | 1.0 | |
| Microsoft Windows 2000 Professional | 1.0 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Date Modified: | 2007-10-25 09:21:53 |
| Date Created: | 2000-05-19 08:52:07 |