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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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?

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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