Code to Create Permanent library.

Super Contributor
Posts: 276

Code to Create Permanent library.

Hello every one.

Generally i use LIbaname Statement to create New LIb in SAS environment. But if i close SAS session and open again,the lib was getting disappearing.So i have to run that Lib name Statement Again

But in other Case

,If i create New Lib in GUI based,i can able to see that lib even in  the next SAS session.

My question is "Is there Any way to Create Lib permanently with LIBNAME statement ????"

Thanks &regards.


Super Contributor
Posts: 333

Re: Code to Create Permanent library.

If you place the libname in the SAS file it will be created everything SAS starts, which I think is what you want. If you never have used autoexec then you might have to create one. Where it lives depends on the SAS install location but typically on windows the files would be in something like C:\program files\SAS\SASFoundation\9.2

On server installs we have had to place a %include in the autoexec with the path to the users network space and their customized autoexec.

Hope this helps


Super Contributor
Posts: 644

Re: Code to Create Permanent library.

If you want SAS to recognise a permanent library every time you login you need to change the options invoked by SAS at load.  One way to do this is to change the SAS startup script to always, automatically, include a libname statement.

This may not be a good idea if you are working in a shared environment and your code has to be run by other users at some point.  It can create errors which are hard to fix if the location of the library to be shared is undocumented.

What's the big deal with having a libname statement at the head of the code?  It acts as documentation and does not slow you down any compared with having the libname in your startup script.


Super Contributor
Posts: 578

Re: Code to Create Permanent library.

yes using the metadata option.  Can you see the generated code that the GUI produces?

Super Contributor
Posts: 1,636

Re: Code to Create Permanent library.

You could also create by using explorer. Please see the attached sceen shot and make sure to check "Enanle at startup"

create permanent library by using explorer.png
Regular Contributor
Posts: 198

Re: Code to Create Permanent library.

This page discusses how to create and where to place an

which has a libname statement.

An file is automagically %included at startup.

Ron Fehd  autoexec maven

Ask a Question
Discussion stats
  • 5 replies
  • 1 like
  • 6 in conversation