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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1987 views
  • 0 likes
  • 3 in conversation