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-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

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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