SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

Error while creating SAS object

Reply
Frequent Contributor
Posts: 89

Error while creating SAS object

Hi,

I wrote following code to submit a dynamic SAS code from excel VBA.

But problem is that it only works from my ID or other admin's id and not with other common SAS user's id. (I've admin access to SAS server)

Function GetInput() As Boolean

Dim sasObjectFactory As New SASObjectManager.ObjectFactory

Dim obSAS As SAS.Workspace

Dim ServerDef As New SASObjectManager.ServerDef

Dim sasObj As SASExcelAddIn

Dim SASCode As String

SASCode = GetDataStep()

If Trim(SASCode) <> "" Then

    Set sasObj = Application.COMAddIns.Item("sas.ExcelAddIn").Object

    ServerDef.MachineDNSName = sasObj.ActiveProfile.HostName

    ServerDef.Port = sasObj.ActiveProfile.Port

    Set sasObjectFactory = New SASObjectManager.ObjectFactory

    Set obSAS = sasObjectFactory.CreateObjectByServer(sasObj.ActiveProfile.Name, True, ServerDef, "", "")

    Set sasLanguageEvent = obSAS.LanguageService

    sasLanguageEvent.Submit (SASCode)

    GetInput = True

Else

    MsgBox "Please provide Mamber Ids for this report in Column A", vbInformation

    ActiveSheet.Range("A3").Select

    GetInput = False

End If

End Function

Above code gives following error when tried to execute from other user's id:

WorkspaceError.png

It pops error at following line:

Set obSAS = sasObjectFactory.CreateObjectByServer(sasObj.ActiveProfile.Name, True, ServerDef, "", "")

Any help will be much appreciated!!

Post a Question
Discussion Stats
  • 0 replies
  • 239 views
  • 0 likes
  • 1 in conversation