Hi,
I have autoexec.sas program which contains all libraries,global macro variables and database connections.
and have nearly 80 %include statements which points to diffirent unix paths which having .sas files and formats.
I am re writing the code, so pleae suggest how can I improvise my process to avaoid so many %include statements.
It is considered best practice these days to set up data sources / libraries in SAS metadata using SAS Management Console. Using the metadata approach gives you the ability to manage permissions more effectively than by just relying on OS permissions.
For files containing macros, consider using the autocall facility.
For other includes, put them in one location; this will not reduce your number of %include's, but will make maintaining them easier in the future.
Having lots of %include*s in the autoexec is not that bad; consider having to put them manually in each program you run. It's better to maintain them in one single file. If you don't want the code to clutter up your logs, consider using the nosource option temporarily while the autoexec executes.
Why don't you combine some of the files you're including so that you've got 1 file for libnames, 1 for global macro declarations, 1 for format locations etc? It would be much easier to maintain and make your autoexec easier to follow.
If you don't like to see a large number of %include in your Autoexec you could make one %include file that calls the others. Just document it:
/* The following include file calls a number of other program files to reduce size of autoexec file*/
%include 'Path/autoinclude.sas';
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.