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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

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