<?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 Need Help to create the logic according to the description in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-Help-to-create-the-logic-according-to-the-description/m-p/843539#M333483</link>
    <description>&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;a1= "aa";&lt;BR /&gt;a2= "bb";&lt;BR /&gt;a3= "cc";&lt;/P&gt;&lt;P&gt;b1= "bb";&lt;BR /&gt;b2= "bb";&lt;BR /&gt;b3= "cc";&lt;/P&gt;&lt;P&gt;/*After comparison*/&lt;BR /&gt;comp1= "No";&lt;BR /&gt;comp2= "Yes";&lt;BR /&gt;comp3= "Yes";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;What I am looking for&amp;nbsp; -&lt;/P&gt;&lt;P&gt;if a1 in (b1,b2,b3) the comp1 = 'Yes';&lt;BR /&gt;else comp1 = 'No';&lt;BR /&gt;as we don't find the match for a1 in any of (b1,b2,b3) then comp1= "No" and our next scenario will be&lt;/P&gt;&lt;P&gt;if a2 in (b1,b2,b3) the comp1 = 'Yes';&lt;BR /&gt;else comp2 = 'No';&lt;/P&gt;&lt;P&gt;now we found a match for a2 in b1 then comp2= "Yes" and&amp;nbsp;will not include that column where we found the matching value in next scenario and our next scenario will be&lt;/P&gt;&lt;P&gt;if a3 in (b2,b3) then comp3 = 'Yes';&lt;BR /&gt;else comp3 = 'No';&lt;/P&gt;&lt;P&gt;now we found a match for a3 in b2 then comp3= "Yes" and our next scenerio will be if there are anything else&lt;/P&gt;&lt;P&gt;if a4 in (b3) then comp3 = 'Yes';&lt;BR /&gt;else comp3 = 'No';&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Nov 2022 07:54:00 GMT</pubDate>
    <dc:creator>nitink26</dc:creator>
    <dc:date>2022-11-10T07:54:00Z</dc:date>
    <item>
      <title>Need Help to create the logic according to the description</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help-to-create-the-logic-according-to-the-description/m-p/843539#M333483</link>
      <description>&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;a1= "aa";&lt;BR /&gt;a2= "bb";&lt;BR /&gt;a3= "cc";&lt;/P&gt;&lt;P&gt;b1= "bb";&lt;BR /&gt;b2= "bb";&lt;BR /&gt;b3= "cc";&lt;/P&gt;&lt;P&gt;/*After comparison*/&lt;BR /&gt;comp1= "No";&lt;BR /&gt;comp2= "Yes";&lt;BR /&gt;comp3= "Yes";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;What I am looking for&amp;nbsp; -&lt;/P&gt;&lt;P&gt;if a1 in (b1,b2,b3) the comp1 = 'Yes';&lt;BR /&gt;else comp1 = 'No';&lt;BR /&gt;as we don't find the match for a1 in any of (b1,b2,b3) then comp1= "No" and our next scenario will be&lt;/P&gt;&lt;P&gt;if a2 in (b1,b2,b3) the comp1 = 'Yes';&lt;BR /&gt;else comp2 = 'No';&lt;/P&gt;&lt;P&gt;now we found a match for a2 in b1 then comp2= "Yes" and&amp;nbsp;will not include that column where we found the matching value in next scenario and our next scenario will be&lt;/P&gt;&lt;P&gt;if a3 in (b2,b3) then comp3 = 'Yes';&lt;BR /&gt;else comp3 = 'No';&lt;/P&gt;&lt;P&gt;now we found a match for a3 in b2 then comp3= "Yes" and our next scenerio will be if there are anything else&lt;/P&gt;&lt;P&gt;if a4 in (b3) then comp3 = 'Yes';&lt;BR /&gt;else comp3 = 'No';&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 07:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help-to-create-the-logic-according-to-the-description/m-p/843539#M333483</guid>
      <dc:creator>nitink26</dc:creator>
      <dc:date>2022-11-10T07:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help to create the logic according to the description</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help-to-create-the-logic-according-to-the-description/m-p/843540#M333484</link>
      <description>&lt;P&gt;If the values of the a-variables are that simple, this should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set test;
   
   length compare1-compare3 $ 3;
   
   array a_vars[3] a1-a3;
   array cmp[3] compare1-compare3;
   
   cmp_string = catx('|', of b1-b3);
   
   do i = 1 to dim(a_vars);
      if findw(cmp_string, a_vars[i], '|', 't') &amp;gt; 0 then do;
         cmp_string = tranwrd(cmp_string, a_vars[i], ' ');
         cmp[i] = 'yes';
      end;
      else do;
         cmp[i] = 'no';
      end;
   end;
   
   drop cmp_string i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Nov 2022 08:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help-to-create-the-logic-according-to-the-description/m-p/843540#M333484</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-11-10T08:20:34Z</dc:date>
    </item>
  </channel>
</rss>

