Hi,
I am writing a VB script to run a SAS code. It works perfectly.
It runs the SAS code and saves log at requried location.
But I'm not able to save the SAS list. I tried various options but no luck ![]()
Below is a part of VB Script that I'm using:
----------------------------------------------------------------------------------------------------------
Set app = CreateObject("SASEGObjectModel.Application.6.1")
If Checkerror("CreateObject") = True Then
Exit Sub
End If
' open the project
Set prjObject = app.New()
If Checkerror("app.New") = True Then
Exit Sub
End If
' open the file and put the text into the fileString variable
Dim fileSys, fReadStream, fileString
Set fileSys = CreateObject("Scripting.FileSystemObject")
Set fReadStream = fileSys.OpenTextFile(codeFile,1, False)
fileString = fReadStream.ReadAll()
' add the new code object to the project
Set codeObj = prjObject.CodeCollection.Add
' Set the server and text for the code
codeObj.Server = codeServer
codeObj.Text = fileString
codeObj.Run ' Run the code
codeObj.Log.SaveAs logFile ' Save the log filelist
Default for SAS 9.3 and later is to not create listing output so version may be important. And possibly how you call SAS as options such as -Print can affect output locations or even if created. Does the log for these jobs show any info about output?
I'm using SAS 9.4.
There is one option "Proc Print" but I don't want to modify the SAS code. Because there are a lot of them and also I'm not the developer for most of them.
I can use -print option when I execute a SAS code from command line. But I have some EGP files as well and I don't think I can call them from command line.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.