BookmarkSubscribeRSS Feed
PhatRam33
Fluorite | Level 6

This is kind of a wild question, is there SAS code that can automatically open (not assigning it as a library) an existing ms access database file?

6 REPLIES 6
ballardw
Super User

The X command, if enable in your install, will start any program you can run from a command prompt. Pass the name of the file the program is to open and that should work. You will likely need to have the full path the executeable for Access and use the full path to the file.

PhatRam33
Fluorite | Level 6

I'm not sure I follow.  Here is what Im trying to do: I have a report that uses SAS to pull and organize the data.  Once the program completes, it dumps it into an access database a VBA script will run and produce the excel output.  Without having to wait for the SAS program to finish and then clicking on the access database, I would like the SAS program to automatically open the access database and begin running the VBA code that I have. At this point, I just need SAS to somehow open my existing ms access file from a specific location where it resides.  My ultimate goal down the road is to code and automate the entire process in SAS.

SASKiwi
PROC Star

I think it would be a lot easier for SAS to send the required output to Excel directly rather than trying to "daisy chain" it via Access. What is this output?

PhatRam33
Fluorite | Level 6

It is a dataset of about 1500 records.  It would need to be dumped into an existing excel template, run the VBA macros within excel then save as a new file.

Reeza
Super User
Yes, you can, this is how it would work for Excel. You can change the path to Excel with the path to Access application and then the path to the file with the path to the DB.

How to pass the command to run the macro I'm not sure, can you set it to run whenever the DB opens?

options noxwait noxsync;
x '"C:\Program Files (x86)\Microsoft Office\Office14\Excel.exe" "C:\_localdata\Template.xlsx"';
Reeza
Super User
Is it just a proc export to the template or does it need to go to specific cells? Otherwise this is relatively easy. I wrote an unclear paper on it here: http://www.sas.com/content/dam/SAS/en_ca/User%20Group%20Presentations/Edmonton-User-Group/FareezaKhu...

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 6 replies
  • 1310 views
  • 0 likes
  • 4 in conversation