<?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: question on substring in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293606#M61149</link>
    <description>&lt;PRE&gt;
Another one :


data code;
input code $;
cards;
35
10
20
50
3540
36x40
;
run;
 
 
 
data B;
input x $80.;
cards;
a35,a90
a36,a3540
zz72
jj36x40, jj3640,jj72
a10,x1010
;
run;
data want;
 if _n_=1 then do;
  if 0 then set code;
  declare hash h(dataset:'code');
  h.definekey('code');
  h.definedone();
 end;
set b;
do i=1 to countw(x,',');
 temp=scan(x,i,',');
 temp1=prxchange('s/^\D+//',1,temp);
 if h.find(key:temp1)=0 then new_code=temp;
end;
drop temp temp1 i code;
run;


&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 Aug 2016 02:58:45 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-08-24T02:58:45Z</dc:date>
    <item>
      <title>question on substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293510#M61098</link>
      <description>&lt;P&gt;Thank you all for your help. I have a follow up on this question that I posted earlier&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/question-on-substring/m-p/293499#M61090" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/question-on-substring/m-p/293499#M61090&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my table A is as before only consistent of the below&lt;/P&gt;
&lt;P&gt;code&lt;/P&gt;
&lt;P&gt;35&lt;/P&gt;
&lt;P&gt;10&lt;/P&gt;
&lt;P&gt;20&lt;/P&gt;
&lt;P&gt;50&lt;/P&gt;
&lt;P&gt;3540&lt;/P&gt;
&lt;P&gt;&amp;nbsp;36x40&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;table B&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;code&lt;/P&gt;
&lt;P&gt;a35,a90&lt;/P&gt;
&lt;P&gt;a36,a3540&lt;/P&gt;
&lt;P&gt;zz72&lt;/P&gt;
&lt;P&gt;jj36x40, jj3640,jj72&lt;/P&gt;
&lt;P&gt;a10,x1010&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like the output to be table B where I would like to add an extra column which has the only those codes which are available in table A&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;table B&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;code &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; codenew&lt;/P&gt;
&lt;P&gt;a35,a90 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a35&lt;/P&gt;
&lt;P&gt;a36,a3540 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a3540&lt;/P&gt;
&lt;P&gt;zz72&lt;/P&gt;
&lt;P&gt;jj36x40, jj3640, jj72 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jj36x40&lt;/P&gt;
&lt;P&gt;a10,x1010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;THanks again for your help&lt;/P&gt;
&lt;P&gt;I tried with find but&amp;nbsp;I am not getting the answer I want if there is any other function whcih can help me do this.&lt;/P&gt;
&lt;P&gt;Thanks so much&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 17:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293510#M61098</guid>
      <dc:creator>hdg</dc:creator>
      <dc:date>2016-08-23T17:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: question on substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293542#M61113</link>
      <description>&lt;P&gt;What do you want if there are multiple matches in A?&lt;/P&gt;
&lt;P&gt;Since I doubt that your A example has all the values you are concerned with, is there any chance that the A set has a value like 40 which would be a substring of your values 3540 and 36x40? If so would 40 also match anything that 36x40 matches?&lt;/P&gt;
&lt;P&gt;In a minor bit, does any character other than a comma separate your values in dataset B?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why doesn't&amp;nbsp;x1010 match 10?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to be looking a INDEX as part of the solution but you need to address some of the questions above.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 19:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293542#M61113</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-23T19:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: question on substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293604#M61147</link>
      <description>&lt;PRE&gt;
First of all, you need to know what kind of character you should clear up .


data code;
input code $;
cards;
35
10
20
50
3540
36x40
;
run;
 
 
 
data B;
input x $80.;
cards;
a35,a90
a36,a3540
zz72
jj36x40, jj3640,jj72
a10,x1010
;
run;
data want;
 if _n_=1 then do;
  if 0 then set code;
  declare hash h(dataset:'code');
  h.definekey('code');
  h.definedone();
 end;
set b;
do i=1 to countw(x,',');
 temp=scan(x,i,',');
 temp1=compress(temp,'x','kd');
 if h.find(key:temp1)=0 then new_code=temp;
end;
drop temp temp1 i code;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Aug 2016 02:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293604#M61147</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-24T02:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: question on substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293606#M61149</link>
      <description>&lt;PRE&gt;
Another one :


data code;
input code $;
cards;
35
10
20
50
3540
36x40
;
run;
 
 
 
data B;
input x $80.;
cards;
a35,a90
a36,a3540
zz72
jj36x40, jj3640,jj72
a10,x1010
;
run;
data want;
 if _n_=1 then do;
  if 0 then set code;
  declare hash h(dataset:'code');
  h.definekey('code');
  h.definedone();
 end;
set b;
do i=1 to countw(x,',');
 temp=scan(x,i,',');
 temp1=prxchange('s/^\D+//',1,temp);
 if h.find(key:temp1)=0 then new_code=temp;
end;
drop temp temp1 i code;
run;


&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Aug 2016 02:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-on-substring/m-p/293606#M61149</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-24T02:58:45Z</dc:date>
    </item>
  </channel>
</rss>

