Creating an Instance of SAS

To create an instance of SAS (that is, invoke a SAS session), you must create an OLE object by using the SAS 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 SAS 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 that you invoked by using another method (for example, by using the Start menu).