BookmarkSubscribeRSS Feed
vomer
Obsidian | Level 7

Hi Guys,

I have created an automation SAS file that calls/runs another SAS file in a specific directory. Here is my question:

File1.SAS --> This is my automation file that contains a few macros for directory locations. I use the following include statement in this file:

%include "&driv.\&path1.\&mth.File2.sas";

File2.SAS --> This is the main SAS file I run using File1.SAS. It also contains a few macros that need to be updated before running.

My Question: If I move the macros from File2.SAS to File1.SAS will it cause any problems? The main reason I want to do this is because I want to update my macros only in 1 file and not open 2 seperate files each month to update.

Thanks!

2 REPLIES 2
twocanbazza
Quartz | Level 8

Assuming when you say moving the macors, your are talking about moving the macro varable assignments and/or macro code , you shouldn't have any issues.... 

Barry

Astounding
PROC Star

Technically, you won't have any problems.

In practice, it's usually done another way.  Look up and read about "autocall libraries".

There are a few reasons your approach becomes cumbersome in the long run.  First, as your list of macros becomes longer and longer, the logs of all your programs become longer and longer as well.  Much of the log will get consumed by defining macros that are never used in that particular program.  This approach also makes it harder for the user to inspect the first file with all the macros and figure out what he needs to know and what he can ignore.  Finally, each program will waste a little CPU time by defining macros not needed in that particular program.

If you do set up an autocall library, you can even stick the libname definitions inside a macro as well.  The user's program might look something like this:

options sasautos='path to autocall library';

%define_libnames

** add the rest of the program, using any macros that are part of the autocall library;

You'll need to do your own homework and reading, though.  Good luck.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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