BookmarkSubscribeRSS Feed
RowanB1986
Fluorite | Level 6

I am trying to get the output of the following SAS stored procedure to appear in an Excel sheet via a VBA macro.

 
 
proc sql;
 CREATE TABLE RV_LIST AS
 SELECT F_RS_DESC FROM FUTURA.to_rv_Sets WHERE F_RS_PROV_ID = 23 And UPPER(F_RS_DESC) LIKE '%LIVE RV%' ORDER BY F_RS_DATE DESC;
quit;
proc print DATA=RV_LIST;
run;

Here is the VBA code I'm using:

 

Sub UpdateDataValidation()
Dim DV As Worksheet
Dim SAS As SASExcelAddIn
Dim prompt As SASPrompts
Dim Output As Range
Dim data As SASDataView

Set DV = ThisWorkbook.Worksheets("Data Validation")
Set SAS = Application.COMAddIns.Item("SAS.ExcelAddIn").Object

SAS.InsertStoredProcess "/User Folders/rbarua/My Folder/RVListUpdate", DV.Range("A4")


End Sub

The VBA macro runs successfully and the output of the SAS stored process appears in the "SAS Add-In For Microsoft Office" pane on the right.


However, I want the output to appear in cell A4 of the "Data Validation" worksheet. Can anyone spot why this is not happening?

 

Any help is much appreciated.

 

1 REPLY 1

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1075 views
  • 0 likes
  • 2 in conversation