<?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: Comparing vars against three values and then creating new var if there’s a match in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684622#M207499</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2020 14:24:42 GMT</pubDate>
    <dc:creator>K_S</dc:creator>
    <dc:date>2020-09-17T14:24:42Z</dc:date>
    <item>
      <title>Comparing vars against three values and then creating new var if there’s a match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684449#M207415</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;i have a database that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;idnum &amp;nbsp;text1 &amp;nbsp; text2 &amp;nbsp; text3 &amp;nbsp; text4 &amp;nbsp; text5 &amp;nbsp; text6 &amp;nbsp; text7.....text35&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bsf &amp;nbsp; &amp;nbsp; &amp;nbsp; ttg &amp;nbsp; &amp;nbsp; &amp;nbsp;Hht&amp;nbsp;&amp;nbsp; &amp;nbsp; Hht &amp;nbsp; &amp;nbsp; &amp;nbsp;Hhp. &amp;nbsp; Ppj &amp;nbsp; &amp;nbsp; &amp;nbsp;Ggt&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Tty&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Yyy. &amp;nbsp; &amp;nbsp; Hjs. &amp;nbsp; Hht &amp;nbsp; &amp;nbsp; Tty &amp;nbsp; &amp;nbsp; &amp;nbsp; Hgy. &amp;nbsp; &amp;nbsp;Xyz. &amp;nbsp; &amp;nbsp;Yyu. &amp;nbsp; &amp;nbsp; Kio&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;what i want to do is this, but in a practical way:&lt;/P&gt;&lt;P&gt;if text1 in (‘Hht’, ‘Tty’, ‘kyo’) &amp;nbsp;or text2 in&amp;nbsp; (‘Hht’, ‘Tty’, ‘kyo’) &amp;nbsp;or text3 in&amp;nbsp; (‘Hht’, ‘Tty’, ‘kyo’) &amp;nbsp;......or text35 in&amp;nbsp; (‘Hht’, ‘Tty’, ‘kyo’) &amp;nbsp;then new_var=1;&lt;/P&gt;&lt;P&gt;else new_var=0;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;any tips?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 01:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684449#M207415</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2020-09-17T01:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing vars against three values and then creating new var if there’s a match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684451#M207417</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set have;
 array j text:;
 do t='Hht', 'Tty', 'kyo';
  new_var= t in j ;
  if new_var then leave;
 end;
 drop t;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Sep 2020 01:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684451#M207417</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-09-17T01:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing vars against three values and then creating new var if there’s a match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684525#M207444</link>
      <description>&lt;P&gt;There are many ways to skin a cat. The shortest code is probably this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  new_var=whichc('Hht',of text1-text35) or whichc('Tty',of text1-text35) or whichc('kyo',of text1-text35);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Sep 2020 09:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684525#M207444</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-09-17T09:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing vars against three values and then creating new var if there’s a match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684622#M207499</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 14:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-vars-against-three-values-and-then-creating-new-var-if/m-p/684622#M207499</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2020-09-17T14:24:42Z</dc:date>
    </item>
  </channel>
</rss>

