<?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 remove  words after '\' in a string? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458035#M284481</link>
    <description>&lt;P&gt;You could double reverse it:&lt;/P&gt;
&lt;PRE&gt;data want;
  pth=reverse(scan(reverse("&amp;amp;path."),1,"\"));
run;&lt;/PRE&gt;
&lt;P&gt;Basically reverse the string, scna off the first block based on \ delimiter, then reverse the result.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Apr 2018 08:05:41 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-04-27T08:05:41Z</dc:date>
    <item>
      <title>How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458013#M284478</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a macro variable something like below and i want to remove the string after the last '\'. and store the output in macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let path = D:\input\sas\files\today\chart_data*.sas7bdat;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected output is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;D:\input\sas\files\today\&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically i want to remove all the words after the last '\'. Can someone please help me to get the desired output? Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 03:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458013#M284478</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2018-04-27T03:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458015#M284479</link>
      <description>Take a look at the findc() and %substr() functions.</description>
      <pubDate>Fri, 27 Apr 2018 03:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458015#M284479</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-04-27T03:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458016#M284480</link>
      <description>&lt;P&gt;One easy and lazy way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path = D:\input\sas\files\today\chart_data*.sas7bdat;

data _null_;
k="&amp;amp;path";
call scan(k, -1, position, length,'\');
substr(k,position,length)=' ';
call symputx('path',k);
run;

%put &amp;amp;path;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I challenge you to accomplish the same with %syscall with call scan in open code or rxchange&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 03:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458016#M284480</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-27T03:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458035#M284481</link>
      <description>&lt;P&gt;You could double reverse it:&lt;/P&gt;
&lt;PRE&gt;data want;
  pth=reverse(scan(reverse("&amp;amp;path."),1,"\"));
run;&lt;/PRE&gt;
&lt;P&gt;Basically reverse the string, scna off the first block based on \ delimiter, then reverse the result.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 08:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458035#M284481</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-27T08:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458114#M284482</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path = D:\input\sas\files\today\chart_data*.sas7bdat;
%let want=%sysfunc(prxchange(s/[^\\\/]+$//,1,&amp;amp;path));

%put &amp;amp;want;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Apr 2018 13:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458114#M284482</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-27T13:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458119#M284483</link>
      <description>It worked. Thank You!</description>
      <pubDate>Fri, 27 Apr 2018 13:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458119#M284483</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2018-04-27T13:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458121#M284484</link>
      <description>Got it, Thank You!</description>
      <pubDate>Fri, 27 Apr 2018 13:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458121#M284484</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2018-04-27T13:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove  words after '\' in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458122#M284485</link>
      <description>I will give it a try with %syscall, thank you!</description>
      <pubDate>Fri, 27 Apr 2018 13:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-words-after-in-a-string/m-p/458122#M284485</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2018-04-27T13:26:21Z</dc:date>
    </item>
  </channel>
</rss>

