Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

Creating an Instance of the SAS System

To create an instance of the SAS System (that is, invoke a SAS session), you must create an OLE object by using the SAS System program identifier as it is listed in the Windows registry. The SAS program identifier is SAS.Application. Here is a Visual Basic example that instantiates (creates an instance of) a SAS session:

Dim OleSAS as Object
Set OleSAS = CreateObject("SAS.Application")
This example sets the identifier OleSAS to the new SAS session. You can then use this identifier to access the methods and properties that the SAS System makes available.

If you want to control an existing SAS automation object by using OLE automation, you can use your automation controlling language. In Visual Basic, you can use the following:

Dim OleSAS as Object
Set OleSAS = GetObject(,"SAS.Automation")
Note that this code does not create an instance of SAS if one does not already exist. Also, the existing SAS session must have been created as an OLE automation object (for example, using CreateObject in Visual Basic). You cannot use OLE automation to control a SAS session you invoked by using another method (for example, by using the Start menu).


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.