BookmarkSubscribeRSS Feed
Calcite | Level 5



In one of my programs, i know the library reference associated with the Database. But i need to find the Server id that has been provided for server=option while creating the libname statement. I checked Dictionary tables and couldn't find the field which holds the server information. 


For example,

libname mydata informix server=year16; --> my libname statement.

But from the programs, i know only the libref name "mydata". how to retrieve the server value "year16" using the libref "mydata"


Thanks for you help!


You are correct. You won't find the the server name in the SAS dictionary tables. A simple solution to this problem would be to use a macro variable to define your server name then you can use it anywhere in your program:



%let MyServer = year16; 

libname mydata informix server=&MyServer;

%put My Server is called: &MyServer;


Calcite | Level 5

Thanks for the response @SASKiwi , my problem is that i am working on a macro that can be added to any program and the macro need to identify the server of the libname passed into it. The libname could have been declared anywhere in the program.



Aswin K

Super User Tom
Super User

Query the metadata tables.  You can use SASHELP.VLIBNAM view. Or with SQL you can reference it directly as DICTIONARY.LIBNAMES.


Here is a link to macro that will return the Engine type, Hostname and schema/database name from that table.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 3 in conversation