DATA Step, Macro, Functions and more

Need help to design autoexec program

Reply
Contributor
Posts: 44

Need help to design autoexec program

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.

Regular Contributor
Posts: 226

Re: Need help to design autoexec program

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.

Contributor
Posts: 44

Re: Need help to design autoexec program

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.
Super User
Posts: 4,026

Re: Need help to design autoexec program

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.

Super User
Posts: 10,580

Re: Need help to design autoexec program

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Valued Guide
Posts: 596

Re: Need help to design autoexec program

Posted in reply to KurtBremser

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.

Super User
Posts: 13,941

Re: Need help to design autoexec program

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

 

Ask a Question
Discussion stats
  • 6 replies
  • 157 views
  • 0 likes
  • 6 in conversation