Hello everyone.
I'm facing a random problem. When executing SAS programs with VBScript and the
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.QuitThe problem is not the Log saving, as the log txt file of the stucked program is also correctly created.
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.
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.
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
Is there a prompt displayed? Or in the command-line console?
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.
Hmm, I see. You can try modifying the options in Tools->Options and bump these thresholds:
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.