<?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: Find the path of a filename in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397341#M96026</link>
    <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i have only the file name text.txt with me.&lt;/P&gt;&lt;P&gt;Don't know the path.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2017 07:13:47 GMT</pubDate>
    <dc:creator>chithra</dc:creator>
    <dc:date>2017-09-20T07:13:47Z</dc:date>
    <item>
      <title>Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397333#M96022</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to find the pathname of a filename in sas. The input should be only the filename.&lt;/P&gt;&lt;P&gt;Is it possible in SAS? or anybody knows how this can be done in UNIX?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chithra&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 06:15:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397333#M96022</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2017-09-20T06:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397339#M96025</link>
      <description>&lt;P&gt;Try this.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
filename="c:\windows\text.txt";
path=substr(filename,1,find(filename,reverse(scan(reverse(filename),1,"\")))-1);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 07:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397339#M96025</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-20T07:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397341#M96026</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i have only the file name text.txt with me.&lt;/P&gt;&lt;P&gt;Don't know the path.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 07:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397341#M96026</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2017-09-20T07:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397342#M96027</link>
      <description>&lt;P&gt;Here's a step by step approach&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  value='C:\Windows\Test.txt';
  file=scan(value,-1,"\");
  endpos=find(value,strip(file));
path=substr(value,1,endpos-1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 07:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397342#M96027</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-20T07:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397343#M96028</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;To find a file on a Unix server, type this at a Unix command line:&lt;/FONT&gt;&amp;nbsp;&lt;CODE&gt;find / -name text.txt&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;I wouldn't recommend doing this from SAS, assuming that you only want to do it once&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 07:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397343#M96028</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-09-20T07:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397344#M96029</link>
      <description>&lt;P&gt;Oh now i understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;options noxwait;&lt;BR /&gt;FILENAME pathloc 'e:\test.txt';

data MYPATH;
  x "dir e:\sample.txt /s /p &amp;gt; e:\test.txt";
infile pathloc;
input locator $100.;
if indexw(locator,'Directory of');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#1 assign a fileref (just like a libname statement)&amp;nbsp;&lt;/P&gt;&lt;P&gt;#2 Use x command and specify a directory and the file that will be searched, file is saved (same as fileref).&lt;/P&gt;&lt;P&gt;#3. Read the saved file.&lt;/P&gt;&lt;P&gt;#4 Look and retian the keywords "Directory of"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 07:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397344#M96029</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-20T07:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397356#M96034</link>
      <description>&lt;P&gt;yes..exactly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks. I use this command with pipe and it works fine.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 08:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397356#M96034</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2017-09-20T08:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397357#M96035</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this also. This helps.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 08:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/397357#M96035</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2017-09-20T08:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/490785#M128514</link>
      <description>&lt;P&gt;Go here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245924.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245924.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 11:40:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/490785#M128514</guid>
      <dc:creator>PatrickCuba</dc:creator>
      <dc:date>2018-08-29T11:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Find the path of a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/634074#M188170</link>
      <description>&lt;P&gt;To find the path to a filename use:&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let myFilePath=%sysfunc(pathname(&lt;EM&gt;myFileName&lt;/EM&gt;));&lt;/P&gt;&lt;P&gt;or for a library, use:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;%let myLibraryPath=%sysfunc(pathname(&lt;/SPAN&gt;&lt;EM&gt;myLibName&lt;/EM&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;See:&amp;nbsp;&lt;FONT&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245924.htm" target="_blank" rel="noopener"&gt;https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245924.htm&lt;/A&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 12:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-path-of-a-filename/m-p/634074#M188170</guid>
      <dc:creator>JimE</dc:creator>
      <dc:date>2020-03-23T12:13:30Z</dc:date>
    </item>
  </channel>
</rss>

