<?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: Extract filename from path string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/51719#M10877</link>
    <description>As I understand your post, you want to extract the "filename.extension" information from a complete file-path data string?  If this is true, you can use the SCAN function in a DATA step with the third argument "-1" with the delimiter "\" as you have explained.  If you are using the SAS macro language, you can use the function %SYSFUNC along with SCAN, as explained above.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS.COM support website resources:&lt;BR /&gt;
&lt;BR /&gt;
-- SAS 9.2 DOC on SCAN function:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000214639.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000214639.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
-- SAS Documentation web page:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/onlinedoc/base/index.html" target="_blank"&gt;http://support.sas.com/documentation/onlinedoc/base/index.html&lt;/A&gt;</description>
    <pubDate>Mon, 06 Oct 2008 01:29:07 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2008-10-06T01:29:07Z</dc:date>
    <item>
      <title>Extract filename from path string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/51718#M10876</link>
      <description>Hi, &lt;BR /&gt;
&lt;BR /&gt;
I have a string to store the path of a file, such as:C:\abc\example.csv&lt;BR /&gt;
&lt;BR /&gt;
Suppose, Now, I have a lot of paths.&lt;BR /&gt;
Like, C:\abc\1.csv&lt;BR /&gt;
 C:\abc\information\1.csv&lt;BR /&gt;
 C:\abc\t\aac.csv&lt;BR /&gt;
 e:\abct\b.csv&lt;BR /&gt;
......&lt;BR /&gt;
&lt;BR /&gt;
How can I get the filename(example) from the undefined string?&lt;BR /&gt;
I think I can use substr to find the last '.'  and position of last '/' , then get the filename.&lt;BR /&gt;
How can I do that?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Mon, 06 Oct 2008 00:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/51718#M10876</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-06T00:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Extract filename from path string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/51719#M10877</link>
      <description>As I understand your post, you want to extract the "filename.extension" information from a complete file-path data string?  If this is true, you can use the SCAN function in a DATA step with the third argument "-1" with the delimiter "\" as you have explained.  If you are using the SAS macro language, you can use the function %SYSFUNC along with SCAN, as explained above.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS.COM support website resources:&lt;BR /&gt;
&lt;BR /&gt;
-- SAS 9.2 DOC on SCAN function:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000214639.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000214639.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
-- SAS Documentation web page:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/onlinedoc/base/index.html" target="_blank"&gt;http://support.sas.com/documentation/onlinedoc/base/index.html&lt;/A&gt;</description>
      <pubDate>Mon, 06 Oct 2008 01:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/51719#M10877</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-10-06T01:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extract filename from path string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/51720#M10878</link>
      <description>Hi, Scott, thank you for you time. &lt;BR /&gt;
&lt;BR /&gt;
I solved it!&lt;BR /&gt;
&lt;BR /&gt;
Best wishes,&lt;BR /&gt;
Jun</description>
      <pubDate>Mon, 06 Oct 2008 05:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/51720#M10878</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-06T05:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extract filename from path string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/293779#M61218</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please share, how did you solved it, as i m looking for same thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Sunil&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 16:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-filename-from-path-string/m-p/293779#M61218</guid>
      <dc:creator>SunilJ</dc:creator>
      <dc:date>2016-08-24T16:59:05Z</dc:date>
    </item>
  </channel>
</rss>

