<?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: Combining in an if statement both &amp;quot;and&amp;quot; and &amp;quot;or&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811299#M319980</link>
    <description>&lt;P&gt;Of course, you can. Why not?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
 set sashelp.class;
 if Sex='M' AND (Age &amp;gt; 20 OR Height &amp;gt; 70 OR Weight &amp;gt; 100) then put 'HIT'; 
 else put 'No HIT';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mind&amp;nbsp;De Morgan's laws when combining AND's , OR's and NOT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Tue, 03 May 2022 18:29:39 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2022-05-03T18:29:39Z</dc:date>
    <item>
      <title>Combining in an if statement both "and" and "or"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811291#M319978</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;
&lt;P&gt;I wanted to ask if I can combine in one command both an "and" and multiple "or" statements - or the opposite.&amp;nbsp; For example something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if var1=5 and (var2=2 or var2=4 or var2=5) then var3=20;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you very much,&lt;/P&gt;
&lt;P&gt;Dimitrios&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 17:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811291#M319978</guid>
      <dc:creator>Dim13</dc:creator>
      <dc:date>2022-05-03T17:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Combining in an if statement both "and" and "or"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811299#M319980</link>
      <description>&lt;P&gt;Of course, you can. Why not?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
 set sashelp.class;
 if Sex='M' AND (Age &amp;gt; 20 OR Height &amp;gt; 70 OR Weight &amp;gt; 100) then put 'HIT'; 
 else put 'No HIT';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mind&amp;nbsp;De Morgan's laws when combining AND's , OR's and NOT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 18:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811299#M319980</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-05-03T18:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Combining in an if statement both "and" and "or"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811302#M319982</link>
      <description>&lt;P&gt;An alternative that might make this more readable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if var1=5 and var2 in (2, 4, 5) then var3=20;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 May 2022 18:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811302#M319982</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-05-03T18:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combining in an if statement both "and" and "or"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811363#M320009</link>
      <description>.......  strangely enough my "question code" worked as well....!!!!  thank you for the reply though.</description>
      <pubDate>Wed, 04 May 2022 05:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811363#M320009</guid>
      <dc:creator>Dim13</dc:creator>
      <dc:date>2022-05-04T05:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining in an if statement both "and" and "or"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811364#M320010</link>
      <description>thank you</description>
      <pubDate>Wed, 04 May 2022 05:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-in-an-if-statement-both-quot-and-quot-and-quot-or-quot/m-p/811364#M320010</guid>
      <dc:creator>Dim13</dc:creator>
      <dc:date>2022-05-04T05:12:51Z</dc:date>
    </item>
  </channel>
</rss>

