BookmarkSubscribeRSS Feed
Banu
Obsidian | Level 7

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.

6 REPLIES 6
error_prone
Barite | Level 11
Do you need all that stuff in every SAS session?

Include-statements are not bad, and 80% means nothing while not knowing the total number of lines.

Banu
Obsidian | Level 7
Need all that stuff in every job which includes .Sas and formats.

I feel it not looks good to keep all .SAS codes with %include. So looking for any better idea.
SASKiwi
PROC Star

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.

Kurt_Bremser
Super User

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.

ChrisBrooks
Ammonite | Level 13

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.

ballardw
Super User

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';

 

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