02-27-2012 02:42 PM
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:
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.
02-27-2012 04:42 PM
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';
** 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.