<?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: Programming Help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875195#M345809</link>
    <description>&lt;P&gt;You can use substr function in SAS to extract sub-string from a string. You can set the start and end position to fetch sub string from variable v1.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93854"&gt;@kumarsandip975&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this one:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data out; 
set t1;
v1_new = substr(v1,1, 33);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 May 2023 12:53:07 GMT</pubDate>
    <dc:creator>MayurJadhav</dc:creator>
    <dc:date>2023-05-11T12:53:07Z</dc:date>
    <item>
      <title>Extract folder search path from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875189#M345806</link>
      <description>&lt;P&gt;data t1;&lt;BR /&gt;length v1 $ 100;&lt;BR /&gt;input v1 $;&lt;BR /&gt;datalines;&lt;BR /&gt;G:/Data/CXV/PGMS/CTS_Test/Scripts/ScannedFiles1.txt&lt;BR /&gt;D:/Data/ABC/PGMS/CTS_Test/Scripts/ScannedFiles2.txt&lt;BR /&gt;E:/Data/XYZ/PGMS/CTS_Test/Scripts/ScannedFiles3.txt&lt;BR /&gt;C:/Data/DEF/PGMS/CTS_Test/Scripts/ScannedFiles4.txt&lt;BR /&gt;F:/Data/JFK/PGMS/CTS_Test/Scripts/ScannedFiles5.txt&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to extract only folder, not file (which is last ). Can you please help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;G:/Data/CXV/PGMS/CTS_Test/Scripts&lt;BR /&gt;D:/Data/ABC/PGMS/CTS_Test/Scripts&lt;BR /&gt;E:/Data/XYZ/PGMS/CTS_Test/Scripts&lt;BR /&gt;C:/Data/DEF/PGMS/CTS_Test/Scripts&lt;BR /&gt;F:/Data/JFK/PGMS/CTS_Test/Scripts&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in Adavance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 15:04:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875189#M345806</guid>
      <dc:creator>kumarsandip975</dc:creator>
      <dc:date>2023-05-11T15:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Programming Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875195#M345809</link>
      <description>&lt;P&gt;You can use substr function in SAS to extract sub-string from a string. You can set the start and end position to fetch sub string from variable v1.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93854"&gt;@kumarsandip975&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this one:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data out; 
set t1;
v1_new = substr(v1,1, 33);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 May 2023 12:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875195#M345809</guid>
      <dc:creator>MayurJadhav</dc:creator>
      <dc:date>2023-05-11T12:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Programming Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875199#M345811</link>
      <description>&lt;P&gt;Addition to the above solution.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set t1;
v2= substr(v1, 1, length(v1) - length(scan(v1, -1, '/'))-1);
proc print; run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code works for dynamic path.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 13:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875199#M345811</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2023-05-11T13:14:23Z</dc:date>
    </item>
    <item>
      <title>Finding folder name from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875200#M345812</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set t1;
    where=find(v1,'/',-100);
    folder_name=substr(v1,1,where-1);
    drop where;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93854"&gt;@kumarsandip975&lt;/a&gt;&amp;nbsp;please do not use meaningless subject lines like "Programming Help", because virtually every thread can be "Programming Help". Please, from now on, make the subject line a brief description of the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 13:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875200#M345812</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-11T13:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extract folder search path from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875432#M345888</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t1;
length v1 $ 100;
input v1 $;
want=prxchange('s/\/[^\/]+$//',1,strip(v1));
datalines;
G:/Data/CXV/PGMS/CTS_Test/Scripts/ScannedFiles1.txt
D:/Data/ABC/PGMS/CTS_Test/Scripts/ScannedFiles2.txt
E:/Data/XYZ/PGMS/CTS_Test/Scripts/ScannedFiles3.txt
C:/Data/DEF/PGMS/CTS_Test/Scripts/ScannedFiles4.txt
F:/Data/JFK/PGMS/CTS_Test/Scripts/ScannedFiles5.txt
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2023 11:40:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-folder-search-path-from-string/m-p/875432#M345888</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-05-12T11:40:07Z</dc:date>
    </item>
  </channel>
</rss>

