<?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: Loop through second Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298348#M312162</link>
    <description>&lt;P&gt;index() function should be able to handle it:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  A.*,
             case when B.VAL is not null then 1 else 0 end
  from    LONGSTRING A
  left join SMALLDATA B
  on        index(A.VAL,B.VAL)&amp;gt;0;
quit;&lt;/PRE&gt;
&lt;P&gt;This should join the small dataset to the larger one, based on finding the small string in the big string.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Sep 2016 15:01:52 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-09-14T15:01:52Z</dc:date>
    <item>
      <title>Loop through second Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298347#M312161</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I have two sasdatasets , one has column ID which has 8 digit number. The second dataset has a text field in which it has ID from the first dataset any where placed in the text field. &amp;nbsp;I need a column in the second dataset which says "exists" &amp;nbsp;if the ID exists in the first dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;&amp;nbsp; First Dataset : 12345678&lt;/P&gt;&lt;P&gt;&amp;nbsp; Second data set text Value: **Request #&lt;SPAN&gt;12345678&lt;/SPAN&gt;-Corporate Membership&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the text field the ID value can be anywhere in the text.&amp;nbsp;Basically for every ID in the first dataset it has to loop through all records in the second &amp;nbsp;dataset and put a flag exists in that row where it matches in the second dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks In Advance,&lt;/P&gt;&lt;P&gt;Vani.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 14:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298347#M312161</guid>
      <dc:creator>VaniNaga</dc:creator>
      <dc:date>2016-09-14T14:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through second Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298348#M312162</link>
      <description>&lt;P&gt;index() function should be able to handle it:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  A.*,
             case when B.VAL is not null then 1 else 0 end
  from    LONGSTRING A
  left join SMALLDATA B
  on        index(A.VAL,B.VAL)&amp;gt;0;
quit;&lt;/PRE&gt;
&lt;P&gt;This should join the small dataset to the larger one, based on finding the small string in the big string.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 15:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298348#M312162</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-09-14T15:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through second Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298349#M312163</link>
      <description>&lt;P&gt;Please provide some example data from each data set and the result. The wording you are describing for output has a couple of different interpretations and an example of what the output looks like would help determine which meaning(s) to use. For instance what if the ID is duplicated in the first set. One interpretation would be to create two or more 'marked' result records in the output.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 15:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298349#M312163</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-14T15:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through second Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298374#M312164</link>
      <description>&lt;P&gt;Thank you. It did work , got that extra flag column as I want.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 16:53:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-through-second-Dataset/m-p/298374#M312164</guid>
      <dc:creator>VaniNaga</dc:creator>
      <dc:date>2016-09-14T16:53:01Z</dc:date>
    </item>
  </channel>
</rss>

