<?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 get this substring in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257640#M57270</link>
    <description>&lt;P&gt;There are several methods, I choose this one for brevity:&lt;/P&gt;
&lt;PRE&gt;data want;
  length result $200;
  string="*475664/779* 475664/780* 475664/4341* 483220/1577*";
  do i=1 to countw(string,"*");
    result=catx(",",result,scan(scan(string,i,"*"),2,'/'));
  end;
run;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Mar 2016 15:16:48 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-03-18T15:16:48Z</dc:date>
    <item>
      <title>How to get this substring</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257639#M57269</link>
      <description>&lt;P&gt;Hello all;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a string like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"*475664/779* 475664/780* 475664/4341* 483220/1577*"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want get these 4 strings locate &amp;nbsp;after "/" and before "*":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;779, 780, 4341, 1577,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another words, &amp;nbsp;If I&amp;nbsp;only want keep&amp;nbsp;characters&amp;nbsp;&amp;nbsp;between'/' and '*' ,what should I do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 15:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257639#M57269</guid>
      <dc:creator>GeorgeSAS</dc:creator>
      <dc:date>2016-03-18T15:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get this substring</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257640#M57270</link>
      <description>&lt;P&gt;There are several methods, I choose this one for brevity:&lt;/P&gt;
&lt;PRE&gt;data want;
  length result $200;
  string="*475664/779* 475664/780* 475664/4341* 483220/1577*";
  do i=1 to countw(string,"*");
    result=catx(",",result,scan(scan(string,i,"*"),2,'/'));
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Mar 2016 15:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257640#M57270</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-18T15:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get this substring</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257641#M57271</link>
      <description>&lt;P&gt;Does all of your data have this structure?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the scan function...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;first=scan(string, 2, "/*");
second=scan(string, 4, "/*);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Mar 2016 15:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257641#M57271</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-18T15:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get this substring</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257729#M57272</link>
      <description>&lt;P&gt;With regular expression pattern matching:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
if not prx0 then prx0 + prxParse("#\/[^/*]+\*#");
str = "*475664/779* 475664/780* 475664/4341* 483220/1577*";
start = 1;
call prxNext(prx0, start, -1, str, pos, len);
do subStrNo = 1 by 1 while (pos &amp;gt; 0);
    subStr = substr(str, pos+1, len-2);
    output;
    call prxNext(prx0, start, -1, str, pos, len);
    end;
keep subStrNo subStr;
run;

proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The pattern reads: Character /, followed with one or more characters except / or *, followed by character *.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2016 02:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257729#M57272</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-19T02:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get this substring</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257752#M57275</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
pid=prxparse("/(?&amp;lt;=\/)\w+(?=\*)/");
str = "*475664/779* 475664/780* 475664/4341* 483220/1577*";
start = 1;
stop=length(str);
length want $ 200;
call prxnext(pid, start, stop, str, pos, len);
do while (pos &amp;gt; 0);
    want=catx(',',want,substr(str, pos, len));
    call prxnext(pid, start, stop, str, pos, len);
end;
put want=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Mar 2016 10:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257752#M57275</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-19T10:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get this substring</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257775#M57282</link>
      <description>&lt;P&gt;Why need two prxnext function? can we remove the first one? and how if I want to keep space symbol?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2016 19:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257775#M57282</guid>
      <dc:creator>GeorgeSAS</dc:creator>
      <dc:date>2016-03-19T19:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get this substring</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257805#M57287</link>
      <description>&lt;P&gt;No. You have to have two call prxnext().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
pid=prxparse("/(?&amp;lt;=\/)\s*\w+\s*(?=\*)/");
str = "*475664/ 779 * 475664/ 780* 475664/4341* 483220/1577*";
start = 1;
stop=length(str);
length want $ 200;
call prxnext(pid, start, stop, str, pos, len);
do while (pos &amp;gt; 0);
    want=catx(',',want,translate(substr(str, pos, len),'09'x,' '));
    call prxnext(pid, start, stop, str, pos, len);
end;
want=translate(want,' ','09'x);
put want=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Mar 2016 02:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-this-substring/m-p/257805#M57287</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-20T02:17:02Z</dc:date>
    </item>
  </channel>
</rss>

