Dear community,
this time, I would like to ask for your help concerning the following administrative issue:
Now it happened to me three times (after using SAS for ~ five months) that when I open SAS, all my librefs (Explorer View: SAS Environment → Libraries →) where gone.
Am I somehow able to story something like a “profile”, such that I do not have to manually add all old libraries again?
Or, is there are a way to (if I am capable of restoring all locations manually) to write all librefs to a file, such that, if they happen to "vanish" once again, I could recreate them with a SAS-command?
I would be glad, if you could help me with this issue.
Yours sincerely,
Sinistrum
Find your autoexec file and add your librefs there.
The following code should show you where your autoexec file is located
%let autox = %str(%sysfunc(getoption(autoexec)));
%put &autox;
If it's blank you don't have one but you can set one up.
I would also store a copy elsewhere since something appears to reset your settings.
SAS Libraries are created using the LIBNAME statement.
So all you need to do is, save all the LIBNAME statements to a SAS program and run it when you start SAS.
Depending on your SAS Environment (SAS University Edition, SAS Installation on your PC, SAS Platform Installation) there might be other options.
Bruno
Hello Bruno,
thank you for your fast reply.
Up untill now, I did not use a LIBNAME state.
I just right-clicked "libraries" and created a new library. With this method, one can use "enable on start up" and everything should be fine, I thought.
So, for now, I use the method suggested by you: I create a program and put all the libname statements in it.
Is there a way to make them "enabled on startup"?
If I right-lick them in the explorer view, there is no option causing them to be loaded when SAS is started.
Sinistrum
The "Enable at Startup" can only be specified when you create a new library from the SAS Explorer.
This information is stored in the SAS Registry (stored in the SASUSER library).
I recommend the approach using a SAS program, since this is portable.
Bruno
Find your autoexec file and add your librefs there.
The following code should show you where your autoexec file is located
%let autox = %str(%sysfunc(getoption(autoexec)));
%put &autox;
If it's blank you don't have one but you can set one up.
I would also store a copy elsewhere since something appears to reset your settings.
First of all: Thank you both for responding. I was really in panic this morning; when this first happened to me, I thought, all my data was gone. But now, I assume, that somehow, "just" the settings are reset, as suggested by Reeza (spoiler for my "theory" on this issue).
So, Reeza's answer is exactly what I was looking for.
Indeed, "it was blank", so I created an "autoexec.sas" with the txt.-editor and stored it in my "current folder" and it worked perfectly.
To combine, I take the solution by Bruno and create a file with all librefs-statements. This is taken aside, as recommended by Reeza.
The content of that very file is pasted into - the now existing - "autoexec.sas" in my "current folder".
Such, if it happens again (which, as I hope, should not, for I know have an autoexec.sas, but, who knows), I have a back up.
So, once again, thank you very much indeed.
It is always a horror to see all the libraries vanished.
Sinistrum
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.