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-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
  • 1 reply
  • 3696 views
  • 0 likes
  • 2 in conversation