Your SAS programs, embedded in web apps and elsewhere

Invoke SAS Stored Process using EXCEL Macro

New Contributor
Posts: 2

Invoke SAS Stored Process using EXCEL Macro


I have a stored process that can be run in excel using AMO. I am trying to create a macro in excel that will invoke the stored process directly. My questions are as follows.

1) Since I am using SAS EG , I figured I will need to write code to connect to server for running this Stored process. How do I connect to linux server using EXCEL?

2) How do I find the location of metadata? My stored process is located on the server.

Thanks in Advance

Posts: 50

Re: Invoke SAS Stored Process using EXCEL Macro


I think the paper bellow have exactly what you want, give a check.

Tips and Techniques for Automating the SAS® Add-In for Microsoft Office with Visual Basic for Applications

Sample VBA macro to run a stored process

Turn Your SAS® Macros into Microsoft Excel Functions with the SAS® Integrated Object Model and ADO

Probably you need a few adjustments in order to comply with your SAS version.

Best Regards.

New Contributor
Posts: 2

Re: Invoke SAS Stored Process using EXCEL Macro

Hi , I tried to insert the following code in macro editor

Sub TestConnectionToSAS()

Dim sas As SASExcelAddIn

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


End Sub

I am getting a complie error: USer-Defined type not defined. I assume this is because connection to API is not working properly. I am unable to go to references tab within macro editor to enable SAS COM add-in.

Am I missing something.Please let me know .


Ask a Question
Discussion stats
  • 2 replies
  • 1 like
  • 2 in conversation