BookmarkSubscribeRSS Feed
Malathi13
Obsidian | Level 7

Hi,

I'm trying to store all my libraries in one %includes statement, I did that before but unable to think how I did that.

 

Here is an example of my libraries in sas 9.4.

 

libname A "C:\\desktop\toys";

libname B "C:\\desktop\price";

libname C "C:\\desktop\orders";

 

I want to put all these libraries in %include so that I can just use one %include statement in my programs to access all these libraries instead of mentioning all the libraries again in the program.

 

Can anyone help me in this? I know it is  very simple and easy but unable to figure out how I did before.

 

Thanks

M

6 REPLIES 6
Reeza
Super User

Create a SAS program that contains all your library definitions.

 

Then use %include to that program whenever you want to assign all libraries.

 

If you're looking for this to occur automatically when you start SAS you need to modify your autoexec or config file. Usually you'll have access to an Autoexec but not necessarily the config file. 

Malathi13
Obsidian | Level 7

Thank you Reeza, I figured out using %include immediately after posting it. Thank you for the automatic running of %include which I'll try and see if I can get it as I like the idea of making it run automatically when I start SAS.

 

Thanks

M

Peter_C
Rhodochrosite | Level 12
there is a concept referred to as AUTOEXEC.
There you can store statements that will execute when SAS starts
Malathi13
Obsidian | Level 7

Hi Peter,

can you provide me an example for autoexe. Do we have to make it a global option in the sas program and run it?

 

Thanks

M

art297
Opal | Level 21

@Malathi13: It's just a txt file that contains SAS statements.  See: http://support.sas.com/kb/19/244.html

 

HTH,

Art, CEO, AnalystFinder.com

 

Patrick
Opal | Level 21

Whatever you add to an autoexec will get executed during SAS startup and will be applicable always.

 

For library assignments: You can do this in an autoexec but I'm kind of astonished that no one mentioned to do such an assignment via SAS Metadata Server (using SAS Management Console) as that's the place where this normally is done in a corporate environment.

Using SAS Metadata also allows you to only get such assignments executed for certain metadata groups (ie. a department) and not the whole company.

 

Managing such company level SAS configurations is a SAS Administrator task. Contact yours if you've got such requirements.

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
  • 619 views
  • 0 likes
  • 5 in conversation