Sample 33037: Using the "SAS Workspace Init Script", "SAS Workspace Init List", and "SAS Workspace Init Log" IOM provider properties
The SAS® 9.2 IOM provider contains three new properties for managing SAS code before a data source is initialized:
- "SAS Workspace Init Script" (DBPROPSAS_INIT_WORKSPACE_INIT_SCRIPT) enables you to specify SAS code to be submitted to a SAS Workspace Server immediately after a connection to the server is established.
- "SAS Workspace Init List" (DBPROP_SAS_WORKSPACE_INIT_LIST) enables you to capture the SAS listing from the SAS code submitted using the "SAS Workspace Init Script" property.
- "SAS Workspace Init Log" (DBPROP_SAS_WORKSPACE_INIT_LOG) enables you to capture the SAS log from the SAS code submitted using the "SAS Workspace Init Script" property.
Additional documentation on this topic is available in the SAS® 9.2 Providers for OLE DB Cookbook.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The code below is from a .Net console application and requires the Microsoft ActiveX Data Objects 2.8 Library reference. It uses the SAS Workspace Init Script property to assign a libname statement and execute a PROC PRINT when the connection is made. It uses the SAS Workspace Init Log and SAS Workspace Init List properties to retrieve the SAS log and list generated by the code from SAS Workspace Init Script.
Module Module1
Sub Main()
Dim obConnection As New ADODB.Connection
Dim obRecordset As New ADODB.Recordset
Dim SASStmts As String = "libname foo 'c:\temp'; proc print data=foo.class;"
'Open ADO connection.
obConnection.Provider = "SAS.IOMProvider.9.2"
obConnection.Properties("SAS Workspace Init Script").Value = SASStmts
obConnection.Properties("Data Source").Value = "_LOCAL_"
obConnection.Open()
'Display log from DBPROP_SAS_INIT_WORKSPACE_INIT_SCRIPT
Console.WriteLine("SAS WORKSPACE INIT LOG: " & vbCrLf & obConnection.Properties("SAS Workspace Init Log").Value)
'Display list from DBPROP_SAS_INIT_WORKSPACE_INIT_SCRIPT
Console.WriteLine("SAS WORKSPACE INIT LIST: " & vbCrLf & obConnection.Properties("SAS Workspace Init List").Value)
obConnection.Close()
End Sub
End Module
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This .Net example shows how to use the "SAS Workspace Init Script", "SAS Workspace Init List", and "SAS Workspace Init Log" to manage SAS® code before a data source is initialized.
| Date Modified: | 2008-08-25 15:58:19 |
| Date Created: | 2008-08-21 16:40:24 |
Operating System and Release Information
| SAS System | SAS Providers for OLE DB | Microsoft® Windows® for x64 | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
| Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
| Microsoft Windows XP Professional | 9.2 TS1M0 | |
| Windows Vista | 9.2 TS1M0 | |