BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sinistrum
Quartz | Level 8

 

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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.

 

http://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#p0bmj7wjme32ayn1h4...

 

 

I would also store a copy elsewhere since something appears to reset your settings. 

View solution in original post

5 REPLIES 5
BrunoMueller
SAS Super FREQ

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

Sinistrum
Quartz | Level 8

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

BrunoMueller
SAS Super FREQ

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

Reeza
Super User

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.

 

http://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#p0bmj7wjme32ayn1h4...

 

 

I would also store a copy elsewhere since something appears to reset your settings. 

Sinistrum
Quartz | Level 8

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).

Spoiler
Sometimes, I, accidentally, double-double-click SAS.exe in order to open it. Then, the "first" SAS.exe would operate normally, the "second" SAS.exe would not have access to the settings, because the "first" SAS is using them. Then, I conveniently close the second SAS and everything works fine.
But maybe, sometimes I double-double-click too fast - then, the settings are corrupted at all.

What I would like to add, is the following:
In addition, other settings are overwritten; e.g., I have it set in general, that, instead of variable-labels, I have variable-names displayed in tableview. This setting I adjust via this instruction, is also gone.

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

sas-innovate-2024.png

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.

 

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
  • 5 replies
  • 1166 views
  • 4 likes
  • 3 in conversation