BookmarkSubscribeRSS Feed
dkstoneman
Calcite | Level 5

I'm new to SAS programming. I would like the syntax to start a MS Access database macro at the end of a SAS program. I've taken over some SAS programs that use the following syntax to kick off an Excel macro:

 

/*Opens the Excel macro prior to establishing the DDE to run the Excel VB macro***/
%let xlsMacro = \\wpmfiles\Intraday_Forecasting\30 Day Charts\Auto_Morning_Reports.xlsm;
options noxsync noxwait;
x "'&xlsMacro.'";

 

Is there syntax like this to start a macro in MS Access?

 

 

 

5 REPLIES 5
SASKiwi
PROC Star

If you are using a remote SAS server you can't start MS Access at all. This will only possibly work if you have SAS installed on your PC and you are using a local SAS session. You can write from SAS to an MS Access database without opening it though.

 

 

dkstoneman
Calcite | Level 5

The SAS application I'm using is on my local desktop computer. I know you can pass data to an Access database from SAS. I need the SAS program to open an Access database and then run a macro within that database. I have to do additional data manipulation in the Access database and then publish that new information to Excel workbooks via the macro. The additional manipulation can't be performed by a SAS program.

SASKiwi
PROC Star

So have you tried this outside of SAS on a Windows command line and it works? 

 

According to Google this should work - MSACCESS.EXE appName.mdb /X=macroToBeExecuted

dkstoneman
Calcite | Level 5

I don't know how to kick off MS Access from a command line, but I can call Access and run the macro from Task Scheduler and other applications outside of SAS. Here is my process follow for what I'm trying to accomplish:

 

  • I kick off SAS via Windows Task Scheduler to import data from another source
  • Next a SAS program parses out the necessary data into individual tables and runs calculation processes
  • When the SAS program ends, I want to start the MS Access macro to complete additional work on the data before publishing it to other files.
SASKiwi
PROC Star

"I don't know how to kick off MS Access from a command line."

Right click on the Windows icon in the bottom left of your screen and select Run. Type in cmd to open a Command window. Type in the command I've already supplied you with and press the enter key.

 

Also if you don't know how to do something on your computer, have you tried using Google to search for the answer? I didn't know how to run MS Access from a command line but a quick search got me the answer.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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