BookmarkSubscribeRSS Feed
Dreamer
Obsidian | Level 7

Hi,

Previously I could run Excel/Access VBA macro from my SAS code as shown in below example. But now my organization has moved to SAS EG 6.1 and SAS Server 9.4 architecture.

Now code like below doesn't work from SAS EG. Does it need MS Office to installed at server to support these kind of codes?

OPTIONS NOXWAIT NOXSYNC;

DATA _NULL_;

RC=SYSTEM('START EXCEL');

RC=SLEEP(5);

RUN;

FILENAME CMDS DDE 'EXCEL|SYSTEM';

DATA _NULL_;

FILE CMDS;

PUT "[OPEN(""D:\ANALYSIS-REPORTING.XLS"")]";

PUT '[RUN("Macro1")]';

PUT '[SAVE.AS("D:\FORMATTED_FILE.XLS")';

PUT "[QUIT()]";

RUN;

QUIT;

2 REPLIES 2
Reeza
Super User

The code above is DDE, I don't think you can call DDE from SAS EG.

If you have Base SAS on your desktop you can.

You may also have your X commands restricted, but if not you can create a VBScript file instead that does the same thing and call that.

Kurt_Bremser
Super User

For this to work, the SAS server needs to be installed on a Windows system and said Windows system needs to have Office installed.

And you will need to have access to a directory resource on the server via AD to work with the created files.

The prudent solution for this problem is to move the logic of the macro into SAS and create the final result with a more modern and platform-independent tool like ods tagsets.excelxp.

Doing business logic in Excel is a recipe for disaster.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 2159 views
  • 0 likes
  • 3 in conversation