Farouk Sellami
Farouk Sellami

Reputation: 1

launch SAS code through VBA modules and licence needed

I am trying to launch the following SAS code through VBA. But an

error 429 ActiveX can't create the object

is showing. Does someone know which licenses/Modules/required_drivers are needed for SAS or Excel? I am using SAS Enterprise Guide 6.1 and Microsoft Office 15. The same code worked before on the other PC containing all SAS licenses for SAS 9.3 and Microsoft Office 16.

    Dim OleSAS As Object
    Set OleSAS = CreateObject("SAS.Application")
    OleSAS.Visible = True
    OleSAS.Wait = True
    OleSAS.Submit("SAScode")
    OleSAS.Quit
    Set OleSAS = Nothing

Upvotes: 0

Views: 267

Answers (1)

Allan Bowe
Allan Bowe

Reputation: 12701

The easiest way to call SAS from VBA is via the StoredProcess server. This approach also nicely separates the SAS code from VBA logic. An explanation can be found here, which essentially involves:

  • Registering your SAS code as a Stored Process with streaming output
  • Setting up a web query in excel, with relevant parameters in the url
  • Calling the refresh event on the QueryTables object

Another nice thing about this approach is that you don't need the addin, or a local instance of SAS. However you do need SSO.

Upvotes: 2

Related Questions