12-07-2015 09:31 PM
Hopefully someone could assist me on this as I am kind of stuck. Suppose I have a project file called: myproject.egp saved in C:\desktop with multiple embedded programs: myprogram1 myprogram2 myprogram3.
All I want to do is just run myprogram2 at a specific time later at 5pm. My SAS project is already opened so I all I require is to just let it run that program in that opened session. Afterwards, it should save. Could anyone suggest a way to do so? Thanks in advance!
12-07-2015 09:38 PM
If it helps I am currently trying to modify the following script generated by EG's scheduler to suit my needs
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:\Desktop\myproject.egp" 'Project Name Set app = CreateObject("SASEGObjectModel.Application.5.1") 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
12-09-2015 02:19 AM
It may be a lot easier just to export your embedded program and schedule it separately. If you only have a remote SAS server then you would need to schedule it on there. SAS Management Console provides scheduling capabilities but it does depend on how scheduling has been configured at your site.