<?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 do I get the name of the file a Libref is referring to? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377392#M90611</link>
    <description>&lt;P&gt;The SET statement supports the INDSNAME= option.&amp;nbsp; That should be a possibility.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2017 15:29:05 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-07-19T15:29:05Z</dc:date>
    <item>
      <title>How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377366#M90600</link>
      <description>&lt;P&gt;I am wondering if there is a way to pull the name of the file defined in the LIBNAME statement into a variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is, is there an analog to the FILENAME= option of the INFILE statement for the SET statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to be able to access the name of the file to place it in report titles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 14:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377366#M90600</guid>
      <dc:creator>pplummer62</dc:creator>
      <dc:date>2017-07-19T14:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377392#M90611</link>
      <description>&lt;P&gt;The SET statement supports the INDSNAME= option.&amp;nbsp; That should be a possibility.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377392#M90611</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-19T15:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377398#M90614</link>
      <description>&lt;P&gt;you can extract pathnames from dictionary.members or by using pathname function. Need to use capital letters while using dictionary.members. replace yourlib with libname&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
select distinct path as path_var from dictionary.members
where libname= 'YOURLIB';
data abc;
path_var=pathname('yourlib');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377398#M90614</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-07-19T15:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377417#M90622</link>
      <description>This almost does it.&lt;BR /&gt;If you have the statement LIBNAME FILEREF "SASDATASET; in your program&lt;BR /&gt;&lt;BR /&gt;Then when you use this: SET FILEREF.SETNAME INDSNAME= DSNAME , the value of DSNAME is FILEREF.SETNAME when what I was wanting it to be equal to SASDATASET.&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377417#M90622</guid>
      <dc:creator>pplummer62</dc:creator>
      <dc:date>2017-07-19T15:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377463#M90641</link>
      <description>&lt;P&gt;looks like you have by mistakenly, selected my answer as accepted answer instead of &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;answer&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377463#M90641</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-07-19T17:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377465#M90642</link>
      <description>&lt;P&gt;You could easily have been right ... I wasn't sure what the end goal was either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, use the SCAN function to pick out the second part of the name returned by INDSNAME=:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;member_name = scan(full_name, 2, '.');&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/377465#M90642</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-19T17:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/378092#M90827</link>
      <description>&lt;P&gt;I found that this worked when using a file on the SAS server.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I failed to mention was that I was using the code while connected to the mainframe.&amp;nbsp; When connected to the mainframe, it is necessary to use the PROC SQL answer of kirnav_.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 12:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/378092#M90827</guid>
      <dc:creator>pplummer62</dc:creator>
      <dc:date>2017-07-21T12:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the name of the file a Libref is referring to?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/378111#M90828</link>
      <description>&lt;P&gt;The PATHNAME() function will return the path that a libref or fileref is using.&lt;/P&gt;
&lt;P&gt;You can use it in a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  length path $256 ;
  path=pathname('mylib');
  put path= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or wrap it in %SYSFUNC() and use it directly in macro code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=%sysfunc(pathname(mylib));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also ask PROC CONTENTS to tell you where a particular dataset is. That is useful if you libref is actually pointing to multiple directories.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=mylib.mymember;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jul 2017 12:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-name-of-the-file-a-Libref-is-referring-to/m-p/378111#M90828</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-21T12:46:36Z</dc:date>
    </item>
  </channel>
</rss>

