- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 04-19-2011 12:06 PM
(1457 views)
I am trying to learn more about using VBScript to run SAS processes. I have written the script below just to open and run a few code files in SAS EG, but this is as far as I got. Is there any good reference for this?
'Set ErrorHandler
On Error Resume Next
'Run Daily
ProjectName = "\\Nasvs1\Shared\4700Mac\Shared3\Actuarial\SAS\Projects\ISO.egp"
Files = Array("LIBRARIES", "PLCY")
Call Work(ProjectName, Files)
'Define Functions
Sub Work(ProjectName, Files)
Set App = CreateObject("SASEGObjectModel.Application.4")
Set Project = App.Open(ProjectName,"")
Set Container = Project.CodeCollection
For Each File In Files
For Each Object In Container
If Object.Name = File Then Object.Run
Next
Next
Project.Save
Project.Close
End Sub
'Reset Error Handler
On Error Goto 0
'Set ErrorHandler
On Error Resume Next
'Run Daily
ProjectName = "\\Nasvs1\Shared\4700Mac\Shared3\Actuarial\SAS\Projects\ISO.egp"
Files = Array("LIBRARIES", "PLCY")
Call Work(ProjectName, Files)
'Define Functions
Sub Work(ProjectName, Files)
Set App = CreateObject("SASEGObjectModel.Application.4")
Set Project = App.Open(ProjectName,"")
Set Container = Project.CodeCollection
For Each File In Files
For Each Object In Container
If Object.Name = File Then Object.Run
Next
Next
Project.Save
Project.Close
End Sub
'Reset Error Handler
On Error Goto 0
Christopher Johnson
www.codeitmagazine.com
www.codeitmagazine.com
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here is some reference documentation.
For 4.1:
http://support.sas.com/documentation/onlinedoc/guide/SASEGScripting41.zip
For 4.2, and generally useful for 4.3 as well (no substantive changes):
http://support.sas.com/documentation/onlinedoc/guide/SASEGScripting42.zip
Also, there are several examples at (for 4.2 or 4.3):
http://support.sas.com/kb/40/781.html
Chris
For 4.1:
http://support.sas.com/documentation/onlinedoc/guide/SASEGScripting41.zip
For 4.2, and generally useful for 4.3 as well (no substantive changes):
http://support.sas.com/documentation/onlinedoc/guide/SASEGScripting42.zip
Also, there are several examples at (for 4.2 or 4.3):
http://support.sas.com/kb/40/781.html
Chris
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. This is exactly what I needed.
Christopher Johnson
www.codeitmagazine.com
www.codeitmagazine.com