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

 

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!

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.

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