BookmarkSubscribeRSS Feed
GarethLor
Calcite | Level 5

Hi all

 

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!

 

Regards
Gareth

 

3 REPLIES 3
GarethLor
Calcite | Level 5

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
GarethLor
Calcite | Level 5
Hi could anyone kindly assist please? 😞 Thank you
SASKiwi
PROC Star

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 856 views
  • 0 likes
  • 2 in conversation