<?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 extract this string? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563444#M157964</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input path $50.;&lt;BR /&gt;datalines;&lt;BR /&gt;/c:/user/new/path1/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/old/new/path1/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/new/path5/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/old/new/path5/path2/path3/path4/cjx.sas&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;new_path= Tranwrd(path,'cjx.sas',"");&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anushree&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2019 05:52:12 GMT</pubDate>
    <dc:creator>anushreebiotech</dc:creator>
    <dc:date>2019-06-04T05:52:12Z</dc:date>
    <item>
      <title>How to extract this string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563430#M157956</link>
      <description>Hi team, &lt;BR /&gt;&lt;BR /&gt;I have a dataset with a variable path, I need to extract the path till last but one and save it as new variable. Example:&lt;BR /&gt;Path;&lt;BR /&gt;/c:/user/new/path1/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/old/new/path1/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/new/path5/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/old/new/path5/path2/path3/path4/cjx.sas&lt;BR /&gt;&lt;BR /&gt;What I want is:&lt;BR /&gt;Path_1;&lt;BR /&gt;/c:/user/new/path1/path2/path3/path4/&lt;BR /&gt;/c:/user/old/new/path1/path2/path3/path4/&lt;BR /&gt;/c:/user/new/path5/path2/path3/path4/&lt;BR /&gt;/c:/user/old/new/path5/path2/path3/path4/&lt;BR /&gt;&lt;BR /&gt;Regards, &lt;BR /&gt;GK&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Jun 2019 03:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563430#M157956</guid>
      <dc:creator>Ganeshk</dc:creator>
      <dc:date>2019-06-04T03:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract this string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563435#M157961</link>
      <description>&lt;P&gt;Would this work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	FilePath = "/c:/user/new/path1/path2/path3/path4/cjx.sas";
	Folder = substr(FilePath,1,length(FilePath)-length(scan(FilePath,-1,"/")));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 03:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563435#M157961</guid>
      <dc:creator>heffo</dc:creator>
      <dc:date>2019-06-04T03:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract this string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563442#M157962</link>
      <description>&lt;P&gt;Or by using substr and findc:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have_want;
   length path directory $ 200;

   input path;

   directory = substr(path, 1, findc(path, '/', 'b'));

datalines;
/c:/user/new/path1/path2/path3/path4/cjx.sas
/c:/user/old/new/path1/path2/path3/path4/cjx.sas
/c:/user/new/path5/path2/path3/path4/cjx.sas
/c:/user/old/new/path5/path2/path3/path4/cjx.sas
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 05:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563442#M157962</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-06-04T05:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract this string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563444#M157964</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input path $50.;&lt;BR /&gt;datalines;&lt;BR /&gt;/c:/user/new/path1/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/old/new/path1/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/new/path5/path2/path3/path4/cjx.sas&lt;BR /&gt;/c:/user/old/new/path5/path2/path3/path4/cjx.sas&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;new_path= Tranwrd(path,'cjx.sas',"");&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anushree&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 05:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563444#M157964</guid>
      <dc:creator>anushreebiotech</dc:creator>
      <dc:date>2019-06-04T05:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract this string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563506#M157989</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have_want;
   length path directory $ 200;

   input path;

   directory = prxchange('s/[^\/]+$//',1,strip(path));

datalines;
/c:/user/new/path1/path2/path3/path4/cjx.sas
/c:/user/old/new/path1/path2/path3/path4/cjx.sas
/c:/user/new/path5/path2/path3/path4/cjx.sas
/c:/user/old/new/path5/path2/path3/path4/cjx.sas
;
run;

proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-this-string/m-p/563506#M157989</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-06-04T12:53:58Z</dc:date>
    </item>
  </channel>
</rss>

