BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

You can define a libref or a fileref to point to multiple physical directories.

filename myfile ('path1' 'path2' 'path3');
libname mylib ('path1' 'path2' 'path3');

I was reviewing a program where the code went to a lot of work to handle the possibility that the SASUSER libref was pointing to multiple physical directories.

 

My question is: 

Has anyone ever seen a situation where SAS will actually define SASUSER to point to more than one physical directory?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Thanks.  I suspect that the code was copied from a situation where multiple directories were possible for the libref they wanted to search.

 

Anyway here is what I came up with as a compromise just in case anyone actually did try to point SASUSER to multiple directories.

*----------------------------------------------------------------------------;
* Check for xxxx.txt file in SASUSER directory. ;
*----------------------------------------------------------------------------;
%let _filename=;
data _null_;
  set sashelp.vlibnam;
  by level;
  where libname='SASUSER';
  if first.level;
  if fileexist(catx('/',path,'xxxx.txt')) then do;
    call symputx('_filename',catx('/',path,'xxxx.txt'));
    stop;
  end;
run;

View solution in original post

5 REPLIES 5
Reeza
Super User
I can't check right now, but I believe that's true by default in the config file. SASHELP points to several directories as well.
Tom
Super User Tom
Super User

 

But I have never seen it for SASUSER and cannot even think of a case where you would want to point SASUSER to multiple directories.

 

SASHELP on Windows definitely points to multiple directories. 

802   %put %sysfunc(pathname(sashelp));
( 'C:\Program Files\SASHome\SASFoundation\9.4\nls\en\SASCFG' 'C:\Program Files\SASHome\SASFoundation\9.4\core\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\aacomp\sashelp' 'C:\Program Files\SASHome\SASFoundation\9.4\af\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\assist\sashelp' 'C:\Program Files\SASHome\SASFoundation\9.4\cas\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\cmp\sashelp' 'C:\Program Files\SASHome\SASFoundation\9.4\connect\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\eis\sashelp' 'C:\Program Files\SASHome\SASFoundation\9.4\ets\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\graph\sashelp' 'C:\Program Files\SASHome\SASFoundation\9.4\iml\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\mlearning\sashelp' 'C:\Program Files\SASHome\SASFoundation\9.4\or\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\qc\sashelp' 'C:\Program Files\SASHome\SASFoundation\9.4\spdsclient\sashelp' 'C:\Program
Files\SASHome\SASFoundation\9.4\stat\sashelp' )

On Unix usually not as many.

1    %put %sysfunc(pathname(sashelp));
( '/Volumes/app/sas/prod/sas9.4/SASFoundation/9.4/nls/en/sascfg'
'/Volumes/app/sas/prod/sas9.4/SASFoundation/9.4/nls/en/sascfg'
'/Volumes/app/sas/prod/sas9.4/SASFoundation/9.4/sashelp' )
SASKiwi
PROC Star

What would be the use of an aggregate SASUSER library? The idea of the SASUSER is to store user-specific data and configurations. For example the SAS Windowing Environment stores its PROFILE catalog here. With an aggregate library only the first directory in the sequence would ever get written to when using SASUSER.

Kurt_Bremser
Super User

Imagine a directory with a formats.sas7bcat in it. Appending that to the user's own sasuser.v94 by using a concatenated SASUSER might be used to distribute formats from a central location, but there are much better ways to achieve this.

Tom
Super User Tom
Super User

Thanks.  I suspect that the code was copied from a situation where multiple directories were possible for the libref they wanted to search.

 

Anyway here is what I came up with as a compromise just in case anyone actually did try to point SASUSER to multiple directories.

*----------------------------------------------------------------------------;
* Check for xxxx.txt file in SASUSER directory. ;
*----------------------------------------------------------------------------;
%let _filename=;
data _null_;
  set sashelp.vlibnam;
  by level;
  where libname='SASUSER';
  if first.level;
  if fileexist(catx('/',path,'xxxx.txt')) then do;
    call symputx('_filename',catx('/',path,'xxxx.txt'));
    stop;
  end;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 704 views
  • 2 likes
  • 4 in conversation