BookmarkSubscribeRSS Feed
MRW
Calcite | Level 5 MRW
Calcite | Level 5

I am wanting to open SAS EG from a *.bat file and run the ordered List.  I can get my .bat to open my project by using "Start K:\Dental_Database\Project_Dental.egp".  However what is the correct syntax to have it open and run the ordered List?

1 REPLY 1
CaseySmith
SAS Employee

You can accomplish using EG's automation interface...

 

-Open your EG project and note the name of the ordered list you want to run (ex. "MyOrderList") and the parent folder (ex. "Ordered Lists").

-Click File->Schedule <projectName>, then click OK in the scheduler dialog to cause an EGScript1.vbs file to be created in the same directory as your EG project.  (EGScript1.vbs is a VBScript file that will use the EG automation interface to open your project, run your project, save it, and then close it.)

-Close your project.

-Run the EGScript1.vbs file (ex. "cscript.exe EGScript1.vbs")  (Note: If running 32-bit EG on 64-bit Windows, you'll have to use the 32-bit cscript.exe in c:\Windows\SysWOW64...  ex. "c:\Windows\SysWOW64\cscript.exe EGScript1.vbs".)

-Open your project in EG and confirm it was run by executing the VBScript file.

-After confirming EGScript1.vbs successfully ran your entire project, now we just need to edit it to only run the desired Ordered List.  For example, replace the portion of the EGScript1.vbs that runs the project (commented out below) with code that finds and runs the desired ordered list (example below):

 

    '-----
    ' run the project
    '-----
    'prjObject.run
    'If Checkerror("Project.run") = True Then
    '    Exit Sub
    'End If
    
    'Find and Run the desired ordered list
    Dim orderedListContainer
    Dim orderedList

    Set orderedListContainer = prjObject.ContainerCollection.Item("Ordered Lists")
    For Each orderedList in orderedListContainer.Items
        If orderedList.Name = "MyOrderList" Then
            orderedList.Run()
        End If
    Next
    If Checkerror("OrderedList.Run") = True Then
        Exit Sub
    End If

-The last step (assuming you really want to be able to do this from a batch file), is to run the VBScript file from your batch file.  For example:

 

@echo off
pushd %~dp0
cscript EGScript1.vbs

Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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