BookmarkSubscribeRSS Feed
pramod_duvvuri
Calcite | Level 5

I have SAS EG version 7.1 and Office 2013 Installed on my system. I am trying to run my SAS projects by calling them from VBA. As a first step, I tried to call a simple PROC step using the below code I found online:

 

Sub createTable()
    Dim obObjectFactory As New SASObjectManager.ObjectFactory

    Dim obObjectKeeper As New SASObjectManager.ObjectKeeper

    Dim obServer As New SASObjectManager.ServerDef

    Dim obSAS as SAS.workspace
    
    Dim query as String
    query = "PROC SQL; CREATE TABLE ME.TABLE1; RUN;"

    obServer.MachineDNSName = "XXXXXXXXX"
    obServer.Protocol = ProtocolBridge
    obServer.Port = 8561
    obObjectFactory.LogEnabled = True

    Set obSAS = obObjectFactory.CreateObjectByServer("SASApp", True, obServer, "", "")

    obSAS.LanguageService.Submit query
    
End Sub

 

But I'm getting an error at below line:

Set obSAS = obObjectFactory.CreateObjectByServer("SASApp", True, obServer, "", "")

 3275_VBA ERROR.JPG

 

Can anyone please help me to move forward this error? Also, any guidance to run the SAS projects is greatly appreciated. I am new to both VBA and SAS.

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Have a read here (for code, but your code seems fine) and here (for a similar IT connection error).

 

Test your connection with itconfig2.exe .

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Discussion stats
  • 2 replies
  • 1512 views
  • 0 likes
  • 3 in conversation