BookmarkSubscribeRSS Feed
cynthya
Calcite | Level 5

Hi,

I have a SAS EG 4.1 project that I would like to run monthly as a scheduled job.

I tries using tools > schedule project and scheduling a vbs script.

For some reason the script is run by Windows, but the project is not run in SAS EG.

Below is the content of the script.

Could you please help me schedule an automatic job.

Thank you.

 

Option Explicit

Dim app

Call dowork

'shut down the app

If not (app Is Nothing) Then

app.Quit

Set app = Nothing

End If

 

Sub dowork()

On Error Resume Next

'----

' Start up Enterprise Guide using the project name

'----

Dim prjName

Dim prjObject

prjName = "C:\P2P v3.egp" 'Project Name

Set app = CreateObject("SASEGObjectModel.Application.4")

If Checkerror("CreateObject") = True Then

Exit Sub

End If

'-----

' open the project

'-----

Set prjObject = app.Open(prjName,"")

If Checkerror("app.Open") = True Then

Exit Sub

End If

'-----

' run the project

'-----

prjObject.run

If Checkerror("Project.run") = True Then

Exit Sub

End If

'-----

' Save the new project

'-----

prjObject.Save

If Checkerror("Project.Save") = True Then

Exit Sub

End If

'-----

' Close the project

'-----

prjObject.Close

If Checkerror("Project.Close") = True Then

Exit Sub

End If

End Sub

Function Checkerror(fnName)

Checkerror = False

Dim strmsg

Dim errNum

If Err.Number <> 0 Then

strmsg = "Error #" & Hex(Err.Number) & vbCrLf & "In Function " & fnName & vbCrLf & Err.Description

'MsgBox strmsg 'Uncomment this line if you want to be notified via MessageBox of Errors in the script.

Checkerror = True

End If

End Function

1 REPLY 1
jakarman
Barite | Level 11

Cynthia, this one is more difficult than dates....
Eguide 4.1 (SAS 9.1.3) scheduling is working on the local machine/desktop.
The Windows schedule manager is used for that. If that is not present or closed as you are probably working on a office desktop,  it could fail here.

Also the desktop must be able to start by the windows schedule manager at that moment.....

If you want to use this try to do it in a simple progam in a verifyable way. The generated VBS should work and the schedule manager displaying the info.

---->-- ja karman --<-----

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 777 views
  • 0 likes
  • 2 in conversation