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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

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
  • 2 replies
  • 1213 views
  • 0 likes
  • 2 in conversation