BookmarkSubscribeRSS Feed
Dreamer
Obsidian | Level 7

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 Smiley Sad

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

2 REPLIES 2
ballardw
Super User

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?

Dreamer
Obsidian | Level 7

Hi ,

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1602 views
  • 0 likes
  • 2 in conversation