BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
traldim
Fluorite | Level 6

Hello everyone.

I'm facing a random problem. When executing SAS programs with VBScript and the

SASEGObjectModel.Application.7.1, looping through 
CodeCollection get stuck sometimes, even if the program execution was succeeded (the final data bases are correctly created in our server). The script simple doesn't go to the next program of CodeCollection (the prompt executing the script still open... ad infinitum). I'm going with something like this:

Dim oSasApp
Set oSasApp = CreateObject("SASEGObjectModel.Application.7.1")
oSasApp.SetActiveProfile("some-profile")

Dim oSasProj
Set oSasProj = oSasApp.Open("some-project.egp", "")

Dim oProgramList
Set oProgramList = oSasProj.CodeCollection

Dim programOrder
Set programOrder = ...here I assign the SAS programs order array reading from a .txt...

For Each program in programOrder
       For Each sasProgram in oProgramList
              If sasProgram.Name = program Then
                     sasProgram.Run
                     sasProgram.Log.SaveAs "some-folder/" & sasProgram.Name & ".txt"
              End If
       Next
Next

oSasProj.Close
oSasApp.Quit
The problem is not the Log saving, as the log txt file of the stucked program is also correctly created.

Any idea? Maybe problems in our SAS server? Should I declare some kind of options?

SAS Guide version: 7.15
Windows: 10
1 ACCEPTED SOLUTION

Accepted Solutions
traldim
Fluorite | Level 6

For people facing the same problem, I did 2 things to get around it. Not sure if all of them are necessary or if only one solves it, but here it goes:

 

First, by VBScript I turned off a list of generations and I applied a delay after the SAS program runs:

For Each program in programOrder
       For Each sasProgram i oProgramList
              If sasProgram.Name = program Then
                     sasProgram.GenSasReport = False
                     sasProgram.GenHTML = False
                     sasProgram.GenListing = False
                     sasProgram.GenPDF = False
                     sasProgram.GenRTF = False
                     sasProgram.Run
                     WScript.Sleep(2000)
                     sasProgram.Log.SaveAs "some-folder/" & sasProgram.Name & ".txt"
              End If
       Next
Next

 

 

Them, in my batch file, wich I use to call the VBScript with the "cscript" command, I set it to apply "y" to every single message the VBScript could ask:

cd ./script-folder
echo y | cscript script-file-name.vbs

  

And that is it.

View solution in original post

7 REPLIES 7
traldim
Fluorite | Level 6
...the SAS program it stucks is random and also the frequency it happens.
ChrisHemedinger
Community Manager

I suggest that you turn on Application Logging (in Tools->Options).  This will create a CSCRIPT.nnnn.log file in your user profile area that contains lots of diagnostic info.  You might not be able to interpret it yourself, but if you track it with SAS Tech Support and supply a log file that represents when this problem occurs, the development team might be able to diagnose.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
traldim
Fluorite | Level 6

That is good info Chris.

Just found out something that changes erverything and makes the problem simpler: if I press enter on prompt the script flows again. So it is waiting for my input. Can't understand why as I did't code anything for that in the .vbs file. Must be something with SAS Enterprise Guide. The data bases I'm manipulating are preatty big, the main programs takes something like 7 hours to run. I'm thinking if SAS Guide is asking anything to goes on. Maybe something related to the data size? Any idea what could be?

 

Tnks

ChrisHemedinger
Community Manager

Is there a prompt displayed? Or in the command-line console?

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
traldim
Fluorite | Level 6

Nothing displayed on command line. I pressed enter by luck. When running directly with SAS Guide app something it prompts messages saying the log is too long, or that results are too long, asking for my OK (not sure about the messages). I'm thinking in something like that.

ChrisHemedinger
Community Manager

Hmm, I see.  You can try modifying the options in Tools->Options and bump these thresholds:

  • Results->General, Prompt before opening results -- change to a high number like 50MB.  I think that applies to ODS and logs.

Also, you should consider tweaking your options and/or code to produce more concise results.  Generate graphs? Look at whether you are using the ActiveX device (large if you have graphs with lots of points).  And how verbose is your log output?

 

And if you use the Project Log, change those properties for your project.  Right-click on the Project name in your project tree, select Properties, then Project Log.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
traldim
Fluorite | Level 6

For people facing the same problem, I did 2 things to get around it. Not sure if all of them are necessary or if only one solves it, but here it goes:

 

First, by VBScript I turned off a list of generations and I applied a delay after the SAS program runs:

For Each program in programOrder
       For Each sasProgram i oProgramList
              If sasProgram.Name = program Then
                     sasProgram.GenSasReport = False
                     sasProgram.GenHTML = False
                     sasProgram.GenListing = False
                     sasProgram.GenPDF = False
                     sasProgram.GenRTF = False
                     sasProgram.Run
                     WScript.Sleep(2000)
                     sasProgram.Log.SaveAs "some-folder/" & sasProgram.Name & ".txt"
              End If
       Next
Next

 

 

Them, in my batch file, wich I use to call the VBScript with the "cscript" command, I set it to apply "y" to every single message the VBScript could ask:

cd ./script-folder
echo y | cscript script-file-name.vbs

  

And that is it.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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