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

Several libraries I work with were stored on a network drive.  That drive was failing, so our network services group moved my directories to another drive in the system.  Now my libraries are broken in SAS.  When I try to get properties it says it doesn't exist. 

I just need the path name SAS thinks it wants and I can easily repair the connection, but some of them will take some time to reconstruct if I have to figure it out manually.

 

Is there an easy way to pull up this information?  A config file or something?

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @iiibbb,

 

If you know the librefs, you can use the PATHNAME function to obtain the corresponding paths.

 

Example:

data _null_;
input libref $;
length path $1000;
path=pathname(libref);
put libref $9. path=;
cards;
maps
sasuser
work
yourlib
;

View solution in original post

10 REPLIES 10
Amir
PROC Star

Hi,

 

Do you have any previous SAS logs that you can refer to?

 

Is there any existing code where the paths are assigned to a library name?

 

Can you perform a textual search on your files?

 

 

Thanks & kind regards,

Amir.

iiibbb
Quartz | Level 8
There are no logs. I have a few dozen libraries that were affected by the move. I can search for the files/directories one by one, but it would be much faster if I could just see where SAS was trying to look for the library. Instead it just says that the library no longer exists. But there must be a path it was trying to follow.
Amir
PROC Star

Hi,

 

When you say "Instead it just says that the library no longer exists", is this a log? If it is a log, can you see if there is a path in the log.

 

If it is not a log then what is "it"? Please provide evidence either way, e.g., text from the (using the Insert Code icon "</>") for a log or a screen shot in the case of a pop-up.

 

In the case of a log, ensure option source is on. Also, if macros are being used then it might be worth switching on the macro options mprint symbolgen.

 

 

Kind regards,

Amir.

ballardw
Super User

Where did you store the code that assigned libraries? Or how are your libraries assigned?

FreelanceReinh
Jade | Level 19

Hi @iiibbb,

 

If you know the librefs, you can use the PATHNAME function to obtain the corresponding paths.

 

Example:

data _null_;
input libref $;
length path $1000;
path=pathname(libref);
put libref $9. path=;
cards;
maps
sasuser
work
yourlib
;
iiibbb
Quartz | Level 8

First time I tried this it didn't work.  Didn't change anything and ran it again and it worked perfectly. 

Go figure.

Thank you.

Tom
Super User Tom
Super User

I assume you mean that you are trying to use a libref, like MYLIB, that is still pointing to the old location.

To point MYLIB at the new location just run a new LIBNAME statement.

libname mylib '/path to new location';

But the question I have is how did the libref get defined?

Did you run some SAS code, like the example libname statement above, to make the libref?  If so then update that program to use the right path.

Did you somehow define the libref once and SAS is remembering it the next time you startup?  If so then you need to go back to the process you used to define the libref and re-define it.

Or just add the code like above the redefine it now.

 

What interface are you using to run your SAS code? 

Are you typing the a command at the command line?  Like 

sas myfile.sas

In that case look and see if your autoexec.sas file is running the libname command.

 

Are you using Enterprise Guide?
Are you using SAS/Studio?

Is your site using SAS Metadata Manager to push common librefs to every user?

iiibbb
Quartz | Level 8

Follow up question.

 

Now that I know the path names of these librefs, is there a simple way to change the pathname?  

Literally all I need to do is change the Z: to a W:

Z:\2016_SLXHD\1_SAS_DATA\TOUT_DOE\DOE_LEGS




FreelanceReinh
Jade | Level 19

I'd suggest that you

  1. create a .sas file containing the appropriate LIBNAME statements, e.g.,
    data _null_;
    file 'C:\Temp\libnames.sas';
    input libref $;
    length path $1000;
    path=tranwrd(pathname(libref), 'Z:\', 'W:\');
    if path ne:'(' then path=quote(trim(path));
    put 'libname ' libref path ';';
    cards;
    yourlib1
    yourlib2
    ;
  2. review that file (libname.sas) to make sure that all LIBNAME statements are correct
  3. %INCLUDE the file to submit the LIBNAME statements
    %inc 'C:\Temp\libnames.sas';
    or copy the code from libnames.sas into your AUTOEXEC file so that the libraries are always made available at startup.
Tom
Super User Tom
Super User

@iiibbb wrote:

Follow up question.

 

Now that I know the path names of these librefs, is there a simple way to change the pathname?  

Literally all I need to do is change the Z: to a W:

Z:\2016_SLXHD\1_SAS_DATA\TOUT_DOE\DOE_LEGS





Wouldn't it just be easier to mount the new disk as Z instead of W?  Then the libref definition does not need to change.  Part of the reason to use mapped drives.  You can change the physical drive without having to change the logical name you use to reference it.

 

Or are their other folders that are still on the old W drive?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 1181 views
  • 1 like
  • 5 in conversation