<?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: Looking up strings in one column and matching in another. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looking-up-strings-in-one-column-and-matching-in-another/m-p/564950#M158522</link>
    <description>&lt;P&gt;Untested without data but has a chance of to get started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   length wantstr $100; /* or long enough to hold expected longest value*/
   do i= 1 to countw(HaveA,',');
      if index(haveb, scan(havea,i,','))&amp;gt;0 then wantstr=catx(',',wantstr,scan(havea,i,','));
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;Countw&amp;nbsp; and Scan&amp;nbsp;functions are&amp;nbsp;told to only consider comma as delimiter for finding phrases,&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2019 16:30:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-06-10T16:30:19Z</dc:date>
    <item>
      <title>Looking up strings in one column and matching in another.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-up-strings-in-one-column-and-matching-in-another/m-p/564941#M158518</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have string data in two columns that are separated by commas. I'd like to scan the first column's characters and see if it appears in the second column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is some sample data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;HaveA&lt;/TD&gt;&lt;TD&gt;HaveB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Homeless, Health Care, Aided&lt;/TD&gt;&lt;TD&gt;Health Care, Verified, Aided&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A,B,C&lt;/TD&gt;&lt;TD&gt;A,C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;X,Y,Z&lt;/TD&gt;&lt;TD&gt;J,K,F&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;HaveA&lt;/TD&gt;&lt;TD&gt;HaveB&lt;/TD&gt;&lt;TD&gt;Want&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Homeless, Health Care, Aided&lt;/TD&gt;&lt;TD&gt;Health Care, Verified, Aided&lt;/TD&gt;&lt;TD&gt;Health Care, Aided&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A,B,C&lt;/TD&gt;&lt;TD&gt;A,C&lt;/TD&gt;&lt;TD&gt;A,C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;X,Y,Z&lt;/TD&gt;&lt;TD&gt;J,K,F&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-up-strings-in-one-column-and-matching-in-another/m-p/564941#M158518</guid>
      <dc:creator>hwangnyc</dc:creator>
      <dc:date>2019-06-10T16:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Looking up strings in one column and matching in another.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-up-strings-in-one-column-and-matching-in-another/m-p/564950#M158522</link>
      <description>&lt;P&gt;Untested without data but has a chance of to get started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   length wantstr $100; /* or long enough to hold expected longest value*/
   do i= 1 to countw(HaveA,',');
      if index(haveb, scan(havea,i,','))&amp;gt;0 then wantstr=catx(',',wantstr,scan(havea,i,','));
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;Countw&amp;nbsp; and Scan&amp;nbsp;functions are&amp;nbsp;told to only consider comma as delimiter for finding phrases,&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-up-strings-in-one-column-and-matching-in-another/m-p/564950#M158522</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-10T16:30:19Z</dc:date>
    </item>
  </channel>
</rss>

