Hello experts,
with sas under unix, the administrator define a server path acces, -it can be called $home time or other - it will be used for the allocation of library ...
example /app/server1
libname lib "/app/server1/files/project01";
Please, how can I identify this path ( /app/server1, some can be $home or not)
You already have the path, what do you need to identify?
The UNIX environment variable $HOME (note the capitalization) contains the absolute path to the user's home directory.
Not sure if the following could work. libname lib "."; %put %sysfunc(pathname(lib));
I don't really understand what you're asking for. Assuming you want to list all the UNIX/Linux environment variable which exist during as SAS session then the following code should do (not tested).
filename ll pipe 'env';
data _null_;
infile ll;
input;
put _infile_;
run;
filename ll clear;
If you just want to get the physical path for a defined library, use the pathname() function.
@ll: Thank you all for answer.
No, I do not know that path which will be before every directory for allocating a sas unix library.
In my question, I give "/app/server1" as example. In first, I do not know why this special Path in sas unix ? and how can we identify it ?
You really need to explain better what you have and what you're after. Is this directory you're talking about the folder "Files" you see in the Server tree in EG or SAS Studio?
And you would want to know the path to "Files" as set in SMC?
This root path should never change once defined for a server so easiest would be to get the information from your SAS Admin.
So far I couldn't find an automatic macro variable or the like containing this root path and I want to avoid proposing to query SAS Metadata directly. May be ask your SAS Admin to define such a macro variable in the Server Context autoexec which contains this root path so you can use it programmatically.
Another way: Go to a sub-folder and add a SAS table to your project. Then look at this SAS table's properties. That will give you the path.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.