<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to retrieve Server id from libref for Database in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/513160#M2491</link>
    <description>&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let MyServer = year16; 

libname mydata informix server=&amp;amp;MyServer;

%put My Server is called: &amp;amp;MyServer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 00:04:38 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2018-11-15T00:04:38Z</dc:date>
    <item>
      <title>How to retrieve Server id from libref for Database</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/513081#M2486</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;libname&amp;nbsp;mydata informix server=year16; --&amp;gt; my libname statement.&lt;/P&gt;&lt;P&gt;But from the programs, i&amp;nbsp;know only the libref name "mydata". how to retrieve the server value "year16" using the libref "mydata"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for you help!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 20:06:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/513081#M2486</guid>
      <dc:creator>Aswin_K</dc:creator>
      <dc:date>2018-11-14T20:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve Server id from libref for Database</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/513160#M2491</link>
      <description>&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let MyServer = year16; 

libname mydata informix server=&amp;amp;MyServer;

%put My Server is called: &amp;amp;MyServer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 00:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/513160#M2491</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-11-15T00:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve Server id from libref for Database</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/515512#M2939</link>
      <description>&lt;P&gt;Thanks for the response&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;, 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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Aswin K&lt;/P&gt;</description>
      <pubDate>Fri, 23 Nov 2018 09:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/515512#M2939</guid>
      <dc:creator>Aswin_K</dc:creator>
      <dc:date>2018-11-23T09:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve Server id from libref for Database</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/515712#M2975</link>
      <description>&lt;P&gt;Query the metadata tables.&amp;nbsp; You can use SASHELP.VLIBNAM view. Or with SQL you can reference it directly as DICTIONARY.LIBNAMES.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a link to macro that will return the Engine type, Hostname and schema/database name from that table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/dblibchk.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/dblibchk.sas&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Nov 2018 08:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-retrieve-Server-id-from-libref-for-Database/m-p/515712#M2975</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-24T08:47:30Z</dc:date>
    </item>
  </channel>
</rss>

