BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
cosmid
Lapis Lazuli | Level 10

Hi,

 

So the PUT can print a data variable and its value to the log and the %PUT can do the same for Macro variables. Is there a way to do this for libname vars?

 

For example, if I have a libname defined as the following:

libname x "%SYSGET(dir)";

If the above code is written as:

%let x = %sysget(dir);

I can get the value of x by using %PUT x; What can I do if %LET is replaced with LIBNAME? I know in a SAS log, it'll print out the definition of a libname defined in the program. I guess my question is, if you can print a Macro variable or a SAS data step variable, can you do something similar for a libname var?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

A libref is not a variable.

But the LIBNAME statement does have an option for displaying information about an existing libref.

Try :

libname x list;

If you only want the path that the libref points to use the PATHNAME() function.

%put Path for libref X is %qsysfunc(pathname(X,L));

 

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

A libref is not a variable.

But the LIBNAME statement does have an option for displaying information about an existing libref.

Try :

libname x list;

If you only want the path that the libref points to use the PATHNAME() function.

%put Path for libref X is %qsysfunc(pathname(X,L));

 

Kurt_Bremser
Super User

There are no libname variables. LIBNAME is a statement, and it creates a library reference. The attributes of a library reference can be displayed with the LIST option of the LIBNAME statement.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 2 replies
  • 502 views
  • 3 likes
  • 3 in conversation